oraclebmc 2.0.9 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README_BMCS.md +181 -13
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0990773c9d867e8c1df64cefaa1388c9312938be
4
- data.tar.gz: 53b013100afd6cb2c624db07e1a4bb1a0409f5ca
3
+ metadata.gz: b6aacb7956a1f987ff343b6806bde5538dd771a8
4
+ data.tar.gz: ebdf8ccf94e16332622d7937f465fdad9c486e62
5
5
  SHA512:
6
- metadata.gz: 7973bb66cb99924dd867c0d10735026927028244fd16080da3c63b8d270f0c59e58a41979227fe781bae0774190760b892f167b610f170088b319590c6095f4d
7
- data.tar.gz: 776201b2b5947e6973c97a8c2eca62da1d8cd89e0f389d0bb6f4882e4c38952474d585cd9d74768f9011d6345dd1e2b786ddb21cc5551b09834f51df6475352a
6
+ metadata.gz: db2e8a5b4414352d268ca630754908ab44a7e738edb94160bef4f7f15f9bfbdd1a7bc99ae0e44c9cea8807d9887863f54898cb444c79dac9d765554d818a0756
7
+ data.tar.gz: f59e6d888b1c8b735db7141218038376d5fbba1155d529484155d6ceb5d99d7f2292764561ed7fe81f37f6e0aa5be33522e887823638cb3ddeef494da10305f1
@@ -1,5 +1,5 @@
1
1
  # Oracle Cloud Infrastructure Ruby SDK
2
- **Version 2.0.9**
2
+ **Version 2.1.0**
3
3
 
4
4
  This topic describes how to install, configure, and use the Oracle Cloud Infrastructure Ruby SDK.
5
5
 
@@ -41,7 +41,24 @@ The following table provides details about some of the attributes of the SDK.
41
41
  </tr>
42
42
  <tr>
43
43
  <td>Errors</td>
44
- <td>Unsuccessful requests will always raise an exception. {OracleBMC::Errors::ServiceError ServiceError} is raised when the service returns an error, and {OracleBMC::Errors::NetworkError NetworkError} is raised for network issues (such as failed host resolution).</td>
44
+ <td>
45
+ The main exception classes for the SDK are:
46
+ <ul>
47
+ <li>{OracleBMC::Errors::ServiceError ServiceError} is thrown when an OCI service returns a non-2xx HTTP status code</li>
48
+ <li>
49
+ {OracleBMC::Errors::NetworkError NetworkError} is thrown when the issue is likely to be network-related rather than an application issue. This is defined as:
50
+ <ul>
51
+ <li>
52
+ Requests that were sent from the SDK, but for which the outcome was not a response from an OCI service. Examples include a gateway timeout, read or connection timeouts from Net::HTTP, and any (Errno) exception that was generated by the request itself.
53
+ </li>
54
+ <li>Requests that result in a HTTP 408 (timeout)</li>
55
+ </ul>
56
+ </li>
57
+ <li>
58
+ {OracleBMC::Errors::ResponseParsingError ResponseParsingError} is thrown when a response is received from an OCI service, but the SDK could not parse it into the appropriate model type for inserting into an {OracleBMC::Response}
59
+ </li>
60
+ </ul>
61
+ </td>
45
62
  </tr>
46
63
  <tr>
47
64
  <td>Signing</td>
@@ -57,8 +74,7 @@ The following table provides details about some of the attributes of the SDK.
57
74
  </tr>
58
75
  <tr>
59
76
  <td>HTTP Client</td>
