oci 2.5.9 → 2.5.10

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.
Files changed (129) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/oci/autoscaling/auto_scaling_client.rb +73 -0
  4. data/lib/oci/autoscaling/autoscaling.rb +1 -0
  5. data/lib/oci/autoscaling/models/change_auto_scaling_compartment_details.rb +154 -0
  6. data/lib/oci/autoscaling/models/create_auto_scaling_configuration_details.rb +0 -1
  7. data/lib/oci/container_engine/models/work_request_error.rb +0 -1
  8. data/lib/oci/core/blockstorage_client.rb +342 -0
  9. data/lib/oci/core/compute_client.rb +77 -5
  10. data/lib/oci/core/compute_client_composite_operations.rb +3 -3
  11. data/lib/oci/core/compute_management_client.rb +211 -0
  12. data/lib/oci/core/core.rb +27 -0
  13. data/lib/oci/core/models/add_network_security_group_security_rules_details.rb +153 -0
  14. data/lib/oci/core/models/add_security_rule_details.rb +388 -0
  15. data/lib/oci/core/models/added_network_security_group_security_rules.rb +153 -0
  16. data/lib/oci/core/models/change_boot_volume_backup_compartment_details.rb +153 -0
  17. data/lib/oci/core/models/change_boot_volume_compartment_details.rb +153 -0
  18. data/lib/oci/core/models/change_image_compartment_details.rb +154 -0
  19. data/lib/oci/core/models/change_instance_configuration_compartment_details.rb +155 -0
  20. data/lib/oci/core/models/change_instance_pool_compartment_details.rb +155 -0
  21. data/lib/oci/core/models/change_nat_gateway_compartment_details.rb +153 -0
  22. data/lib/oci/core/models/change_route_table_compartment_details.rb +155 -0
  23. data/lib/oci/core/models/change_security_list_compartment_details.rb +155 -0
  24. data/lib/oci/core/models/change_service_gateway_compartment_details.rb +155 -0
  25. data/lib/oci/core/models/change_subnet_compartment_details.rb +155 -0
  26. data/lib/oci/core/models/change_vcn_compartment_details.rb +155 -0
  27. data/lib/oci/core/models/change_volume_backup_compartment_details.rb +153 -0
  28. data/lib/oci/core/models/change_volume_compartment_details.rb +153 -0
  29. data/lib/oci/core/models/change_volume_group_backup_compartment_details.rb +153 -0
  30. data/lib/oci/core/models/change_volume_group_compartment_details.rb +153 -0
  31. data/lib/oci/core/models/create_network_security_group_details.rb +223 -0
  32. data/lib/oci/core/models/create_vnic_details.rb +18 -1
  33. data/lib/oci/core/models/image.rb +2 -1
  34. data/lib/oci/core/models/instance_configuration.rb +3 -1
  35. data/lib/oci/core/models/instance_configuration_create_vnic_details.rb +18 -1
  36. data/lib/oci/core/models/instance_configuration_instance_source_via_image_details.rb +15 -1
  37. data/lib/oci/core/models/instance_configuration_summary.rb +3 -3
  38. data/lib/oci/core/models/instance_pool.rb +4 -1
  39. data/lib/oci/core/models/instance_pool_summary.rb +3 -3
  40. data/lib/oci/core/models/network_security_group.rb +324 -0
  41. data/lib/oci/core/models/network_security_group_vnic.rb +188 -0
  42. data/lib/oci/core/models/remove_network_security_group_security_rules_details.rb +154 -0
  43. data/lib/oci/core/models/security_list.rb +5 -0
  44. data/lib/oci/core/models/security_rule.rb +455 -0
  45. data/lib/oci/core/models/update_network_security_group_details.rb +189 -0
  46. data/lib/oci/core/models/update_network_security_group_security_rules_details.rb +153 -0
  47. data/lib/oci/core/models/update_security_rule_details.rb +404 -0
  48. data/lib/oci/core/models/update_vnic_details.rb +20 -1
  49. data/lib/oci/core/models/updated_network_security_group_security_rules.rb +153 -0
  50. data/lib/oci/core/models/vnic.rb +18 -1
  51. data/lib/oci/core/virtual_network_client.rb +1228 -132
  52. data/lib/oci/core/virtual_network_client_composite_operations.rb +119 -0
  53. data/lib/oci/database/database.rb +19 -0
  54. data/lib/oci/database/database_client.rb +1066 -46
  55. data/lib/oci/database/database_client_composite_operations.rb +317 -0
  56. data/lib/oci/database/models/autonomous_container_database.rb +416 -0
  57. data/lib/oci/database/models/autonomous_container_database_backup_config.rb +157 -0
  58. data/lib/oci/database/models/autonomous_container_database_summary.rb +420 -0
  59. data/lib/oci/database/models/autonomous_database.rb +58 -1
  60. data/lib/oci/database/models/autonomous_database_backup.rb +16 -1
  61. data/lib/oci/database/models/autonomous_database_backup_summary.rb +16 -1
  62. data/lib/oci/database/models/autonomous_database_connection_strings.rb +11 -1
  63. data/lib/oci/database/models/autonomous_database_connection_urls.rb +170 -0
  64. data/lib/oci/database/models/autonomous_database_summary.rb +58 -1
  65. data/lib/oci/database/models/autonomous_db_preview_version_summary.rb +224 -0
  66. data/lib/oci/database/models/autonomous_exadata_infrastructure.rb +419 -0
  67. data/lib/oci/database/models/autonomous_exadata_infrastructure_maintenance_window.rb +186 -0
  68. data/lib/oci/database/models/autonomous_exadata_infrastructure_shape_summary.rb +224 -0
  69. data/lib/oci/database/models/autonomous_exadata_infrastructure_summary.rb +436 -0
  70. data/lib/oci/database/models/backup.rb +1 -0
  71. data/lib/oci/database/models/backup_summary.rb +1 -0
  72. data/lib/oci/database/models/create_autonomous_container_database_details.rb +284 -0
  73. data/lib/oci/database/models/create_autonomous_database_base.rb +46 -1
  74. data/lib/oci/database/models/create_autonomous_database_clone_details.rb +13 -1
  75. data/lib/oci/database/models/create_autonomous_database_details.rb +13 -1
  76. data/lib/oci/database/models/create_data_guard_association_with_new_db_system_details.rb +34 -1
  77. data/lib/oci/database/models/create_db_home_with_db_system_id_base.rb +1 -1
  78. data/lib/oci/database/models/day_of_week.rb +174 -0
  79. data/lib/oci/database/models/db_system.rb +34 -1
  80. data/lib/oci/database/models/db_system_summary.rb +34 -1
  81. data/lib/oci/database/models/launch_autonomous_exadata_infrastructure_details.rb +304 -0
  82. data/lib/oci/database/models/launch_db_system_base.rb +35 -2
  83. data/lib/oci/database/models/launch_db_system_details.rb +11 -2
  84. data/lib/oci/database/models/launch_db_system_from_backup_details.rb +11 -2
  85. data/lib/oci/database/models/maintenance_run.rb +392 -0
  86. data/lib/oci/database/models/maintenance_run_summary.rb +395 -0
  87. data/lib/oci/database/models/maintenance_window.rb +226 -0
  88. data/lib/oci/database/models/month.rb +179 -0
  89. data/lib/oci/database/models/restore_autonomous_database_details.rb +30 -4
  90. data/lib/oci/database/models/update_autonomous_container_database_details.rb +230 -0
  91. data/lib/oci/database/models/update_autonomous_database_details.rb +18 -1
  92. data/lib/oci/database/models/update_autonomous_exadata_infrastructure_details.rb +203 -0
  93. data/lib/oci/database/models/update_db_system_details.rb +37 -4
  94. data/lib/oci/database/models/update_maintenance_run_details.rb +154 -0
  95. data/lib/oci/email/email.rb +1 -0
  96. data/lib/oci/email/email_client.rb +62 -0
  97. data/lib/oci/email/models/change_sender_compartment_details.rb +157 -0
  98. data/lib/oci/key_management/key_management.rb +1 -0
  99. data/lib/oci/key_management/kms_crypto_client.rb +4 -4
  100. data/lib/oci/key_management/kms_management_client.rb +161 -10
  101. data/lib/oci/key_management/kms_management_client_composite_operations.rb +79 -0
  102. data/lib/oci/key_management/kms_vault_client.rb +16 -11
  103. data/lib/oci/key_management/models/key.rb +17 -1
  104. data/lib/oci/key_management/models/schedule_key_deletion_details.rb +156 -0
  105. data/lib/oci/load_balancer/load_balancer.rb +1 -0
  106. data/lib/oci/load_balancer/load_balancer_client.rb +64 -0
  107. data/lib/oci/load_balancer/load_balancer_client_composite_operations.rb +50 -0
  108. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +16 -1
  109. data/lib/oci/load_balancer/models/load_balancer.rb +16 -1
  110. data/lib/oci/load_balancer/models/remove_http_request_header_rule.rb +1 -1
  111. data/lib/oci/load_balancer/models/remove_http_response_header_rule.rb +1 -1
  112. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +9 -5
  113. data/lib/oci/load_balancer/models/update_backend_set_details.rb +2 -0
  114. data/lib/oci/load_balancer/models/update_network_security_groups_details.rb +154 -0
  115. data/lib/oci/monitoring/models/metric.rb +1 -0
  116. data/lib/oci/object_storage/models/work_request_error.rb +1 -0
  117. data/lib/oci/resource_manager/models/change_stack_compartment_details.rb +155 -0
  118. data/lib/oci/resource_manager/models/work_request.rb +293 -0
  119. data/lib/oci/resource_manager/models/work_request_error.rb +170 -0
  120. data/lib/oci/resource_manager/models/work_request_log_entry.rb +159 -0
  121. data/lib/oci/resource_manager/models/work_request_resource.rb +217 -0
  122. data/lib/oci/resource_manager/models/work_request_summary.rb +254 -0
  123. data/lib/oci/resource_manager/resource_manager.rb +6 -0
  124. data/lib/oci/resource_manager/resource_manager_client.rb +338 -0
  125. data/lib/oci/resource_manager/resource_manager_client_composite_operations.rb +50 -0
  126. data/lib/oci/streaming/stream_admin_client.rb +2 -2
  127. data/lib/oci/streaming/stream_client.rb +1 -1
  128. data/lib/oci/version.rb +1 -1
  129. metadata +58 -2
