class OCI::Identity::Models::NetworkSources
A network source specifies a list of source IP addresses that are allowed to make authorization requests. Use the network source in policy statements to restrict access to only requests that come from the specified IPs. For more information, see [Managing Network Sources](docs.cloud.oracle.com/Content/Identity/Tasks/managingnetworksources.htm).
Constants
- LIFECYCLE_STATE_ENUM
Attributes
[Required] The OCID of the tenancy containing the network source. The tenancy is the root compartment. @return [String]
[Required] The description you assign to the network source. Does not have to be unique, and it's changeable. @return [String]
[Required] The OCID of the network source. @return [String]
The detailed status of INACTIVE lifecycleState. @return [Integer]
[Required] The network source object's current state. After creating a network source, make sure its `lifecycleState` changes from CREATING to ACTIVE before using it.
@return [String]
[Required] The name you assign to the network source during creation. The name must be unique across the tenancy and cannot be changed.
@return [String]
A list of allowed public IPs and CIDR ranges.
@return [Array<String>]
A list of services allowed to make on-behalf-of requests. These requests can have different source IPs than those specified in the network source. Currently, only `all` and `none` are supported. The default is `all`.
@return [Array<String>]
[Required] Date and time the group was created, in the format defined by RFC3339.
Example: `2016-08-25T21:10:29.600Z`
@return [DateTime]
A list of allowed VCN OCID and IP range pairs. Example:`"vcnId": "ocid1.vcn.oc1.iad.aaaaaaaaexampleuniqueID", "ipRanges": [ "129.213.39.0/24" ]`
@return [Array<OCI::Identity::Models::NetworkSourcesVirtualSourceList>]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/oci/identity/models/network_sources.rb, line 91 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'id': :'id', 'compartment_id': :'compartmentId', 'name': :'name', 'description': :'description', 'public_source_list': :'publicSourceList', 'virtual_source_list': :'virtualSourceList', 'services': :'services', 'time_created': :'timeCreated', 'lifecycle_state': :'lifecycleState', 'inactive_status': :'inactiveStatus', 'freeform_tags': :'freeformTags', 'defined_tags': :'definedTags' # rubocop:enable Style/SymbolLiteral } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :id The value to assign to the {#id} property @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :description The value to assign to the {#description} property @option attributes [Array<String>] :public_source_list The value to assign to the {#public_source_list} property @option attributes [Array<OCI::Identity::Models::NetworkSourcesVirtualSourceList>] :virtual_source_list The value to assign to the {#virtual_source_list} property @option attributes [Array<String>] :services The value to assign to the {#services} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [String] :lifecycle_state The value to assign to the {#lifecycle_state} property @option attributes [Integer] :inactive_status The value to assign to the {#inactive_status} property @option attributes [Hash<String, String>] :freeform_tags The value to assign to the {#freeform_tags} property @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
# File lib/oci/identity/models/network_sources.rb, line 148 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.id = attributes[:'id'] if attributes[:'id'] self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId'] raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id'] self.name = attributes[:'name'] if attributes[:'name'] self.description = attributes[:'description'] if attributes[:'description'] self.public_source_list = attributes[:'publicSourceList'] if attributes[:'publicSourceList'] raise 'You cannot provide both :publicSourceList and :public_source_list' if attributes.key?(:'publicSourceList') && attributes.key?(:'public_source_list') self.public_source_list = attributes[:'public_source_list'] if attributes[:'public_source_list'] self.virtual_source_list = attributes[:'virtualSourceList'] if attributes[:'virtualSourceList'] raise 'You cannot provide both :virtualSourceList and :virtual_source_list' if attributes.key?(:'virtualSourceList') && attributes.key?(:'virtual_source_list') self.virtual_source_list = attributes[:'virtual_source_list'] if attributes[:'virtual_source_list'] self.services = attributes[:'services'] if attributes[:'services'] self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated'] raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created') self.time_created = attributes[:'time_created'] if attributes[:'time_created'] self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState'] raise 'You cannot provide both :lifecycleState and :lifecycle_state' if attributes.key?(:'lifecycleState') && attributes.key?(:'lifecycle_state') self.lifecycle_state = attributes[:'lifecycle_state'] if attributes[:'lifecycle_state'] self.inactive_status = attributes[:'inactiveStatus'] if attributes[:'inactiveStatus'] raise 'You cannot provide both :inactiveStatus and :inactive_status' if attributes.key?(:'inactiveStatus') && attributes.key?(:'inactive_status') self.inactive_status = attributes[:'inactive_status'] if attributes[:'inactive_status'] self.freeform_tags = attributes[:'freeformTags'] if attributes[:'freeformTags'] raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags') self.freeform_tags = attributes[:'freeform_tags'] if attributes[:'freeform_tags'] self.defined_tags = attributes[:'definedTags'] if attributes[:'definedTags'] raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags') self.defined_tags = attributes[:'defined_tags'] if attributes[:'defined_tags'] end
Attribute type mapping.
# File lib/oci/identity/models/network_sources.rb, line 111 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'id': :'String', 'compartment_id': :'String', 'name': :'String', 'description': :'String', 'public_source_list': :'Array<String>', 'virtual_source_list': :'Array<OCI::Identity::Models::NetworkSourcesVirtualSourceList>', 'services': :'Array<String>', 'time_created': :'DateTime', 'lifecycle_state': :'String', 'inactive_status': :'Integer', 'freeform_tags': :'Hash<String, String>', 'defined_tags': :'Hash<String, Hash<String, Object>>' # rubocop:enable Style/SymbolLiteral } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] other the other object to be compared
# File lib/oci/identity/models/network_sources.rb, line 231 def ==(other) return true if equal?(other) self.class == other.class && id == other.id && compartment_id == other.compartment_id && name == other.name && description == other.description && public_source_list == other.public_source_list && virtual_source_list == other.virtual_source_list && services == other.services && time_created == other.time_created && lifecycle_state == other.lifecycle_state && inactive_status == other.inactive_status && freeform_tags == other.freeform_tags && defined_tags == other.defined_tags end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/oci/identity/models/network_sources.rb, line 272 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end
@see the `==` method @param [Object] other the other object to be compared
# File lib/oci/identity/models/network_sources.rb, line 252 def eql?(other) self == other end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/oci/identity/models/network_sources.rb, line 261 def hash [id, compartment_id, name, description, public_source_list, virtual_source_list, services, time_created, lifecycle_state, inactive_status, freeform_tags, defined_tags].hash end
Custom attribute writer method checking allowed values (enum). @param [Object] lifecycle_state
Object
to be assigned
# File lib/oci/identity/models/network_sources.rb, line 215 def lifecycle_state=(lifecycle_state) # rubocop:disable Style/ConditionalAssignment if lifecycle_state && !LIFECYCLE_STATE_ENUM.include?(lifecycle_state) OCI.logger.debug("Unknown value for 'lifecycle_state' [" + lifecycle_state + "]. Mapping to 'LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE'") if OCI.logger @lifecycle_state = LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE else @lifecycle_state = lifecycle_state end # rubocop:enable Style/ConditionalAssignment end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/oci/identity/models/network_sources.rb, line 305 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/oci/identity/models/network_sources.rb, line 299 def to_s to_hash.to_s end
Private Instance Methods
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/oci/identity/models/network_sources.rb, line 322 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end