oci 2.3.2 → 2.3.3

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -5
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/api_client.rb +2 -2
  5. data/lib/oci/auth/federation_client.rb +1 -0
  6. data/lib/oci/auth/signers/instance_principals_security_token_signer.rb +1 -1
  7. data/lib/oci/auth/signers/x509_federation_client_based_security_token_signer.rb +2 -1
  8. data/lib/oci/core/compute_client.rb +7 -5
  9. data/lib/oci/core/models/create_boot_volume_details.rb +17 -1
  10. data/lib/oci/core/models/egress_security_rule.rb +19 -5
  11. data/lib/oci/core/models/fast_connect_provider_service.rb +2 -2
  12. data/lib/oci/core/models/ingress_security_rule.rb +16 -7
  13. data/lib/oci/core/models/instance.rb +0 -2
  14. data/lib/oci/core/models/launch_instance_details.rb +0 -2
  15. data/lib/oci/core/models/route_rule.rb +19 -8
  16. data/lib/oci/core/models/virtual_circuit.rb +6 -1
  17. data/lib/oci/regions.rb +2 -1
  18. data/lib/oci/resource_search/models/free_text_search_details.rb +158 -0
  19. data/lib/oci/resource_search/models/queryable_field_description.rb +225 -0
  20. data/lib/oci/resource_search/models/resource_summary.rb +272 -0
  21. data/lib/oci/resource_search/models/resource_summary_collection.rb +146 -0
  22. data/lib/oci/resource_search/models/resource_type.rb +158 -0
  23. data/lib/oci/resource_search/models/search_context.rb +149 -0
  24. data/lib/oci/resource_search/models/search_details.rb +192 -0
  25. data/lib/oci/resource_search/models/structured_search_details.rb +158 -0
  26. data/lib/oci/resource_search/resource_search.rb +26 -0
  27. data/lib/oci/resource_search/resource_search_client.rb +279 -0
  28. data/lib/oci/resource_search/resource_search_client_composite_operations.rb +24 -0
  29. data/lib/oci/resource_search/util.rb +2 -0
  30. data/lib/oci/version.rb +1 -1
  31. metadata +14 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5dce598b5266d9674ebe6ea0e70e422671331b47
4
- data.tar.gz: e8dd3e1ad2d99f2ea990f4b93878692d02a3aa32
3
+ metadata.gz: 0a647e50ba728b350d47a6c070345cab43ececd7
4
+ data.tar.gz: 52c6e26ab685616101aad910a6ba8273e55fb851
5
5
  SHA512:
6
- metadata.gz: b50db7913ddcb46fd07972392ddee5ef2fe8d9faa3e84f56411d25151c32163661f169b8beb1502676c14da5a415cb8afdc2e1bcda7f25ac12e60c5b6029d106
7
- data.tar.gz: 2969c2b133de7b2d9563f5293386f282f4a38de21d1d47cdeef4a2045096d3cabcc392c6965413f7d655d127dc1be9ec62f162ba6fdae1fad187d7720b344086
6
+ metadata.gz: 9a580cf9ce0e7fff8a812eec68673d978f36b54dd49d2b8912e1fc142811d0bd2d7e83154e7608d2ee930aed9db088116d398f2f442b0f65436a1084ea2fbf28
7
+ data.tar.gz: 9080bd2e30a9487dc761e54d5d1bade809cff666f432c20fc39bd0dbf3ca4746e7b78dfc7444ca8f6139b5c1818d6971a9a283a23581ffc1b5712dfec35f5bf3
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Oracle Cloud Infrastructure Ruby SDK
2
- **Version 2.3.2**
2
+ **Version 2.3.3**
3
3
 
4
4
  This topic describes how to install, configure, and use the Oracle Cloud Infrastructure Ruby SDK.
5
5
 
@@ -8,15 +8,16 @@ This topic describes how to install, configure, and use the Oracle Cloud Infrast
8
8
  The Ruby SDK supports the following services:
9
9
 
10
10
  * Audit
11
+ * Container Engine
11
12
  * Core Services (which includes Networking Service, Compute Service, and Block Volume Service)
12
13
  * Database Service
14
+ * Domain Name System Service
15
+ * Email Service
16
+ * File Storage Service
13
17
  * Identity and Access Management Service
14
18
  * Load Balancing Service
15
19
  * Object Storage Service
16
- * Domain Name System Service
17
- * File Storage Service
18
- * Email Service
19
- * Container Engine
20
+ * OCI Search
20
21
 
21
22
  **Licensing:** This SDK and sample is dual licensed under the Universal Permissive License 1.0 and the Apache License.
22
23
 
data/lib/oci.rb CHANGED
@@ -28,6 +28,7 @@ require 'oci/identity/identity'
28
28
  require 'oci/load_balancer/load_balancer'
29
29
  require 'oci/object_storage/object_storage'
30
30
  require 'oci/object_storage/transfer/transfer'
31
+ require 'oci/resource_search/resource_search'
31
32
 
32
33
  # Top level module for the Oracle Cloud Infrastructure SDK
33
34
  module OCI
@@ -521,7 +521,7 @@ module OCI
521
521
  return body if (return_type == 'String' && !json_mime?(content_type)) || return_type == 'Stream'
522
522
 
523
523
  # There are some cases, the error is not returned by services but by like gateway, for example in bug
524
- # https://jira.aka.lgl.grungy.us/browse/DEX-564, gateway timeouts and 504 is returned and content is generated
524
+ # https://jira.oci.oraclecorp.com/browse/DEX-564, gateway timeouts and 504 is returned and content is generated
525
525
  # by gateway, so there is no guarantee that the content-type will be application/json.
526
526
  if !success?(response) && !response_from_oci_service?(response)