@@ -0,0 +1,188 @@
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
+ # Information about a VNIC that belongs to a network security group.
8
+ #
9
+ class Core::Models::NetworkSecurityGroupVnic
10
+ # The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the parent resource that the VNIC
11
+ # is attached to (for example, a Compute instance).
12
+ #
13
+ # @return [String]
14
+ attr_accessor :resource_id
15
+
16
+ # The date and time the VNIC was added to the network security group, in the format
17
+ # defined by RFC3339.
18
+ #
19
+ # Example: `2016-08-25T21:10:29.600Z`
20
+ #
21
+ # @return [DateTime]
22
+ attr_accessor :time_associated
23
+
24
+ # **[Required]** The [OCID](https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm) of the VNIC.
25
+ # @return [String]
26
+ attr_accessor :vnic_id
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ # rubocop:disable Style/SymbolLiteral
32
+ 'resource_id': :'resourceId',
33
+ 'time_associated': :'timeAssociated',
34
+ 'vnic_id': :'vnicId'
35
+ # rubocop:enable Style/SymbolLiteral
36
+ }
37
+ end
38
+
39
+ # Attribute type mapping.
40
+ def self.swagger_types
41
+ {
42
+ # rubocop:disable Style/SymbolLiteral
43
+ 'resource_id': :'String',
44
+ 'time_associated': :'DateTime',
45
+ 'vnic_id': :'String'
46
+ # rubocop:enable Style/SymbolLiteral
47
+ }
48
+ end
49
+
50
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
51
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
52
+
53
+
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
56
+ # @option attributes [String] :resource_id The value to assign to the {#resource_id} property
57
+ # @option attributes [DateTime] :time_associated The value to assign to the {#time_associated} property
58
+ # @option attributes [String] :vnic_id The value to assign to the {#vnic_id} property
59
+ def initialize(attributes = {})
60
+ return unless attributes.is_a?(Hash)
61
+
62
+ # convert string to symbol for hash key
63
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
64
+
65
+ self.resource_id = attributes[:'resourceId'] if attributes[:'resourceId']
66
+
67
+ raise 'You cannot provide both :resourceId and :resource_id' if attributes.key?(:'resourceId') && attributes.key?(:'resource_id')
68
+
69
+ self.resource_id = attributes[:'resource_id'] if attributes[:'resource_id']
70
+
71
+ self.time_associated = attributes[:'timeAssociated'] if attributes[:'timeAssociated']
72
+
73
+ raise 'You cannot provide both :timeAssociated and :time_associated' if attributes.key?(:'timeAssociated') && attributes.key?(:'time_associated')
74
+
75
+ self.time_associated = attributes[:'time_associated'] if attributes[:'time_associated']
76
+
77
+ self.vnic_id = attributes[:'vnicId'] if attributes[:'vnicId']
78
+
79
+ raise 'You cannot provide both :vnicId and :vnic_id' if attributes.key?(:'vnicId') && attributes.key?(:'vnic_id')
80
+
81
+ self.vnic_id = attributes[:'vnic_id'] if attributes[:'vnic_id']
82
+ end
83
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
84
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
85
+
86
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
87
+
88
+
89
+ # Checks equality by comparing each attribute.
90
+ # @param [Object] other the other object to be compared
91
+ def ==(other)
92
+ return true if equal?(other)
93
+
94
+ self.class == other.class &&
95
+ resource_id == other.resource_id &&
96
+ time_associated == other.time_associated &&
97
+ vnic_id == other.vnic_id
98
+ end
99
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
100
+
101
+ # @see the `==` method
102
+ # @param [Object] other the other object to be compared
103
+ def eql?(other)
104
+ self == other
105
+ end
106
+
107
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
108
+
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [resource_id, time_associated, vnic_id].hash
114
+ end
115
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
116
+
117
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
118
+
119
+
120
+ # Builds the object from hash
121
+ # @param [Hash] attributes Model attributes in the form of hash
122
+ # @return [Object] Returns the model itself
123
+ def build_from_hash(attributes)
124
+ return nil unless attributes.is_a?(Hash)
125
+
126
+ self.class.swagger_types.each_pair do |key, type|
127
+ if type =~ /^Array<(.*)>/i
128
+ # check to ensure the input is an array given that the the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ public_method("#{key}=").call(
132
+ attributes[self.class.attribute_map[key]]
133
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
134
+ )
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ public_method("#{key}=").call(
138
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
139
+ )
140
+ end
141
+ # or else data not found in attributes(hash), not an issue as the data can be optional
142
+ end
143
+
144
+ self
145
+ end
146
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
147
+
148
+ # Returns the string representation of the object
149
+ # @return [String] String presentation of the object
150
+ def to_s
151
+ to_hash.to_s
152
+ end
153
+
154
+ # Returns the object in the form of hash
155
+ # @return [Hash] Returns the object in the form of hash
156
+ def to_hash
157
+ hash = {}
158
+ self.class.attribute_map.each_pair do |attr, param|
159
+ value = public_method(attr).call
160
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
161
+
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ private
168
+
169
+ # Outputs non-array value in the form of hash
170
+ # For object, use to_hash. Otherwise, just return the value
171
+ # @param [Object] value Any valid value
172
+ # @return [Hash] Returns the value in the form of hash
173
+ def _to_hash(value)
174
+ if value.is_a?(Array)
175
+ value.compact.map { |v| _to_hash(v) }
176
+ elsif value.is_a?(Hash)
177
+ {}.tap do |hash|
178
+ value.each { |k, v| hash[k] = _to_hash(v) }
179
+ end
180
+ elsif value.respond_to? :to_hash
181
+ value.to_hash
182
+ else
183
+ value
184
+ end
185
+ end
186
+ end
187
+ end
188
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,154 @@
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
+ # RemoveNetworkSecurityGroupSecurityRulesDetails model.
8
+ class Core::Models::RemoveNetworkSecurityGroupSecurityRulesDetails
9
+ # The Oracle-assigned ID of each {SecurityRule} to be deleted.
10
+ #
11
+ # @return [Array<String>]
12
+ attr_accessor :security_rule_ids
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'security_rule_ids': :'securityRuleIds'
19
+ # rubocop:enable Style/SymbolLiteral
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+ # rubocop:disable Style/SymbolLiteral
27
+ 'security_rule_ids': :'Array<String>'
28
+ # rubocop:enable Style/SymbolLiteral
29
+ }
30
+ end
31
+
32
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
33
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
34
+
35
+
36
+ # Initializes the object
37
+ # @param [Hash] attributes Model attributes in the form of hash
38
+ # @option attributes [Array<String>] :security_rule_ids The value to assign to the {#security_rule_ids} property
39
+ def initialize(attributes = {})
40
+ return unless attributes.is_a?(Hash)
41
+
42
+ # convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
44
+
45
+ self.security_rule_ids = attributes[:'securityRuleIds'] if attributes[:'securityRuleIds']
46
+
47
+ raise 'You cannot provide both :securityRuleIds and :security_rule_ids' if attributes.key?(:'securityRuleIds') && attributes.key?(:'security_rule_ids')
48
+
49
+ self.security_rule_ids = attributes[:'security_rule_ids'] if attributes[:'security_rule_ids']
50
+ end
51
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
52
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
53
+
54
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
55
+
56
+
57
+ # Checks equality by comparing each attribute.
58
+ # @param [Object] other the other object to be compared
59
+ def ==(other)
60
+ return true if equal?(other)
61
+
62
+ self.class == other.class &&
63
+ security_rule_ids == other.security_rule_ids
64
+ end
65
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
66
+
67
+ # @see the `==` method
68
+ # @param [Object] other the other object to be compared
69
+ def eql?(other)
70
+ self == other
71
+ end
72
+
73
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
74
+
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [security_rule_ids].hash
80
+ end
81
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
82
+
83
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
84
+
85
+
86
+ # Builds the object from hash
87
+ # @param [Hash] attributes Model attributes in the form of hash
88
+ # @return [Object] Returns the model itself
89
+ def build_from_hash(attributes)
90
+ return nil unless attributes.is_a?(Hash)
91
+
92
+ self.class.swagger_types.each_pair do |key, type|
93
+ if type =~ /^Array<(.*)>/i
94
+ # check to ensure the input is an array given that the the attribute
95
+ # is documented as an array but the input is not
96
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
97
+ public_method("#{key}=").call(
98
+ attributes[self.class.attribute_map[key]]
99
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
100
+ )
101
+ end
102
+ elsif !attributes[self.class.attribute_map[key]].nil?
103
+ public_method("#{key}=").call(
104
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
105
+ )
106
+ end
107
+ # or else data not found in attributes(hash), not an issue as the data can be optional
108
+ end
109
+
110
+ self
111
+ end
112
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
113
+
114
+ # Returns the string representation of the object
115
+ # @return [String] String presentation of the object
116
+ def to_s
117
+ to_hash.to_s
118
+ end
119
+
120
+ # Returns the object in the form of hash
121
+ # @return [Hash] Returns the object in the form of hash
122
+ def to_hash
123
+ hash = {}
124
+ self.class.attribute_map.each_pair do |attr, param|
125
+ value = public_method(attr).call
126
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
127
+
128
+ hash[param] = _to_hash(value)
129
+ end
130
+ hash
131
+ end
132
+
133
+ private
134
+
135
+ # Outputs non-array value in the form of hash
136
+ # For object, use to_hash. Otherwise, just return the value
137
+ # @param [Object] value Any valid value
138
+ # @return [Hash] Returns the value in the form of hash
139
+ def _to_hash(value)
140
+ if value.is_a?(Array)
141
+ value.compact.map { |v| _to_hash(v) }
142
+ elsif value.is_a?(Hash)
143
+ {}.tap do |hash|
144
+ value.each { |k, v| hash[k] = _to_hash(v) }
145
+ end
146
+ elsif value.respond_to? :to_hash
147
+ value.to_hash
148
+ else
149
+ value
150
+ end
151
+ end
152
+ end
153
+ end
154
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -10,6 +10,11 @@ module OCI
10
10
  # in the subnet. The rules can be stateful or stateless. For more information, see
