oci 2.4.7 → 2.5.0

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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -1
  3. data/lib/oci.rb +1 -0
  4. data/lib/oci/announcements_service/announcement_client.rb +47 -36
  5. data/lib/oci/announcements_service/announcements_service.rb +0 -1
  6. data/lib/oci/announcements_service/models/affected_resource.rb +4 -4
  7. data/lib/oci/announcements_service/models/announcement.rb +10 -14
  8. data/lib/oci/announcements_service/models/announcement_summary.rb +1 -1
  9. data/lib/oci/announcements_service/models/announcement_user_status_details.rb +5 -5
  10. data/lib/oci/announcements_service/models/announcements_collection.rb +3 -3
  11. data/lib/oci/announcements_service/models/base_announcement.rb +28 -18
  12. data/lib/oci/audit/audit_client.rb +17 -10
  13. data/lib/oci/container_engine/container_engine_client.rb +17 -10
  14. data/lib/oci/core/blockstorage_client.rb +17 -10
  15. data/lib/oci/core/compute_client.rb +17 -10
  16. data/lib/oci/core/compute_management_client.rb +17 -10
  17. data/lib/oci/core/models/create_subnet_details.rb +1 -1
  18. data/lib/oci/core/models/subnet.rb +1 -1
  19. data/lib/oci/core/virtual_network_client.rb +17 -10
  20. data/lib/oci/database/database_client.rb +17 -10
  21. data/lib/oci/dns/dns_client.rb +17 -10
  22. data/lib/oci/email/email_client.rb +17 -10
  23. data/lib/oci/file_storage/file_storage_client.rb +17 -10
  24. data/lib/oci/healthchecks/health_checks_client.rb +17 -10
  25. data/lib/oci/identity/identity_client.rb +17 -10
  26. data/lib/oci/key_management/kms_crypto_client.rb +4 -5
  27. data/lib/oci/key_management/kms_management_client.rb +7 -8
  28. data/lib/oci/key_management/kms_vault_client.rb +20 -13
  29. data/lib/oci/key_management/models/create_key_details.rb +34 -1
  30. data/lib/oci/key_management/models/create_vault_details.rb +34 -1
  31. data/lib/oci/key_management/models/key_version.rb +1 -1
  32. data/lib/oci/key_management/models/update_key_details.rb +37 -4
  33. data/lib/oci/key_management/models/update_vault_details.rb +37 -4
  34. data/lib/oci/load_balancer/load_balancer_client.rb +17 -10
  35. data/lib/oci/object_storage/object_storage_client.rb +17 -10
  36. data/lib/oci/regions.rb +20 -4
  37. data/lib/oci/resource_search/resource_search_client.rb +17 -10
  38. data/lib/oci/streaming/models/create_cursor_details.rb +205 -0
  39. data/lib/oci/streaming/models/create_group_cursor_details.rb +237 -0
  40. data/lib/oci/streaming/models/create_stream_details.rb +227 -0
  41. data/lib/oci/streaming/models/cursor.rb +150 -0
  42. data/lib/oci/streaming/models/group.rb +179 -0
  43. data/lib/oci/streaming/models/message.rb +199 -0
  44. data/lib/oci/streaming/models/partition_reservation.rb +192 -0
  45. data/lib/oci/streaming/models/put_messages_details.rb +149 -0
  46. data/lib/oci/{announcements_service/models/notification_followup_details.rb → streaming/models/put_messages_details_entry.rb} +19 -22
  47. data/lib/oci/streaming/models/put_messages_result.rb +165 -0
  48. data/lib/oci/streaming/models/put_messages_result_entry.rb +196 -0
  49. data/lib/oci/streaming/models/stream.rb +319 -0
  50. data/lib/oci/streaming/models/stream_summary.rb +291 -0
  51. data/lib/oci/streaming/models/update_group_details.rb +176 -0
  52. data/lib/oci/streaming/models/update_stream_details.rb +174 -0
  53. data/lib/oci/streaming/stream_admin_client.rb +432 -0
  54. data/lib/oci/streaming/stream_admin_client_composite_operations.rb +143 -0
  55. data/lib/oci/streaming/stream_client.rb +602 -0
  56. data/lib/oci/streaming/stream_client_composite_operations.rb +24 -0
  57. data/lib/oci/streaming/streaming.rb +35 -0
  58. data/lib/oci/streaming/util.rb +2 -0
  59. data/lib/oci/version.rb +1 -1
  60. data/lib/oci/waas/waas_client.rb +17 -10
  61. metadata +51 -3
@@ -0,0 +1,143 @@
1
+ # Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ # rubocop:disable Lint/UnneededCopDisableDirective, Metrics/LineLength
4
+ module OCI
5
+ # This class provides a wrapper around {OCI::Streaming::StreamAdminClient} and offers convenience methods
6
+ # for operations that would otherwise need to be chained together. For example, instead of performing an action
7
+ # on a resource (e.g. launching an instance, creating a load balancer) and then using a waiter to wait for the resource
8
+ # to enter a given state, you can call a single method in this class to accomplish the same functionality
9
+ class Streaming::StreamAdminClientCompositeOperations
10
+ # The {OCI::Streaming::StreamAdminClient} used to communicate with the service_client
11
+ #
12
+ # @return [OCI::Streaming::StreamAdminClient]
13
+ attr_reader :service_client
14
+
15
+ # Initializes a new StreamAdminClientCompositeOperations
16
+ #
17
+ # @param [OCI::Streaming::StreamAdminClient] service_client The client used to communicate with the service.
18
+ # Defaults to a new service client created via {OCI::Streaming::StreamAdminClient#initialize} with no arguments
19
+ def initialize(service_client = OCI::Streaming::StreamAdminClient.new)
20
+ @service_client = service_client
21
+ end
22
+
23
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
24
+ # rubocop:disable Layout/EmptyLines
25
+
26
+
27
+ # Calls {OCI::Streaming::StreamAdminClient#create_stream} and then waits for the {OCI::Streaming::Models::Stream} acted upon
28
+ # to enter the given state(s).
29
+ #
30
+ # @param [OCI::Streaming::Models::CreateStreamDetails] create_stream_details The stream to create.
31
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Streaming::Models::Stream#lifecycle_state}
32
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Streaming::StreamAdminClient#create_stream}
33
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
34
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
35
+ # * max_wait_seconds The maximum time to wait, in seconds
36
+ #
37
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Streaming::Models::Stream}
38
+ def create_stream_and_wait_for_state(create_stream_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
39
+ operation_result = @service_client.create_stream(create_stream_details, base_operation_opts)
40
+
41
+ return operation_result if wait_for_states.empty?
42
+
43
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
44
+ wait_for_resource_id = operation_result.data.id
45
+
46
+ begin
47
+ waiter_result = @service_client.get_stream(wait_for_resource_id).wait_until(
48
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
49
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
50
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
51
+ )
52
+ result_to_return = waiter_result
53
+
54
+ return result_to_return
55
+ rescue StandardError
56
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
57
+ end
58
+ end
59
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
60
+ # rubocop:enable Layout/EmptyLines
61
+
62
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
63
+ # rubocop:disable Layout/EmptyLines
64
+
65
+
66
+ # Calls {OCI::Streaming::StreamAdminClient#delete_stream} and then waits for the {OCI::Streaming::Models::Stream} acted upon
67
+ # to enter the given state(s).
68
+ #
69
+ # @param [String] stream_id The OCID of the stream to delete.
70
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Streaming::Models::Stream#lifecycle_state}
71
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Streaming::StreamAdminClient#delete_stream}
72
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
73
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
74
+ # * max_wait_seconds The maximum time to wait, in seconds
75
+ #
76
+ # @return [OCI::Response] A {OCI::Response} object with data of type nil
77
+ def delete_stream_and_wait_for_state(stream_id, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
78
+ initial_get_result = @service_client.get_stream(stream_id)
79
+ operation_result = @service_client.delete_stream(stream_id, base_operation_opts)
80
+
81
+ return operation_result if wait_for_states.empty?
82
+
83
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
84
+
85
+ begin
86
+ waiter_result = initial_get_result.wait_until(
87
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
88
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
89
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200,
90
+ succeed_on_not_found: true
91
+ )
92
+ result_to_return = waiter_result
93
+
94
+ return result_to_return
95
+ rescue StandardError
96
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
97
+ end
98
+ end
99
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
100
+ # rubocop:enable Layout/EmptyLines
101
+
102
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
103
+ # rubocop:disable Layout/EmptyLines
104
+
105
+
106
+ # Calls {OCI::Streaming::StreamAdminClient#update_stream} and then waits for the {OCI::Streaming::Models::Stream} acted upon
107
+ # to enter the given state(s).
108
+ #
109
+ # @param [String] stream_id The OCID of the stream to update.
110
+ # @param [OCI::Streaming::Models::UpdateStreamDetails] update_stream_details The stream is updated with the tags provided.
111
+ # @param [Array<String>] wait_for_states An array of states to wait on. These should be valid values for {OCI::Streaming::Models::Stream#lifecycle_state}
112
+ # @param [Hash] base_operation_opts Any optional arguments accepted by {OCI::Streaming::StreamAdminClient#update_stream}
113
+ # @param [Hash] waiter_opts Optional arguments for the waiter. Keys should be symbols, and the following keys are supported:
114
+ # * max_interval_seconds: The maximum interval between queries, in seconds.
115
+ # * max_wait_seconds The maximum time to wait, in seconds
116
+ #
117
+ # @return [OCI::Response] A {OCI::Response} object with data of type {OCI::Streaming::Models::Stream}
118
+ def update_stream_and_wait_for_state(stream_id, update_stream_details, wait_for_states = [], base_operation_opts = {}, waiter_opts = {})
119
+ operation_result = @service_client.update_stream(stream_id, update_stream_details, base_operation_opts)
120
+
121
+ return operation_result if wait_for_states.empty?
122
+
123
+ lowered_wait_for_states = wait_for_states.map(&:downcase)
124
+ wait_for_resource_id = operation_result.data.id
125
+
126
+ begin
127
+ waiter_result = @service_client.get_stream(wait_for_resource_id).wait_until(
128
+ eval_proc: ->(response) { response.data.respond_to?(:lifecycle_state) && lowered_wait_for_states.include?(response.data.lifecycle_state.downcase) },
129
+ max_interval_seconds: waiter_opts.key?(:max_interval_seconds) ? waiter_opts[:max_interval_seconds] : 30,
130
+ max_wait_seconds: waiter_opts.key?(:max_wait_seconds) ? waiter_opts[:max_wait_seconds] : 1200
131
+ )
132
+ result_to_return = waiter_result
133
+
134
+ return result_to_return
135
+ rescue StandardError
136
+ raise OCI::Errors::CompositeOperationError.new(partial_results: [operation_result])
137
+ end
138
+ end
139
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/ParameterLists, Metrics/PerceivedComplexity
140
+ # rubocop:enable Layout/EmptyLines
141
+ end
142
+ end
143
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength
@@ -0,0 +1,602 @@
1
+ # Copyright (c) 2016, 2019, 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
+ # The API for the Streaming Service.
9
+ class Streaming::StreamClient
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, Metrics/PerceivedComplexity
29
+
30
+
31
+ # Creates a new StreamClient.
32
+ # Notes:
33
+ # If a config is not specified, then the global OCI.config will be used.
34
+ #
35
+ # This client is not thread-safe
36
+ #
37
+ # Either a region or an endpoint must be specified. If an endpoint is specified, it will be used instead of the
38
+ # region. A region may be specified in the config or via or the region parameter. If specified in both, then the
39
+ # region parameter will be used.
40
+ # @param [Config] config A Config object.
41
+ # @param [String] region A region used to determine the service endpoint. This will usually
42
+ # correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
43
+ # @param [String] endpoint The fully qualified endpoint URL
44
+ # @param [OCI::BaseSigner] signer A signer implementation which can be used by this client. If this is not provided then
45
+ # a signer will be constructed via the provided config. One use case of this parameter is instance principals authentication,
46
+ # so that the instance principals signer can be provided to the client
47
+ # @param [OCI::ApiClientProxySettings] proxy_settings If your environment requires you to use a proxy server for outgoing HTTP requests
48
+ # the details for the proxy can be provided in this parameter
49
+ # @param [OCI::Retry::RetryConfig] retry_config The retry configuration for this service client. This represents the default retry configuration to
50
+ # 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
51
+ # will not perform any retries
52
+ def initialize(config: nil, region: nil, endpoint: nil, signer: nil, proxy_settings: nil, retry_config: nil)
53
+ # If the signer is an InstancePrincipalsSecurityTokenSigner and no config was supplied (which is valid for instance principals)
54
+ # then create a dummy config to pass to the ApiClient constructor. If customers wish to create a client which uses instance principals
55
+ # and has config (either populated programmatically or loaded from a file), they must construct that config themselves and then
56
+ # pass it to this constructor.
57
+ #
58
+ # If there is no signer (or the signer is not an instance principals signer) and no config was supplied, this is not valid
59
+ # so try and load the config from the default file.
60
+ config ||= OCI.config unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
61
+ config ||= OCI::Config.new if signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
62
+ config.validate unless signer.is_a?(OCI::Auth::Signers::InstancePrincipalsSecurityTokenSigner)
63
+
64
+ if signer.nil?
65
+ signer = OCI::Signer.new(
66
+ config.user,
67
+ config.fingerprint,
68
+ config.tenancy,
69
+ config.key_file,
70
+ pass_phrase: config.pass_phrase,
71
+ private_key_content: config.key_content
72
+ )
73
+ end
74
+
75
+ @api_client = OCI::ApiClient.new(config, signer, proxy_settings: proxy_settings)
76
+ @retry_config = retry_config
77
+
78
+ if endpoint
79
+ @endpoint = endpoint + '/20180418'
80
+ else
81
+ region ||= config.region
82
+ region ||= signer.region if signer.respond_to?(:region)
83
+ self.region = region
84
+ end
85
+ logger.info "StreamClient endpoint set to '#{@endpoint}'." if logger
86
+ end
87
+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Layout/EmptyLines, Metrics/PerceivedComplexity
88
+
89
+ # Set the region that will be used to determine the service endpoint.
90
+ # This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
91
+ # but may be an arbitrary string.
92
+ def region=(new_region)
93
+ @region = new_region
94
+
95
+ raise 'A region must be specified.' unless @region
96
+
97
+ @endpoint = OCI::Regions.get_service_endpoint_for_template(@region, 'https://streams.{region}.streaming.oci.{secondLevelDomain}') + '/20180418'
98
+ logger.info "StreamClient endpoint set to '#{@endpoint} from region #{@region}'." if logger
99
+ end
100
+
101
+ # @return [Logger] The logger for this client. May be nil.
102
+ def logger
103
+ @api_client.config.logger
104
+ end
105
+
106
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
107
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
108
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
109
+
110
+
111
+ # Provides a mechanism to manually commit offsets, if not using commit-on-get consumer semantics.
112
+ # This commits offsets assicated with the provided cursor, extends the timeout on each of the affected partitions, and returns an updated cursor.
113
+ #
114
+ # @param [String] stream_id The OCID of the stream for which the group is committing offsets.
115
+ # @param [String] cursor The group-cursor representing the offsets of the group. This cursor is retrieved from the CreateGroupCursor API call.
116
+ #
117
+ # @param [Hash] opts the optional parameters
118
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
119
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
120
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
121
+ # particular request, please provide the request ID.
122
+ #
123
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::Cursor Cursor}
124
+ def consumer_commit(stream_id, cursor, opts = {})
125
+ logger.debug 'Calling operation StreamClient#consumer_commit.' if logger
126
+
127
+ raise "Missing the required parameter 'stream_id' when calling consumer_commit." if stream_id.nil?
128
+ raise "Missing the required parameter 'cursor' when calling consumer_commit." if cursor.nil?
129
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
130
+
131
+ path = '/streams/{streamId}/commit'.sub('{streamId}', stream_id.to_s)
132
+ operation_signing_strategy = :standard
133
+
134
+ # rubocop:disable Style/NegatedIf
135
+ # Query Params
136
+ query_params = {}
137
+ query_params[:cursor] = cursor
138
+
139
+ # Header Params
140
+ header_params = {}
141
+ header_params[:accept] = 'application/json'
142
+ header_params[:'content-type'] = 'application/json'
143
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
144
+ # rubocop:enable Style/NegatedIf
145
+
146
+ post_body = nil
147
+
148
+ # rubocop:disable Metrics/BlockLength
149
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#consumer_commit') do
150
+ @api_client.call_api(
151
+ :POST,
152
+ path,
153
+ endpoint,
154
+ header_params: header_params,
155
+ query_params: query_params,
156
+ operation_signing_strategy: operation_signing_strategy,
157
+ body: post_body,
158
+ return_type: 'OCI::Streaming::Models::Cursor'
159
+ )
160
+ end
161
+ # rubocop:enable Metrics/BlockLength
162
+ end
163
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
164
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
165
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
166
+
167
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
168
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
169
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
170
+
171
+
172
+ # Allows long-running processes to extend the timeout on partitions reserved by a consumer instance.
173
+ #
174
+ # @param [String] stream_id The OCID of the stream for which the group is committing offsets.
175
+ # @param [String] cursor The group-cursor representing the offsets of the group. This cursor is retrieved from the CreateGroupCursor API call.
176
+ #
177
+ # @param [Hash] opts the optional parameters
178
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
179
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
180
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
181
+ # particular request, please provide the request ID.
182
+ #
183
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::Cursor Cursor}
184
+ def consumer_heartbeat(stream_id, cursor, opts = {})
185
+ logger.debug 'Calling operation StreamClient#consumer_heartbeat.' if logger
186
+
187
+ raise "Missing the required parameter 'stream_id' when calling consumer_heartbeat." if stream_id.nil?
188
+ raise "Missing the required parameter 'cursor' when calling consumer_heartbeat." if cursor.nil?
189
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
190
+
191
+ path = '/streams/{streamId}/heartbeat'.sub('{streamId}', stream_id.to_s)
192
+ operation_signing_strategy = :standard
193
+
194
+ # rubocop:disable Style/NegatedIf
195
+ # Query Params
196
+ query_params = {}
197
+ query_params[:cursor] = cursor
198
+
199
+ # Header Params
200
+ header_params = {}
201
+ header_params[:accept] = 'application/json'
202
+ header_params[:'content-type'] = 'application/json'
203
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
204
+ # rubocop:enable Style/NegatedIf
205
+
206
+ post_body = nil
207
+
208
+ # rubocop:disable Metrics/BlockLength
209
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#consumer_heartbeat') do
210
+ @api_client.call_api(
211
+ :POST,
212
+ path,
213
+ endpoint,
214
+ header_params: header_params,
215
+ query_params: query_params,
216
+ operation_signing_strategy: operation_signing_strategy,
217
+ body: post_body,
218
+ return_type: 'OCI::Streaming::Models::Cursor'
219
+ )
220
+ end
221
+ # rubocop:enable Metrics/BlockLength
222
+ end
223
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
224
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
225
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
226
+
227
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
228
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
229
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
230
+
231
+
232
+ # Creates a cursor. Cursors are used to consume a stream, starting from a specific point in the partition and going forward from there.
233
+ # You can create a cursor based on an offset, a time, the trim horizon, or the most recent message in the stream. As the oldest message
234
+ # inside the retention period boundary, using the trim horizon effectively lets you consume all messages in the stream. A cursor based
235
+ # on the most recent message allows consumption of only messages that are added to the stream after you create the cursor. Cursors expire
236
+ # five minutes after you receive them from the service.
237
+ #
238
+ # @param [String] stream_id The OCID of the stream to create a cursor for.
239
+ # @param [OCI::Streaming::Models::CreateCursorDetails] create_cursor_details The information used to create the cursor.
240
+ # @param [Hash] opts the optional parameters
241
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
242
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
243
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
244
+ # particular request, please provide the request ID.
245
+ #
246
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::Cursor Cursor}
247
+ def create_cursor(stream_id, create_cursor_details, opts = {})
248
+ logger.debug 'Calling operation StreamClient#create_cursor.' if logger
249
+
250
+ raise "Missing the required parameter 'stream_id' when calling create_cursor." if stream_id.nil?
251
+ raise "Missing the required parameter 'create_cursor_details' when calling create_cursor." if create_cursor_details.nil?
252
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
253
+
254
+ path = '/streams/{streamId}/cursors'.sub('{streamId}', stream_id.to_s)
255
+ operation_signing_strategy = :standard
256
+
257
+ # rubocop:disable Style/NegatedIf
258
+ # Query Params
259
+ query_params = {}
260
+
261
+ # Header Params
262
+ header_params = {}
263
+ header_params[:accept] = 'application/json'
264
+ header_params[:'content-type'] = 'application/json'
265
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
266
+ # rubocop:enable Style/NegatedIf
267
+
268
+ post_body = @api_client.object_to_http_body(create_cursor_details)
269
+
270
+ # rubocop:disable Metrics/BlockLength
271
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#create_cursor') do
272
+ @api_client.call_api(
273
+ :POST,
274
+ path,
275
+ endpoint,
276
+ header_params: header_params,
277
+ query_params: query_params,
278
+ operation_signing_strategy: operation_signing_strategy,
279
+ body: post_body,
280
+ return_type: 'OCI::Streaming::Models::Cursor'
281
+ )
282
+ end
283
+ # rubocop:enable Metrics/BlockLength
284
+ end
285
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
286
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
287
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
288
+
289
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
290
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
291
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
292
+
293
+
294
+ # Creates a group-cursor.
295
+ #
296
+ # @param [String] stream_id The OCID of the stream to create a cursor for.
297
+ # @param [OCI::Streaming::Models::CreateGroupCursorDetails] create_group_cursor_details The information used to create the cursor.
298
+ # @param [Hash] opts the optional parameters
299
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
300
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
301
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
302
+ # particular request, please provide the request ID.
303
+ #
304
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::Cursor Cursor}
305
+ def create_group_cursor(stream_id, create_group_cursor_details, opts = {})
306
+ logger.debug 'Calling operation StreamClient#create_group_cursor.' if logger
307
+
308
+ raise "Missing the required parameter 'stream_id' when calling create_group_cursor." if stream_id.nil?
309
+ raise "Missing the required parameter 'create_group_cursor_details' when calling create_group_cursor." if create_group_cursor_details.nil?
310
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
311
+
312
+ path = '/streams/{streamId}/groupCursors'.sub('{streamId}', stream_id.to_s)
313
+ operation_signing_strategy = :standard
314
+
315
+ # rubocop:disable Style/NegatedIf
316
+ # Query Params
317
+ query_params = {}
318
+
319
+ # Header Params
320
+ header_params = {}
321
+ header_params[:accept] = 'application/json'
322
+ header_params[:'content-type'] = 'application/json'
323
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
324
+ # rubocop:enable Style/NegatedIf
325
+
326
+ post_body = @api_client.object_to_http_body(create_group_cursor_details)
327
+
328
+ # rubocop:disable Metrics/BlockLength
329
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#create_group_cursor') do
330
+ @api_client.call_api(
331
+ :POST,
332
+ path,
333
+ endpoint,
334
+ header_params: header_params,
335
+ query_params: query_params,
336
+ operation_signing_strategy: operation_signing_strategy,
337
+ body: post_body,
338
+ return_type: 'OCI::Streaming::Models::Cursor'
339
+ )
340
+ end
341
+ # rubocop:enable Metrics/BlockLength
342
+ end
343
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
344
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
345
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
346
+
347
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
348
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
349
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
350
+
351
+
352
+ # Returns the current state of a consumer group.
353
+ #
354
+ # @param [String] stream_id The OCID of the stream, on which the group is operating.
355
+ # @param [String] group_name The name of the consumer group.
356
+ # @param [Hash] opts the optional parameters
357
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
358
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
359
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
360
+ # particular request, please provide the request ID.
361
+ #
362
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::Group Group}
363
+ def get_group(stream_id, group_name, opts = {})
364
+ logger.debug 'Calling operation StreamClient#get_group.' if logger
365
+
366
+ raise "Missing the required parameter 'stream_id' when calling get_group." if stream_id.nil?
367
+ raise "Missing the required parameter 'group_name' when calling get_group." if group_name.nil?
368
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
369
+ raise "Parameter value for 'group_name' must not be blank" if OCI::Internal::Util.blank_string?(group_name)
370
+
371
+ path = '/streams/{streamId}/groups/{groupName}'.sub('{streamId}', stream_id.to_s).sub('{groupName}', group_name.to_s)
372
+ operation_signing_strategy = :standard
373
+
374
+ # rubocop:disable Style/NegatedIf
375
+ # Query Params
376
+ query_params = {}
377
+
378
+ # Header Params
379
+ header_params = {}
380
+ header_params[:accept] = 'application/json'
381
+ header_params[:'content-type'] = 'application/json'
382
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
383
+ # rubocop:enable Style/NegatedIf
384
+
385
+ post_body = nil
386
+
387
+ # rubocop:disable Metrics/BlockLength
388
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#get_group') do
389
+ @api_client.call_api(
390
+ :GET,
391
+ path,
392
+ endpoint,
393
+ header_params: header_params,
394
+ query_params: query_params,
395
+ operation_signing_strategy: operation_signing_strategy,
396
+ body: post_body,
397
+ return_type: 'OCI::Streaming::Models::Group'
398
+ )
399
+ end
400
+ # rubocop:enable Metrics/BlockLength
401
+ end
402
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
403
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
404
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
405
+
406
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
407
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
408
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
409
+
410
+
411
+ # Returns messages from the specified stream using the specified cursor as the starting point for consumption. By default, the number of messages returned is undefined, but the service returns as many as possible.
412
+ # To get messages, you must first obtain a cursor using the {#create_cursor create_cursor} operation.
413
+ # In the response, retrieve the value of the 'opc-next-cursor' header to pass as a parameter to get the next batch of messages in the stream.
414
+ #
415
+ # @param [String] stream_id The OCID of the stream to get messages from.
416
+ # @param [String] cursor The cursor used to consume the stream.
417
+ #
418
+ # @param [Hash] opts the optional parameters
419
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
420
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
421
+ # @option opts [Integer] :limit The maximum number of messages to return. You can specify any value up to 10000. By default, the service returns as many messages as possible.
422
+ # Consider your average message size to help avoid exceeding throughput on the stream.
423
+ #
424
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
425
+ # particular request, please provide the request ID.
426
+ #
427
+ # @return [Response] A Response object with data of type Array<{OCI::Streaming::Models::Message Message}>
428
+ def get_messages(stream_id, cursor, opts = {})
429
+ logger.debug 'Calling operation StreamClient#get_messages.' if logger
430
+
431
+ raise "Missing the required parameter 'stream_id' when calling get_messages." if stream_id.nil?
432
+ raise "Missing the required parameter 'cursor' when calling get_messages." if cursor.nil?
433
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
434
+
435
+ path = '/streams/{streamId}/messages'.sub('{streamId}', stream_id.to_s)
436
+ operation_signing_strategy = :standard
437
+
438
+ # rubocop:disable Style/NegatedIf
439
+ # Query Params
440
+ query_params = {}
441
+ query_params[:cursor] = cursor
442
+ query_params[:limit] = opts[:limit] if opts[:limit]
443
+
444
+ # Header Params
445
+ header_params = {}
446
+ header_params[:accept] = 'application/json'
447
+ header_params[:'content-type'] = 'application/json'
448
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
449
+ # rubocop:enable Style/NegatedIf
450
+
451
+ post_body = nil
452
+
453
+ # rubocop:disable Metrics/BlockLength
454
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#get_messages') do
455
+ @api_client.call_api(
456
+ :GET,
457
+ path,
458
+ endpoint,
459
+ header_params: header_params,
460
+ query_params: query_params,
461
+ operation_signing_strategy: operation_signing_strategy,
462
+ body: post_body,
463
+ return_type: 'Array<OCI::Streaming::Models::Message>'
464
+ )
465
+ end
466
+ # rubocop:enable Metrics/BlockLength
467
+ end
468
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
469
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
470
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
471
+
472
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
473
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
474
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
475
+
476
+
477
+ # Emits messages to a stream. There's no limit to the number of messages in a request, but the total size of a message or request must be 1 MiB or less.
478
+ # The service calculates the partition ID from the message key and stores messages that share a key on the same partition.
479
+ # If a message does not contain a key or if the key is null, the service generates a message key for you.
480
+ # The partition ID cannot be passed as a parameter.
481
+ #
482
+ # @param [String] stream_id The OCID of the stream where you want to put messages.
483
+ # @param [OCI::Streaming::Models::PutMessagesDetails] put_messages_details Array of messages to put into the stream.
484
+ # @param [Hash] opts the optional parameters
485
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
486
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
487
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
488
+ # particular request, please provide the request ID.
489
+ #
490
+ # @return [Response] A Response object with data of type {OCI::Streaming::Models::PutMessagesResult PutMessagesResult}
491
+ def put_messages(stream_id, put_messages_details, opts = {})
492
+ logger.debug 'Calling operation StreamClient#put_messages.' if logger
493
+
494
+ raise "Missing the required parameter 'stream_id' when calling put_messages." if stream_id.nil?
495
+ raise "Missing the required parameter 'put_messages_details' when calling put_messages." if put_messages_details.nil?
496
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
497
+
498
+ path = '/streams/{streamId}/messages'.sub('{streamId}', stream_id.to_s)
499
+ operation_signing_strategy = :exclude_body
500
+
501
+ # rubocop:disable Style/NegatedIf
502
+ # Query Params
503
+ query_params = {}
504
+
505
+ # Header Params
506
+ header_params = {}
507
+ header_params[:accept] = 'application/json'
508
+ header_params[:'content-type'] = 'application/json'
509
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
510
+ # rubocop:enable Style/NegatedIf
511
+
512
+ post_body = @api_client.object_to_http_body(put_messages_details)
513
+
514
+ # rubocop:disable Metrics/BlockLength
515
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#put_messages') do
516
+ @api_client.call_api(
517
+ :POST,
518
+ path,
519
+ endpoint,
520
+ header_params: header_params,
521
+ query_params: query_params,
522
+ operation_signing_strategy: operation_signing_strategy,
523
+ body: post_body,
524
+ return_type: 'OCI::Streaming::Models::PutMessagesResult'
525
+ )
526
+ end
527
+ # rubocop:enable Metrics/BlockLength
528
+ end
529
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
530
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
531
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
532
+
533
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
534
+ # rubocop:disable Style/IfUnlessModifier, Metrics/ParameterLists
535
+ # rubocop:disable Metrics/MethodLength, Layout/EmptyLines
536
+
537
+
538
+ # Forcefully changes the current location of a group as a whole; reseting processing location of all consumers to a particular location in the stream.
539
+ #
540
+ # @param [String] stream_id The OCID of the stream, on which the group is operating.
541
+ # @param [String] group_name The name of the consumer group.
542
+ # @param [OCI::Streaming::Models::UpdateGroupDetails] update_group_details The information used to modify the group.
543
+ # @param [Hash] opts the optional parameters
544
+ # @option opts [OCI::Retry::RetryConfig] :retry_config The retry configuration to apply to this operation. If no key is provided then the service-level
545
+ # retry configuration defined by {#retry_config} will be used. If an explicit `nil` value is provided then the operation will not retry
546
+ # @option opts [String] :opc_request_id The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a
547
+ # particular request, please provide the request ID.
548
+ #
549
+ # @return [Response] A Response object with data of type nil
550
+ def update_group(stream_id, group_name, update_group_details, opts = {})
551
+ logger.debug 'Calling operation StreamClient#update_group.' if logger
552
+
553
+ raise "Missing the required parameter 'stream_id' when calling update_group." if stream_id.nil?
554
+ raise "Missing the required parameter 'group_name' when calling update_group." if group_name.nil?
555
+ raise "Missing the required parameter 'update_group_details' when calling update_group." if update_group_details.nil?
556
+ raise "Parameter value for 'stream_id' must not be blank" if OCI::Internal::Util.blank_string?(stream_id)
557
+ raise "Parameter value for 'group_name' must not be blank" if OCI::Internal::Util.blank_string?(group_name)
558
+
559
+ path = '/streams/{streamId}/groups/{groupName}'.sub('{streamId}', stream_id.to_s).sub('{groupName}', group_name.to_s)
560
+ operation_signing_strategy = :standard
561
+
562
+ # rubocop:disable Style/NegatedIf
563
+ # Query Params
564
+ query_params = {}
565
+
566
+ # Header Params
567
+ header_params = {}
568
+ header_params[:accept] = 'application/json'
569
+ header_params[:'content-type'] = 'application/json'
570
+ header_params[:'opc-request-id'] = opts[:opc_request_id] if opts[:opc_request_id]
571
+ # rubocop:enable Style/NegatedIf
572
+
573
+ post_body = @api_client.object_to_http_body(update_group_details)
574
+
575
+ # rubocop:disable Metrics/BlockLength
576
+ OCI::Retry.make_retrying_call(applicable_retry_config(opts), call_name: 'StreamClient#update_group') do
577
+ @api_client.call_api(
578
+ :PUT,
579
+ path,
580
+ endpoint,
581
+ header_params: header_params,
582
+ query_params: query_params,
583
+ operation_signing_strategy: operation_signing_strategy,
584
+ body: post_body
585
+ )
586
+ end
587
+ # rubocop:enable Metrics/BlockLength
588
+ end
589
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
590
+ # rubocop:enable Style/IfUnlessModifier, Metrics/ParameterLists
591
+ # rubocop:enable Metrics/MethodLength, Layout/EmptyLines
592
+
593
+ private
594
+
595
+ def applicable_retry_config(opts = {})
596
+ return @retry_config unless opts.key?(:retry_config)
597
+
598
+ opts[:retry_config]
599
+ end
600
+ end
601
+ end
602
+ # rubocop:enable Lint/UnneededCopDisableDirective, Metrics/LineLength