60
- <td>The Ruby SDK uses Net::HTTP for HTTP requests, if needed, options may be passed to each Net::HTTP by specifying them in {OracleBMC::ApiClient#request_option_overrides ApiClient.request_option_overrides}.</br>
61
- Please check http://ruby-doc.org/stdlib-2.4.1/libdoc/net/http/rdoc/Net/HTTP.html#method-c-start for the supported options.</td>
77
+ <td>The Ruby SDK uses Net::HTTP for HTTP requests. Information on how to configure the client, including configuring a proxy, can be found in the <b>Configuring the HTTP Client</b> section of this page</td>
62
78
  </tr>
63
79
  <tr>
64
80
  <td>Instance Principals Authentication</td>
@@ -71,7 +87,7 @@ The following table provides details about some of the attributes of the SDK.
71
87
  <td>
72
88
  The Object Storage service supports multipart uploads to make large object uploads easier by splitting the large object into parts. The Ruby SDK supports raw multipart upload operations for advanced use cases, as well as a higher-level upload class that uses the multipart upload APIs.
73
89
  <p>
74
- <a href="https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingmultipartuploads.htm">Managing Multipart Uploads</a> provides links to the APIs used for raw multipart upload operations. Higher-level uploads can be performed using the {OracleBMC::ObjectStorage::Transfer::UploadManager}.
90
+ <a href="https://docs.us-phoenix-1.oraclecloud.com/Content/Object/Tasks/managingmultipartuploads.htm">Managing Multipart Uploads</a> provides links to the APIs used for raw multipart upload operations. Higher-level uploads can be performed using the {OracleBMC::ObjectStorage::Transfer::UploadManager}.
75
91
  </p>
76
92
  <p>
77
93
  The UploadManager simplifies interaction with the Object Storage service by abstracting away the method used to upload objects and can handle uploading an entire object at once, or in multiple parts if it is of sufficient size (which is configurable via a {OracleBMC::ObjectStorage::Transfer::UploadManagerConfig} object). In the latter case, the UploadManager will split a large object into parts for you, upload the parts in parallel, and then recombine and commit the parts as a single object in Object Storage.
@@ -104,11 +120,11 @@ To use the Ruby SDK, you must have:
104
120
 
105
121
  ### Troubleshooting an Installation
106
122
  If you see "Unable to resolve dependencies”, you can install the dependencies manually:
107
-
123
+
108
124
  gem install inifile
109
125
 
110
126
  ## SDK modules and namespacing
111
- The top level module name for the Ruby SDK is `OCI`, however using `OracleBMC` as the top level namespace is also supported. For example, you can reference the configuration object as both `OCI::Config` and `OracleBMC::Config`.
127
+ The top level module name for the Ruby SDK is `OCI`, however using `OracleBMC` as the top level namespace is also supported. For example, you can reference the configuration object as both `OCI::Config` and `OracleBMC::Config`.
112
128
 
113
129
  Using `OCI` as the top level module name is preferred and it is also used in the SDK API Reference. Additionally, if you inspect the type of an SDK object it will always be reported as being under the `OCI::` module.
114
130
 
@@ -121,7 +137,7 @@ To use any of the APIs, you must supply a {OracleBMC::Config Config} object. You
121
137
 
122
138
  ## Forward Compatibility
123
139
 
124
- Some response fields are enum-typed. In the future, individual services may return values not covered by existing enums for that field. To address this possibility, every enum-type response field has an additional value named "UNKNOWN_ENUM_VALUE". If a service returns a value that is not recognized by your version of the SDK, then the response field will be set to this value. Please ensure that your code handles the "UNKNOWN_ENUM_VALUE" case if you have conditional logic based on an enum-typed field.
140
+ Some response fields are enum-typed. In the future, individual services may return values not covered by existing enums for that field. To address this possibility, every enum-type response field has an additional value named "UNKNOWN_ENUM_VALUE". If a service returns a value that is not recognized by your version of the SDK, then the response field will be set to this value. Please ensure that your code handles the "UNKNOWN_ENUM_VALUE" case if you have conditional logic based on an enum-typed field.
125
141
 
126
142
  ## Writing Your First Ruby Program with the SDK
127
143
 
@@ -149,9 +165,164 @@ Or you can create a {OracleBMC::Config Config} programmatically. Note that the g
149
165
 
150
166
  The default config file location is `~/.oci/config` (on Windows `C:\Users\{user}\.oci\config`).
151
167
 
152
- ## Service Errors
168
+ ## Configuring the HTTP Client
169
+
170
+ The underlying HTTP client used by the SDK can be configured by setting the {OracleBMC::ApiClient#request_option_overrides ApiClient.request_option_overrides} on the client. An example on how to do this, showing all supported options, is:
171
+
172
+ require 'oci'
173
+
174
+ identity = OracleBMC::Identity::IdentityService.new
175
+
176
+ identity.api_client.request_option_overrides = {
177
+ # The path to the PEM-formatted CA certificate file.
178
+ # The file can contain several CA certificates
179
+ ca_file: '/path/to/pem/file',
180
+
181
+ # The path to a directory of PEM-formatted CA certificate files
182
+ ca_path_cert: '/path/to/cert/directory',
183
+
184
+ # An OpenSSL::X509::Certificate object as client certificate
185
+ cert: OpenSSL::X509::Certificate.new(...),
186
+
187
+ # The X509::Store to verify peer certificate.
188
+ cert_store: OpenSSL::X509::Store.new(...),
189
+
190
+ # One of the available ciphers from OpenSSL::SSL::SSLContext#ciphers
191
+ ciphers: ...,
192
+
193
+ close_on_empty_response: true,
194
+
195
+ # An OpenSSL::PKey::RSA or OpenSSL::PKey::DSA object
196
+ key: ...,
197
+
198
+ # The SSL timeout in seconds
199
+ ssl_timeout: 60,
200
+
201
+ # The SSL version to use. See OpenSSL::SSL::SSLContext#ssl_version
202
+ ssl_version: ...,
203
+
204
+ # The verify callback for the server certification verification
205
+ verify_callback: ...,
206
+
207
+ # The maximum depth for the certificate chain verification
208
+ verify_depth: 3,
209
+
210
+ # Either OpenSSL::SSL::VERIFY_PEER or OpenSSL::SSL::VERIFY_NONE
211
+ # Using OpenSSL::SSL::VERIFY_NONE (i.e. not validating the SSL certificate) is not
212
+ # recommended
213
+ verify_mode: OpenSSL::SSL::VERIFY_PEER
214
+ }
215
+
216
+ Note that these correspond to a subset of the keys that can be provided as `opts` to the `Net::HTTP` [start](https://ruby-doc.org/stdlib-2.4.3/libdoc/net/http/rdoc/Net/HTTP.html#method-c-start) method.
217
+
218
+ ### Setting a proxy
219
+ If the SDK is running in an environment which requires the use of a proxy server for outgoing HTTP requests, this can be configured by providing via:
220
+
221
+ * Providing an environment variable; or
222
+ * Providing an {OracleBMC::ApiClientProxySettings} object. Here is an example of the different ways to create this object:
223
+
224
+ #### Proxy via environment variable
225
+ As the the SDK uses `Net::HTTP`, the `http_proxy` environment variable can be used to specify a proxy:
226
+
227
+ export HTTP_PROXY="http://10.10.1.10:3128"
228
+
229
+ When using the environment variable approach, no code changes need to be made.
230
+
231
+ Note that this does not support providing a username and password to the proxy, *except* when using Ruby 2.5+ on Linux, FreeBSD or macOS (Darwin). Otherwise, if a username and password is required then the {OracleBMC::ApiClientProxySettings} object method can be used.
232
+
233
+ #### Proxy via the ApiClientProxySettings object
234
+ An {OracleBMC::ApiClientProxySettings} object can be used to capture proxy settings. Here are the different ways an object can be created:
235
+
236
+
237
+ # This creates an ApiClientProxySettings with a nil proxy address and will make the API client
238
+ # bypass all proxies
239
+ proxy_settings = OracleBMC::ApiClientProxySettings.new(nil)
240
+
241
+ # This creates an ApiClientProxySettings that will use the proxy at 10.10.1.10:3128 and will
242
+ # not provide a username and password to the proxy
243
+ proxy_settings = OracleBMC::ApiClientProxySettings.new("10.10.1.10", 3128)
244
+
245
+ # This creates an ApiClientProxySettings with a username and password. In Production, you should # use an appropriate password/secret management mechanism to vend the username and password
246
+ # rather than having the credentials in code
247
+ proxy_settings = OracleBMC::ApiClientProxySettings.new("10.10.1.10", 3128, "username", "pass")
248
+
249
+ Once an {OracleBMC::ApiClientProxySettings} object has been created, it can be used when creating or modifying a client:
153
250
 
154
- Any operation resulting in a service error will cause an exception of type OracleBMC::Errors::ServiceError to be thrown by the SDK. For information about common service errors returned by OCI, see [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
251
+ # At client creation time
252
+ identity = OracleBMC::Identity::IdentityService.new(proxy_settings: proxy_settings)
253
+
254
+ # When updating a client
255
+ identity.api_client.proxy_settings = proxy_settings
256
+
257
+ # The proxy_settings can also be nil'ed out. This will make the ApiClient fall back to
258
+ # using the http_proxy environment variable (if present)
259
+ identity.api_client.proxy_settings=. nil
260
+
261
+ ## Exceptions
262
+
263
+ ### Service Errors
264
+ Any operation that receives a response with a non-2xx HTTP status code from an OCI service will cause an exception of type {OracleBMC::Errors::ServiceError ServiceError} to be thrown by the SDK.
265
+
266
+ For information about common service errors returned by OCI, see [API Errors](https://docs.us-phoenix-1.oraclecloud.com/Content/API/References/apierrors.htm).
267
+
268
+ The key attributes to inspect when dealing with a {OracleBMC::Errors::ServiceError} are:
269
+
270
+ * {OracleBMC::Errors::ServiceError#request_id request_id} if you need to contact Oracle about a particular request, please provide this request ID
271
+ * {OracleBMC::Errors::ServiceError#status_code status_code} contains the HTTP status code of the response
272
+ * {OracleBMC::Errors::ServiceError#service_code service_code} should contain a value from the *Error Code* field as described in the *API Errors* page
273
+ * {OracleBMC::Errors::ServiceError#request_made request_made} contains the actual `Net::HTTPRequest` which was sent by the SDK
274
+
275
+ You can also call {OracleBMC::Errors::ServiceError#to_s to_s} on the error to get a summary of the key information about the error.
276
+
277
+ #### HTTP 3xx Responses
278
+ The SDK will throw exceptions of type {OracleBMC::Errors::ServiceError ServiceError} on HTTP 3xx responses. This impacts operations that support conditional GETs. This includes {OracleBMC::ObjectStorage::ObjectStorageClient#get_object} and {OracleBMC::ObjectStorage::ObjectStorageClient#head_object} methods as these can return responses with a HTTP status code of 304 if passed an `if_none_match`, which corresponds to the current etag of the object or bucket.
279
+
280
+ In order to account for this, you should catch {OracleBMC::Errors::ServiceError ServiceError} and check its `status_code` attribute for the HTTP status code. For example:
281
+
282
+ require 'oraclebmc'
283
+
284
+ object_storage = OracleBMC::ObjectStorage::ObjectStorageClient.new
285
+
286
+ begin
287
+ get_object_response = object_storage.get_object('my_namespace', 'my_bucket', 'my_object', if_none_match: 'some_etag_value')
288
+ rescue OracleBMC::Errors::ServiceError => err
289
+ # Do nothing if the object exists but has not been modified (based on the etag value), otherwise raise the exception
290
+ raise if err.status_code != 304
291
+ end
292
+
293
+
294
+ ### Network Errors
295
+ {OracleBMC::Errors::NetworkError NetworkError} is thrown when the issue is likely to be network related rather than an application issue. This is defined as:
296
+
297
+ * Requests which were sent from the SDK but the outcome was not a response from an OCI service. Further examples of include:
298
+ * Gateway timeouts
299
+ * Read or connection timeouts
300
+ * Any {Errno} exception which was generated by making the request
301
+ * Requests which resulted in a HTTP 408 (timeout)
302
+
303
+ The key attributes to inspect when dealing with a {OracleBMC::Errors::NetworkError} are:
304
+
305
+ * {OracleBMC::Errors::NetworkError#request_made request_made} and {OracleBMC::Errors::NetworkError#response_received response_received} contain the `Net::HTTPRequest` and `Net::HTTPResponse`, respectively
306
+ * {OracleBMC::Errors::NetworkError#code code} contains the HTTP status code of the response
307
+
308
+ You can also call {OracleBMC::Errors::NetworkError#to_s to_s} on the error to get a summary of the key information about the error. In addition, the {OracleBMC::Errors::NetworkError#cause NetworkError.cause} of the {OracleBMC::Errors::NetworkError NetworkError} can be inspected to see the original error that caused the {OracleBMC::Errors::NetworkError NetworkError} to be thrown.
309
+
310
+ ### Response Parsing Errors
311
+ {OracleBMC::Errors::ResponseParsingError ResponseParsingError} is thrown when a response was received from an OCI service but the SDK could not parse it into the appropriate model type to put into an {OracleBMC::Response}.
312
+
313
+ The key attributes to inspect when dealing with a {OracleBMC::Errors::ResponseParsingError} are:
314
+
315
+ * {OracleBMC::Errors::ResponseParsingError#request_made request_made} and {OracleBMC::Errors::ResponseParsingError#response_received response_received} contain the `Net::HTTPRequest` and `Net::HTTPResponse`, respectively
316
+ * {OracleBMC::Errors::ResponseParsingError#response_body response_body} contains the response data which failed to parse
317
+
318
+ You can also call {OracleBMC::Errors::ResponseParsingError#to_s to_s} on the error to get a summary of the key information about the error. In addition, the {OracleBMC::Errors::ResponseParsingError#cause ResponseParsingError.cause} of the {OracleBMC::Errors::ResponseParsingError ResponseParsingError} can be inspected to see the original error that caused the {OracleBMC::Errors::ResponseParsingError ResponseParsingError} to be thrown.
319
+
320
+ ### Other Errors
321
+ The other errors you may encounter while using the SDK are:
322
+
323
+ * {OracleBMC::Errors::MaximumWaitTimeExceededError MaximumWaitTimeExceededError} when using {OracleBMC::Response#wait_until} or when using {OracleBMC::LoadBalancer::Util#wait_on_work_request}
324
+ * {OracleBMC::Errors::WorkRequestFailedError WorkRequestFailedError} when using {OracleBMC::LoadBalancer::Util#wait_on_work_request}. The {OracleBMC::Errors::WorkRequestFailedError#work_request work_request} attribute can be inspected to get the actual work request details
325
+ * {OracleBMC::Errors::MultipartUploadError MultipartUploadError} when using {OracleBMC::ObjectStorage::Transfer::UploadManager UploadManager}. The {OracleBMC::Errors::MultipartUploadError#errors errors} attribute can be inspected to see what errors occurred during the upload, and the {OracleBMC::Errors::MultipartUploadError#upload_id upload_id} can be used if you wish to try and resume the upload via the UploadManager's {OracleBMC::ObjectStorage::Transfer::UploadManager#resume resume} method
155
326
 
156
327
  ## Examples
157
328
  The example code in this section shows how various parts of the Ruby SDK work. More examples can be found in the SDK download.
@@ -344,6 +515,3 @@ Ways to get in touch:
344
515
  * [Stack Overflow](https://stackoverflow.com/): Please use the [oracle-cloud-infrastructure](https://stackoverflow.com/questions/tagged/oracle-cloud-infrastructure) and [oci-ruby-sdk](https://stackoverflow.com/questions/tagged/oci-ruby-sdk) tags in your post
345
516
  * [Developer Tools section](https://community.oracle.com/community/cloud_computing/bare-metal/content?filterID=contentstatus%5Bpublished%5D~category%5Bdeveloper-tools%5D&filterID=contentstatus%5Bpublished%5D~objecttype~objecttype%5Bthread%5D) of the Oracle Cloud forums
346
517
  * [My Oracle Support](https://support.oracle.com)
347
-
348
-
349
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oraclebmc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.9
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oracle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-07 00:00:00.000000000 Z
11
+ date: 2018-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oci
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.9
19
+ version: 2.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.9
26
+ version: 2.1.0
27
27
  description: "Ruby SDK for Oracle Cloud Infrastructure. \n \n This gem is deprecated
28
28
  and will no longer be maintained starting March 2018. Please move to 'oci' (https://rubygems.org/gems/oci)
29
29
  instead to avoid interruption."