11
11
  # [Security Lists](https://docs.cloud.oracle.com/Content/Network/Concepts/securitylists.htm).
12
12
  #
13
+ # **Note:** Compare security lists to {NetworkSecurityGroup}s,
14
+ # which let you apply a set of security rules to a *specific set of VNICs* instead of an entire
15
+ # subnet. Oracle recommends using network security groups instead of security lists, although you
16
+ # can use either or both together.
17
+ #
13
18
  # **Important:** Oracle Cloud Infrastructure Compute service images automatically include firewall rules (for example,
14
19
  # Linux iptables, Windows firewall). If there are issues with some type of access to an instance,
15
20
  # make sure both the security lists associated with the instance's subnet and the instance's
@@ -0,0 +1,455 @@
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
+ # A security rule is one of the items in a {NetworkSecurityGroup}.
9
+ # It is a virtual firewall rule for the VNICs in the network security group. A rule can be for
10
+ # either inbound (`direction`= INGRESS) or outbound (`direction`= EGRESS) IP packets.
11
+ #
12
+ class Core::Models::SecurityRule
13
+ DESTINATION_TYPE_ENUM = [
14
+ DESTINATION_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze,
15
+ DESTINATION_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze,
16
+ DESTINATION_TYPE_NETWORK_SECURITY_GROUP = 'NETWORK_SECURITY_GROUP'.freeze,
17
+ DESTINATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
18
+ ].freeze
19
+
20
+ DIRECTION_ENUM = [
21
+ DIRECTION_EGRESS = 'EGRESS'.freeze,
22
+ DIRECTION_INGRESS = 'INGRESS'.freeze,
23
+ DIRECTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
24
+ ].freeze
25
+
26
+ SOURCE_TYPE_ENUM = [
27
+ SOURCE_TYPE_CIDR_BLOCK = 'CIDR_BLOCK'.freeze,
28
+ SOURCE_TYPE_SERVICE_CIDR_BLOCK = 'SERVICE_CIDR_BLOCK'.freeze,
29
+ SOURCE_TYPE_NETWORK_SECURITY_GROUP = 'NETWORK_SECURITY_GROUP'.freeze,
30
+ SOURCE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
31
+ ].freeze
32
+
33
+ # An optional description of your choice for the rule.
34
+ #
35
+ # @return [String]
36
+ attr_accessor :description
37
+
38
+ # Conceptually, this is the range of IP addresses that a packet originating from the instance
39
+ # can go to.
40
+ #
41
+ # Allowed values:
42
+ #
43
+ # * An IP address range in CIDR notation. For example: `192.168.1.0/24`
44
+ #
45
+ # * The `cidrBlock` value for a {Service}, if you're
46
+ # setting up a security rule for traffic destined for a particular `Service` through
47
+ # a service gateway. For example: `oci-phx-objectstorage`.
48
+ #
49
+ # * The OCID of a {NetworkSecurityGroup} in the same
50
+ # VCN. The value can be the NSG that the rule belongs to if the rule's intent is to control
51
+ # traffic between VNICs in the same NSG.
52
+ #
53
+ # @return [String]
54
+ attr_accessor :destination
55
+
56
+ # Type of destination for the rule. Required if `direction` = `EGRESS`.
57
+ #
58
+ # Allowed values:
59
+ #
60
+ # * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation.
61
+ #
62
+ # * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a
63
+ # {Service} (the rule is for traffic destined for a
64
+ # particular `Service` through a service gateway).
65
+ #
66
+ # * `NETWORK_SECURITY_GROUP`: If the rule's `destination` is the OCID of a
67
+ # {NetworkSecurityGroup}.
68
+ #
69
+ # @return [String]
70
+ attr_reader :destination_type
71
+
72
+ # **[Required]** Direction of the security rule. Set to `EGRESS` for rules to allow outbound IP packets, or `INGRESS` for rules to allow inbound IP packets.
73
+ # @return [String]
74
+ attr_reader :direction
75
+
76
+ # Optional and valid only for ICMP and ICMPv6. Use to specify a particular ICMP type and code
77
+ # as defined in:
78
+ # - [ICMP Parameters](http://www.iana.org/assignments/icmp-parameters/icmp-parameters.xhtml)
79
+ # - [ICMPv6 Parameters](https://www.iana.org/assignments/icmpv6-parameters/icmpv6-parameters.xhtml)
80
+ #
81
+ # If you specify ICMP or ICMPv6 as the protocol but omit this object, then all ICMP types and
82
+ # codes are allowed. If you do provide this object, the type is required and the code is optional.
83
+ # To enable MTU negotiation for ingress internet traffic via IPv4, make sure to allow type 3 (\"Destination
84
+ # Unreachable\") code 4 (\"Fragmentation Needed and Don't Fragment was Set\"). If you need to specify
85
+ # multiple codes for a single type, create a separate security rule for each.
86
+ #
87
+ # @return [OCI::Core::Models::IcmpOptions]
88
+ attr_accessor :icmp_options
89
+
90
+ # An Oracle-assigned identifier for the security rule. You specify this ID when you want to
91
+ # update or delete the rule.
92
+ #
93
+ # Example: `04ABEC`
94
+ #
95
+ # @return [String]
96
+ attr_accessor :id
97
+
98
+ # A stateless rule allows traffic in one direction. Remember to add a corresponding
99
+ # stateless rule in the other direction if you need to support bidirectional traffic. For
100
+ # example, if egress traffic allows TCP destination port 80, there should be an ingress
101
+ # rule to allow TCP source port 80. Defaults to false, which means the rule is stateful
102
+ # and a corresponding rule is not necessary for bidirectional traffic.
103
+ #
104
+ # @return [BOOLEAN]
105
+ attr_accessor :is_stateless
106
+
107
+ # Whether the rule is valid. The value is `True` when the rule is first created. If
108
+ # the rule's `source` or `destination` is a network security group, the value changes to
109
+ # `False` if that network security group is deleted.
110
+ #
111
+ # @return [BOOLEAN]
112
+ attr_accessor :is_valid
113
+
114
+ # **[Required]** The transport protocol. Specify either `all` or an IPv4 protocol number as
115
+ # defined in
116
+ # [Protocol Numbers](http://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml).
117
+ # Options are supported only for ICMP (\"1\"), TCP (\"6\"), UDP (\"17\"), and ICMPv6 (\"58\").
118
+ #
119
+ # @return [String]
120
+ attr_accessor :protocol
121
+
122
+ # Conceptually, this is the range of IP addresses that a packet coming into the instance
123
+ # can come from.
124
+ #
125
+ # Allowed values:
126
+ #
127
+ # * An IP address range in CIDR notation. For example: `192.168.1.0/24`
128
+ #
129
+ # * The `cidrBlock` value for a {Service}, if you're
130
+ # setting up a security rule for traffic coming from a particular `Service` through
131
+ # a service gateway. For example: `oci-phx-objectstorage`.
132
+ #
133
+ # * The OCID of a {NetworkSecurityGroup} in the same
134
+ # VCN. The value can be the NSG that the rule belongs to if the rule's intent is to control
135
+ # traffic between VNICs in the same NSG.
136
+ #
137
+ # @return [String]
138
+ attr_accessor :source
139
+
140
+ # Type of source for the rule. Required if `direction` = `INGRESS`.
141
+ #
142
+ # * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation.
143
+ #
144
+ # * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a
145
+ # {Service} (the rule is for traffic coming from a
146
+ # particular `Service` through a service gateway).
147
+ #
148
+ # * `NETWORK_SECURITY_GROUP`: If the rule's `destination` is the OCID of a
149
+ # {NetworkSecurityGroup}.
150
+ #
151
+ # @return [String]
152
+ attr_reader :source_type
153
+
154
+ # Optional and valid only for TCP. Use to specify particular destination ports for TCP rules.
155
+ # If you specify TCP as the protocol but omit this object, then all destination ports are allowed.
156
+ #
157
+ # @return [OCI::Core::Models::TcpOptions]
158
+ attr_accessor :tcp_options
159
+
160
+ # The date and time the security rule was created. Format defined by RFC3339.
161
+ # @return [DateTime]
162
+ attr_accessor :time_created
163
+
164
+ # Optional and valid only for UDP. Use to specify particular destination ports for UDP rules.
165
+ # If you specify UDP as the protocol but omit this object, then all destination ports are allowed.
166
+ #
167
+ # @return [OCI::Core::Models::UdpOptions]
168
+ attr_accessor :udp_options
169
+
170
+ # Attribute mapping from ruby-style variable name to JSON key.
171
+ def self.attribute_map
172
+ {
173
+ # rubocop:disable Style/SymbolLiteral
174
+ 'description': :'description',
175
+ 'destination': :'destination',
176
+ 'destination_type': :'destinationType',
177
+ 'direction': :'direction',
178
+ 'icmp_options': :'icmpOptions',
179
+ 'id': :'id',
180
+ 'is_stateless': :'isStateless',
181
+ 'is_valid': :'isValid',
182
+ 'protocol': :'protocol',
183
+ 'source': :'source',
184
+ 'source_type': :'sourceType',
185
+ 'tcp_options': :'tcpOptions',
186
+ 'time_created': :'timeCreated',
187
+ 'udp_options': :'udpOptions'
188
+ # rubocop:enable Style/SymbolLiteral
189
+ }
190
+ end
191
+
192
+ # Attribute type mapping.
193
+ def self.swagger_types
194
+ {
195
+ # rubocop:disable Style/SymbolLiteral
196
+ 'description': :'String',
197
+ 'destination': :'String',
198
+ 'destination_type': :'String',
199
+ 'direction': :'String',
200
+ 'icmp_options': :'OCI::Core::Models::IcmpOptions',
201
+ 'id': :'String',
202
+ 'is_stateless': :'BOOLEAN',
203
+ 'is_valid': :'BOOLEAN',
204
+ 'protocol': :'String',
205
+ 'source': :'String',
206
+ 'source_type': :'String',
207
+ 'tcp_options': :'OCI::Core::Models::TcpOptions',
208
+ 'time_created': :'DateTime',
209
+ 'udp_options': :'OCI::Core::Models::UdpOptions'
210
+ # rubocop:enable Style/SymbolLiteral
211
+ }
212
+ end
213
+
214
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
215
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
216
+
217
+
218
+ # Initializes the object
219
+ # @param [Hash] attributes Model attributes in the form of hash
220
+ # @option attributes [String] :description The value to assign to the {#description} property
221
+ # @option attributes [String] :destination The value to assign to the {#destination} property
222
+ # @option attributes [String] :destination_type The value to assign to the {#destination_type} property
223
+ # @option attributes [String] :direction The value to assign to the {#direction} property
224
+ # @option attributes [OCI::Core::Models::IcmpOptions] :icmp_options The value to assign to the {#icmp_options} property
225
+ # @option attributes [String] :id The value to assign to the {#id} property
226
+ # @option attributes [BOOLEAN] :is_stateless The value to assign to the {#is_stateless} property
227
+ # @option attributes [BOOLEAN] :is_valid The value to assign to the {#is_valid} property
228
+ # @option attributes [String] :protocol The value to assign to the {#protocol} property
229
+ # @option attributes [String] :source The value to assign to the {#source} property
230
+ # @option attributes [String] :source_type The value to assign to the {#source_type} property
231
+ # @option attributes [OCI::Core::Models::TcpOptions] :tcp_options The value to assign to the {#tcp_options} property
232
+ # @option attributes [DateTime] :time_created The value to assign to the {#time_created} property
233
+ # @option attributes [OCI::Core::Models::UdpOptions] :udp_options The value to assign to the {#udp_options} property
234
+ def initialize(attributes = {})
235
+ return unless attributes.is_a?(Hash)
236
+
237
+ # convert string to symbol for hash key
238
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
239
+
240
+ self.description = attributes[:'description'] if attributes[:'description']
241
+
242
+ self.destination = attributes[:'destination'] if attributes[:'destination']
243
+
244
+ self.destination_type = attributes[:'destinationType'] if attributes[:'destinationType']
245
+
246
+ raise 'You cannot provide both :destinationType and :destination_type' if attributes.key?(:'destinationType') && attributes.key?(:'destination_type')
247
+
248
+ self.destination_type = attributes[:'destination_type'] if attributes[:'destination_type']
249
+
250
+ self.direction = attributes[:'direction'] if attributes[:'direction']
251
+
252
+ self.icmp_options = attributes[:'icmpOptions'] if attributes[:'icmpOptions']
253
+
254
+ raise 'You cannot provide both :icmpOptions and :icmp_options' if attributes.key?(:'icmpOptions') && attributes.key?(:'icmp_options')
255
+
256
+ self.icmp_options = attributes[:'icmp_options'] if attributes[:'icmp_options']
257
+
258
+ self.id = attributes[:'id'] if attributes[:'id']
259
+
260
+ self.is_stateless = attributes[:'isStateless'] unless attributes[:'isStateless'].nil?
261
+
262
+ raise 'You cannot provide both :isStateless and :is_stateless' if attributes.key?(:'isStateless') && attributes.key?(:'is_stateless')
263
+
264
+ self.is_stateless = attributes[:'is_stateless'] unless attributes[:'is_stateless'].nil?
265
+
266
+ self.is_valid = attributes[:'isValid'] unless attributes[:'isValid'].nil?
267
+
268
+ raise 'You cannot provide both :isValid and :is_valid' if attributes.key?(:'isValid') && attributes.key?(:'is_valid')
269
+
270
+ self.is_valid = attributes[:'is_valid'] unless attributes[:'is_valid'].nil?
271
+
272
+ self.protocol = attributes[:'protocol'] if attributes[:'protocol']
273
+
274
+ self.source = attributes[:'source'] if attributes[:'source']
275
+
276
+ self.source_type = attributes[:'sourceType'] if attributes[:'sourceType']
277
+
278
+ raise 'You cannot provide both :sourceType and :source_type' if attributes.key?(:'sourceType') && attributes.key?(:'source_type')
279
+
280
+ self.source_type = attributes[:'source_type'] if attributes[:'source_type']
281
+
282
+ self.tcp_options = attributes[:'tcpOptions'] if attributes[:'tcpOptions']
283
+
284
+ raise 'You cannot provide both :tcpOptions and :tcp_options' if attributes.key?(:'tcpOptions') && attributes.key?(:'tcp_options')
285
+
286
+ self.tcp_options = attributes[:'tcp_options'] if attributes[:'tcp_options']
287
+
288
+ self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']
289
+
290
+ raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')
291
+
292
+ self.time_created = attributes[:'time_created'] if attributes[:'time_created']
293
+
294
+ self.udp_options = attributes[:'udpOptions'] if attributes[:'udpOptions']
295
+
296
+ raise 'You cannot provide both :udpOptions and :udp_options' if attributes.key?(:'udpOptions') && attributes.key?(:'udp_options')
297
+
298
+ self.udp_options = attributes[:'udp_options'] if attributes[:'udp_options']
299
+ end
300
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
301
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
302
+
303
+ # Custom attribute writer method checking allowed values (enum).
304
+ # @param [Object] destination_type Object to be assigned
305
+ def destination_type=(destination_type)
306
+ # rubocop:disable Style/ConditionalAssignment
307
+ if destination_type && !DESTINATION_TYPE_ENUM.include?(destination_type)
308
+ OCI.logger.debug("Unknown value for 'destination_type' [" + destination_type + "]. Mapping to 'DESTINATION_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
309
+ @destination_type = DESTINATION_TYPE_UNKNOWN_ENUM_VALUE
310
+ else
311
+ @destination_type = destination_type
312
+ end
313
+ # rubocop:enable Style/ConditionalAssignment
314
+ end
315
+
316
+ # Custom attribute writer method checking allowed values (enum).
317
+ # @param [Object] direction Object to be assigned
318
+ def direction=(direction)
319
+ # rubocop:disable Style/ConditionalAssignment
320
+ if direction && !DIRECTION_ENUM.include?(direction)
321
+ OCI.logger.debug("Unknown value for 'direction' [" + direction + "]. Mapping to 'DIRECTION_UNKNOWN_ENUM_VALUE'") if OCI.logger
322
+ @direction = DIRECTION_UNKNOWN_ENUM_VALUE
323
+ else
324
+ @direction = direction
325
+ end
326
+ # rubocop:enable Style/ConditionalAssignment
327
+ end
328
+
329
+ # Custom attribute writer method checking allowed values (enum).
330
+ # @param [Object] source_type Object to be assigned
331
+ def source_type=(source_type)
332
+ # rubocop:disable Style/ConditionalAssignment
333
+ if source_type && !SOURCE_TYPE_ENUM.include?(source_type)
334
+ OCI.logger.debug("Unknown value for 'source_type' [" + source_type + "]. Mapping to 'SOURCE_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger
335
+ @source_type = SOURCE_TYPE_UNKNOWN_ENUM_VALUE
336
+ else
337
+ @source_type = source_type
338
+ end
339
+ # rubocop:enable Style/ConditionalAssignment
340
+ end
341
+
342
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
343
+
344
+
345
+ # Checks equality by comparing each attribute.
346
+ # @param [Object] other the other object to be compared
347
+ def ==(other)
348
+ return true if equal?(other)
349
+
350
+ self.class == other.class &&
351
+ description == other.description &&
352
+ destination == other.destination &&
353
+ destination_type == other.destination_type &&
354
+ direction == other.direction &&
355
+ icmp_options == other.icmp_options &&
356
+ id == other.id &&
357
+ is_stateless == other.is_stateless &&
358
+ is_valid == other.is_valid &&
359
+ protocol == other.protocol &&
360
+ source == other.source &&
361
+ source_type == other.source_type &&
362
+ tcp_options == other.tcp_options &&
363
+ time_created == other.time_created &&
364
+ udp_options == other.udp_options
365
+ end
366
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
367
+
368
+ # @see the `==` method
369
+ # @param [Object] other the other object to be compared
370
+ def eql?(other)
371
+ self == other
372
+ end
373
+
374
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
375
+
376
+
377
+ # Calculates hash code according to all attributes.
378
+ # @return [Fixnum] Hash code
379
+ def hash
380
+ [description, destination, destination_type, direction, icmp_options, id, is_stateless, is_valid, protocol, source, source_type, tcp_options, time_created, udp_options].hash
381
+ end
382
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
383
+
384
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
385
+
386
+
387
+ # Builds the object from hash
388
+ # @param [Hash] attributes Model attributes in the form of hash
389
+ # @return [Object] Returns the model itself
390
+ def build_from_hash(attributes)
391
+ return nil unless attributes.is_a?(Hash)
392
+
393
+ self.class.swagger_types.each_pair do |key, type|
394
+ if type =~ /^Array<(.*)>/i
395
+ # check to ensure the input is an array given that the the attribute
396
+ # is documented as an array but the input is not
397
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
398
+ public_method("#{key}=").call(
399
+ attributes[self.class.attribute_map[key]]
400
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
401
+ )
402
+ end
403
+ elsif !attributes[self.class.attribute_map[key]].nil?
404
+ public_method("#{key}=").call(
405
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
406
+ )
407
+ end
408
+ # or else data not found in attributes(hash), not an issue as the data can be optional
409
+ end
410
+
411
+ self
412
+ end
413
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
414
+
415
+ # Returns the string representation of the object
416
+ # @return [String] String presentation of the object
417
+ def to_s
418
+ to_hash.to_s
419
+ end
420
+
421
+ # Returns the object in the form of hash
422
+ # @return [Hash] Returns the object in the form of hash
423
+ def to_hash
424
+ hash = {}
425
+ self.class.attribute_map.each_pair do |attr, param|
426
+ value = public_method(attr).call
427
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
428
+
429
+ hash[param] = _to_hash(value)
430
+ end
431
+ hash
432
+ end
433
+
434
+ private
435
+
436
+ # Outputs non-array value in the form of hash
437
+ # For object, use to_hash. Otherwise, just return the value
438
+ # @param [Object] value Any valid value
439
+ # @return [Hash] Returns the value in the form of hash
440
+ def _to_hash(value)
441
+ if value.is_a?(Array)
442
+ value.compact.map { |v| _to_hash(v) }
443
+ elsif value.is_a?(Hash)
444
+ {}.tap do |hash|
445
+ value.each { |k, v| hash[k] = _to_hash(v) }
446
+ end
447
+ elsif value.respond_to? :to_hash
448
+ value.to_hash
449
+ else
450
+ value
451
+ end
452
+ end
453
+ end
454
+ end
455
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength