oci 2.5.11 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/auth/federation_client.rb +2 -1
  5. data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +6 -1
  6. data/lib/oci/auth/url_based_certificate_retriever.rb +6 -2
  7. data/lib/oci/auth/util.rb +18 -0
  8. data/lib/oci/core/compute_client.rb +730 -48
  9. data/lib/oci/core/compute_client_composite_operations.rb +119 -0
  10. data/lib/oci/core/compute_management_client.rb +11 -4
  11. data/lib/oci/core/core.rb +13 -0
  12. data/lib/oci/core/models/add_security_rule_details.rb +4 -2
  13. data/lib/oci/core/models/attach_vnic_details.rb +1 -0
  14. data/lib/oci/core/models/capture_console_history_details.rb +1 -0
  15. data/lib/oci/core/models/change_dedicated_vm_host_compartment_details.rb +155 -0
  16. data/lib/oci/core/models/change_dhcp_options_compartment_details.rb +155 -0
  17. data/lib/oci/core/models/change_internet_gateway_compartment_details.rb +155 -0
  18. data/lib/oci/core/models/change_local_peering_gateway_compartment_details.rb +155 -0
  19. data/lib/oci/core/models/change_network_security_group_compartment_details.rb +155 -0
  20. data/lib/oci/core/models/change_public_ip_compartment_details.rb +155 -0
  21. data/lib/oci/core/models/create_dedicated_vm_host_details.rb +262 -0
  22. data/lib/oci/core/models/create_drg_attachment_details.rb +4 -2
  23. data/lib/oci/core/models/create_image_details.rb +1 -1
  24. data/lib/oci/core/models/create_instance_configuration_base.rb +16 -6
  25. data/lib/oci/core/models/create_instance_configuration_details.rb +1 -1
  26. data/lib/oci/core/models/create_instance_configuration_from_instance_details.rb +3 -2
  27. data/lib/oci/core/models/create_instance_pool_details.rb +3 -1
  28. data/lib/oci/core/models/create_local_peering_gateway_details.rb +1 -1
  29. data/lib/oci/core/models/create_service_gateway_details.rb +1 -1
  30. data/lib/oci/core/models/create_volume_group_backup_details.rb +3 -1
  31. data/lib/oci/core/models/create_volume_group_details.rb +1 -1
  32. data/lib/oci/core/models/cross_connect_mapping.rb +4 -0
  33. data/lib/oci/core/models/dedicated_vm_host.rb +359 -0
  34. data/lib/oci/core/models/dedicated_vm_host_instance_shape_summary.rb +170 -0
  35. data/lib/oci/core/models/dedicated_vm_host_instance_summary.rb +215 -0
  36. data/lib/oci/core/models/dedicated_vm_host_shape_summary.rb +171 -0
  37. data/lib/oci/core/models/dedicated_vm_host_summary.rb +325 -0
  38. data/lib/oci/core/models/drg_attachment.rb +6 -3
  39. data/lib/oci/core/models/egress_security_rule.rb +1 -0
  40. data/lib/oci/core/models/image.rb +2 -0
  41. data/lib/oci/core/models/ingress_security_rule.rb +2 -1
  42. data/lib/oci/core/models/instance.rb +16 -1
  43. data/lib/oci/core/models/instance_configuration.rb +10 -7
  44. data/lib/oci/core/models/ipv6.rb +2 -0
  45. data/lib/oci/core/models/launch_instance_details.rb +16 -1
  46. data/lib/oci/core/models/launch_options.rb +3 -2
  47. data/lib/oci/core/models/local_peering_gateway.rb +4 -3
  48. data/lib/oci/core/models/route_rule.rb +2 -1
  49. data/lib/oci/core/models/security_rule.rb +3 -1
  50. data/lib/oci/core/models/service_gateway.rb +4 -3
  51. data/lib/oci/core/models/subnet.rb +2 -1
  52. data/lib/oci/core/models/update_console_history_details.rb +1 -0
  53. data/lib/oci/core/models/update_dedicated_vm_host_details.rb +194 -0
  54. data/lib/oci/core/models/update_drg_attachment_details.rb +6 -3
  55. data/lib/oci/core/models/update_instance_pool_details.rb +3 -1
  56. data/lib/oci/core/models/update_local_peering_gateway_details.rb +4 -3
  57. data/lib/oci/core/models/update_network_security_group_details.rb +2 -0
  58. data/lib/oci/core/models/update_security_rule_details.rb +4 -2
  59. data/lib/oci/core/models/update_service_gateway_details.rb +4 -3
  60. data/lib/oci/core/models/update_vnic_details.rb +2 -0
  61. data/lib/oci/core/models/update_volume_backup_details.rb +1 -1
  62. data/lib/oci/core/models/update_volume_group_backup_details.rb +2 -1
  63. data/lib/oci/core/models/update_volume_group_details.rb +2 -1
  64. data/lib/oci/core/models/vcn.rb +2 -1
  65. data/lib/oci/core/models/volume_backup_schedule.rb +1 -1
  66. data/lib/oci/core/virtual_network_client.rb +396 -59
  67. data/lib/oci/dts/dts.rb +57 -0
  68. data/lib/oci/dts/models/attach_devices_details.rb +153 -0
  69. data/lib/oci/dts/models/change_transfer_job_compartment_details.rb +154 -0
  70. data/lib/oci/dts/models/create_transfer_appliance_details.rb +152 -0
  71. data/lib/oci/dts/models/create_transfer_appliance_entitlement_details.rb +178 -0
  72. data/lib/oci/dts/models/create_transfer_device_details.rb +165 -0
  73. data/lib/oci/dts/models/create_transfer_job_details.rb +238 -0
  74. data/lib/oci/dts/models/create_transfer_package_details.rb +178 -0
  75. data/lib/oci/dts/models/detach_devices_details.rb +153 -0
  76. data/lib/oci/dts/models/multiple_transfer_appliances.rb +153 -0
  77. data/lib/oci/dts/models/multiple_transfer_devices.rb +153 -0
  78. data/lib/oci/dts/models/multiple_transfer_packages.rb +153 -0
  79. data/lib/oci/dts/models/new_transfer_device.rb +246 -0
  80. data/lib/oci/dts/models/shipping_address.rb +263 -0
  81. data/lib/oci/dts/models/shipping_vendors.rb +149 -0
  82. data/lib/oci/dts/models/transfer_appliance.rb +367 -0
  83. data/lib/oci/dts/models/transfer_appliance_certificate.rb +148 -0
  84. data/lib/oci/dts/models/transfer_appliance_encryption_passphrase.rb +152 -0
  85. data/lib/oci/dts/models/transfer_appliance_entitlement.rb +240 -0
  86. data/lib/oci/dts/models/transfer_appliance_public_key.rb +152 -0
  87. data/lib/oci/dts/models/transfer_appliance_summary.rb +223 -0
  88. data/lib/oci/dts/models/transfer_device.rb +268 -0
  89. data/lib/oci/dts/models/transfer_device_summary.rb +254 -0
  90. data/lib/oci/dts/models/transfer_job.rb +356 -0
  91. data/lib/oci/dts/models/transfer_job_summary.rb +296 -0
  92. data/lib/oci/dts/models/transfer_package.rb +281 -0
  93. data/lib/oci/dts/models/transfer_package_summary.rb +201 -0
  94. data/lib/oci/dts/models/update_transfer_appliance_details.rb +180 -0
  95. data/lib/oci/dts/models/update_transfer_device_details.rb +166 -0
  96. data/lib/oci/dts/models/update_transfer_job_details.rb +237 -0
  97. data/lib/oci/dts/models/update_transfer_package_details.rb +204 -0
  98. data/lib/oci/dts/shipping_vendors_client.rb +165 -0
  99. data/lib/oci/dts/shipping_vendors_client_composite_operations.rb +24 -0
  100. data/lib/oci/dts/transfer_appliance_client.rb +569 -0
  101. data/lib/oci/dts/transfer_appliance_client_composite_operations.rb +104 -0
  102. data/lib/oci/dts/transfer_appliance_entitlement_client.rb +223 -0
  103. data/lib/oci/dts/transfer_appliance_entitlement_client_composite_operations.rb +24 -0
  104. data/lib/oci/dts/transfer_device_client.rb +402 -0
  105. data/lib/oci/dts/transfer_device_client_composite_operations.rb +65 -0
  106. data/lib/oci/dts/transfer_job_client.rb +458 -0
  107. data/lib/oci/dts/transfer_job_client_composite_operations.rb +143 -0
  108. data/lib/oci/dts/transfer_package_client.rb +515 -0
  109. data/lib/oci/dts/transfer_package_client_composite_operations.rb +104 -0
  110. data/lib/oci/dts/util.rb +2 -0
  111. data/lib/oci/file_storage/models/create_file_system_details.rb +19 -4
  112. data/lib/oci/file_storage/models/file_system.rb +19 -4
  113. data/lib/oci/file_storage/models/file_system_summary.rb +19 -4
  114. data/lib/oci/file_storage/models/update_file_system_details.rb +22 -4
  115. data/lib/oci/limits/limits.rb +5 -0
  116. data/lib/oci/limits/limits_client.rb +444 -0
  117. data/lib/oci/limits/limits_client_composite_operations.rb +24 -0
  118. data/lib/oci/limits/models/create_quota_details.rb +1 -1
  119. data/lib/oci/limits/models/limit_definition_summary.rb +241 -0
  120. data/lib/oci/limits/models/limit_value_summary.rb +210 -0
  121. data/lib/oci/limits/models/quota.rb +1 -1
  122. data/lib/oci/limits/models/resource_availability.rb +163 -0
  123. data/lib/oci/limits/models/service_summary.rb +159 -0
  124. data/lib/oci/limits/models/update_quota_details.rb +1 -1
  125. data/lib/oci/limits/quotas_client.rb +12 -11
  126. data/lib/oci/monitoring/models/alarm.rb +20 -1
  127. data/lib/oci/monitoring/models/create_alarm_details.rb +20 -1
  128. data/lib/oci/monitoring/models/list_metrics_details.rb +23 -3
  129. data/lib/oci/monitoring/models/metric.rb +20 -1
  130. data/lib/oci/monitoring/models/metric_data.rb +20 -1
  131. data/lib/oci/monitoring/models/metric_data_details.rb +20 -1
  132. data/lib/oci/monitoring/models/summarize_metrics_data_details.rb +20 -1
  133. data/lib/oci/monitoring/models/update_alarm_details.rb +20 -1
  134. data/lib/oci/regions.rb +14 -8
  135. data/lib/oci/streaming/models/archiver.rb +291 -0
  136. data/lib/oci/streaming/models/archiver_error.rb +159 -0
  137. data/lib/oci/streaming/models/archiver_lifecycle_state.rb +14 -0
  138. data/lib/oci/streaming/models/archiver_start_position.rb +10 -0
  139. data/lib/oci/streaming/models/create_archiver_details.rb +223 -0
  140. data/lib/oci/streaming/models/update_archiver_details.rb +222 -0
  141. data/lib/oci/streaming/stream_admin_client.rb +304 -0
  142. data/lib/oci/streaming/stream_admin_client_composite_operations.rb +162 -0
  143. data/lib/oci/streaming/streaming.rb +6 -0
  144. data/lib/oci/version.rb +1 -1
  145. data/lib/oci/waas/models/access_rule.rb +121 -4
  146. data/lib/oci/waas/models/access_rule_criteria.rb +12 -0
  147. data/lib/oci/waas/models/address_list.rb +289 -0
  148. data/lib/oci/waas/models/address_list_summary.rb +279 -0
  149. data/lib/oci/waas/models/caching_rule.rb +243 -0
  150. data/lib/oci/waas/models/caching_rule_criteria.rb +194 -0
  151. data/lib/oci/waas/models/caching_rule_summary.rb +246 -0
  152. data/lib/oci/waas/models/certificate.rb +22 -9
  153. data/lib/oci/waas/models/certificate_extensions.rb +3 -0
  154. data/lib/oci/waas/models/certificate_issuer_name.rb +225 -0
  155. data/lib/oci/waas/models/certificate_public_key_info.rb +4 -1
  156. data/lib/oci/waas/models/certificate_subject_name.rb +8 -1
  157. data/lib/oci/waas/models/certificate_summary.rb +10 -2
  158. data/lib/oci/waas/models/change_address_list_compartment_details.rb +154 -0
  159. data/lib/oci/waas/models/change_custom_protection_rule_compartment_details.rb +154 -0
  160. data/lib/oci/waas/models/create_address_list_details.rb +213 -0
  161. data/lib/oci/waas/models/create_certificate_details.rb +22 -3
  162. data/lib/oci/waas/models/create_custom_protection_rule_details.rb +251 -0
  163. data/lib/oci/waas/models/create_waas_policy_details.rb +26 -4
  164. data/lib/oci/waas/models/custom_protection_rule.rb +326 -0
  165. data/lib/oci/waas/models/custom_protection_rule_setting.rb +180 -0
  166. data/lib/oci/waas/models/custom_protection_rule_summary.rb +279 -0
  167. data/lib/oci/waas/models/origin_group.rb +149 -0
  168. data/lib/oci/waas/models/origin_group_origins.rb +159 -0
  169. data/lib/oci/waas/models/policy_config.rb +201 -4
  170. data/lib/oci/waas/models/protection_rule_exclusion.rb +2 -2
  171. data/lib/oci/waas/models/purge_cache.rb +149 -0
  172. data/lib/oci/waas/models/update_address_list_details.rb +199 -0
  173. data/lib/oci/waas/models/update_certificate_details.rb +10 -2
  174. data/lib/oci/waas/models/update_custom_protection_rule_details.rb +237 -0
  175. data/lib/oci/waas/models/update_waas_policy_details.rb +26 -4
  176. data/lib/oci/waas/models/waas_policy.rb +25 -3
  177. data/lib/oci/waas/models/waas_policy_custom_protection_rule_summary.rb +207 -0
  178. data/lib/oci/waas/models/waas_policy_summary.rb +10 -2
  179. data/lib/oci/waas/models/waf_config.rb +43 -1
  180. data/lib/oci/waas/models/waf_config_details.rb +43 -1
  181. data/lib/oci/waas/models/waf_log.rb +3 -3
  182. data/lib/oci/waas/models/work_request.rb +4 -1
  183. data/lib/oci/waas/models/work_request_operation_types.rb +4 -1
  184. data/lib/oci/waas/models/work_request_summary.rb +4 -1
  185. data/lib/oci/waas/waas.rb +19 -0
  186. data/lib/oci/waas/waas_client.rb +1147 -61
  187. data/lib/oci/waas/waas_client_composite_operations.rb +386 -0
  188. metadata +90 -2
@@ -0,0 +1,24 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
4
+ module OCI
5
+ # This class provides a wrapper around {OCI::Limits::LimitsClient} and offers convenience methods
6
+ # for operations that would otherwise need to be chained together. For example, instead of performing an action
7
+ # on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource
8
+ # to enter a given state, you can call a single method in this class to accomplish the same functionality
9
+ class Limits::LimitsClientCompositeOperations
10
+ # The {OCI::Limits::LimitsClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::Limits::LimitsClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new LimitsClientCompositeOperations
16
+ #
17
+ # @param [OCI::Limits::LimitsClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::Limits::LimitsClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::Limits::LimitsClient.new)
20
+ @service_client = service_client
21
+ end
22
+ end
23
+ end
24
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -20,7 +20,7 @@ module OCI
20
20
  # @return [String]
21
21
  attr_accessor :name
22
22
 
23
- # **[Required]** An array of quota statements written in the declarative language.
23
+ # **[Required]** An array of quota statements written in the declarative quota statement language.
24
24
  #
25
25
  # @return [Array<String>]
26
26
  attr_accessor :statements
@@ -0,0 +1,241 @@
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 metadata specific to a resource limit definition.
9
+ class Limits::Models::LimitDefinitionSummary
10
+ SCOPE_TYPE_ENUM = [
11
+ SCOPE_TYPE_GLOBAL = 'GLOBAL'.freeze,
12
+ SCOPE_TYPE_REGION = 'REGION'.freeze,
13
+ SCOPE_TYPE_AD = 'AD'.freeze,
14
+ SCOPE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ # The resource limit name. To be used for writing policies (in case of quotas) or other programmatic calls.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :name
21
+
22
+ # The service name of the limit.
23
+ # @return [String]
24
+ attr_accessor :service_name
25
+
26
+ # The limit description.
27
+ # @return [String]
28
+ attr_accessor :description
29
+
30
+ # Reflects the scope of the resource limit: which can be Global (across all regions), regional or ad specific.
31
+ #
32
+ # @return [String]
33
+ attr_reader :scope_type
34
+
35
+ # If true, quota policies can be created on top of this resource limit.
36
+ #
37
+ # @return [BOOLEAN]
38
+ attr_accessor :are_quotas_supported
39
+
40
+ # Reflects if the GetResourceAvailability API is supported for this limit or not.
41
+ # If not, the API will return an empty JSON response.
42
+ #
43
+ # @return [BOOLEAN]
44
+ attr_accessor :is_resource_availability_supported
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ # rubocop:disable Style/SymbolLiteral
50
+ 'name': :'name',
51
+ 'service_name': :'serviceName',
52
+ 'description': :'description',
53
+ 'scope_type': :'scopeType',
54
+ 'are_quotas_supported': :'areQuotasSupported',
55
+ 'is_resource_availability_supported': :'isResourceAvailabilitySupported'
56
+ # rubocop:enable Style/SymbolLiteral
57
+ }
58
+ end
59
+
60
+ # Attribute type mapping.
61
+ def self.swagger_types
62
+ {
63
+ # rubocop:disable Style/SymbolLiteral
64
+ 'name': :'String',
65
+ 'service_name': :'String',
66
+ 'description': :'String',
67
+ 'scope_type': :'String',
68
+ 'are_quotas_supported': :'BOOLEAN',
69
+ 'is_resource_availability_supported': :'BOOLEAN'
70
+ # rubocop:enable Style/SymbolLiteral
71
+ }
72
+ end
73
+
74
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
75
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
76
+
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ # @option attributes [String] :name The value to assign to the {#name} property
81
+ # @option attributes [String] :service_name The value to assign to the {#service_name} property
82
+ # @option attributes [String] :description The value to assign to the {#description} property
83
+ # @option attributes [String] :scope_type The value to assign to the {#scope_type} property
84
+ # @option attributes [BOOLEAN] :are_quotas_supported The value to assign to the {#are_quotas_supported} property
85
+ # @option attributes [BOOLEAN] :is_resource_availability_supported The value to assign to the {#is_resource_availability_supported} property
86
+ def initialize(attributes = {})
87
+ return unless attributes.is_a?(Hash)
88
+
89
+ # convert string to symbol for hash key
90
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
91
+
92
+ self.name = attributes[:'name'] if attributes[:'name']
93
+
94
+ self.service_name = attributes[:'serviceName'] if attributes[:'serviceName']
95
+
96
+ raise 'You cannot provide both :serviceName and :service_name' if attributes.key?(:'serviceName') && attributes.key?(:'service_name')
97
+
98
+ self.service_name = attributes[:'service_name'] if attributes[:'service_name']
99
+
100
+ self.description = attributes[:'description'] if attributes[:'description']
101
+
102
+ self.scope_type = attributes[:'scopeType'] if attributes[:'scopeType']
103
+
104
+ raise 'You cannot provide both :scopeType and :scope_type' if attributes.key?(:'scopeType') && attributes.key?(:'scope_type')
105
+
106
+ self.scope_type = attributes[:'scope_type'] if attributes[:'scope_type']
107
+
108
+ self.are_quotas_supported = attributes[:'areQuotasSupported'] unless attributes[:'areQuotasSupported'].nil?
109
+
110
+ raise 'You cannot provide both :areQuotasSupported and :are_quotas_supported' if attributes.key?(:'areQuotasSupported') && attributes.key?(:'are_quotas_supported')
111
+
112
+ self.are_quotas_supported = attributes[:'are_quotas_supported'] unless attributes[:'are_quotas_supported'].nil?
113
+
114
+ self.is_resource_availability_supported = attributes[:'isResourceAvailabilitySupported'] unless attributes[:'isResourceAvailabilitySupported'].nil?
115
+
116
+ raise 'You cannot provide both :isResourceAvailabilitySupported and :is_resource_availability_supported' if attributes.key?(:'isResourceAvailabilitySupported') && attributes.key?(:'is_resource_availability_supported')
117
+
118
+ self.is_resource_availability_supported = attributes[:'is_resource_availability_supported'] unless attributes[:'is_resource_availability_supported'].nil?
119
+ end
120
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
121
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
122
+
123
+ # Custom attribute writer method checking allowed values (enum).
124
+ # @param [Object] scope_type Object to be assigned
125
+ def scope_type=(scope_type)
126
+ # rubocop:disable Style/ConditionalAssignment
127
+ if scope_type && !SCOPE_TYPE_ENUM.include?(scope_type)
128
+ OCI.logger.debug("Unknown value for 'scope_type' [" + scope_type + "]. Mapping to 'SCOPE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
129
+ @scope_type = SCOPE_TYPE_UNKNOWN_ENUM_VALUE
130
+ else
131
+ @scope_type = scope_type
132
+ end
133
+ # rubocop:enable Style/ConditionalAssignment
134
+ end
135
+
136
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
137
+
138
+
139
+ # Checks equality by comparing each attribute.
140
+ # @param [Object] other the other object to be compared
141
+ def ==(other)
142
+ return true if equal?(other)
143
+
144
+ self.class == other.class &&
145
+ name == other.name &&
146
+ service_name == other.service_name &&
147
+ description == other.description &&
148
+ scope_type == other.scope_type &&
149
+ are_quotas_supported == other.are_quotas_supported &&
150
+ is_resource_availability_supported == other.is_resource_availability_supported
151
+ end
152
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
153
+
154
+ # @see the `==` method
155
+ # @param [Object] other the other object to be compared
156
+ def eql?(other)
157
+ self == other
158
+ end
159
+
160
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
161
+
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Fixnum] Hash code
165
+ def hash
166
+ [name, service_name, description, scope_type, are_quotas_supported, is_resource_availability_supported].hash
167
+ end
168
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
169
+
170
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
171
+
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def build_from_hash(attributes)
177
+ return nil unless attributes.is_a?(Hash)
178
+
179
+ self.class.swagger_types.each_pair do |key, type|
180
+ if type =~ /^Array<(.*)>/i
181
+ # check to ensure the input is an array given that the the attribute
182
+ # is documented as an array but the input is not
183
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
184
+ public_method("#{key}=").call(
185
+ attributes[self.class.attribute_map[key]]
186
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
187
+ )
188
+ end
189
+ elsif !attributes[self.class.attribute_map[key]].nil?
190
+ public_method("#{key}=").call(
191
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
192
+ )
193
+ end
194
+ # or else data not found in attributes(hash), not an issue as the data can be optional
195
+ end
196
+
197
+ self
198
+ end
199
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
200
+
201
+ # Returns the string representation of the object
202
+ # @return [String] String presentation of the object
203
+ def to_s
204
+ to_hash.to_s
205
+ end
206
+
207
+ # Returns the object in the form of hash
208
+ # @return [Hash] Returns the object in the form of hash
209
+ def to_hash
210
+ hash = {}
211
+ self.class.attribute_map.each_pair do |attr, param|
212
+ value = public_method(attr).call
213
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
214
+
215
+ hash[param] = _to_hash(value)
216
+ end
217
+ hash
218
+ end
219
+
220
+ private
221
+
222
+ # Outputs non-array value in the form of hash
223
+ # For object, use to_hash. Otherwise, just return the value
224
+ # @param [Object] value Any valid value
225
+ # @return [Hash] Returns the value in the form of hash
226
+ def _to_hash(value)
227
+ if value.is_a?(Array)
228
+ value.compact.map { |v| _to_hash(v) }
229
+ elsif value.is_a?(Hash)
230
+ {}.tap do |hash|
231
+ value.each { |k, v| hash[k] = _to_hash(v) }
232
+ end
233
+ elsif value.respond_to? :to_hash
234
+ value.to_hash
235
+ else
236
+ value
237
+ end
238
+ end
239
+ end
240
+ end
241
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,210 @@
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 value of a specific resource limit.
9
+ class Limits::Models::LimitValueSummary
10
+ SCOPE_TYPE_ENUM = [
11
+ SCOPE_TYPE_GLOBAL = 'GLOBAL'.freeze,
12
+ SCOPE_TYPE_REGION = 'REGION'.freeze,
13
+ SCOPE_TYPE_AD = 'AD'.freeze,
14
+ SCOPE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
15
+ ].freeze
16
+
17
+ # The resource limit name. To be used for writing policies (in case of quotas) or other programmatic calls.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :name
21
+
22
+ # The scope type of the limit.
23
+ #
24
+ # @return [String]
25
+ attr_reader :scope_type
26
+
27
+ # If present, the returned value is only specific to this availability domain.
28
+ # @return [String]
29
+ attr_accessor :availability_domain
30
+
31
+ # The resource limit value.
32
+ # @return [Integer]
33
+ attr_accessor :value
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ # rubocop:disable Style/SymbolLiteral
39
+ 'name': :'name',
40
+ 'scope_type': :'scopeType',
41
+ 'availability_domain': :'availabilityDomain',
42
+ 'value': :'value'
43
+ # rubocop:enable Style/SymbolLiteral
44
+ }
45
+ end
46
+
47
+ # Attribute type mapping.
48
+ def self.swagger_types
49
+ {
50
+ # rubocop:disable Style/SymbolLiteral
51
+ 'name': :'String',
52
+ 'scope_type': :'String',
53
+ 'availability_domain': :'String',
54
+ 'value': :'Integer'
55
+ # rubocop:enable Style/SymbolLiteral
56
+ }
57
+ end
58
+
59
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
60
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
61
+
62
+
63
+ # Initializes the object
64
+ # @param [Hash] attributes Model attributes in the form of hash
65
+ # @option attributes [String] :name The value to assign to the {#name} property
66
+ # @option attributes [String] :scope_type The value to assign to the {#scope_type} property
67
+ # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
68
+ # @option attributes [Integer] :value The value to assign to the {#value} property
69
+ def initialize(attributes = {})
70
+ return unless attributes.is_a?(Hash)
71
+
72
+ # convert string to symbol for hash key
73
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
74
+
75
+ self.name = attributes[:'name'] if attributes[:'name']
76
+
77
+ self.scope_type = attributes[:'scopeType'] if attributes[:'scopeType']
78
+
79
+ raise 'You cannot provide both :scopeType and :scope_type' if attributes.key?(:'scopeType') && attributes.key?(:'scope_type')
80
+
81
+ self.scope_type = attributes[:'scope_type'] if attributes[:'scope_type']
82
+
83
+ self.availability_domain = attributes[:'availabilityDomain'] if attributes[:'availabilityDomain']
84
+
85
+ raise 'You cannot provide both :availabilityDomain and :availability_domain' if attributes.key?(:'availabilityDomain') && attributes.key?(:'availability_domain')
86
+
87
+ self.availability_domain = attributes[:'availability_domain'] if attributes[:'availability_domain']
88
+
89
+ self.value = attributes[:'value'] if attributes[:'value']
90
+ end
91
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
92
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
93
+
94
+ # Custom attribute writer method checking allowed values (enum).
95
+ # @param [Object] scope_type Object to be assigned
96
+ def scope_type=(scope_type)
97
+ # rubocop:disable Style/ConditionalAssignment
98
+ if scope_type && !SCOPE_TYPE_ENUM.include?(scope_type)
99
+ OCI.logger.debug("Unknown value for 'scope_type' [" + scope_type + "]. Mapping to 'SCOPE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
100
+ @scope_type = SCOPE_TYPE_UNKNOWN_ENUM_VALUE
101
+ else
102
+ @scope_type = scope_type
103
+ end
104
+ # rubocop:enable Style/ConditionalAssignment
105
+ end
106
+
107
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
108
+
109
+
110
+ # Checks equality by comparing each attribute.
111
+ # @param [Object] other the other object to be compared
112
+ def ==(other)
113
+ return true if equal?(other)
114
+
115
+ self.class == other.class &&
116
+ name == other.name &&
117
+ scope_type == other.scope_type &&
118
+ availability_domain == other.availability_domain &&
119
+ value == other.value
120
+ end
121
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
122
+
123
+ # @see the `==` method
124
+ # @param [Object] other the other object to be compared
125
+ def eql?(other)
126
+ self == other
127
+ end
128
+
129
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
130
+
131
+
132
+ # Calculates hash code according to all attributes.
133
+ # @return [Fixnum] Hash code
134
+ def hash
135
+ [name, scope_type, availability_domain, value].hash
136
+ end
137
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
138
+
139
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
140
+
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+
148
+ self.class.swagger_types.each_pair do |key, type|
149
+ if type =~ /^Array<(.*)>/i
150
+ # check to ensure the input is an array given that the the attribute
151
+ # is documented as an array but the input is not
152
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
153
+ public_method("#{key}=").call(
154
+ attributes[self.class.attribute_map[key]]
155
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
156
+ )
157
+ end
158
+ elsif !attributes[self.class.attribute_map[key]].nil?
159
+ public_method("#{key}=").call(
160
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
161
+ )
162
+ end
163
+ # or else data not found in attributes(hash), not an issue as the data can be optional
164
+ end
165
+
166
+ self
167
+ end
168
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
169
+
170
+ # Returns the string representation of the object
171
+ # @return [String] String presentation of the object
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # Returns the object in the form of hash
177
+ # @return [Hash] Returns the object in the form of hash
178
+ def to_hash
179
+ hash = {}
180
+ self.class.attribute_map.each_pair do |attr, param|
181
+ value = public_method(attr).call
182
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
183
+
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ private
190
+
191
+ # Outputs non-array value in the form of hash
192
+ # For object, use to_hash. Otherwise, just return the value
193
+ # @param [Object] value Any valid value
194
+ # @return [Hash] Returns the value in the form of hash
195
+ def _to_hash(value)
196
+ if value.is_a?(Array)
197
+ value.compact.map { |v| _to_hash(v) }
198
+ elsif value.is_a?(Hash)
199
+ {}.tap do |hash|
200
+ value.each { |k, v| hash[k] = _to_hash(v) }
201
+ end
202
+ elsif value.respond_to? :to_hash
203
+ value.to_hash
204
+ else
205
+ value
206
+ end
207
+ end
208
+ end
209
+ end
210
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength