oci 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +82 -0
  3. data/README.md +262 -0
  4. data/lib/oci.rb +25 -0
  5. data/lib/oci/api_client.rb +389 -0
  6. data/lib/oci/config.rb +118 -0
  7. data/lib/oci/config_file_loader.rb +96 -0
  8. data/lib/oci/core/blockstorage_client.rb +462 -0
  9. data/lib/oci/core/compute_client.rb +1415 -0
  10. data/lib/oci/core/core.rb +114 -0
  11. data/lib/oci/core/models/attach_i_scsi_volume_details.rb +137 -0
  12. data/lib/oci/core/models/attach_vnic_details.rb +144 -0
  13. data/lib/oci/core/models/attach_volume_details.rb +165 -0
  14. data/lib/oci/core/models/capture_console_history_details.rb +120 -0
  15. data/lib/oci/core/models/console_history.rb +213 -0
  16. data/lib/oci/core/models/cpe.rb +169 -0
  17. data/lib/oci/core/models/create_cpe_details.rb +145 -0
  18. data/lib/oci/core/models/create_cross_connect_details.rb +204 -0
  19. data/lib/oci/core/models/create_cross_connect_group_details.rb +133 -0
  20. data/lib/oci/core/models/create_dhcp_details.rb +153 -0
  21. data/lib/oci/core/models/create_drg_attachment_details.rb +142 -0
  22. data/lib/oci/core/models/create_drg_details.rb +131 -0
  23. data/lib/oci/core/models/create_image_details.rb +159 -0
  24. data/lib/oci/core/models/create_instance_console_connection_details.rb +131 -0
  25. data/lib/oci/core/models/create_internet_gateway_details.rb +153 -0
  26. data/lib/oci/core/models/create_ip_sec_connection_details.rb +168 -0
  27. data/lib/oci/core/models/create_private_ip_details.rb +173 -0
  28. data/lib/oci/core/models/create_route_table_details.rb +153 -0
  29. data/lib/oci/core/models/create_security_list_details.rb +164 -0
  30. data/lib/oci/core/models/create_subnet_details.rb +257 -0
  31. data/lib/oci/core/models/create_vcn_details.rb +171 -0
  32. data/lib/oci/core/models/create_virtual_circuit_details.rb +260 -0
  33. data/lib/oci/core/models/create_vnic_details.rb +214 -0
  34. data/lib/oci/core/models/create_volume_backup_details.rb +133 -0
  35. data/lib/oci/core/models/create_volume_details.rb +170 -0
  36. data/lib/oci/core/models/cross_connect.rb +235 -0
  37. data/lib/oci/core/models/cross_connect_group.rb +187 -0
  38. data/lib/oci/core/models/cross_connect_location.rb +134 -0
  39. data/lib/oci/core/models/cross_connect_mapping.rb +190 -0
  40. data/lib/oci/core/models/cross_connect_port_speed_shape.rb +137 -0
  41. data/lib/oci/core/models/cross_connect_status.rb +200 -0
  42. data/lib/oci/core/models/dhcp_dns_option.rb +171 -0
  43. data/lib/oci/core/models/dhcp_option.rb +135 -0
  44. data/lib/oci/core/models/dhcp_options.rb +208 -0
  45. data/lib/oci/core/models/dhcp_search_domain_option.rb +141 -0
  46. data/lib/oci/core/models/drg.rb +186 -0
  47. data/lib/oci/core/models/drg_attachment.rb +208 -0
  48. data/lib/oci/core/models/egress_security_rule.rb +198 -0
  49. data/lib/oci/core/models/export_image_details.rb +134 -0
  50. data/lib/oci/core/models/export_image_via_object_storage_tuple_details.rb +150 -0
  51. data/lib/oci/core/models/export_image_via_object_storage_uri_details.rb +130 -0
  52. data/lib/oci/core/models/fast_connect_provider_service.rb +145 -0
  53. data/lib/oci/core/models/i_scsi_volume_attachment.rb +212 -0
  54. data/lib/oci/core/models/icmp_options.rb +131 -0
  55. data/lib/oci/core/models/image.rb +245 -0
  56. data/lib/oci/core/models/image_source_details.rb +134 -0
  57. data/lib/oci/core/models/image_source_via_object_storage_tuple_details.rb +150 -0
  58. data/lib/oci/core/models/image_source_via_object_storage_uri_details.rb +128 -0
  59. data/lib/oci/core/models/ingress_security_rule.rb +198 -0
  60. data/lib/oci/core/models/instance.rb +307 -0
  61. data/lib/oci/core/models/instance_console_connection.rb +193 -0
  62. data/lib/oci/core/models/instance_credentials.rb +131 -0
  63. data/lib/oci/core/models/internet_gateway.rb +210 -0
  64. data/lib/oci/core/models/ip_sec_connection.rb +223 -0
  65. data/lib/oci/core/models/ip_sec_connection_device_config.rb +153 -0
  66. data/lib/oci/core/models/ip_sec_connection_device_status.rb +156 -0
  67. data/lib/oci/core/models/launch_instance_details.rb +336 -0
  68. data/lib/oci/core/models/letter_of_authority.rb +194 -0
  69. data/lib/oci/core/models/port_range.rb +133 -0
  70. data/lib/oci/core/models/private_ip.rb +248 -0
  71. data/lib/oci/core/models/route_rule.rb +135 -0
  72. data/lib/oci/core/models/route_table.rb +208 -0
  73. data/lib/oci/core/models/security_list.rb +219 -0
  74. data/lib/oci/core/models/shape.rb +122 -0
  75. data/lib/oci/core/models/subnet.rb +351 -0
  76. data/lib/oci/core/models/tcp_options.rb +135 -0
  77. data/lib/oci/core/models/tunnel_config.rb +151 -0
  78. data/lib/oci/core/models/tunnel_status.rb +178 -0
  79. data/lib/oci/core/models/udp_options.rb +135 -0
  80. data/lib/oci/core/models/update_cpe_details.rb +122 -0
  81. data/lib/oci/core/models/update_cross_connect_details.rb +138 -0
  82. data/lib/oci/core/models/update_cross_connect_group_details.rb +122 -0
  83. data/lib/oci/core/models/update_dhcp_details.rb +132 -0
  84. data/lib/oci/core/models/update_drg_attachment_details.rb +122 -0
  85. data/lib/oci/core/models/update_drg_details.rb +122 -0
  86. data/lib/oci/core/models/update_image_details.rb +124 -0
  87. data/lib/oci/core/models/update_instance_details.rb +124 -0
  88. data/lib/oci/core/models/update_internet_gateway_details.rb +133 -0
  89. data/lib/oci/core/models/update_ip_sec_connection_details.rb +122 -0
  90. data/lib/oci/core/models/update_private_ip_details.rb +157 -0
  91. data/lib/oci/core/models/update_route_table_details.rb +133 -0
  92. data/lib/oci/core/models/update_security_list_details.rb +144 -0
  93. data/lib/oci/core/models/update_subnet_details.rb +122 -0
  94. data/lib/oci/core/models/update_vcn_details.rb +122 -0
  95. data/lib/oci/core/models/update_virtual_circuit_details.rb +240 -0
  96. data/lib/oci/core/models/update_vnic_details.rb +144 -0
  97. data/lib/oci/core/models/update_volume_backup_details.rb +122 -0
  98. data/lib/oci/core/models/update_volume_details.rb +122 -0
  99. data/lib/oci/core/models/vcn.rb +276 -0
  100. data/lib/oci/core/models/virtual_circuit.rb +395 -0
  101. data/lib/oci/core/models/virtual_circuit_bandwidth_shape.rb +137 -0
  102. data/lib/oci/core/models/vnic.rb +287 -0
  103. data/lib/oci/core/models/vnic_attachment.rb +250 -0
  104. data/lib/oci/core/models/volume.rb +210 -0
  105. data/lib/oci/core/models/volume_attachment.rb +246 -0
  106. data/lib/oci/core/models/volume_backup.rb +235 -0
  107. data/lib/oci/core/util.rb +1 -0
  108. data/lib/oci/core/virtual_network_client.rb +3421 -0
  109. data/lib/oci/errors.rb +78 -0
  110. data/lib/oci/global_context.rb +20 -0
  111. data/lib/oci/identity/identity.rb +55 -0
  112. data/lib/oci/identity/identity_client.rb +2148 -0
  113. data/lib/oci/identity/models/add_user_to_group_details.rb +131 -0
  114. data/lib/oci/identity/models/api_key.rb +211 -0
  115. data/lib/oci/identity/models/availability_domain.rb +131 -0
  116. data/lib/oci/identity/models/compartment.rb +211 -0
  117. data/lib/oci/identity/models/create_api_key_details.rb +120 -0
  118. data/lib/oci/identity/models/create_compartment_details.rb +145 -0
  119. data/lib/oci/identity/models/create_customer_secret_key_details.rb +121 -0
  120. data/lib/oci/identity/models/create_group_details.rb +144 -0
  121. data/lib/oci/identity/models/create_identity_provider_details.rb +215 -0
  122. data/lib/oci/identity/models/create_idp_group_mapping_details.rb +133 -0
  123. data/lib/oci/identity/models/create_policy_details.rb +173 -0
  124. data/lib/oci/identity/models/create_region_subscription_details.rb +128 -0
  125. data/lib/oci/identity/models/create_saml2_identity_provider_details.rb +154 -0
  126. data/lib/oci/identity/models/create_swift_password_details.rb +121 -0
  127. data/lib/oci/identity/models/create_user_details.rb +144 -0
  128. data/lib/oci/identity/models/customer_secret_key.rb +225 -0
  129. data/lib/oci/identity/models/customer_secret_key_summary.rb +213 -0
  130. data/lib/oci/identity/models/group.rb +211 -0
  131. data/lib/oci/identity/models/identity_provider.rb +261 -0
  132. data/lib/oci/identity/models/idp_group_mapping.rb +220 -0
  133. data/lib/oci/identity/models/policy.rb +237 -0
  134. data/lib/oci/identity/models/region.rb +143 -0
  135. data/lib/oci/identity/models/region_subscription.rb +180 -0
  136. data/lib/oci/identity/models/saml2_identity_provider.rb +180 -0
  137. data/lib/oci/identity/models/swift_password.rb +226 -0
  138. data/lib/oci/identity/models/tenancy.rb +159 -0
  139. data/lib/oci/identity/models/ui_password.rb +187 -0
  140. data/lib/oci/identity/models/update_compartment_details.rb +132 -0
  141. data/lib/oci/identity/models/update_customer_secret_key_details.rb +120 -0
  142. data/lib/oci/identity/models/update_group_details.rb +120 -0
  143. data/lib/oci/identity/models/update_identity_provider_details.rb +160 -0
  144. data/lib/oci/identity/models/update_idp_group_mapping_details.rb +131 -0
  145. data/lib/oci/identity/models/update_policy_details.rb +148 -0
  146. data/lib/oci/identity/models/update_saml2_identity_provider_details.rb +145 -0
  147. data/lib/oci/identity/models/update_state_details.rb +121 -0
  148. data/lib/oci/identity/models/update_swift_password_details.rb +120 -0
  149. data/lib/oci/identity/models/update_user_details.rb +120 -0
  150. data/lib/oci/identity/models/user.rb +217 -0
  151. data/lib/oci/identity/models/user_group_membership.rb +209 -0
  152. data/lib/oci/identity/util.rb +1 -0
  153. data/lib/oci/internal/internal.rb +10 -0
  154. data/lib/oci/internal/util.rb +69 -0
  155. data/lib/oci/load_balancer/load_balancer.rb +51 -0
  156. data/lib/oci/load_balancer/load_balancer_client.rb +1449 -0
  157. data/lib/oci/load_balancer/models/backend.rb +220 -0
  158. data/lib/oci/load_balancer/models/backend_details.rb +206 -0
  159. data/lib/oci/load_balancer/models/backend_health.rb +158 -0
  160. data/lib/oci/load_balancer/models/backend_set.rb +182 -0
  161. data/lib/oci/load_balancer/models/backend_set_details.rb +165 -0
  162. data/lib/oci/load_balancer/models/backend_set_health.rb +207 -0
  163. data/lib/oci/load_balancer/models/certificate.rb +169 -0
  164. data/lib/oci/load_balancer/models/certificate_details.rb +205 -0
  165. data/lib/oci/load_balancer/models/create_backend_details.rb +206 -0
  166. data/lib/oci/load_balancer/models/create_backend_set_details.rb +181 -0
  167. data/lib/oci/load_balancer/models/create_certificate_details.rb +205 -0
  168. data/lib/oci/load_balancer/models/create_listener_details.rb +175 -0
  169. data/lib/oci/load_balancer/models/create_load_balancer_details.rb +220 -0
  170. data/lib/oci/load_balancer/models/health_check_result.rb +183 -0
  171. data/lib/oci/load_balancer/models/health_checker.rb +224 -0
  172. data/lib/oci/load_balancer/models/health_checker_details.rb +223 -0
  173. data/lib/oci/load_balancer/models/ip_address.rb +139 -0
  174. data/lib/oci/load_balancer/models/listener.rb +174 -0
  175. data/lib/oci/load_balancer/models/listener_details.rb +160 -0
  176. data/lib/oci/load_balancer/models/load_balancer.rb +280 -0
  177. data/lib/oci/load_balancer/models/load_balancer_health.rb +215 -0
  178. data/lib/oci/load_balancer/models/load_balancer_health_summary.rb +168 -0
  179. data/lib/oci/load_balancer/models/load_balancer_policy.rb +120 -0
  180. data/lib/oci/load_balancer/models/load_balancer_protocol.rb +120 -0
  181. data/lib/oci/load_balancer/models/load_balancer_shape.rb +120 -0
  182. data/lib/oci/load_balancer/models/session_persistence_configuration_details.rb +141 -0
  183. data/lib/oci/load_balancer/models/ssl_configuration.rb +155 -0
  184. data/lib/oci/load_balancer/models/ssl_configuration_details.rb +155 -0
  185. data/lib/oci/load_balancer/models/update_backend_details.rb +178 -0
  186. data/lib/oci/load_balancer/models/update_backend_set_details.rb +165 -0
  187. data/lib/oci/load_balancer/models/update_health_checker_details.rb +222 -0
  188. data/lib/oci/load_balancer/models/update_listener_details.rb +160 -0
  189. data/lib/oci/load_balancer/models/update_load_balancer_details.rb +124 -0
  190. data/lib/oci/load_balancer/models/work_request.rb +229 -0
  191. data/lib/oci/load_balancer/models/work_request_error.rb +145 -0
  192. data/lib/oci/load_balancer/util.rb +58 -0
  193. data/lib/oci/object_storage/models/bucket.rb +216 -0
  194. data/lib/oci/object_storage/models/bucket_summary.rb +175 -0
  195. data/lib/oci/object_storage/models/commit_multipart_upload_details.rb +133 -0
  196. data/lib/oci/object_storage/models/commit_multipart_upload_part_details.rb +131 -0
  197. data/lib/oci/object_storage/models/create_bucket_details.rb +173 -0
  198. data/lib/oci/object_storage/models/create_multipart_upload_details.rb +166 -0
  199. data/lib/oci/object_storage/models/create_preauthenticated_request_details.rb +171 -0
  200. data/lib/oci/object_storage/models/list_objects.rb +146 -0
  201. data/lib/oci/object_storage/models/multipart_upload.rb +164 -0
  202. data/lib/oci/object_storage/models/multipart_upload_part_summary.rb +153 -0
  203. data/lib/oci/object_storage/models/object_summary.rb +153 -0
  204. data/lib/oci/object_storage/models/preauthenticated_request.rb +207 -0
  205. data/lib/oci/object_storage/models/preauthenticated_request_summary.rb +196 -0
  206. data/lib/oci/object_storage/models/update_bucket_details.rb +171 -0
  207. data/lib/oci/object_storage/object_storage.rb +30 -0
  208. data/lib/oci/object_storage/object_storage_client.rb +1185 -0
  209. data/lib/oci/object_storage/util.rb +1 -0
  210. data/lib/oci/regions.rb +43 -0
  211. data/lib/oci/response.rb +80 -0
  212. data/lib/oci/response_headers.rb +144 -0
  213. data/lib/oci/signer.rb +157 -0
  214. data/lib/oci/version.rb +5 -0
  215. data/lib/oci/waiter.rb +101 -0
  216. data/lib/oraclebmc.rb +3 -0
  217. metadata +375 -0
@@ -0,0 +1,196 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ class ObjectStorage::Models::PreauthenticatedRequestSummary
7
+
8
+ ACCESS_TYPE_ENUM = [ACCESS_TYPE_OBJECT_READ = 'ObjectRead',
9
+ ACCESS_TYPE_OBJECT_WRITE = 'ObjectWrite',
10
+ ACCESS_TYPE_OBJECT_READ_WRITE = 'ObjectReadWrite',
11
+ ACCESS_TYPE_ANY_OBJECT_WRITE = 'AnyObjectWrite',
12
+ ACCESS_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
13
+
14
+ # the unique identifier to use when directly addressing the pre-authenticated request
15
+ # @return [String]
16
+ attr_accessor :id
17
+
18
+ # the user supplied name of the pre-authenticated request
19
+ # @return [String]
20
+ attr_accessor :name
21
+
22
+ # Name of object that is being granted access to by the pre-authenticated request. This can be null and that would mean that the pre-authenticated request is granting access to the entire bucket
23
+ # @return [String]
24
+ attr_accessor :object_name
25
+
26
+ # the operation that can be performed on this resource e.g PUT or GET.
27
+ # @return [String]
28
+ attr_accessor :access_type
29
+
30
+ # the expiration date after which the pre authenticated request will no longer be valid as per spec
31
+ # [RFC 3339](https://tools.ietf.org/rfc/rfc3339)
32
+ #
33
+ # @return [DateTime]
34
+ attr_accessor :time_expires
35
+
36
+ # the date when the pre-authenticated request was created as per spec
37
+ # [RFC 3339](https://tools.ietf.org/rfc/rfc3339)
38
+ #
39
+ # @return [DateTime]
40
+ attr_accessor :time_created
41
+
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ return unless attributes.is_a?(Hash)
47
+
48
+ # convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
50
+
51
+ if attributes[:'id']
52
+ self.id = attributes[:'id']
53
+ end
54
+
55
+ if attributes[:'name']
56
+ self.name = attributes[:'name']
57
+ end
58
+
59
+ if attributes[:'objectName']
60
+ self.object_name = attributes[:'objectName']
61
+ end
62
+
63
+ if attributes[:'accessType']
64
+ self.access_type = attributes[:'accessType']
65
+ end
66
+
67
+ if attributes[:'timeExpires']
68
+ self.time_expires = attributes[:'timeExpires']
69
+ end
70
+
71
+ if attributes[:'timeCreated']
72
+ self.time_created = attributes[:'timeCreated']
73
+ end
74
+
75
+ end
76
+
77
+ # Custom attribute writer method checking allowed values (enum).
78
+ # @param [Object] access_type Object to be assigned
79
+ def access_type=(access_type)
80
+ if access_type && !ACCESS_TYPE_ENUM.include?(access_type)
81
+ @access_type = ACCESS_TYPE_UNKNOWN_ENUM_VALUE
82
+ else
83
+ @access_type = access_type
84
+ end
85
+ end
86
+
87
+ # Checks equality by comparing each attribute.
88
+ # @param [Object] other_object to be compared
89
+ def ==(other_object)
90
+ return true if self.equal?(other_object)
91
+ self.class == other_object.class &&
92
+ id == other_object.id &&
93
+ name == other_object.name &&
94
+ object_name == other_object.object_name &&
95
+ access_type == other_object.access_type &&
96
+ time_expires == other_object.time_expires &&
97
+ time_created == other_object.time_created
98
+ end
99
+
100
+ # @see the `==` method
101
+ # @param [Object] other_object to be compared
102
+ def eql?(other_object)
103
+ self == other_object
104
+ end
105
+
106
+ # Calculates hash code according to all attributes.
107
+ # @return [Fixnum] Hash code
108
+ def hash
109
+ [id, name, object_name, access_type, time_expires, time_created].hash
110
+ end
111
+
112
+ # Builds the object from hash
113
+ # @param [Hash] attributes Model attributes in the form of hash
114
+ # @return [Object] Returns the model itself
115
+ def build_from_hash(attributes)
116
+ return nil unless attributes.is_a?(Hash)
117
+ self.class.swagger_types.each_pair do |key, type|
118
+ if type =~ /^Array<(.*)>/i
119
+ # check to ensure the input is an array given that the the attribute
120
+ # is documented as an array but the input is not
121
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
122
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
123
+ end
124
+ elsif !attributes[self.class.attribute_map[key]].nil?
125
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
126
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
127
+ end
128
+
129
+ self
130
+ end
131
+
132
+ # Returns the string representation of the object
133
+ # @return [String] String presentation of the object
134
+ def to_s
135
+ to_hash.to_s
136
+ end
137
+
138
+ # Returns the object in the form of hash
139
+ # @return [Hash] Returns the object in the form of hash
140
+ def to_hash
141
+ hash = {}
142
+ self.class.attribute_map.each_pair do |attr, param|
143
+ value = self.send(attr)
144
+ next if value.nil?
145
+ hash[param] = _to_hash(value)
146
+ end
147
+ hash
148
+ end
149
+
150
+ private
151
+
152
+ # Outputs non-array value in the form of hash
153
+ # For object, use to_hash. Otherwise, just return the value
154
+ # @param [Object] value Any valid value
155
+ # @return [Hash] Returns the value in the form of hash
156
+ def _to_hash(value)
157
+ if value.is_a?(Array)
158
+ value.compact.map{ |v| _to_hash(v) }
159
+ elsif value.is_a?(Hash)
160
+ {}.tap do |hash|
161
+ value.each { |k, v| hash[k] = _to_hash(v) }
162
+ end
163
+ elsif value.respond_to? :to_hash
164
+ value.to_hash
165
+ else
166
+ value
167
+ end
168
+ end
169
+
170
+
171
+
172
+ # Attribute mapping from ruby-style variable name to JSON key.
173
+ def self.attribute_map
174
+ {
175
+ :'id' => :'id',
176
+ :'name' => :'name',
177
+ :'object_name' => :'objectName',
178
+ :'access_type' => :'accessType',
179
+ :'time_expires' => :'timeExpires',
180
+ :'time_created' => :'timeCreated'
181
+ }
182
+ end
183
+
184
+ # Attribute type mapping.
185
+ def self.swagger_types
186
+ {
187
+ :'id' => :'String',
188
+ :'name' => :'String',
189
+ :'object_name' => :'String',
190
+ :'access_type' => :'String',
191
+ :'time_expires' => :'DateTime',
192
+ :'time_created' => :'DateTime'
193
+ }
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,171 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require 'date'
4
+
5
+ module OCI
6
+ class ObjectStorage::Models::UpdateBucketDetails
7
+
8
+ PUBLIC_ACCESS_TYPE_ENUM = [PUBLIC_ACCESS_TYPE_NO_PUBLIC_ACCESS = 'NoPublicAccess',
9
+ PUBLIC_ACCESS_TYPE_OBJECT_READ = 'ObjectRead']
10
+
11
+ # The namespace in which the bucket lives.
12
+ # @return [String]
13
+ attr_accessor :namespace
14
+
15
+ # The name of the bucket.
16
+ # @return [String]
17
+ attr_accessor :name
18
+
19
+ # Arbitrary string, up to 4KB, of keys and values for user-defined metadata.
20
+ # @return [Hash<String, String>]
21
+ attr_accessor :metadata
22
+
23
+ # The type of public access available on this bucket. Allows authenticated caller to access the bucket or
24
+ # contents of this bucket. By default a bucket is set to NoPublicAccess. It is treated as NoPublicAccess
25
+ # when this value is not specified. When the type is NoPublicAccess the bucket does not allow any public access.
26
+ # When the type is ObjectRead the bucket allows public access to the GetObject, HeadObject, ListObjects.
27
+ #
28
+ # @return [String]
29
+ attr_accessor :public_access_type
30
+
31
+
32
+ # Initializes the object
33
+ # @param [Hash] attributes Model attributes in the form of hash
34
+ def initialize(attributes = {})
35
+ return unless attributes.is_a?(Hash)
36
+
37
+ # convert string to symbol for hash key
38
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
39
+
40
+ if attributes[:'namespace']
41
+ self.namespace = attributes[:'namespace']
42
+ end
43
+
44
+ if attributes[:'name']
45
+ self.name = attributes[:'name']
46
+ end
47
+
48
+ if attributes[:'metadata']
49
+ self.metadata = attributes[:'metadata']
50
+ end
51
+
52
+ if attributes[:'publicAccessType']
53
+ self.public_access_type = attributes[:'publicAccessType']
54
+ end
55
+
56
+ end
57
+
58
+ # Custom attribute writer method checking allowed values (enum).
59
+ # @param [Object] public_access_type Object to be assigned
60
+ def public_access_type=(public_access_type)
61
+ if public_access_type && !PUBLIC_ACCESS_TYPE_ENUM.include?(public_access_type)
62
+ fail "Invalid value for 'public_access_type': this must be one of the values in PUBLIC_ACCESS_TYPE_ENUM."
63
+ else
64
+ @public_access_type = public_access_type
65
+ end
66
+ end
67
+
68
+ # Checks equality by comparing each attribute.
69
+ # @param [Object] other_object to be compared
70
+ def ==(other_object)
71
+ return true if self.equal?(other_object)
72
+ self.class == other_object.class &&
73
+ namespace == other_object.namespace &&
74
+ name == other_object.name &&
75
+ metadata == other_object.metadata &&
76
+ public_access_type == other_object.public_access_type
77
+ end
78
+
79
+ # @see the `==` method
80
+ # @param [Object] other_object to be compared
81
+ def eql?(other_object)
82
+ self == other_object
83
+ end
84
+
85
+ # Calculates hash code according to all attributes.
86
+ # @return [Fixnum] Hash code
87
+ def hash
88
+ [namespace, name, metadata, public_access_type].hash
89
+ end
90
+
91
+ # Builds the object from hash
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ # @return [Object] Returns the model itself
94
+ def build_from_hash(attributes)
95
+ return nil unless attributes.is_a?(Hash)
96
+ self.class.swagger_types.each_pair do |key, type|
97
+ if type =~ /^Array<(.*)>/i
98
+ # check to ensure the input is an array given that the the attribute
99
+ # is documented as an array but the input is not
100
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
101
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
102
+ end
103
+ elsif !attributes[self.class.attribute_map[key]].nil?
104
+ self.send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]))
105
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
106
+ end
107
+
108
+ self
109
+ end
110
+
111
+ # Returns the string representation of the object
112
+ # @return [String] String presentation of the object
113
+ def to_s
114
+ to_hash.to_s
115
+ end
116
+
117
+ # Returns the object in the form of hash
118
+ # @return [Hash] Returns the object in the form of hash
119
+ def to_hash
120
+ hash = {}
121
+ self.class.attribute_map.each_pair do |attr, param|
122
+ value = self.send(attr)
123
+ next if value.nil?
124
+ hash[param] = _to_hash(value)
125
+ end
126
+ hash
127
+ end
128
+
129
+ private
130
+
131
+ # Outputs non-array value in the form of hash
132
+ # For object, use to_hash. Otherwise, just return the value
133
+ # @param [Object] value Any valid value
134
+ # @return [Hash] Returns the value in the form of hash
135
+ def _to_hash(value)
136
+ if value.is_a?(Array)
137
+ value.compact.map{ |v| _to_hash(v) }
138
+ elsif value.is_a?(Hash)
139
+ {}.tap do |hash|
140
+ value.each { |k, v| hash[k] = _to_hash(v) }
141
+ end
142
+ elsif value.respond_to? :to_hash
143
+ value.to_hash
144
+ else
145
+ value
146
+ end
147
+ end
148
+
149
+
150
+
151
+ # Attribute mapping from ruby-style variable name to JSON key.
152
+ def self.attribute_map
153
+ {
154
+ :'namespace' => :'namespace',
155
+ :'name' => :'name',
156
+ :'metadata' => :'metadata',
157
+ :'public_access_type' => :'publicAccessType'
158
+ }
159
+ end
160
+
161
+ # Attribute type mapping.
162
+ def self.swagger_types
163
+ {
164
+ :'namespace' => :'String',
165
+ :'name' => :'String',
166
+ :'metadata' => :'Hash<String, String>',
167
+ :'public_access_type' => :'String'
168
+ }
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ module OCI
4
+ module ObjectStorage
5
+ module Models
6
+ end
7
+ end
8
+ end
9
+
10
+ # Require models
11
+ require 'oci/object_storage/models/bucket'
12
+ require 'oci/object_storage/models/bucket_summary'
13
+ require 'oci/object_storage/models/commit_multipart_upload_details'
14
+ require 'oci/object_storage/models/commit_multipart_upload_part_details'
15
+ require 'oci/object_storage/models/create_bucket_details'
16
+ require 'oci/object_storage/models/create_multipart_upload_details'
17
+ require 'oci/object_storage/models/create_preauthenticated_request_details'
18
+ require 'oci/object_storage/models/list_objects'
19
+ require 'oci/object_storage/models/multipart_upload'
20
+ require 'oci/object_storage/models/multipart_upload_part_summary'
21
+ require 'oci/object_storage/models/object_summary'
22
+ require 'oci/object_storage/models/preauthenticated_request'
23
+ require 'oci/object_storage/models/preauthenticated_request_summary'
24
+ require 'oci/object_storage/models/update_bucket_details'
25
+
26
+ # Require generated clients
27
+ require 'oci/object_storage/object_storage_client'
28
+
29
+ # Require service utilities
30
+ require 'oci/object_storage/util'
@@ -0,0 +1,1185 @@
1
+ # Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
2
+
3
+ require "uri"
4
+ require "logger"
5
+
6
+ module OCI
7
+
8
+ class ObjectStorage::ObjectStorageClient
9
+
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 region, which will usually correspond to a value in {OCI::Regions::REGION_ENUM}.
19
+ # @return [String]
20
+ attr_accessor :region
21
+
22
+ # Creates a new ObjectStorageClient.
23
+ # If a config is not specified, then the global OCI.config will be used.
24
+ #
25
+ # A region must be specified in either the config or the region parameter. If specified
26
+ # in both, then the region parameter will be used.
27
+ #
28
+ # @param [Config] config A Config object.
29
+ # @param [String] region A region used to determine the service endpoint. This will usually
30
+ # correspond to a value in {OCI::Regions::REGION_ENUM}, but may be an arbitrary string.
31
+ #
32
+ def initialize(config:nil, region:nil)
33
+ config ||= OCI.config
34
+ config.validate
35
+
36
+ signer = Signer.new(config.user, config.fingerprint, config.tenancy, config.key_file, pass_phrase: config.pass_phrase, private_key_content: config.key_content, signing_strategy: Signer::OBJECT_STORAGE)
37
+ @api_client = ApiClient.new(config, signer)
38
+
39
+ region ||= config.region
40
+ self.region = region
41
+ end
42
+
43
+ # Set the region that will be used to determine the service endpoint.
44
+ # This will usually correspond to a value in {OCI::Regions::REGION_ENUM},
45
+ # but may be an arbitrary string.
46
+ def region=(r)
47
+ @region = r
48
+
49
+ fail 'A region must be specified.' unless @region
50
+
51
+ @endpoint = OCI::Regions.get_service_endpoint(@region, :ObjectStorageClient) + '/'
52
+ logger.info "ObjectStorageClient endpoint set to '#{endpoint}'." if logger
53
+ end
54
+
55
+ # @return [Logger] The logger for this client. May be nil.
56
+ def logger
57
+ @api_client.config.logger
58
+ end
59
+
60
+
61
+ # Aborts an in-progress multipart upload and deletes all parts that have been uploaded.
62
+ #
63
+ # @param [String] namespace_name The top-level namespace used for the request.
64
+ # @param [String] bucket_name The name of the bucket.
65
+ #
66
+ # Example: `my-new-bucket1`
67
+ #
68
+ # @param [String] object_name The name of the object.
69
+ #
70
+ # Example: `test/object1.log`
71
+ #
72
+ # @param [String] upload_id The upload ID for a multipart upload.
73
+ # @param [Hash] opts the optional parameters
74
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
75
+ # @return [Response] A Response object with data of type nil
76
+ def abort_multipart_upload(namespace_name, bucket_name, object_name, upload_id, opts = {})
77
+ logger.debug "Calling operation ObjectStorageClient#abort_multipart_upload." if logger
78
+
79
+ fail "Missing the required parameter 'namespace_name' when calling abort_multipart_upload." if namespace_name.nil?
80
+ fail "Missing the required parameter 'bucket_name' when calling abort_multipart_upload." if bucket_name.nil?
81
+ fail "Missing the required parameter 'object_name' when calling abort_multipart_upload." if object_name.nil?
82
+ fail "Missing the required parameter 'upload_id' when calling abort_multipart_upload." if upload_id.nil?
83
+
84
+ path = "/n/{namespaceName}/b/{bucketName}/u/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
85
+
86
+ # Query Params
87
+ query_params = {}
88
+ query_params[:'uploadId'] = upload_id
89
+
90
+ # Header Params
91
+ header_params = {}
92
+ header_params['accept'] = 'application/json'
93
+ header_params['content-type'] = 'application/json'
94
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
95
+
96
+ post_body = nil
97
+
98
+ return @api_client.call_api(
99
+ :DELETE,
100
+ path,
101
+ endpoint,
102
+ :header_params => header_params,
103
+ :query_params => query_params,
104
+ :body => post_body)
105
+ end
106
+
107
+ # Commits a multipart upload, which involves checking part numbers and ETags of the parts, to create an aggregate object.
108
+ #
109
+ # @param [String] namespace_name The top-level namespace used for the request.
110
+ # @param [String] bucket_name The name of the bucket.
111
+ #
112
+ # Example: `my-new-bucket1`
113
+ #
114
+ # @param [String] object_name The name of the object.
115
+ #
116
+ # Example: `test/object1.log`
117
+ #
118
+ # @param [String] upload_id The upload ID for a multipart upload.
119
+ # @param [CommitMultipartUploadDetails] commit_multipart_upload_details The part numbers and ETags for the parts you want to commit.
120
+ # @param [Hash] opts the optional parameters
121
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
122
+ # For uploading a part, this is the entity tag of the target part.
123
+ #
124
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
125
+ # 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
126
+ # of the target part.
127
+ #
128
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
129
+ # @return [Response] A Response object with data of type nil
130
+ def commit_multipart_upload(namespace_name, bucket_name, object_name, upload_id, commit_multipart_upload_details, opts = {})
131
+ logger.debug "Calling operation ObjectStorageClient#commit_multipart_upload." if logger
132
+
133
+ fail "Missing the required parameter 'namespace_name' when calling commit_multipart_upload." if namespace_name.nil?
134
+ fail "Missing the required parameter 'bucket_name' when calling commit_multipart_upload." if bucket_name.nil?
135
+ fail "Missing the required parameter 'object_name' when calling commit_multipart_upload." if object_name.nil?
136
+ fail "Missing the required parameter 'upload_id' when calling commit_multipart_upload." if upload_id.nil?
137
+ fail "Missing the required parameter 'commit_multipart_upload_details' when calling commit_multipart_upload." if commit_multipart_upload_details.nil?
138
+
139
+ path = "/n/{namespaceName}/b/{bucketName}/u/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
140
+
141
+ # Query Params
142
+ query_params = {}
143
+ query_params[:'uploadId'] = upload_id
144
+
145
+ # Header Params
146
+ header_params = {}
147
+ header_params['accept'] = 'application/json'
148
+ header_params['content-type'] = 'application/json'
149
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
150
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
151
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
152
+
153
+ post_body = @api_client.object_to_http_body(commit_multipart_upload_details)
154
+
155
+ return @api_client.call_api(
156
+ :POST,
157
+ path,
158
+ endpoint,
159
+ :header_params => header_params,
160
+ :query_params => query_params,
161
+ :body => post_body)
162
+ end
163
+
164
+ # Creates a bucket in the given namespace with a bucket name and optional user-defined metadata.
165
+ #
166
+ # To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized,
167
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
168
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
169
+ #
170
+ # @param [String] namespace_name The top-level namespace used for the request.
171
+ # @param [CreateBucketDetails] create_bucket_details Request object for creating a bucket.
172
+ # @param [Hash] opts the optional parameters
173
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
174
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::Bucket
175
+ def create_bucket(namespace_name, create_bucket_details, opts = {})
176
+ logger.debug "Calling operation ObjectStorageClient#create_bucket." if logger
177
+
178
+ fail "Missing the required parameter 'namespace_name' when calling create_bucket." if namespace_name.nil?
179
+ fail "Missing the required parameter 'create_bucket_details' when calling create_bucket." if create_bucket_details.nil?
180
+
181
+ path = "/n/{namespaceName}/b/".sub('{namespaceName}', namespace_name.to_s)
182
+
183
+ # Query Params
184
+ query_params = {}
185
+
186
+ # Header Params
187
+ header_params = {}
188
+ header_params['accept'] = 'application/json'
189
+ header_params['content-type'] = 'application/json'
190
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
191
+
192
+ post_body = @api_client.object_to_http_body(create_bucket_details)
193
+
194
+ return @api_client.call_api(
195
+ :POST,
196
+ path,
197
+ endpoint,
198
+ :header_params => header_params,
199
+ :query_params => query_params,
200
+ :body => post_body,
201
+ :return_type => 'OCI::ObjectStorage::Models::Bucket')
202
+ end
203
+
204
+ # Starts a new multipart upload to a specific object in the given bucket in the given namespace.
205
+ #
206
+ # @param [String] namespace_name The top-level namespace used for the request.
207
+ # @param [String] bucket_name The name of the bucket.
208
+ #
209
+ # Example: `my-new-bucket1`
210
+ #
211
+ # @param [CreateMultipartUploadDetails] create_multipart_upload_details Request object for creating a multi-part upload.
212
+ # @param [Hash] opts the optional parameters
213
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
214
+ # For uploading a part, this is the entity tag of the target part.
215
+ #
216
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
217
+ # 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
218
+ # of the target part.
219
+ #
220
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
221
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::MultipartUpload
222
+ def create_multipart_upload(namespace_name, bucket_name, create_multipart_upload_details, opts = {})
223
+ logger.debug "Calling operation ObjectStorageClient#create_multipart_upload." if logger
224
+
225
+ fail "Missing the required parameter 'namespace_name' when calling create_multipart_upload." if namespace_name.nil?
226
+ fail "Missing the required parameter 'bucket_name' when calling create_multipart_upload." if bucket_name.nil?
227
+ fail "Missing the required parameter 'create_multipart_upload_details' when calling create_multipart_upload." if create_multipart_upload_details.nil?
228
+
229
+ path = "/n/{namespaceName}/b/{bucketName}/u".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
230
+
231
+ # Query Params
232
+ query_params = {}
233
+
234
+ # Header Params
235
+ header_params = {}
236
+ header_params['accept'] = 'application/json'
237
+ header_params['content-type'] = 'application/json'
238
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
239
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
240
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
241
+
242
+ post_body = @api_client.object_to_http_body(create_multipart_upload_details)
243
+
244
+ return @api_client.call_api(
245
+ :POST,
246
+ path,
247
+ endpoint,
248
+ :header_params => header_params,
249
+ :query_params => query_params,
250
+ :body => post_body,
251
+ :return_type => 'OCI::ObjectStorage::Models::MultipartUpload')
252
+ end
253
+
254
+ # Create a pre-authenticated request specific to the bucket
255
+ #
256
+ # @param [String] namespace_name The top-level namespace used for the request.
257
+ # @param [String] bucket_name The name of the bucket.
258
+ #
259
+ # Example: `my-new-bucket1`
260
+ #
261
+ # @param [CreatePreauthenticatedRequestDetails] create_preauthenticated_request_details details for creating the pre-authenticated request.
262
+ # @param [Hash] opts the optional parameters
263
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
264
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::PreauthenticatedRequest
265
+ def create_preauthenticated_request(namespace_name, bucket_name, create_preauthenticated_request_details, opts = {})
266
+ logger.debug "Calling operation ObjectStorageClient#create_preauthenticated_request." if logger
267
+
268
+ fail "Missing the required parameter 'namespace_name' when calling create_preauthenticated_request." if namespace_name.nil?
269
+ fail "Missing the required parameter 'bucket_name' when calling create_preauthenticated_request." if bucket_name.nil?
270
+ fail "Missing the required parameter 'create_preauthenticated_request_details' when calling create_preauthenticated_request." if create_preauthenticated_request_details.nil?
271
+
272
+ path = "/n/{namespaceName}/b/{bucketName}/p/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
273
+
274
+ # Query Params
275
+ query_params = {}
276
+
277
+ # Header Params
278
+ header_params = {}
279
+ header_params['accept'] = 'application/json'
280
+ header_params['content-type'] = 'application/json'
281
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
282
+
283
+ post_body = @api_client.object_to_http_body(create_preauthenticated_request_details)
284
+
285
+ return @api_client.call_api(
286
+ :POST,
287
+ path,
288
+ endpoint,
289
+ :header_params => header_params,
290
+ :query_params => query_params,
291
+ :body => post_body,
292
+ :return_type => 'OCI::ObjectStorage::Models::PreauthenticatedRequest')
293
+ end
294
+
295
+ # Deletes a bucket if it is already empty. If the bucket is not empty, use {#delete_object delete_object} first.
296
+ #
297
+ # @param [String] namespace_name The top-level namespace used for the request.
298
+ # @param [String] bucket_name The name of the bucket.
299
+ #
300
+ # Example: `my-new-bucket1`
301
+ #
302
+ # @param [Hash] opts the optional parameters
303
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
304
+ # For uploading a part, this is the entity tag of the target part.
305
+ #
306
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
307
+ # @return [Response] A Response object with data of type nil
308
+ def delete_bucket(namespace_name, bucket_name, opts = {})
309
+ logger.debug "Calling operation ObjectStorageClient#delete_bucket." if logger
310
+
311
+ fail "Missing the required parameter 'namespace_name' when calling delete_bucket." if namespace_name.nil?
312
+ fail "Missing the required parameter 'bucket_name' when calling delete_bucket." if bucket_name.nil?
313
+
314
+ path = "/n/{namespaceName}/b/{bucketName}/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
315
+
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[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
324
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
325
+
326
+ post_body = nil
327
+
328
+ return @api_client.call_api(
329
+ :DELETE,
330
+ path,
331
+ endpoint,
332
+ :header_params => header_params,
333
+ :query_params => query_params,
334
+ :body => post_body)
335
+ end
336
+
337
+ # Deletes an object.
338
+ #
339
+ # @param [String] namespace_name The top-level namespace used for the request.
340
+ # @param [String] bucket_name The name of the bucket.
341
+ #
342
+ # Example: `my-new-bucket1`
343
+ #
344
+ # @param [String] object_name The name of the object.
345
+ #
346
+ # Example: `test/object1.log`
347
+ #
348
+ # @param [Hash] opts the optional parameters
349
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
350
+ # For uploading a part, this is the entity tag of the target part.
351
+ #
352
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
353
+ # @return [Response] A Response object with data of type nil
354
+ def delete_object(namespace_name, bucket_name, object_name, opts = {})
355
+ logger.debug "Calling operation ObjectStorageClient#delete_object." if logger
356
+
357
+ fail "Missing the required parameter 'namespace_name' when calling delete_object." if namespace_name.nil?
358
+ fail "Missing the required parameter 'bucket_name' when calling delete_object." if bucket_name.nil?
359
+ fail "Missing the required parameter 'object_name' when calling delete_object." if object_name.nil?
360
+
361
+ path = "/n/{namespaceName}/b/{bucketName}/o/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
362
+
363
+ # Query Params
364
+ query_params = {}
365
+
366
+ # Header Params
367
+ header_params = {}
368
+ header_params['accept'] = 'application/json'
369
+ header_params['content-type'] = 'application/json'
370
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
371
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
372
+
373
+ post_body = nil
374
+
375
+ return @api_client.call_api(
376
+ :DELETE,
377
+ path,
378
+ endpoint,
379
+ :header_params => header_params,
380
+ :query_params => query_params,
381
+ :body => post_body)
382
+ end
383
+
384
+ # Deletes the bucket level pre-authenticateted request
385
+ # @param [String] namespace_name The top-level namespace used for the request.
386
+ # @param [String] bucket_name The name of the bucket.
387
+ #
388
+ # Example: `my-new-bucket1`
389
+ #
390
+ # @param [String] par_id The unique identifier for the pre-authenticated request (PAR). This can be used to manage the PAR
391
+ # such as GET or DELETE the PAR
392
+ #
393
+ # @param [Hash] opts the optional parameters
394
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
395
+ # @return [Response] A Response object with data of type nil
396
+ def delete_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {})
397
+ logger.debug "Calling operation ObjectStorageClient#delete_preauthenticated_request." if logger
398
+
399
+ fail "Missing the required parameter 'namespace_name' when calling delete_preauthenticated_request." if namespace_name.nil?
400
+ fail "Missing the required parameter 'bucket_name' when calling delete_preauthenticated_request." if bucket_name.nil?
401
+ fail "Missing the required parameter 'par_id' when calling delete_preauthenticated_request." if par_id.nil?
402
+
403
+ path = "/n/{namespaceName}/b/{bucketName}/p/{parId}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{parId}', par_id.to_s)
404
+
405
+ # Query Params
406
+ query_params = {}
407
+
408
+ # Header Params
409
+ header_params = {}
410
+ header_params['accept'] = 'application/json'
411
+ header_params['content-type'] = 'application/json'
412
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
413
+
414
+ post_body = nil
415
+
416
+ return @api_client.call_api(
417
+ :DELETE,
418
+ path,
419
+ endpoint,
420
+ :header_params => header_params,
421
+ :query_params => query_params,
422
+ :body => post_body)
423
+ end
424
+
425
+ # Gets the current representation of the given bucket in the given namespace.
426
+ #
427
+ # @param [String] namespace_name The top-level namespace used for the request.
428
+ # @param [String] bucket_name The name of the bucket.
429
+ #
430
+ # Example: `my-new-bucket1`
431
+ #
432
+ # @param [Hash] opts the optional parameters
433
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
434
+ # For uploading a part, this is the entity tag of the target part.
435
+ #
436
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
437
+ # 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
438
+ # of the target part.
439
+ #
440
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
441
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::Bucket
442
+ def get_bucket(namespace_name, bucket_name, opts = {})
443
+ logger.debug "Calling operation ObjectStorageClient#get_bucket." if logger
444
+
445
+ fail "Missing the required parameter 'namespace_name' when calling get_bucket." if namespace_name.nil?
446
+ fail "Missing the required parameter 'bucket_name' when calling get_bucket." if bucket_name.nil?
447
+
448
+ path = "/n/{namespaceName}/b/{bucketName}/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
449
+
450
+ # Query Params
451
+ query_params = {}
452
+
453
+ # Header Params
454
+ header_params = {}
455
+ header_params['accept'] = 'application/json'
456
+ header_params['content-type'] = 'application/json'
457
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
458
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
459
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
460
+
461
+ post_body = nil
462
+
463
+ return @api_client.call_api(
464
+ :GET,
465
+ path,
466
+ endpoint,
467
+ :header_params => header_params,
468
+ :query_params => query_params,
469
+ :body => post_body,
470
+ :return_type => 'OCI::ObjectStorage::Models::Bucket')
471
+ end
472
+
473
+ # Gets the name of the namespace for the user making the request. An account name must be unique, must start with a
474
+ # letter, and can have up to 15 lowercase letters and numbers. You cannot use spaces or special characters.
475
+ #
476
+ # @param [Hash] opts the optional parameters
477
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
478
+ # @return [Response] A Response object with data of type String
479
+ def get_namespace(opts = {})
480
+ logger.debug "Calling operation ObjectStorageClient#get_namespace." if logger
481
+
482
+
483
+ path = "/n/"
484
+
485
+ # Query Params
486
+ query_params = {}
487
+
488
+ # Header Params
489
+ header_params = {}
490
+ header_params['accept'] = 'application/json'
491
+ header_params['content-type'] = 'application/json'
492
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
493
+
494
+ post_body = nil
495
+
496
+ return @api_client.call_api(
497
+ :GET,
498
+ path,
499
+ endpoint,
500
+ :header_params => header_params,
501
+ :query_params => query_params,
502
+ :body => post_body,
503
+ :return_type => 'String')
504
+ end
505
+
506
+ # Gets the metadata and body of an object.
507
+ #
508
+ # @param [String] namespace_name The top-level namespace used for the request.
509
+ # @param [String] bucket_name The name of the bucket.
510
+ #
511
+ # Example: `my-new-bucket1`
512
+ #
513
+ # @param [String] object_name The name of the object.
514
+ #
515
+ # Example: `test/object1.log`
516
+ #
517
+ # @param [Hash] opts the optional parameters
518
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
519
+ # For uploading a part, this is the entity tag of the target part.
520
+ #
521
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
522
+ # 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
523
+ # of the target part.
524
+ #
525
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
526
+ # @option opts [String] :range Optional byte range to fetch, as described in [RFC 7233](https://tools.ietf.org/rfc/rfc7233), section 2.1.
527
+ # Note, only a single range of bytes is supported.
528
+ #
529
+ # @option opts [String, IO] :response_target Streaming http body into a file (specified by file name or File object) or IO object if the block is not given
530
+ # @option [Block] &block Streaming http body to the block
531
+ # @return [Response] A Response object with data of type String if response_target and block are not given, otherwise with nil data
532
+ def get_object(namespace_name, bucket_name, object_name, opts = {}, &block)
533
+ logger.debug "Calling operation ObjectStorageClient#get_object." if logger
534
+
535
+ fail "Missing the required parameter 'namespace_name' when calling get_object." if namespace_name.nil?
536
+ fail "Missing the required parameter 'bucket_name' when calling get_object." if bucket_name.nil?
537
+ fail "Missing the required parameter 'object_name' when calling get_object." if object_name.nil?
538
+
539
+ path = "/n/{namespaceName}/b/{bucketName}/o/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
540
+
541
+ # Query Params
542
+ query_params = {}
543
+
544
+ # Header Params
545
+ header_params = {}
546
+ header_params['accept'] = 'application/json'
547
+ header_params['content-type'] = 'application/json'
548
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
549
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
550
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
551
+ header_params[:'range'] = opts[:'range'] if opts[:'range']
552
+
553
+ post_body = nil
554
+
555
+ if !block.nil?
556
+ return @api_client.call_api(
557
+ :GET,
558
+ path,
559
+ endpoint,
560
+ header_params: header_params,
561
+ query_params: query_params,
562
+ body: post_body,
563
+ return_type: 'Stream',
564
+ &block
565
+ )
566
+ elsif opts[:response_target]
567
+ if opts[:response_target].respond_to? :write
568
+ return @api_client.call_api(
569
+ :GET,
570
+ path,
571
+ endpoint,
572
+ header_params: header_params,
573
+ query_params: query_params,
574
+ body: post_body,
575
+ return_type: 'Stream',
576
+ &proc { |chunk, response| opts[:response_target].write(chunk) }
577
+ )
578
+ elsif opts[:response_target].is_a?(String)
579
+ open(opts[:response_target], 'wb') do |output|
580
+ return @api_client.call_api(
581
+ :GET,
582
+ path,
583
+ endpoint,
584
+ header_params: header_params,
585
+ query_params: query_params,
586
+ body: post_body,
587
+ return_type: 'Stream',
588
+ &proc { |chunk, response| output.write(chunk) }
589
+ )
590
+ end
591
+ end
592
+ else
593
+ return @api_client.call_api(
594
+ :GET,
595
+ path,
596
+ endpoint,
597
+ header_params:header_params,
598
+ query_params: query_params,
599
+ body: post_body,
600
+ return_type: 'String'
601
+ )
602
+ end
603
+ end
604
+
605
+ # Get the bucket level pre-authenticateted request
606
+ # @param [String] namespace_name The top-level namespace used for the request.
607
+ # @param [String] bucket_name The name of the bucket.
608
+ #
609
+ # Example: `my-new-bucket1`
610
+ #
611
+ # @param [String] par_id The unique identifier for the pre-authenticated request (PAR). This can be used to manage the PAR
612
+ # such as GET or DELETE the PAR
613
+ #
614
+ # @param [Hash] opts the optional parameters
615
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
616
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::PreauthenticatedRequestSummary
617
+ def get_preauthenticated_request(namespace_name, bucket_name, par_id, opts = {})
618
+ logger.debug "Calling operation ObjectStorageClient#get_preauthenticated_request." if logger
619
+
620
+ fail "Missing the required parameter 'namespace_name' when calling get_preauthenticated_request." if namespace_name.nil?
621
+ fail "Missing the required parameter 'bucket_name' when calling get_preauthenticated_request." if bucket_name.nil?
622
+ fail "Missing the required parameter 'par_id' when calling get_preauthenticated_request." if par_id.nil?
623
+
624
+ path = "/n/{namespaceName}/b/{bucketName}/p/{parId}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{parId}', par_id.to_s)
625
+
626
+ # Query Params
627
+ query_params = {}
628
+
629
+ # Header Params
630
+ header_params = {}
631
+ header_params['accept'] = 'application/json'
632
+ header_params['content-type'] = 'application/json'
633
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
634
+
635
+ post_body = nil
636
+
637
+ return @api_client.call_api(
638
+ :GET,
639
+ path,
640
+ endpoint,
641
+ :header_params => header_params,
642
+ :query_params => query_params,
643
+ :body => post_body,
644
+ :return_type => 'OCI::ObjectStorage::Models::PreauthenticatedRequestSummary')
645
+ end
646
+
647
+ # Efficiently checks if a bucket exists and gets the current ETag for the bucket.
648
+ #
649
+ # @param [String] namespace_name The top-level namespace used for the request.
650
+ # @param [String] bucket_name The name of the bucket.
651
+ #
652
+ # Example: `my-new-bucket1`
653
+ #
654
+ # @param [Hash] opts the optional parameters
655
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
656
+ # For uploading a part, this is the entity tag of the target part.
657
+ #
658
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
659
+ # 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
660
+ # of the target part.
661
+ #
662
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
663
+ # @return [Response] A Response object with data of type nil
664
+ def head_bucket(namespace_name, bucket_name, opts = {})
665
+ logger.debug "Calling operation ObjectStorageClient#head_bucket." if logger
666
+
667
+ fail "Missing the required parameter 'namespace_name' when calling head_bucket." if namespace_name.nil?
668
+ fail "Missing the required parameter 'bucket_name' when calling head_bucket." if bucket_name.nil?
669
+
670
+ path = "/n/{namespaceName}/b/{bucketName}/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
671
+
672
+ # Query Params
673
+ query_params = {}
674
+
675
+ # Header Params
676
+ header_params = {}
677
+ header_params['accept'] = 'application/json'
678
+ header_params['content-type'] = 'application/json'
679
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
680
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
681
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
682
+
683
+ post_body = nil
684
+
685
+ return @api_client.call_api(
686
+ :HEAD,
687
+ path,
688
+ endpoint,
689
+ :header_params => header_params,
690
+ :query_params => query_params,
691
+ :body => post_body)
692
+ end
693
+
694
+ # Gets the user-defined metadata and entity tag for an object.
695
+ #
696
+ # @param [String] namespace_name The top-level namespace used for the request.
697
+ # @param [String] bucket_name The name of the bucket.
698
+ #
699
+ # Example: `my-new-bucket1`
700
+ #
701
+ # @param [String] object_name The name of the object.
702
+ #
703
+ # Example: `test/object1.log`
704
+ #
705
+ # @param [Hash] opts the optional parameters
706
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
707
+ # For uploading a part, this is the entity tag of the target part.
708
+ #
709
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
710
+ # 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
711
+ # of the target part.
712
+ #
713
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
714
+ # @return [Response] A Response object with data of type nil
715
+ def head_object(namespace_name, bucket_name, object_name, opts = {})
716
+ logger.debug "Calling operation ObjectStorageClient#head_object." if logger
717
+
718
+ fail "Missing the required parameter 'namespace_name' when calling head_object." if namespace_name.nil?
719
+ fail "Missing the required parameter 'bucket_name' when calling head_object." if bucket_name.nil?
720
+ fail "Missing the required parameter 'object_name' when calling head_object." if object_name.nil?
721
+
722
+ path = "/n/{namespaceName}/b/{bucketName}/o/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
723
+
724
+ # Query Params
725
+ query_params = {}
726
+
727
+ # Header Params
728
+ header_params = {}
729
+ header_params['accept'] = 'application/json'
730
+ header_params['content-type'] = 'application/json'
731
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
732
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
733
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
734
+
735
+ post_body = nil
736
+
737
+ return @api_client.call_api(
738
+ :HEAD,
739
+ path,
740
+ endpoint,
741
+ :header_params => header_params,
742
+ :query_params => query_params,
743
+ :body => post_body)
744
+ end
745
+
746
+ # Gets a list of all `BucketSummary`s in a compartment. A `BucketSummary` contains only summary fields for the bucket
747
+ # and does not contain fields like the user-defined metadata.
748
+ #
749
+ # To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized,
750
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
751
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
752
+ #
753
+ # @param [String] namespace_name The top-level namespace used for the request.
754
+ # @param [String] compartment_id The ID of the compartment in which to create the bucket.
755
+ # @param [Hash] opts the optional parameters
756
+ # @option opts [Integer] :limit The maximum number of items to return.
757
+ # @option opts [String] :page The page at which to start retrieving results.
758
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
759
+ # @return [Response] A Response object with data of type Array<OCI::ObjectStorage::Models::BucketSummary>
760
+ def list_buckets(namespace_name, compartment_id, opts = {})
761
+ logger.debug "Calling operation ObjectStorageClient#list_buckets." if logger
762
+
763
+ fail "Missing the required parameter 'namespace_name' when calling list_buckets." if namespace_name.nil?
764
+ fail "Missing the required parameter 'compartment_id' when calling list_buckets." if compartment_id.nil?
765
+
766
+ path = "/n/{namespaceName}/b/".sub('{namespaceName}', namespace_name.to_s)
767
+
768
+ # Query Params
769
+ query_params = {}
770
+ query_params[:'compartmentId'] = compartment_id
771
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
772
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
773
+
774
+ # Header Params
775
+ header_params = {}
776
+ header_params['accept'] = 'application/json'
777
+ header_params['content-type'] = 'application/json'
778
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
779
+
780
+ post_body = nil
781
+
782
+ return @api_client.call_api(
783
+ :GET,
784
+ path,
785
+ endpoint,
786
+ :header_params => header_params,
787
+ :query_params => query_params,
788
+ :body => post_body,
789
+ :return_type => 'Array<OCI::ObjectStorage::Models::BucketSummary>')
790
+ end
791
+
792
+ # Lists the parts of an in-progress multipart upload.
793
+ #
794
+ # @param [String] namespace_name The top-level namespace used for the request.
795
+ # @param [String] bucket_name The name of the bucket.
796
+ #
797
+ # Example: `my-new-bucket1`
798
+ #
799
+ # @param [String] object_name The name of the object.
800
+ #
801
+ # Example: `test/object1.log`
802
+ #
803
+ # @param [String] upload_id The upload ID for a multipart upload.
804
+ # @param [Hash] opts the optional parameters
805
+ # @option opts [Integer] :limit The maximum number of items to return.
806
+ # @option opts [String] :page The page at which to start retrieving results.
807
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
808
+ # @return [Response] A Response object with data of type Array<OCI::ObjectStorage::Models::MultipartUploadPartSummary>
809
+ def list_multipart_upload_parts(namespace_name, bucket_name, object_name, upload_id, opts = {})
810
+ logger.debug "Calling operation ObjectStorageClient#list_multipart_upload_parts." if logger
811
+
812
+ fail "Missing the required parameter 'namespace_name' when calling list_multipart_upload_parts." if namespace_name.nil?
813
+ fail "Missing the required parameter 'bucket_name' when calling list_multipart_upload_parts." if bucket_name.nil?
814
+ fail "Missing the required parameter 'object_name' when calling list_multipart_upload_parts." if object_name.nil?
815
+ fail "Missing the required parameter 'upload_id' when calling list_multipart_upload_parts." if upload_id.nil?
816
+
817
+ path = "/n/{namespaceName}/b/{bucketName}/u/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
818
+
819
+ # Query Params
820
+ query_params = {}
821
+ query_params[:'uploadId'] = upload_id
822
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
823
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
824
+
825
+ # Header Params
826
+ header_params = {}
827
+ header_params['accept'] = 'application/json'
828
+ header_params['content-type'] = 'application/json'
829
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
830
+
831
+ post_body = nil
832
+
833
+ return @api_client.call_api(
834
+ :GET,
835
+ path,
836
+ endpoint,
837
+ :header_params => header_params,
838
+ :query_params => query_params,
839
+ :body => post_body,
840
+ :return_type => 'Array<OCI::ObjectStorage::Models::MultipartUploadPartSummary>')
841
+ end
842
+
843
+ # Lists all in-progress multipart uploads for the given bucket in the given namespace.
844
+ #
845
+ # @param [String] namespace_name The top-level namespace used for the request.
846
+ # @param [String] bucket_name The name of the bucket.
847
+ #
848
+ # Example: `my-new-bucket1`
849
+ #
850
+ # @param [Hash] opts the optional parameters
851
+ # @option opts [Integer] :limit The maximum number of items to return.
852
+ # @option opts [String] :page The page at which to start retrieving results.
853
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
854
+ # @return [Response] A Response object with data of type Array<OCI::ObjectStorage::Models::MultipartUpload>
855
+ def list_multipart_uploads(namespace_name, bucket_name, opts = {})
856
+ logger.debug "Calling operation ObjectStorageClient#list_multipart_uploads." if logger
857
+
858
+ fail "Missing the required parameter 'namespace_name' when calling list_multipart_uploads." if namespace_name.nil?
859
+ fail "Missing the required parameter 'bucket_name' when calling list_multipart_uploads." if bucket_name.nil?
860
+
861
+ path = "/n/{namespaceName}/b/{bucketName}/u".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
862
+
863
+ # Query Params
864
+ query_params = {}
865
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
866
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
867
+
868
+ # Header Params
869
+ header_params = {}
870
+ header_params['accept'] = 'application/json'
871
+ header_params['content-type'] = 'application/json'
872
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
873
+
874
+ post_body = nil
875
+
876
+ return @api_client.call_api(
877
+ :GET,
878
+ path,
879
+ endpoint,
880
+ :header_params => header_params,
881
+ :query_params => query_params,
882
+ :body => post_body,
883
+ :return_type => 'Array<OCI::ObjectStorage::Models::MultipartUpload>')
884
+ end
885
+
886
+ # Lists the objects in a bucket.
887
+ #
888
+ # To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized,
889
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
890
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
891
+ #
892
+ # @param [String] namespace_name The top-level namespace used for the request.
893
+ # @param [String] bucket_name The name of the bucket.
894
+ #
895
+ # Example: `my-new-bucket1`
896
+ #
897
+ # @param [Hash] opts the optional parameters
898
+ # @option opts [String] :prefix The string to use for matching against the start of object names in a list query.
899
+ # @option opts [String] :start Object names returned by a list query must be greater or equal to this parameter.
900
+ # @option opts [String] :_end Object names returned by a list query must be strictly less than this parameter.
901
+ # @option opts [Integer] :limit The maximum number of items to return.
902
+ # @option opts [String] :delimiter When this parameter is set, only objects whose names do not contain the delimiter character
903
+ # (after an optionally specified prefix) are returned. Scanned objects whose names contain the
904
+ # delimiter have part of their name up to the last occurrence of the delimiter (after the optional
905
+ # prefix) returned as a set of prefixes. Note that only '/' is a supported delimiter character at
906
+ # this time.
907
+ #
908
+ # @option opts [String] :fields Object summary in list of objects includes the 'name' field. This parameter can also include 'size'
909
+ # (object size in bytes), 'md5', and 'timeCreated' (object creation date and time) fields.
910
+ # Value of this parameter should be a comma-separated, case-insensitive list of those field names.
911
+ # For example 'name,timeCreated,md5'.
912
+ #
913
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
914
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::ListObjects
915
+ def list_objects(namespace_name, bucket_name, opts = {})
916
+ logger.debug "Calling operation ObjectStorageClient#list_objects." if logger
917
+
918
+ fail "Missing the required parameter 'namespace_name' when calling list_objects." if namespace_name.nil?
919
+ fail "Missing the required parameter 'bucket_name' when calling list_objects." if bucket_name.nil?
920
+
921
+ if opts[:'fields'] && !['name', 'size', 'timeCreated', 'md5'].include?(opts[:'fields'])
922
+ fail 'Invalid value for "fields", must be one of name, size, timeCreated, md5.'
923
+ end
924
+
925
+ path = "/n/{namespaceName}/b/{bucketName}/o".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
926
+
927
+ # Query Params
928
+ query_params = {}
929
+ query_params[:'prefix'] = opts[:'prefix'] if opts[:'prefix']
930
+ query_params[:'start'] = opts[:'start'] if opts[:'start']
931
+ query_params[:'end'] = opts[:'_end'] if opts[:'_end']
932
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
933
+ query_params[:'delimiter'] = opts[:'delimiter'] if opts[:'delimiter']
934
+ query_params[:'fields'] = opts[:'fields'] if opts[:'fields']
935
+
936
+ # Header Params
937
+ header_params = {}
938
+ header_params['accept'] = 'application/json'
939
+ header_params['content-type'] = 'application/json'
940
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
941
+
942
+ post_body = nil
943
+
944
+ return @api_client.call_api(
945
+ :GET,
946
+ path,
947
+ endpoint,
948
+ :header_params => header_params,
949
+ :query_params => query_params,
950
+ :body => post_body,
951
+ :return_type => 'OCI::ObjectStorage::Models::ListObjects')
952
+ end
953
+
954
+ # List pre-authenticated requests for the bucket
955
+ #
956
+ # @param [String] namespace_name The top-level namespace used for the request.
957
+ # @param [String] bucket_name The name of the bucket.
958
+ #
959
+ # Example: `my-new-bucket1`
960
+ #
961
+ # @param [Hash] opts the optional parameters
962
+ # @option opts [String] :object_name_prefix Pre-authenticated requests returned by the list must have object names starting with prefix
963
+ # @option opts [Integer] :limit The maximum number of items to return.
964
+ # @option opts [String] :page The page at which to start retrieving results.
965
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
966
+ # @return [Response] A Response object with data of type Array<OCI::ObjectStorage::Models::PreauthenticatedRequestSummary>
967
+ def list_preauthenticated_requests(namespace_name, bucket_name, opts = {})
968
+ logger.debug "Calling operation ObjectStorageClient#list_preauthenticated_requests." if logger
969
+
970
+ fail "Missing the required parameter 'namespace_name' when calling list_preauthenticated_requests." if namespace_name.nil?
971
+ fail "Missing the required parameter 'bucket_name' when calling list_preauthenticated_requests." if bucket_name.nil?
972
+
973
+ path = "/n/{namespaceName}/b/{bucketName}/p/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
974
+
975
+ # Query Params
976
+ query_params = {}
977
+ query_params[:'objectNamePrefix'] = opts[:'object_name_prefix'] if opts[:'object_name_prefix']
978
+ query_params[:'limit'] = opts[:'limit'] if opts[:'limit']
979
+ query_params[:'page'] = opts[:'page'] if opts[:'page']
980
+
981
+ # Header Params
982
+ header_params = {}
983
+ header_params['accept'] = 'application/json'
984
+ header_params['content-type'] = 'application/json'
985
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
986
+
987
+ post_body = nil
988
+
989
+ return @api_client.call_api(
990
+ :GET,
991
+ path,
992
+ endpoint,
993
+ :header_params => header_params,
994
+ :query_params => query_params,
995
+ :body => post_body,
996
+ :return_type => 'Array<OCI::ObjectStorage::Models::PreauthenticatedRequestSummary>')
997
+ end
998
+
999
+ # Creates a new object or overwrites an existing one.
1000
+ #
1001
+ # To use this and other API operations, you must be authorized in an IAM policy. If you're not authorized,
1002
+ # talk to an administrator. If you're an administrator who needs to write policies to give users access, see
1003
+ # [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm).
1004
+ #
1005
+ # @param [String] namespace_name The top-level namespace used for the request.
1006
+ # @param [String] bucket_name The name of the bucket.
1007
+ #
1008
+ # Example: `my-new-bucket1`
1009
+ #
1010
+ # @param [String] object_name The name of the object.
1011
+ #
1012
+ # Example: `test/object1.log`
1013
+ #
1014
+ # @param [String, IO] put_object_body The object to upload to the object store.
1015
+ # @param [Hash] opts the optional parameters
1016
+ # @option opts [Integer] :content_length The content length of the body.
1017
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
1018
+ # For uploading a part, this is the entity tag of the target part.
1019
+ #
1020
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
1021
+ # 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
1022
+ # of the target part.
1023
+ #
1024
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
1025
+ # @option opts [String] :expect 100-continue (default to 100-continue)
1026
+ # @option opts [String] :content_md5 The base-64 encoded MD5 hash of the body.
1027
+ # @option opts [String] :content_type The content type of the object. Defaults to 'application/octet-stream' if not overridden during the PutObject call.
1028
+ # @option opts [String] :content_language The content language of the object.
1029
+ # @option opts [String] :content_encoding The content encoding of the object.
1030
+ # @option opts [dict(str, str)] :opc_meta Optional user-defined metadata key and value.
1031
+ # @return [Response] A Response object with data of type nil
1032
+ def put_object(namespace_name, bucket_name, object_name, put_object_body, opts = {})
1033
+ logger.debug "Calling operation ObjectStorageClient#put_object." if logger
1034
+
1035
+ fail "Missing the required parameter 'namespace_name' when calling put_object." if namespace_name.nil?
1036
+ fail "Missing the required parameter 'bucket_name' when calling put_object." if bucket_name.nil?
1037
+ fail "Missing the required parameter 'object_name' when calling put_object." if object_name.nil?
1038
+ fail "Missing the required parameter 'put_object_body' when calling put_object." if put_object_body.nil?
1039
+
1040
+ path = "/n/{namespaceName}/b/{bucketName}/o/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
1041
+
1042
+ # Query Params
1043
+ query_params = {}
1044
+
1045
+ # Header Params
1046
+ header_params = {}
1047
+ header_params['accept'] = 'application/json'
1048
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
1049
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
1050
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
1051
+ header_params[:'Expect'] = opts[:'expect'] if opts[:'expect']
1052
+ header_params[:'Content-Length'] = opts[:'content_length'] if opts[:'content_length']
1053
+ header_params[:'Content-MD5'] = opts[:'content_md5'] if opts[:'content_md5']
1054
+ header_params[:'Content-Type'] = opts[:'content_type'] if opts[:'content_type']
1055
+ header_params[:'Content-Language'] = opts[:'content_language'] if opts[:'content_language']
1056
+ header_params[:'Content-Encoding'] = opts[:'content_encoding'] if opts[:'content_encoding']
1057
+
1058
+ if opts[:opc_meta]
1059
+ opts[:opc_meta].each do |key, value|
1060
+ header_params["opc-meta-#{key}".to_sym] = value
1061
+ end
1062
+ end
1063
+
1064
+ post_body = @api_client.object_to_http_body(put_object_body)
1065
+
1066
+ return @api_client.call_api(
1067
+ :PUT,
1068
+ path,
1069
+ endpoint,
1070
+ :header_params => header_params,
1071
+ :query_params => query_params,
1072
+ :body => post_body)
1073
+ end
1074
+
1075
+ # Performs a partial or full update of a bucket's user-defined metadata.
1076
+ #
1077
+ # @param [String] namespace_name The top-level namespace used for the request.
1078
+ # @param [String] bucket_name The name of the bucket.
1079
+ #
1080
+ # Example: `my-new-bucket1`
1081
+ #
1082
+ # @param [UpdateBucketDetails] update_bucket_details Request object for updating a bucket.
1083
+ # @param [Hash] opts the optional parameters
1084
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
1085
+ # For uploading a part, this is the entity tag of the target part.
1086
+ #
1087
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
1088
+ # @return [Response] A Response object with data of type OCI::ObjectStorage::Models::Bucket
1089
+ def update_bucket(namespace_name, bucket_name, update_bucket_details, opts = {})
1090
+ logger.debug "Calling operation ObjectStorageClient#update_bucket." if logger
1091
+
1092
+ fail "Missing the required parameter 'namespace_name' when calling update_bucket." if namespace_name.nil?
1093
+ fail "Missing the required parameter 'bucket_name' when calling update_bucket." if bucket_name.nil?
1094
+ fail "Missing the required parameter 'update_bucket_details' when calling update_bucket." if update_bucket_details.nil?
1095
+
1096
+ path = "/n/{namespaceName}/b/{bucketName}/".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s)
1097
+
1098
+ # Query Params
1099
+ query_params = {}
1100
+
1101
+ # Header Params
1102
+ header_params = {}
1103
+ header_params['accept'] = 'application/json'
1104
+ header_params['content-type'] = 'application/json'
1105
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
1106
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
1107
+
1108
+ post_body = @api_client.object_to_http_body(update_bucket_details)
1109
+
1110
+ return @api_client.call_api(
1111
+ :POST,
1112
+ path,
1113
+ endpoint,
1114
+ :header_params => header_params,
1115
+ :query_params => query_params,
1116
+ :body => post_body,
1117
+ :return_type => 'OCI::ObjectStorage::Models::Bucket')
1118
+ end
1119
+
1120
+ # Uploads a single part of a multipart upload.
1121
+ #
1122
+ # @param [String] namespace_name The top-level namespace used for the request.
1123
+ # @param [String] bucket_name The name of the bucket.
1124
+ #
1125
+ # Example: `my-new-bucket1`
1126
+ #
1127
+ # @param [String] object_name The name of the object.
1128
+ #
1129
+ # Example: `test/object1.log`
1130
+ #
1131
+ # @param [String] upload_id The upload ID for a multipart upload.
1132
+ # @param [Integer] upload_part_num The part number that identifies the object part currently being uploaded.
1133
+ # @param [String, IO] upload_part_body The part being uploaded to the Object Storage Service.
1134
+ # @param [Hash] opts the optional parameters
1135
+ # @option opts [Integer] :content_length The content length of the body.
1136
+ # @option opts [String] :opc_client_request_id The client request ID for tracing.
1137
+ # @option opts [String] :if_match The entity tag to match. For creating and committing a multipart upload to an object, this is the entity tag of the target object.
1138
+ # For uploading a part, this is the entity tag of the target part.
1139
+ #
1140
+ # @option opts [String] :if_none_match The entity tag to avoid matching. The only valid value is \u2018*\u2019, which indicates that the request should fail if the object already exists.
1141
+ # 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
1142
+ # of the target part.
1143
+ #
1144
+ # @option opts [String] :expect 100-continue (default to 100-continue)
1145
+ # @option opts [String] :content_md5 The base-64 encoded MD5 hash of the body.
1146
+ # @return [Response] A Response object with data of type nil
1147
+ def upload_part(namespace_name, bucket_name, object_name, upload_id, upload_part_num, upload_part_body, opts = {})
1148
+ logger.debug "Calling operation ObjectStorageClient#upload_part." if logger
1149
+
1150
+ fail "Missing the required parameter 'namespace_name' when calling upload_part." if namespace_name.nil?
1151
+ fail "Missing the required parameter 'bucket_name' when calling upload_part." if bucket_name.nil?
1152
+ fail "Missing the required parameter 'object_name' when calling upload_part." if object_name.nil?
1153
+ fail "Missing the required parameter 'upload_id' when calling upload_part." if upload_id.nil?
1154
+ fail "Missing the required parameter 'upload_part_num' when calling upload_part." if upload_part_num.nil?
1155
+ fail "Missing the required parameter 'upload_part_body' when calling upload_part." if upload_part_body.nil?
1156
+
1157
+ path = "/n/{namespaceName}/b/{bucketName}/u/{objectName}".sub('{namespaceName}', namespace_name.to_s).sub('{bucketName}', bucket_name.to_s).sub('{objectName}', object_name.to_s)
1158
+
1159
+ # Query Params
1160
+ query_params = {}
1161
+ query_params[:'uploadId'] = upload_id
1162
+ query_params[:'uploadPartNum'] = upload_part_num
1163
+
1164
+ # Header Params
1165
+ header_params = {}
1166
+ header_params['accept'] = 'application/json'
1167
+ header_params[:'opc-client-request-id'] = opts[:'opc_client_request_id'] if opts[:'opc_client_request_id']
1168
+ header_params[:'if-match'] = opts[:'if_match'] if opts[:'if_match']
1169
+ header_params[:'if-none-match'] = opts[:'if_none_match'] if opts[:'if_none_match']
1170
+ header_params[:'Expect'] = opts[:'expect'] if opts[:'expect']
1171
+ header_params[:'Content-Length'] = opts[:'content_length'] if opts[:'content_length']
1172
+ header_params[:'Content-MD5'] = opts[:'content_md5'] if opts[:'content_md5']
1173
+
1174
+ post_body = @api_client.object_to_http_body(upload_part_body)
1175
+
1176
+ return @api_client.call_api(
1177
+ :PUT,
1178
+ path,
1179
+ endpoint,
1180
+ :header_params => header_params,
1181
+ :query_params => query_params,
1182
+ :body => post_body)
1183
+ end
1184
+ end
1185
+ end