oci 2.4.1 → 2.4.2
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.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +3 -1
- data/lib/oci/api_client.rb +24 -20
- data/lib/oci/auth/federation_client.rb +5 -0
- data/lib/oci/object_storage/models/bucket.rb +36 -4
- data/lib/oci/object_storage/object_storage_client.rb +16 -0
- data/lib/oci/regions.rb +59 -1
- data/lib/oci/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c540db2d59f168706fd0419eede5da8c1d45dc9150b77da8d8325ad53fb47495
|
4
|
+
data.tar.gz: 6c44cf54a1dada0fe102b0e4fc0262f7cf5a3cb51463dfcc4106725017ae23db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c4f4ee4b3eb2754e946d66f3154b18e0b40a0690a1002dfe5393c73ed6da1f56fded5edca4db906a0636392da52352211638cec1d8cb9150b0bc1e2d9565540
|
7
|
+
data.tar.gz: f19c66c15aea0a4b765dba3e9ef24cbbc93a4cd41aa55cfe591bba3f82acf9184a35077599dfb9e58da932d387ad06cbdfac77228c42716609ad2d5d9e6b7d7e
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
2
2
|
|
3
|
-
This software is dual-licensed to you under the Universal Permissive License (UPL)
|
3
|
+
This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 or Apache License 2.0. See below for license terms. You may choose either license.
|
4
4
|
____________________________
|
5
5
|
The Universal Permissive License (UPL), Version 1.0
|
6
6
|
Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Oracle Cloud Infrastructure Ruby SDK
|
2
|
-
**Version 2.4.
|
2
|
+
**Version 2.4.2**
|
3
3
|
|
4
4
|
This topic describes how to install, configure, and use the Oracle Cloud Infrastructure Ruby SDK.
|
5
5
|
|
@@ -158,6 +158,8 @@ To use any of the APIs, you must supply a {OCI::Config Config} object. You can c
|
|
158
158
|
* Required credentials and settings: See [SDK and Tool Configuration](https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/sdkconfig.htm) in the User Guide.
|
159
159
|
* Optional SDK-specific settings: See the {OCI::Config Config} object for the full list of config options.
|
160
160
|
|
161
|
+
Note that the Ruby SDK does not support parsing custom attributes in the configuration file.
|
162
|
+
|
161
163
|
## Forward Compatibility
|
162
164
|
|
163
165
|
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.
|
data/lib/oci/api_client.rb
CHANGED
@@ -18,6 +18,21 @@ module OCI
|
|
18
18
|
# services. This client also handles request serialization and response deserialization
|
19
19
|
class ApiClient
|
20
20
|
class << self
|
21
|
+
# Builds the client info string to be sent with each request.
|
22
|
+
def build_request_id
|
23
|
+
SecureRandom.uuid.delete!('-').upcase
|
24
|
+
end
|
25
|
+
|
26
|
+
# Builds the client info string to be sent with each request.
|
27
|
+
def build_user_info
|
28
|
+
"Oracle-RubySDK/#{VERSION}"
|
29
|
+
end
|
30
|
+
|
31
|
+
# Build the user agent string to be sent with each request.
|
32
|
+
def build_user_agent
|
33
|
+
"#{build_user_info}#{OCI.sdk_name} (ruby #{RUBY_VERSION}; #{RUBY_PLATFORM})"
|
34
|
+
end
|
35
|
+
|
21
36
|
private
|
22
37
|
|
23
38
|
def get_rfc339_formatted_date_string_with_z_offset(date_time)
|
@@ -158,24 +173,6 @@ module OCI
|
|
158
173
|
end
|
159
174
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
160
175
|
|
161
|
-
# Builds the client info string to be sent with each request.
|
162
|
-
def build_request_id
|
163
|
-
SecureRandom.uuid.delete!('-').upcase
|
164
|
-
end
|
165
|
-
|
166
|
-
# Builds the client info string to be sent with each request.
|
167
|
-
def build_user_info
|
168
|
-
"Oracle-RubySDK/#{VERSION}"
|
169
|
-
end
|
170
|
-
|
171
|
-
# Build the user agent string to be send with each request.
|
172
|
-
def build_user_agent
|
173
|
-
agent = "#{build_user_info}#{OCI.sdk_name} (ruby #{RUBY_VERSION}; #{RUBY_PLATFORM})"
|
174
|
-
agent = "#{agent} #{config.additional_user_agent}" if config.additional_user_agent
|
175
|
-
|
176
|
-
agent
|
177
|
-
end
|
178
|
-
|
179
176
|
def self.build_collection_params(collection, collection_format)
|
180
177
|
if collection_format.nil? || !VALID_COLLECTION_FORMATS.key?(collection_format.to_sym)
|
181
178
|
raise "Invalid collection_format: #{collection_format}. Must be one of: #{VALID_COLLECTION_FORMATS.keys}"
|
@@ -265,6 +262,12 @@ module OCI
|
|
265
262
|
end
|
266
263
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
267
264
|
|
265
|
+
# Build the user agent string that also includes the additional_user_agent to be sent with each request.
|
266
|
+
def build_user_agent
|
267
|
+
agent = self.class.build_user_agent
|
268
|
+
"#{agent} #{config.additional_user_agent}" unless config.nil? || config.additional_user_agent.nil?
|
269
|
+
end
|
270
|
+
|
268
271
|
private
|
269
272
|
|
270
273
|
# rubocop:disable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
@@ -311,8 +314,8 @@ module OCI
|
|
311
314
|
request[key.to_s] = value
|
312
315
|
end
|
313
316
|
|
314
|
-
request['opc-client-info'] = build_user_info
|
315
|
-
request['opc-request-id'] ||= build_request_id
|
317
|
+
request['opc-client-info'] = self.class.build_user_info
|
318
|
+
request['opc-request-id'] ||= self.class.build_request_id
|
316
319
|
request['User-Agent'] = build_user_agent
|
317
320
|
|
318
321
|
http = get_http_object(uri.hostname, uri.port)
|
@@ -566,6 +569,7 @@ module OCI
|
|
566
569
|
|
567
570
|
OCI::Internal::Util.convert_to_type return_type, data
|
568
571
|
end
|
572
|
+
|
569
573
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Layout/EmptyLines
|
570
574
|
|
571
575
|
def build_request_url(path, endpoint)
|
@@ -101,6 +101,11 @@ module OCI
|
|
101
101
|
signer.sign(:post, @federation_endpoint, header_params, request.body)
|
102
102
|
header_params.each { |key, value| request[key.to_s] = value }
|
103
103
|
|
104
|
+
# Additional header info to aid in debugging issues
|
105
|
+
request['opc-client-info'] = OCI::ApiClient.build_user_info
|
106
|
+
request['opc-request-id'] ||= OCI::ApiClient.build_request_id
|
107
|
+
request['User-Agent'] = OCI::ApiClient.build_user_agent
|
108
|
+
|
104
109
|
raw_body = nil
|
105
110
|
@federation_http_client.start do
|
106
111
|
@federation_http_client.request(request) do |response|
|
@@ -96,6 +96,18 @@ module OCI
|
|
96
96
|
# @return [String]
|
97
97
|
attr_accessor :object_lifecycle_policy_etag
|
98
98
|
|
99
|
+
# The approximate number of objects in the bucket. Count statistics are reported periodically. You will see a
|
100
|
+
# lag between what is displayed and the actual object count.
|
101
|
+
#
|
102
|
+
# @return [Integer]
|
103
|
+
attr_accessor :approximate_count
|
104
|
+
|
105
|
+
# The approximate total size of all objects in the bucket. Size statistics are reported periodically. You will
|
106
|
+
# see a lag between what is displayed and the actual size of the bucket.
|
107
|
+
#
|
108
|
+
# @return [Integer]
|
109
|
+
attr_accessor :approximate_size
|
110
|
+
|
99
111
|
# Attribute mapping from ruby-style variable name to JSON key.
|
100
112
|
def self.attribute_map
|
101
113
|
{
|
@@ -112,7 +124,9 @@ module OCI
|
|
112
124
|
'freeform_tags': :'freeformTags',
|
113
125
|
'defined_tags': :'definedTags',
|
114
126
|
'kms_key_id': :'kmsKeyId',
|
115
|
-
'object_lifecycle_policy_etag': :'objectLifecyclePolicyEtag'
|
127
|
+
'object_lifecycle_policy_etag': :'objectLifecyclePolicyEtag',
|
128
|
+
'approximate_count': :'approximateCount',
|
129
|
+
'approximate_size': :'approximateSize'
|
116
130
|
# rubocop:enable Style/SymbolLiteral
|
117
131
|
}
|
118
132
|
end
|
@@ -133,7 +147,9 @@ module OCI
|
|
133
147
|
'freeform_tags': :'Hash<String, String>',
|
134
148
|
'defined_tags': :'Hash<String, Hash<String, Object>>',
|
135
149
|
'kms_key_id': :'String',
|
136
|
-
'object_lifecycle_policy_etag': :'String'
|
150
|
+
'object_lifecycle_policy_etag': :'String',
|
151
|
+
'approximate_count': :'Integer',
|
152
|
+
'approximate_size': :'Integer'
|
137
153
|
# rubocop:enable Style/SymbolLiteral
|
138
154
|
}
|
139
155
|
end
|
@@ -157,6 +173,8 @@ module OCI
|
|
157
173
|
# @option attributes [Hash<String, Hash<String, Object>>] :defined_tags The value to assign to the {#defined_tags} property
|
158
174
|
# @option attributes [String] :kms_key_id The value to assign to the {#kms_key_id} property
|
159
175
|
# @option attributes [String] :object_lifecycle_policy_etag The value to assign to the {#object_lifecycle_policy_etag} property
|
176
|
+
# @option attributes [Integer] :approximate_count The value to assign to the {#approximate_count} property
|
177
|
+
# @option attributes [Integer] :approximate_size The value to assign to the {#approximate_size} property
|
160
178
|
def initialize(attributes = {})
|
161
179
|
return unless attributes.is_a?(Hash)
|
162
180
|
|
@@ -224,6 +242,18 @@ module OCI
|
|
224
242
|
raise 'You cannot provide both :objectLifecyclePolicyEtag and :object_lifecycle_policy_etag' if attributes.key?(:'objectLifecyclePolicyEtag') && attributes.key?(:'object_lifecycle_policy_etag')
|
225
243
|
|
226
244
|
self.object_lifecycle_policy_etag = attributes[:'object_lifecycle_policy_etag'] if attributes[:'object_lifecycle_policy_etag']
|
245
|
+
|
246
|
+
self.approximate_count = attributes[:'approximateCount'] if attributes[:'approximateCount']
|
247
|
+
|
248
|
+
raise 'You cannot provide both :approximateCount and :approximate_count' if attributes.key?(:'approximateCount') && attributes.key?(:'approximate_count')
|
249
|
+
|
250
|
+
self.approximate_count = attributes[:'approximate_count'] if attributes[:'approximate_count']
|
251
|
+
|
252
|
+
self.approximate_size = attributes[:'approximateSize'] if attributes[:'approximateSize']
|
253
|
+
|
254
|
+
raise 'You cannot provide both :approximateSize and :approximate_size' if attributes.key?(:'approximateSize') && attributes.key?(:'approximate_size')
|
255
|
+
|
256
|
+
self.approximate_size = attributes[:'approximate_size'] if attributes[:'approximate_size']
|
227
257
|
end
|
228
258
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity
|
229
259
|
# rubocop:enable Metrics/LineLength, Metrics/MethodLength, Layout/EmptyLines, Style/SymbolLiteral
|
@@ -279,7 +309,9 @@ module OCI
|
|
279
309
|
freeform_tags == other.freeform_tags &&
|
280
310
|
defined_tags == other.defined_tags &&
|
281
311
|
kms_key_id == other.kms_key_id &&
|
282
|
-
object_lifecycle_policy_etag == other.object_lifecycle_policy_etag
|
312
|
+
object_lifecycle_policy_etag == other.object_lifecycle_policy_etag &&
|
313
|
+
approximate_count == other.approximate_count &&
|
314
|
+
approximate_size == other.approximate_size
|
283
315
|
end
|
284
316
|
# rubocop:enable Metrics/CyclomaticComplexity, Metrics/AbcSize, Metrics/PerceivedComplexity, Metrics/LineLength, Layout/EmptyLines
|
285
317
|
|
@@ -295,7 +327,7 @@ module OCI
|
|
295
327
|
# Calculates hash code according to all attributes.
|
296
328
|
# @return [Fixnum] Hash code
|
297
329
|
def hash
|
298
|
-
[namespace, name, compartment_id, metadata, created_by, time_created, etag, public_access_type, storage_tier, freeform_tags, defined_tags, kms_key_id, object_lifecycle_policy_etag].hash
|
330
|
+
[namespace, name, compartment_id, metadata, created_by, time_created, etag, public_access_type, storage_tier, freeform_tags, defined_tags, kms_key_id, object_lifecycle_policy_etag, approximate_count, approximate_size].hash
|
299
331
|
end
|
300
332
|
# rubocop:enable Metrics/AbcSize, Metrics/LineLength, Layout/EmptyLines
|
301
333
|
|
@@ -810,12 +810,27 @@ module OCI
|
|
810
810
|
# For creating and committing a multipart upload, this is the entity tag of the target object. For uploading a part, this is the entity tag of the target part.
|
811
811
|
#
|
812
812
|
# @option opts [String] :opc_client_request_id The client request ID for tracing.
|
813
|
+
# @option opts [Array<String>] :fields Bucket summary includes the 'namespace', 'name', 'compartmentId', 'createdBy', 'timeCreated',
|
814
|
+
# and 'etag' fields. This parameter can also include 'approximateCount' (Approximate number of objects) and 'approximateSize'
|
815
|
+
# (total approximate size in bytes of all objects). For example 'approximateCount,approximateSize'
|
816
|
+
#
|
817
|
+
# Allowed values are: approximateCount, approximateSize
|
813
818
|
# @return [Response] A Response object with data of type {OCI::ObjectStorage::Models::Bucket Bucket}
|
814
819
|
def get_bucket(namespace_name, bucket_name, opts = {})
|
815
820
|
logger.debug 'Calling operation ObjectStorageClient#get_bucket.' if logger
|
816
821
|
|
817
822
|
raise "Missing the required parameter 'namespace_name' when calling get_bucket." if namespace_name.nil?
|
818
823
|
raise "Missing the required parameter 'bucket_name' when calling get_bucket." if bucket_name.nil?
|
824
|
+
|
825
|
+
|
826
|
+
fields_allowable_values = %w[approximateCount approximateSize]
|
827
|
+
if opts[:fields] && !opts[:fields].empty?
|
828
|
+
opts[:fields].each do |val_to_check|
|
829
|
+
unless fields_allowable_values.include?(val_to_check)
|
830
|
+
raise 'Invalid value for "fields", must be one of approximateCount, approximateSize.'
|
831
|
+
end
|
832
|
+
end
|
833
|
+
end
|
819
834
|
raise "Parameter value for 'namespace_name' must not be blank" if OCI::Internal::Util.blank_string?(namespace_name)
|
820
835
|
raise "Parameter value for 'bucket_name' must not be blank" if OCI::Internal::Util.blank_string?(bucket_name)
|
821
836
|
|
@@ -825,6 +840,7 @@ module OCI
|
|
825
840
|
# rubocop:disable Style/NegatedIf
|
826
841
|
# Query Params
|
827
842
|
query_params = {}
|
843
|
+
query_params[:fields] = OCI::ApiClient.build_collection_params(opts[:fields], :csv) if opts[:fields] && !opts[:fields].empty?
|
828
844
|
|
829
845
|
# Header Params
|
830
846
|
header_params = {}
|
data/lib/oci/regions.rb
CHANGED
@@ -17,6 +17,21 @@ module OCI
|
|
17
17
|
'lhr': REGION_UK_LONDON_1
|
18
18
|
}.freeze
|
19
19
|
|
20
|
+
# --- Start of region realm mapping ---
|
21
|
+
REGION_REALM_MAPPING = {
|
22
|
+
'us-phoenix-1': 'oc1'.freeze,
|
23
|
+
'us-ashburn-1': 'oc1'.freeze,
|
24
|
+
'eu-frankfurt-1': 'oc1'.freeze,
|
25
|
+
'uk-london-1': 'oc1'.freeze
|
26
|
+
}.freeze
|
27
|
+
# --- end of region realm mapping ---
|
28
|
+
|
29
|
+
# --- Start of realm domain mapping ---
|
30
|
+
REALM_DOMAIN_MAPPING = {
|
31
|
+
'oc1': 'oraclecloud.com'.freeze
|
32
|
+
}.freeze
|
33
|
+
# --- end of realm domain mapping ---
|
34
|
+
|
20
35
|
# --- Start of service prefixes ---
|
21
36
|
SERVICE_ENDPOINT_PREFIX_MAPPING = {
|
22
37
|
BlockstorageClient: 'iaas',
|
@@ -51,6 +66,24 @@ module OCI
|
|
51
66
|
format_endpoint(prefix, region)
|
52
67
|
end
|
53
68
|
|
69
|
+
# Returns an endpoint for the given region and service endpoint template.
|
70
|
+
#
|
71
|
+
# @param [String] region A region used to determine the service endpoint. This will usually
|
72
|
+
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
73
|
+
# @param [String] endpoint_template A service endpoint template defined by service team in spec.
|
74
|
+
#
|
75
|
+
# @return [String] A fully qualified endpoint
|
76
|
+
def self.get_service_endpoint_for_template(region, endpoint_template)
|
77
|
+
endpoint = endpoint_template.clone
|
78
|
+
|
79
|
+
# replace the token inside service_endpoint_template if exists
|
80
|
+
[
|
81
|
+
['{region}', region],
|
82
|
+
['{secondLevelDomain}', get_second_level_domain(region).to_s]
|
83
|
+
].each { |k, v| endpoint.sub!(k, v) }
|
84
|
+
endpoint
|
85
|
+
end
|
86
|
+
|
54
87
|
# @return [Boolean] Returns true if the given string corresponds to a known region, as defined in
|
55
88
|
# {OCI::Regions::REGION_ENUM}.
|
56
89
|
def self.valid_region?(region)
|
@@ -58,7 +91,32 @@ module OCI
|
|
58
91
|
end
|
59
92
|
|
60
93
|
def self.format_endpoint(prefix, region)
|
61
|
-
|
94
|
+
second_level_domain = get_second_level_domain(region)
|
95
|
+
"https://#{prefix}.#{region}.#{second_level_domain}"
|
96
|
+
end
|
97
|
+
|
98
|
+
# Returns a second level domain for the given region.
|
99
|
+
#
|
100
|
+
# @param [String] region A region used to get the second level domain. This will usually
|
101
|
+
# correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
|
102
|
+
#
|
103
|
+
# @return [String] A second level domain for given region, default to oraclecloud.com
|
104
|
+
def self.get_second_level_domain(region)
|
105
|
+
symbolised_region = region.to_sym
|
106
|
+
|
107
|
+
# get realm from region, default to oc1
|
108
|
+
realm = if REGION_REALM_MAPPING.key?(symbolised_region)
|
109
|
+
REGION_REALM_MAPPING[symbolised_region]
|
110
|
+
else
|
111
|
+
'oc1'
|
112
|
+
end
|
113
|
+
|
114
|
+
# return second level domain if exists
|
115
|
+
symbolised_realm = realm.to_sym
|
116
|
+
return REALM_DOMAIN_MAPPING[symbolised_realm] if REALM_DOMAIN_MAPPING.key?(symbolised_realm)
|
117
|
+
|
118
|
+
# otherwise return oc1 domain by default
|
119
|
+
REALM_DOMAIN_MAPPING[:oc1]
|
62
120
|
end
|
63
121
|
end
|
64
122
|
end
|
data/lib/oci/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oracle
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|