527
527
  raise Errors::NetworkError.new(
@@ -625,7 +625,7 @@ module OCI
625
625
  return yield
626
626
  rescue OCI::Errors::ServiceError => e
627
627
  raise if attempt >= (max_attempts - 1) # .times is zero-based
628
- raise if e.status != 401
628
+ raise if e.status_code != 401
629
629
 
630
630
  @signer.refresh_security_token
631
631
  retry
@@ -97,6 +97,7 @@ module OCI
97
97
  request.body = request_payload.to_json
98
98
 
99
99
  header_params = {}
100
+ header_params['content-type'] = 'application/json'
100
101
  signer.sign(:post, @federation_endpoint, header_params, request.body)
101
102
  header_params.each { |key, value| request[key.to_s] = value }
102
103
 
@@ -68,7 +68,7 @@ module OCI
68
68
  raw_region
69
69
  end
70
70
 
71
- @federation_endpoint = if federation_endpoint
71
+ @federation_endpoint = if defined?(federation_endpoint)
72
72
  federation_endpoint
73
73
  else
74
74
  "#{OCI::Regions.get_service_endpoint(@region, :Auth)}/v1/x509"
@@ -50,7 +50,8 @@ module OCI
50
50
  # @param [String] uri The URI, such as 'https://iaas.us-phoenix-1.oraclecloud.com/20160918/volumeAttachments/'
51
51
  # @param [Hash] headers A hash of headers
52
52
  # @param [String] body The request body
53
- def sign(method, uri, headers, body)
53
+ # @param [String] operation_signing_strategy the signing strategy for the operation. Default is :standard
54
+ def sign(method, uri, headers, body, operation_signing_strategy = :standard)
54
55
  reset_signer
55
56
  super
56
57
  end
@@ -1751,11 +1751,13 @@ module OCI
1751
1751
  # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
1752
1752
 
1753
1753
 
1754
- # Lists the available images in the specified compartment.
1755
- # If you specify a value for the `sortBy` parameter, Oracle-provided images appear first in the list, followed by custom images.
1756
- # For more
1757
- # information about images, see
1758
- # [Managing Custom Images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm).
1754
+ # Lists the available images in the specified compartment, including both
1755
+ # [Oracle-provided images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm) and
1756
+ # [custom images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm) that have
1757
+ # been created. The list of images returned is ordered to first show all
1758
+ # Oracle-provided images, then all custom images.
1759
+ #
1760
+ # The order of images returned may change when new images are released.
1759
1761
  #
1760
1762
  # @param [String] compartment_id The OCID of the compartment.
1761
1763
  # @param [Hash] opts the optional parameters
@@ -13,6 +13,12 @@ module OCI
13
13
  # @return [String]
14
14
  attr_accessor :availability_domain
15
15
 
16
+ # If provided, specifies the ID of the boot volume backup policy to assign to the newly
17
+ # created boot volume. If omitted, no policy will be assigned.
18
+ #
19
+ # @return [String]
20
+ attr_accessor :backup_policy_id
21
+
16
22
  # **[Required]** The OCID of the compartment that contains the boot volume.
17
23
  # @return [String]
18
24
  attr_accessor :compartment_id
@@ -55,6 +61,7 @@ module OCI
55
61
  {
56
62
  # rubocop:disable Style/SymbolLiteral
57
63
  'availability_domain': :'availabilityDomain',
64
+ 'backup_policy_id': :'backupPolicyId',
58
65
  'compartment_id': :'compartmentId',
59
66
  'defined_tags': :'definedTags',
60
67
  'display_name': :'displayName',
@@ -70,6 +77,7 @@ module OCI
70
77
  {
71
78
  # rubocop:disable Style/SymbolLiteral
72
79
  'availability_domain': :'String',
80
+ 'backup_policy_id': :'String',
73
81
  'compartment_id': :'String',
74
82
  'defined_tags': :'Hash<String, Hash<String, Object>>',
75
83
  'display_name': :'String',
@@ -87,6 +95,7 @@ module OCI
87
95
  # Initializes the object
88
96
  # @param [Hash] attributes Model attributes in the form of hash
89
97
  # @option attributes [String] :availability_domain The value to assign to the {#availability_domain} property
98
+ # @option attributes [String] :backup_policy_id The value to assign to the {#backup_policy_id} property
90
99
  # @option attributes [String] :compartment_id The value to assign to the {#compartment_id} property
91
100
  # @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
92
101
  # @option attributes [String] :display_name The value to assign to the {#display_name} property
@@ -105,6 +114,12 @@ module OCI
105
114
 
106
115
  self.availability_domain = attributes[:'availability_domain'] if attributes[:'availability_domain']
107
116
 
117
+ self.backup_policy_id = attributes[:'backupPolicyId'] if attributes[:'backupPolicyId']
118
+
119
+ raise 'You cannot provide both :backupPolicyId and :backup_policy_id' if attributes.key?(:'backupPolicyId') && attributes.key?(:'backup_policy_id')
120
+
121
+ self.backup_policy_id = attributes[:'backup_policy_id'] if attributes[:'backup_policy_id']
122
+
108
123
  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']
109
124
 
110
125
  raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id')
@@ -153,6 +168,7 @@ module OCI
153
168
  return true if equal?(other)
154
169
  self.class == other.class &&
155
170
  availability_domain == other.availability_domain &&
171
+ backup_policy_id == other.backup_policy_id &&
156
172
  compartment_id == other.compartment_id &&
157
173
  defined_tags == other.defined_tags &&
158
174
  display_name == other.display_name &&
@@ -174,7 +190,7 @@ module OCI
174
190
  # Calculates hash code according to all attributes.
175
191
  # @return [Fixnum] Hash code
176
192
  def hash
177
- [availability_domain, compartment_id, defined_tags, display_name, freeform_tags, size_in_gbs, source_details].hash
193
+ [availability_domain, backup_policy_id, compartment_id, defined_tags, display_name, freeform_tags, size_in_gbs, source_details].hash
178
194
  end
179
195
  # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
180
196
 
@@ -13,15 +13,29 @@ module OCI
13
13
  DESTINATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
14
14
  ].freeze
15
15
 
16
- # **[Required]** The destination service cidrBlock or destination IP address range in CIDR notation for the egress rule.
17
- # This is the range of IP addresses that a packet originating from the instance can go to.
16
+ # **[Required]** Conceptually, this is the range of IP addresses that a packet originating from the instance
17
+ # can go to.
18
+ #
19
+ # Allowed values:
20
+ #
21
+ # * IP address range in CIDR notation. For example: `192.168.1.0/24`
22
+ #
23
+ # * The `cidrBlock` value for a {Service}, if you're
24
+ # setting up a security list rule for traffic destined for a particular service through
25
+ # a service gateway. For example: `oci-phx-objectstorage`
18
26
  #
19
27
  # @return [String]
20
28
  attr_accessor :destination
21
29
 
22
- # Type of destination for EgressSecurityRule. SERVICE_CIDR_BLOCK should be used if destination is a service
23
- # cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation.
24
- # It defaults to CIDR_BLOCK, if not specified.
30
+ # Type of destination for the rule. The default is `CIDR_BLOCK`.
31
+ #
32
+ # Allowed values:
33
+ #
34
+ # * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation.
35
+ #
36
+ # * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a
37
+ # {Service} (the rule is for traffic destined for a
38
+ # particular service through a service gateway).
25
39
  #
26
40
  # @return [String]
27
41
  attr_reader :destination_type
@@ -45,7 +45,7 @@ module OCI
45
45
  # @return [String]
46
46
  attr_accessor :id
47
47
 
48
- # **[Required]** Private peering BGP management.
48
+ # **[Required]** Who is responsible for managing the private peering BGP information.
49
49
  #
50
50
  # @return [String]
51
51
  attr_reader :private_peering_bgp_management
@@ -60,7 +60,7 @@ module OCI
60
60
  # @return [String]
61
61
  attr_accessor :provider_service_name
62
62
 
63
- # **[Required]** Public peering BGP management.
63
+ # **[Required]** Who is responsible for managing the public peering BGP information.
64
64
  #
65
65
  # @return [String]
66
66
  attr_reader :public_peering_bgp_management
@@ -42,18 +42,27 @@ module OCI
42
42
  # @return [String]
43
43
  attr_accessor :protocol
44
44
 
45
- # **[Required]** The source service cidrBlock or source IP address range in CIDR notation for the ingress rule. This is the
46
- # range of IP addresses that a packet coming into the instance can come from.
45
+ # **[Required]** Conceptually, this is the range of IP addresses that a packet coming into the instance
46
+ # can come from.
47
47
  #
48
- # Examples: `10.12.0.0/16`
49
- # `oci-phx-objectstorage`
48
+ # Allowed values:
49
+ #
50
+ # * IP address range in CIDR notation. For example: `192.168.1.0/24`
51
+ #
52
+ # * The `cidrBlock` value for a {Service}, if you're
53
+ # setting up a security list rule for traffic coming from a particular service through
54
+ # a service gateway. For example: `oci-phx-objectstorage`
50
55
  #
51
56
  # @return [String]
52
57
  attr_accessor :source
53
58
 
54
- # Type of source for IngressSecurityRule. SERVICE_CIDR_BLOCK should be used if source is a service cidrBlock.
55
- # CIDR_BLOCK should be used if source is IP address range in CIDR notation. It defaults to CIDR_BLOCK, if
56
- # not specified.
59
+ # Type of source for the rule. The default is `CIDR_BLOCK`.
60
+ #
61
+ # * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation.
62
+ #
63
+ # * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a
64
+ # {Service} (the rule is for traffic coming from a
65
+ # particular service through a service gateway).
57
66
  #
58
67
  # @return [String]
59
68
  attr_reader :source_type
@@ -65,8 +65,6 @@ module OCI
65
65
  #
66
66
  # They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
67
67
  #
68
- # If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead.
69
- #
70
68
  # @return [Hash<String, Object>]
71
69
  attr_accessor :extended_metadata
72
70
 
@@ -45,8 +45,6 @@ module OCI
45
45
  #
46
46
  # They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only).
47
47
  #
48
- # If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead.
49
- #
50
48
  # @return [Hash<String, Object>]
51
49
  attr_accessor :extended_metadata
52
50
 
@@ -15,7 +15,9 @@ module OCI
15
15
  DESTINATION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
16
16
  ].freeze
17
17
 
18
- # **[Required]** Deprecated, Destination and DestinationType should be used instead; request including both fields will be rejected.
18
+ # Deprecated. Instead use `destination` and `destinationType`. Requests that include both
19
+ # `cidrBlock` and `destination` will be rejected.
20
+ #
19
21
  # A destination IP address range in CIDR notation. Matching packets will
20
22
  # be routed to the indicated network entity (the target).
21
23
  #
@@ -24,18 +26,27 @@ module OCI
24
26
  # @return [String]
25
27
  attr_accessor :cidr_block
26
28
 
27
- # The destination service cidrBlock or destination IP address range in CIDR notation. Matching packets will
28
- # be routed to the indicated network entity (the target).
29
+ # Conceptually, this is the range of IP addresses used for matching when routing
30
+ # traffic. Required if you provide a `destinationType`.
31
+ #
32
+ # Allowed values:
29
33
  #
30
- # Examples: `10.12.0.0/16`
31
- # `oci-phx-objectstorage`
34
+ # * IP address range in CIDR notation. For example: `192.168.1.0/24`
35
+ #
36
+ # * The `cidrBlock` value for a {Service}, if you're
37
+ # setting up a route rule for traffic destined for a particular service through
38
+ # a service gateway. For example: `oci-phx-objectstorage`
32
39
  #
33
40
  # @return [String]
34
41
  attr_accessor :destination
35
42
 
36
- # Type of destination for the route rule. SERVICE_CIDR_BLOCK should be used if destination is a service
37
- # cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. It must be provided
38
- # along with `destination`.
43
+ # Type of destination for the rule. Required if you provide a `destination`.
44
+ #
45
+ # * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation.
46
+ #
47
+ # * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a
48
+ # {Service} (the rule is for traffic destined for a
49
+ # particular service through a service gateway).
39
50
  #
40
51
  # @return [String]
41
52
  attr_reader :destination_type
@@ -70,7 +70,12 @@ module OCI
70
70
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
71
71
  ].freeze
72
72
 
73
- # The provisioned data rate of the connection.
73
+ # The provisioned data rate of the connection. To get a list of the
74
+ # available bandwidth levels (that is, shapes), see
75
+ # {#list_fast_connect_provider_virtual_circuit_bandwidth_shapes list_fast_connect_provider_virtual_circuit_bandwidth_shapes}.
76
+ #
77
+ # Example: `10 Gbps`
78
+ #
74
79
  # @return [String]
75
80
  attr_accessor :bandwidth_shape_name
76
81
 
@@ -31,7 +31,8 @@ module OCI
31
31
  DnsClient: 'dns',
32
32
  FileStorageClient: 'filestorage',
33
33
  EmailClient: 'email',
34
- ContainerEngineClient: 'containerengine'
34
+ ContainerEngineClient: 'containerengine',
35
+ ResourceSearchClient: 'query'
35
36
  }.freeze
36
37
  # --- End of service prefixes ---
37
38
 
@@ -0,0 +1,158 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+ require_relative 'search_details'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective
7
+ module OCI
8
+ # A request containing arbitrary text that must be present in the resource.
9
+ class ResourceSearch::Models::FreeTextSearchDetails < ResourceSearch::Models::SearchDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The text to search for.
11
+ # @return [String]
12
+ attr_accessor :text
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ # rubocop:disable Style/SymbolLiteral
18
+ 'type': :'type',
19
+ 'matching_context_type': :'matchingContextType',
20
+ 'text': :'text'
21
+ # rubocop:enable Style/SymbolLiteral
22
+ }
23
+ end
24
+
25
+ # Attribute type mapping.
26
+ def self.swagger_types
27
+ {
28
+ # rubocop:disable Style/SymbolLiteral
29
+ 'type': :'String',
30
+ 'matching_context_type': :'String',
31
+ 'text': :'String'
32
+ # rubocop:enable Style/SymbolLiteral
33
+ }
34
+ end
35
+
36
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
37
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
38
+
39
+
40
+ # Initializes the object
41
+ # @param [Hash] attributes Model attributes in the form of hash
42
+ # @option attributes [String] :matching_context_type The value to assign to the {OCI::ResourceSearch::Models::SearchDetails#matching_context_type #matching_context_type} proprety
43
+ # @option attributes [String] :text The value to assign to the {#text} property
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ attributes['type'] = 'FreeText'
48
+
49
+ super(attributes)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
53
+
54
+ self.text = attributes[:'text'] if attributes[:'text']
55
+ end
56
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
57
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
58
+
59
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
60
+
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] other the other object to be compared
64
+ def ==(other)
65
+ return true if equal?(other)
66
+ self.class == other.class &&
67
+ type == other.type &&
68
+ matching_context_type == other.matching_context_type &&
69
+ text == other.text
70
+ end
71
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
72
+
73
+ # @see the `==` method
74
+ # @param [Object] other the other object to be compared
75
+ def eql?(other)
76
+ self == other
77
+ end
78
+
79
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
80
+
81
+
82
+ # Calculates hash code according to all attributes.
83
+ # @return [Fixnum] Hash code
84
+ def hash
85
+ [type, matching_context_type, text].hash
86
+ end
87
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
88
+
89
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
90
+
91
+
92
+ # Builds the object from hash
93
+ # @param [Hash] attributes Model attributes in the form of hash
94
+ # @return [Object] Returns the model itself
95
+ def build_from_hash(attributes)
96
+ return nil unless attributes.is_a?(Hash)
97
+ self.class.swagger_types.each_pair do |key, type|
98
+ if type =~ /^Array<(.*)>/i
99
+ # check to ensure the input is an array given that the the attribute
100
+ # is documented as an array but the input is not
101
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
102
+ public_method("#{key}=").call(
103
+ attributes[self.class.attribute_map[key]]
104
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
105
+ )
106
+ end
107
+ elsif !attributes[self.class.attribute_map[key]].nil?
108
+ public_method("#{key}=").call(
109
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
110
+ )
111
+ end
112
+ # or else data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+
115
+ self
116
+ end
117
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
118
+
119
+ # Returns the string representation of the object
120
+ # @return [String] String presentation of the object
121
+ def to_s
122
+ to_hash.to_s
123
+ end
124
+
125
+ # Returns the object in the form of hash
126
+ # @return [Hash] Returns the object in the form of hash
127
+ def to_hash
128
+ hash = {}
129
+ self.class.attribute_map.each_pair do |attr, param|
130
+ value = public_method(attr).call
131
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
132
+ hash[param] = _to_hash(value)
133
+ end
134
+ hash
135
+ end
136
+
137
+ private
138
+
139
+ # Outputs non-array value in the form of hash
140
+ # For object, use to_hash. Otherwise, just return the value
141
+ # @param [Object] value Any valid value
142
+ # @return [Hash] Returns the value in the form of hash
143
+ def _to_hash(value)
144
+ if value.is_a?(Array)
145
+ value.compact.map { |v| _to_hash(v) }
146
+ elsif value.is_a?(Hash)
147
+ {}.tap do |hash|
148
+ value.each { |k, v| hash[k] = _to_hash(v) }
149
+ end
150
+ elsif value.respond_to? :to_hash
151
+ value.to_hash
152
+ else
153
+ value
154
+ end
155
+ end
156
+ end
157
+ end
158
+ # rubocop:enable Lint/UnneededCopDisableDirective