oci 2.3.2 → 2.3.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,192 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ # rubocop:disable Lint/UnneededCopDisableDirective
6
+ module OCI
7
+ # A base request type containing common criteria for searching for resources.
8
+ # This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
9
+ class ResourceSearch::Models::SearchDetails # rubocop:disable Metrics/LineLength
10
+ MATCHING_CONTEXT_TYPE_ENUM = [
11
+ MATCHING_CONTEXT_TYPE_NONE = 'NONE'.freeze,
12
+ MATCHING_CONTEXT_TYPE_HIGHLIGHTS = 'HIGHLIGHTS'.freeze
13
+ ].freeze
14
+
15
+ # **[Required]** The type of SearchDetails, whether `FreeText` or `Structured`.
16
+ # @return [String]
17
+ attr_accessor :type
18
+
19
+ # The type of matching context returned in the response. If you specify `HIGHLIGHTS`, then the service will highlight fragments in its response. (See ResourceSummary.searchContext and SearchContext for more information.) The default setting is `NONE`.
20
+ #
21
+ # @return [String]
22
+ attr_reader :matching_context_type
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ # rubocop:disable Style/SymbolLiteral
28
+ 'type': :'type',
29
+ 'matching_context_type': :'matchingContextType'
30
+ # rubocop:enable Style/SymbolLiteral
31
+ }
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.swagger_types
36
+ {
37
+ # rubocop:disable Style/SymbolLiteral
38
+ 'type': :'String',
39
+ 'matching_context_type': :'String'
40
+ # rubocop:enable Style/SymbolLiteral
41
+ }
42
+ end
43
+
44
+ # rubocop:disable Metrics/CyclomaticComplexity, Layout/EmptyLines
45
+
46
+
47
+ # Given the hash representation of a subtype of this class,
48
+ # use the info in the hash to return the class of the subtype.
49
+ def self.get_subtype(object_hash)
50
+ type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral
51
+
52
+ return 'OCI::ResourceSearch::Models::StructuredSearchDetails' if type == 'Structured'
53
+ return 'OCI::ResourceSearch::Models::FreeTextSearchDetails' if type == 'FreeText'
54
+
55
+ # TODO: Log a warning when the subtype is not found.
56
+ 'OCI::ResourceSearch::Models::SearchDetails'
57
+ end
58
+ # rubocop:enable Metrics/CyclomaticComplexity, Layout/EmptyLines
59
+
60
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
61
+ # rubocop:disable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
62
+
63
+
64
+ # Initializes the object
65
+ # @param [Hash] attributes Model attributes in the form of hash
66
+ # @option attributes [String] :type The value to assign to the {#type} property
67
+ # @option attributes [String] :matching_context_type The value to assign to the {#matching_context_type} property
68
+ def initialize(attributes = {})
69
+ return unless attributes.is_a?(Hash)
70
+
71
+ # convert string to symbol for hash key
72
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
73
+
74
+ self.type = attributes[:'type'] if attributes[:'type']
75
+
76
+ self.matching_context_type = attributes[:'matchingContextType'] if attributes[:'matchingContextType']
77
+
78
+ raise 'You cannot provide both :matchingContextType and :matching_context_type' if attributes.key?(:'matchingContextType') && attributes.key?(:'matching_context_type')
79
+
80
+ self.matching_context_type = attributes[:'matching_context_type'] if attributes[:'matching_context_type']
81
+ end
82
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
83
+ # rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
84
+
85
+ # Custom attribute writer method checking allowed values (enum).
86
+ # @param [Object] matching_context_type Object to be assigned
87
+ def matching_context_type=(matching_context_type)
88
+ # rubocop: disable Metrics/LineLength
89
+ raise "Invalid value for 'matching_context_type': this must be one of the values in MATCHING_CONTEXT_TYPE_ENUM." if matching_context_type && !MATCHING_CONTEXT_TYPE_ENUM.include?(matching_context_type)
90
+ # rubocop: enable Metrics/LineLength
91
+ @matching_context_type = matching_context_type
92
+ end
93
+
94
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
95
+
96
+
97
+ # Checks equality by comparing each attribute.
98
+ # @param [Object] other the other object to be compared
99
+ def ==(other)
100
+ return true if equal?(other)
101
+ self.class == other.class &&
102
+ type == other.type &&
103
+ matching_context_type == other.matching_context_type
104
+ end
105
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
106
+
107
+ # @see the `==` method
108
+ # @param [Object] other the other object to be compared
109
+ def eql?(other)
110
+ self == other
111
+ end
112
+
113
+ # rubocop:disable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
114
+
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Fixnum] Hash code
118
+ def hash
119
+ [type, matching_context_type].hash
120
+ end
121
+ # rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
122
+
123
+ # rubocop:disable Metrics/AbcSize, Layout/EmptyLines
124
+
125
+
126
+ # Builds the object from hash
127
+ # @param [Hash] attributes Model attributes in the form of hash
128
+ # @return [Object] Returns the model itself
129
+ def build_from_hash(attributes)
130
+ return nil unless attributes.is_a?(Hash)
131
+ self.class.swagger_types.each_pair do |key, type|
132
+ if type =~ /^Array<(.*)>/i
133
+ # check to ensure the input is an array given that the the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ public_method("#{key}=").call(
137
+ attributes[self.class.attribute_map[key]]
138
+ .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
139
+ )
140
+ end
141
+ elsif !attributes[self.class.attribute_map[key]].nil?
142
+ public_method("#{key}=").call(
143
+ OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
144
+ )
145
+ end
146
+ # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+ # rubocop:enable Metrics/AbcSize, Layout/EmptyLines
152
+
153
+ # Returns the string representation of the object
154
+ # @return [String] String presentation of the object
155
+ def to_s
156
+ to_hash.to_s
157
+ end
158
+
159
+ # Returns the object in the form of hash
160
+ # @return [Hash] Returns the object in the form of hash
161
+ def to_hash
162
+ hash = {}
163
+ self.class.attribute_map.each_pair do |attr, param|
164
+ value = public_method(attr).call
165
+ next if value.nil? && !instance_variable_defined?("@#{attr}")
166
+ hash[param] = _to_hash(value)
167
+ end
168
+ hash
169
+ end
170
+
171
+ private
172
+
173
+ # Outputs non-array value in the form of hash
174
+ # For object, use to_hash. Otherwise, just return the value
175
+ # @param [Object] value Any valid value
176
+ # @return [Hash] Returns the value in the form of hash
177
+ def _to_hash(value)
178
+ if value.is_a?(Array)
179
+ value.compact.map { |v| _to_hash(v) }
180
+ elsif value.is_a?(Hash)
181
+ {}.tap do |hash|
182
+ value.each { |k, v| hash[k] = _to_hash(v) }
183
+ end
184
+ elsif value.respond_to? :to_hash
185
+ value.to_hash
186
+ else
187
+ value
188
+ end
189
+ end
190
+ end
191
+ end
192
+ # rubocop:enable Lint/UnneededCopDisableDirective
@@ -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 search filters using the structured search query language.
9
+ class ResourceSearch::Models::StructuredSearchDetails < ResourceSearch::Models::SearchDetails # rubocop:disable Metrics/LineLength
10
+ # **[Required]** The structured query describing which resources to search for.
11
+ # @return [String]
12
+ attr_accessor :query
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
+ 'query': :'query'
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
+ 'query': :'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] :query The value to assign to the {#query} property
44
+ def initialize(attributes = {})
45
+ return unless attributes.is_a?(Hash)
46
+
47
+ attributes['type'] = 'Structured'
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.query = attributes[:'query'] if attributes[:'query']
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
+ query == other.query
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, query].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
@@ -0,0 +1,26 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module ResourceSearch
5
+ # Module containing models for requests made to, and responses received from,
6
+ # OCI ResourceSearch services
7
+ module Models
8
+ end
9
+ end
10
+ end
11
+
12
+ # Require models
13
+ require 'oci/resource_search/models/free_text_search_details'
14
+ require 'oci/resource_search/models/queryable_field_description'
15
+ require 'oci/resource_search/models/resource_summary'
16
+ require 'oci/resource_search/models/resource_summary_collection'
17
+ require 'oci/resource_search/models/resource_type'
18
+ require 'oci/resource_search/models/search_context'
19
+ require 'oci/resource_search/models/search_details'
20
+ require 'oci/resource_search/models/structured_search_details'
21
+
22
+ # Require generated clients
23
+ require 'oci/resource_search/resource_search_client'
24
+
25
+ # Require service utilities
26
+ require 'oci/resource_search/util'
@@ -0,0 +1,279 @@
1
+ # Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'uri'
4
+ require 'logger'
5
+
6
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
7
+ module OCI
8
+ # Search for resources in your cloud network.
9
+ class ResourceSearch::ResourceSearchClient
10
+ # Client used to make HTTP requests.
11
+ # @return [OCI::ApiClient]
12
+ attr_reader :api_client
13
+
14
+ # Fully qualified endpoint URL
15
+ # @return [String]
16
+ attr_reader :endpoint
17
+
18
+ # The default retry configuration to apply to all operations in this service client. This can be overridden
19
+ # on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
20
+ # will not perform any retries
21
+ # @return [OCI::Retry::RetryConfig]
22
+ attr_reader :retry_config
23
+
24
+ # The region, which will usually correspond to a value in {OCI::Regions::REGION_ENUM}.
25
+ # @return [String]
26
+ attr_reader :region
27
+
28
+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
29
+
30
+
31
+ # Creates a new ResourceSearchClient.
32
+ # If a config is not specified, then the global OCI.config will be used.
33
+ #
34
+ # A region must be specified in either the config or the region parameter. If specified
35
+ # in both, then the region parameter will be used.
36
+ #
37
+ # @param [Config] config A Config object.
38
+ # @param [String] region A region used to determine the service endpoint. This will usually
39
+ # correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
40
+ # @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
41
+ # a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
42
+ # so that the instance principals signer can be provided to the client
43
+ # @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
44
+ # the details for the proxy can be provided in this parameter
45
+ # @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
46
+ # apply across all operations. This can be overridden on a per-operation basis. The default retry configuration value is `nil`, which means that an operation
47
+ # will not perform any retries
48
+ def initialize(config: nil, region: nil, signer: nil, proxy_settings: nil, retry_config: nil)
49
+ # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
50
+ # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
51
+ # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
52
+ # pass it to this constructor.
53
+ #
54
+ # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
55
+ # so try and load the config from the default file.
56
+ config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
57
+ config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
58
+ config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
59
+
60
+ if signer.nil?
61
+ signer = OCI::Signer.new(
62
+ config.user,
63
+ config.fingerprint,
64
+ config.tenancy,
65
+ config.key_file,
66
+ pass_phrase: config.pass_phrase,
67
+ private_key_content: config.key_content
68
+ )
69
+ end
70
+
71
+ @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
72
+ @retry_config = retry_config
73
+
74
+ region ||= config.region
75
+ region ||= signer.region if signer.respond_to?(:region)
76
+ self.region = region
77
+ end
78
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines
79
+
80
+ # Set the region that will be used to determine the service endpoint.
81
+ # This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
82
+ # but may be an arbitrary string.
83
+ def region=(new_region)
84
+ @region = new_region
85
+
86
+ raise 'A region must be specified.' unless @region
87
+
88
+ @endpoint = OCI::Regions.get_service_endpoint(@region, :ResourceSearchClient) + '/20180409'
89
+ logger.info "ResourceSearchClient endpoint set to '#{endpoint}'." if logger
90
+ end
91
+
92
+ # @return [Logger] The logger for this client. May be nil.
93
+ def logger
94
+ @api_client.config.logger
95
+ end
96
+
97
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
98
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
99
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
100
+
101
+
102
+ # Gets detailed information about a resource type by using the resource type name.
103
+ #
104
+ # @param [String] name The name of the resource type.
105
+ # @param [Hash] opts the optional parameters
106
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
107
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
108
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular
109
+ # request, please provide the complete request ID.
110
+ #
111
+ # @return [Response] A Response object with data of type {OCI::ResourceSearch::Models::ResourceType ResourceType}
112
+ def get_resource_type(name, opts = {})
113
+ logger.debug 'Calling operation ResourceSearchClient#get_resource_type.' if logger
114
+
115
+ raise "Missing the required parameter 'name' when calling get_resource_type." if name.nil?
116
+ raise "Parameter value for 'name' must not be blank" if OCI::Internal::Util.blank_string?(name)
117
+
118
+ path = '/resourceTypes/{name}'.sub('{name}', name.to_s)
119
+ operation_signing_strategy = :standard
120
+
121
+ # rubocop:disable Style/NegatedIf
122
+ # Query Params
123
+ query_params = {}
124
+
125
+ # Header Params
126
+ header_params = {}
127
+ header_params['accept'] = 'application/json'
128
+ header_params['content-type'] = 'application/json'
129
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
130
+ # rubocop:enable Style/NegatedIf
131
+
132
+ post_body = nil
133
+
134
+ # rubocop:disable Metrics/BlockLength
135
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ResourceSearchClient#get_resource_type') do
136
+ @api_client.call_api(
137
+ :GET,
138
+ path,
139
+ endpoint,
140
+ header_params: header_params,
141
+ query_params: query_params,
142
+ operation_signing_strategy: operation_signing_strategy,
143
+ body: post_body,
144
+ return_type: 'OCI::ResourceSearch::Models::ResourceType'
145
+ )
146
+ end
147
+ # rubocop:enable Metrics/BlockLength
148
+ end
149
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
150
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
151
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
152
+
153
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
154
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
155
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
156
+
157
+
158
+ # Lists all resource types that you can search or query for.
159
+ #
160
+ # @param [Hash] opts the optional parameters
161
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
162
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
163
+ # @option opts [Integer] :limit The maximum number of items to return. The value must be between 1 and 1000.
164
+ # @option opts [String] :page The page at which to start retrieving results.
165
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular
166
+ # request, please provide the complete request ID.
167
+ #
168
+ # @return [Response] A Response object with data of type Array<{OCI::ResourceSearch::Models::ResourceType ResourceType}>
169
+ def list_resource_types(opts = {})
170
+ logger.debug 'Calling operation ResourceSearchClient#list_resource_types.' if logger
171
+
172
+
173
+ path = '/resourceTypes'
174
+ operation_signing_strategy = :standard
175
+
176
+ # rubocop:disable Style/NegatedIf
177
+ # Query Params
178
+ query_params = {}
179
+ query_params[:limit] = opts[:limit] if opts[:limit]
180
+ query_params[:page] = opts[:page] if opts[:page]
181
+
182
+ # Header Params
183
+ header_params = {}
184
+ header_params['accept'] = 'application/json'
185
+ header_params['content-type'] = 'application/json'
186
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
187
+ # rubocop:enable Style/NegatedIf
188
+
189
+ post_body = nil
190
+
191
+ # rubocop:disable Metrics/BlockLength
192
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ResourceSearchClient#list_resource_types') do
193
+ @api_client.call_api(
194
+ :GET,
195
+ path,
196
+ endpoint,
197
+ header_params: header_params,
198
+ query_params: query_params,
199
+ operation_signing_strategy: operation_signing_strategy,
200
+ body: post_body,
201
+ return_type: 'Array<OCI::ResourceSearch::Models::ResourceType>'
202
+ )
203
+ end
204
+ # rubocop:enable Metrics/BlockLength
205
+ end
206
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
207
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
208
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
209
+
210
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
211
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
212
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
213
+
214
+
215
+ # Queries any and all compartments in the tenancy to find resources that match the specified criteria.
216
+ # Results include resources that you have permission to view and can span different resource types.
217
+ # You can also sort results based on a specified resource attribute.
218
+ #
219
+ # @param [OCI::ResourceSearch::Models::SearchDetails] search_details Request parameters that describe query criteria.
220
+ # @param [Hash] opts the optional parameters
221
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
222
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
223
+ # @option opts [Integer] :limit The maximum number of items to return. The value must be between 1 and 1000.
224
+ # @option opts [String] :page The page at which to start retrieving results.
225
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular
226
+ # request, please provide the complete request ID.
227
+ #
228
+ # @return [Response] A Response object with data of type {OCI::ResourceSearch::Models::ResourceSummaryCollection ResourceSummaryCollection}
229
+ def search_resources(search_details, opts = {})
230
+ logger.debug 'Calling operation ResourceSearchClient#search_resources.' if logger
231
+
232
+ raise "Missing the required parameter 'search_details' when calling search_resources." if search_details.nil?
233
+
234
+ path = '/resources'
235
+ operation_signing_strategy = :standard
236
+
237
+ # rubocop:disable Style/NegatedIf
238
+ # Query Params
239
+ query_params = {}
240
+ query_params[:limit] = opts[:limit] if opts[:limit]
241
+ query_params[:page] = opts[:page] if opts[:page]
242
+
243
+ # Header Params
244
+ header_params = {}
245
+ header_params['accept'] = 'application/json'
246
+ header_params['content-type'] = 'application/json'
247
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
248
+ # rubocop:enable Style/NegatedIf
249
+
250
+ post_body = @api_client.object_to_http_body(search_details)
251
+
252
+ # rubocop:disable Metrics/BlockLength
253
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'ResourceSearchClient#search_resources') do
254
+ @api_client.call_api(
255
+ :POST,
256
+ path,
257
+ endpoint,
258
+ header_params: header_params,
259
+ query_params: query_params,
260
+ operation_signing_strategy: operation_signing_strategy,
261
+ body: post_body,
262
+ return_type: 'OCI::ResourceSearch::Models::ResourceSummaryCollection'
263
+ )
264
+ end
265
+ # rubocop:enable Metrics/BlockLength
266
+ end
267
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
268
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
269
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
270
+
271
+ private
272
+
273
+ def applicable_retry_config(opts = {})
274
+ return @retry_config unless opts.key?(:retry_config)
275
+ opts[:retry_config]
276
+ end
277
+ end
278
+ end
279
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength