Class: LinodeOpenapiClient::ImagesApi
- Inherits:
-
Object
- Object
- LinodeOpenapiClient::ImagesApi
- Defined in:
- lib/linode_openapi_client/api/images_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_image(api_version, image_id, opts = {}) ⇒ Object
Delete an image Deletes a private image you have permission to ‘read_write`.
-
#delete_image_with_http_info(api_version, image_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete an image Deletes a private image you have permission to `read_write`.
-
#get_image(api_version, image_id, opts = {}) ⇒ GetImage200Response
Get an image Get information about a single image.
-
#get_image_with_http_info(api_version, image_id, opts = {}) ⇒ Array<(GetImage200Response, Integer, Hash)>
Get an image Get information about a single image.
-
#get_images(api_version, opts = {}) ⇒ GetImages200Response
List images Returns a paginated list of images.
-
#get_images_with_http_info(api_version, opts = {}) ⇒ Array<(GetImages200Response, Integer, Hash)>
List images Returns a paginated list of images.
-
#initialize(api_client = ApiClient.default) ⇒ ImagesApi
constructor
A new instance of ImagesApi.
-
#post_image(api_version, opts = {}) ⇒ PostImage200Response
Create an image Captures a private, gold-master image from a Linode disk.
-
#post_image_with_http_info(api_version, opts = {}) ⇒ Array<(PostImage200Response, Integer, Hash)>
Create an image Captures a private, gold-master image from a Linode disk.
-
#post_replicate_image(api_version, image_id, post_replicate_image_request, opts = {}) ⇒ PostReplicateImage200Response
Replicate an image Target an existing image and replicate it to another compute region.
-
#post_replicate_image_with_http_info(api_version, image_id, post_replicate_image_request, opts = {}) ⇒ Array<(PostReplicateImage200Response, Integer, Hash)>
Replicate an image Target an existing image and replicate it to another compute region.
-
#post_upload_image(api_version, opts = {}) ⇒ PostUploadImage200Response
Upload an image Creates a new private image instance and returns a URL as the ‘upload_to` object in the response.
-
#post_upload_image_with_http_info(api_version, opts = {}) ⇒ Array<(PostUploadImage200Response, Integer, Hash)>
Upload an image Creates a new private image instance and returns a URL as the `upload_to` object in the response.
-
#put_image(api_version, image_id, put_image_request, opts = {}) ⇒ PutImage200Response
Update an image Updates a private image that you have permission to ‘read_write`.
-
#put_image_with_http_info(api_version, image_id, put_image_request, opts = {}) ⇒ Array<(PutImage200Response, Integer, Hash)>
Update an image Updates a private image that you have permission to `read_write`.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#delete_image(api_version, image_id, opts = {}) ⇒ Object
Delete an image Deletes a private image you have permission to ‘read_write`. > 🚧 > > You can’t undo this delete action. <<LB>> — - __CLI__. “‘ linode-cli images delete 12345 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
28 29 30 31 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 28 def delete_image(api_version, image_id, opts = {}) data, _status_code, _headers = delete_image_with_http_info(api_version, image_id, opts) data end |
#delete_image_with_http_info(api_version, image_id, opts = {}) ⇒ Array<(Object, Integer, Hash)>
Delete an image Deletes a private image you have permission to `read_write`. > 🚧 > > You can't undo this delete action. <<LB>> — - __CLI__. ``` linode-cli images delete 12345 ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_write ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 39 def delete_image_with_http_info(api_version, image_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.delete_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.delete_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # verify the required parameter 'image_id' is set if @api_client.config.client_side_validation && image_id.nil? fail ArgumentError, "Missing the required parameter 'image_id' when calling ImagesApi.delete_image" end # resource path local_var_path = '/{apiVersion}/images/{imageId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'imageId' + '}', CGI.escape(image_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Object' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.delete_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#delete_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_image(api_version, image_id, opts = {}) ⇒ GetImage200Response
Get an image Get information about a single image. An image can be one of two types: - **Public image**. The ‘id` for these images begins with `linode/`. These images are generally available to all users. To limit the response to public images, don’t include [authentication](techdocs.akamai.com/linode-api/reference/get-started#authentication) when calling this operation. - **Private image**. The ‘id` for these images begins with `private/`. These images are account-specific and only accessible to users with appropriate [grants](techdocs.akamai.com/linode-api/reference/get-user-grants). To view private images, you need to include authentication when calling this operation. The response will also include public images. <<LB>> — - __CLI__. “` linode-cli images view linode/debian9 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_only “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
102 103 104 105 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 102 def get_image(api_version, image_id, opts = {}) data, _status_code, _headers = get_image_with_http_info(api_version, image_id, opts) data end |
#get_image_with_http_info(api_version, image_id, opts = {}) ⇒ Array<(GetImage200Response, Integer, Hash)>
Get an image Get information about a single image. An image can be one of two types: - **Public image**. The `id` for these images begins with `linode/`. These images are generally available to all users. To limit the response to public images, don't include [authentication](techdocs.akamai.com/linode-api/reference/get-started#authentication) when calling this operation. - **Private image**. The `id` for these images begins with `private/`. These images are account-specific and only accessible to users with appropriate [grants](techdocs.akamai.com/linode-api/reference/get-user-grants). To view private images, you need to include authentication when calling this operation. The response will also include public images. <<LB>> — - __CLI__. ``` linode-cli images view linode/debian9 ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_only ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 113 def get_image_with_http_info(api_version, image_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.get_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.get_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # verify the required parameter 'image_id' is set if @api_client.config.client_side_validation && image_id.nil? fail ArgumentError, "Missing the required parameter 'image_id' when calling ImagesApi.get_image" end # resource path local_var_path = '/{apiVersion}/images/{imageId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'imageId' + '}', CGI.escape(image_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetImage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.get_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#get_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_images(api_version, opts = {}) ⇒ GetImages200Response
List images Returns a paginated list of images. An image can be one of two types: - **Public image**. The ‘id` for these images begins with `linode/`. These images are generally available to all users. To limit the response to public images, don’t include [authentication](techdocs.akamai.com/linode-api/reference/get-started#authentication) when calling this operation. - **Private image**. The ‘id` for these images begins with `private/`. These images are account-specific and only accessible to users with appropriate [grants](techdocs.akamai.com/linode-api/reference/get-user-grants). To view private images, you need to include authentication when calling this operation. The response includes both private and public images. <<LB>> — - __CLI__. “` linode-cli images list “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_only “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
177 178 179 180 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 177 def get_images(api_version, opts = {}) data, _status_code, _headers = get_images_with_http_info(api_version, opts) data end |
#get_images_with_http_info(api_version, opts = {}) ⇒ Array<(GetImages200Response, Integer, Hash)>
List images Returns a paginated list of images. An image can be one of two types: - **Public image**. The `id` for these images begins with `linode/`. These images are generally available to all users. To limit the response to public images, don't include [authentication](techdocs.akamai.com/linode-api/reference/get-started#authentication) when calling this operation. - **Private image**. The `id` for these images begins with `private/`. These images are account-specific and only accessible to users with appropriate [grants](techdocs.akamai.com/linode-api/reference/get-user-grants). To view private images, you need to include authentication when calling this operation. The response includes both private and public images. <<LB>> — - __CLI__. ``` linode-cli images list ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_only ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 189 def get_images_with_http_info(api_version, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.get_images ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.get_images" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page'].nil? && opts[:'page'] < 1 fail ArgumentError, 'invalid value for "opts[:"page"]" when calling ImagesApi.get_images, must be greater than or equal to 1.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 500 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ImagesApi.get_images, must be smaller than or equal to 500.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 25 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ImagesApi.get_images, must be greater than or equal to 25.' end # resource path local_var_path = '/{apiVersion}/images'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetImages200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.get_images", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#get_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#post_image(api_version, opts = {}) ⇒ PostImage200Response
Create an image Captures a private, gold-master image from a Linode disk. > 📘 > > If you create an image from an encrypted disk, the API doesn’t encrypt the image. When you rebuild a compute instance from that image, the resulting disk will be automatically encrypted. <<LB>> — - __CLI__. “‘ linode-cli images create \ –label this_is_a_label \ –description "A longer description \ of the image" \ –disk_id 123 “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_write linodes:read_only “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
262 263 264 265 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 262 def post_image(api_version, opts = {}) data, _status_code, _headers = post_image_with_http_info(api_version, opts) data end |
#post_image_with_http_info(api_version, opts = {}) ⇒ Array<(PostImage200Response, Integer, Hash)>
Create an image Captures a private, gold-master image from a Linode disk. > 📘 > > If you create an image from an encrypted disk, the API doesn't encrypt the image. When you rebuild a compute instance from that image, the resulting disk will be automatically encrypted. <<LB>> — - __CLI__. ``` linode-cli images create \ –label this_is_a_label \ –description "A longer description \ of the image" \ –disk_id 123 ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_write linodes:read_only ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 273 def post_image_with_http_info(api_version, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.post_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.post_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # resource path local_var_path = '/{apiVersion}/images'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'post_image_request']) # return_type return_type = opts[:debug_return_type] || 'PostImage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.post_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#post_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#post_replicate_image(api_version, image_id, post_replicate_image_request, opts = {}) ⇒ PostReplicateImage200Response
Replicate an image Target an existing image and replicate it to another compute region. - To also keep the target image in its original compute region, you need to include that ‘region` in the request’s data. If you leave it out, the API removes the image from that region. Run the [Get an image](techdocs.akamai.com/linode-api/reference/get-image) operation to see the ‘regions` where an image currently exists. - You need to provide at least one region. You can’t include an empty array to delete all images. Use the [Delete an image](techdocs.akamai.com/linode-api/reference/delete-image) operation. - Only core compute regions can be used. Currently, distributed compute regions aren’t supported. <<LB>> — - __CLI__. “‘ linode-cli images replicate private/12345/regions \ –regions "us-iad" “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
338 339 340 341 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 338 def post_replicate_image(api_version, image_id, post_replicate_image_request, opts = {}) data, _status_code, _headers = post_replicate_image_with_http_info(api_version, image_id, post_replicate_image_request, opts) data end |
#post_replicate_image_with_http_info(api_version, image_id, post_replicate_image_request, opts = {}) ⇒ Array<(PostReplicateImage200Response, Integer, Hash)>
Replicate an image Target an existing image and replicate it to another compute region. - To also keep the target image in its original compute region, you need to include that `region` in the request's data. If you leave it out, the API removes the image from that region. Run the [Get an image](techdocs.akamai.com/linode-api/reference/get-image) operation to see the `regions` where an image currently exists. - You need to provide at least one region. You can't include an empty array to delete all images. Use the [Delete an image](techdocs.akamai.com/linode-api/reference/delete-image) operation. - Only core compute regions can be used. Currently, distributed compute regions aren't supported. <<LB>> — - __CLI__. ``` linode-cli images replicate private/12345/regions \ –regions "us-iad" ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_write ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 350 def post_replicate_image_with_http_info(api_version, image_id, post_replicate_image_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.post_replicate_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.post_replicate_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # verify the required parameter 'image_id' is set if @api_client.config.client_side_validation && image_id.nil? fail ArgumentError, "Missing the required parameter 'image_id' when calling ImagesApi.post_replicate_image" end # verify the required parameter 'post_replicate_image_request' is set if @api_client.config.client_side_validation && post_replicate_image_request.nil? fail ArgumentError, "Missing the required parameter 'post_replicate_image_request' when calling ImagesApi.post_replicate_image" end # resource path local_var_path = '/{apiVersion}/images/{imageId}/regions'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'imageId' + '}', CGI.escape(image_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(post_replicate_image_request) # return_type return_type = opts[:debug_return_type] || 'PostReplicateImage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.post_replicate_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#post_replicate_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#post_upload_image(api_version, opts = {}) ⇒ PostUploadImage200Response
Upload an image Creates a new private image instance and returns a URL as the ‘upload_to` object in the response. Use this URL to upload image data to that instance. - Ensure the disk is raw disk image (`.img`) format. - Compress it using gzip (`.gz`) format. The maximum compressed file size is 5GB. - Upload the file in a PUT request that includes the `Content-type: application/octet-stream` header. For example: “` curl -v \ -H "Content-Type: application/octet-stream" \ –upload-file example.img.gz \ $UPLOAD_URL \ –progress-bar \ –output /dev/null “` > 📘 > > - You need to upload image data within 24 hours of creation or the API cancels the upload and deletes the image. > > - If you create an image from an encrypted disk, the API doesn’t encrypt the image. When you rebuild a compute instance from that image, the resulting disk will be automatically encrypted. > > - You can create a new image and upload image data using a single process through [Cloud Manager](www.linode.com/docs/products/tools/images/guides/upload-an-image/#uploading-an-image-file-through-the-cloud-manager) or the [Linode CLI](www.linode.com/docs/products/tools/images/guides/upload-an-image/#uploading-an-image-file-through-the-linode-cli). <<LB>> — - __CLI__. “‘ # Upload the image file in a single step linode-cli image-upload \ –description "Optional details about the Image" \ –label "Example Image" \ –region us-east \ /path/to/image-file.img.gz # Returns the upload_to URL linode-cli images upload \ –description "Optional details about the Image" \ –label "Example Image" \ –region us-east “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
422 423 424 425 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 422 def post_upload_image(api_version, opts = {}) data, _status_code, _headers = post_upload_image_with_http_info(api_version, opts) data end |
#post_upload_image_with_http_info(api_version, opts = {}) ⇒ Array<(PostUploadImage200Response, Integer, Hash)>
Upload an image Creates a new private image instance and returns a URL as the `upload_to` object in the response. Use this URL to upload image data to that instance. - Ensure the disk is raw disk image (`.img`) format. - Compress it using gzip (`.gz`) format. The maximum compressed file size is 5GB. - Upload the file in a PUT request that includes the `Content-type: application/octet-stream` header. For example: ``` curl -v \ -H "Content-Type: application/octet-stream" \ –upload-file example.img.gz \ $UPLOAD_URL \ –progress-bar \ –output /dev/null ``` > 📘 > > - You need to upload image data within 24 hours of creation or the API cancels the upload and deletes the image. > > - If you create an image from an encrypted disk, the API doesn't encrypt the image. When you rebuild a compute instance from that image, the resulting disk will be automatically encrypted. > > - You can create a new image and upload image data using a single process through [Cloud Manager](www.linode.com/docs/products/tools/images/guides/upload-an-image/#uploading-an-image-file-through-the-cloud-manager) or the [Linode CLI](www.linode.com/docs/products/tools/images/guides/upload-an-image/#uploading-an-image-file-through-the-linode-cli). <<LB>> — - __CLI__. ``` # Upload the image file in a single step linode-cli image-upload \ –description "Optional details about the Image" \ –label "Example Image" \ –region us-east \ /path/to/image-file.img.gz # Returns the upload_to URL linode-cli images upload \ –description "Optional details about the Image" \ –label "Example Image" \ –region us-east ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_write ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 433 def post_upload_image_with_http_info(api_version, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.post_upload_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.post_upload_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # resource path local_var_path = '/{apiVersion}/images/upload'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'post_upload_image_request']) # return_type return_type = opts[:debug_return_type] || 'PostUploadImage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.post_upload_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#post_upload_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#put_image(api_version, image_id, put_image_request, opts = {}) ⇒ PutImage200Response
Update an image Updates a private image that you have permission to ‘read_write`. > 📘 > > You can’t update the ‘regions` with this operation. Use the [Replicate an image](techdocs.akamai.com/linode-api/reference/post-replicate-image) operation to modify the existing regions for your image. <<LB>> — - __CLI__. “` linode-cli images update private/12345 \ –label "My gold-master image" \ –description "The detailed description \ of my image." “` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. “` images:read_write “` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
498 499 500 501 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 498 def put_image(api_version, image_id, put_image_request, opts = {}) data, _status_code, _headers = put_image_with_http_info(api_version, image_id, put_image_request, opts) data end |
#put_image_with_http_info(api_version, image_id, put_image_request, opts = {}) ⇒ Array<(PutImage200Response, Integer, Hash)>
Update an image Updates a private image that you have permission to `read_write`. > 📘 > > You can't update the `regions` with this operation. Use the [Replicate an image](techdocs.akamai.com/linode-api/reference/post-replicate-image) operation to modify the existing regions for your image. <<LB>> — - __CLI__. ``` linode-cli images update private/12345 \ –label "My gold-master image" \ –description "The detailed description \ of my image." ``` [Learn more…](www.linode.com/docs/products/tools/cli/get-started/) - __OAuth scopes__. ``` images:read_write ``` [Learn more…](techdocs.akamai.com/linode-api/reference/get-started#oauth)
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 |
# File 'lib/linode_openapi_client/api/images_api.rb', line 510 def put_image_with_http_info(api_version, image_id, put_image_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ImagesApi.put_image ...' end # verify the required parameter 'api_version' is set if @api_client.config.client_side_validation && api_version.nil? fail ArgumentError, "Missing the required parameter 'api_version' when calling ImagesApi.put_image" end # verify enum value allowable_values = ["v4", "v4beta"] if @api_client.config.client_side_validation && !allowable_values.include?(api_version) fail ArgumentError, "invalid value for \"api_version\", must be one of #{allowable_values}" end # verify the required parameter 'image_id' is set if @api_client.config.client_side_validation && image_id.nil? fail ArgumentError, "Missing the required parameter 'image_id' when calling ImagesApi.put_image" end # verify the required parameter 'put_image_request' is set if @api_client.config.client_side_validation && put_image_request.nil? fail ArgumentError, "Missing the required parameter 'put_image_request' when calling ImagesApi.put_image" end # resource path local_var_path = '/{apiVersion}/images/{imageId}'.sub('{' + 'apiVersion' + '}', CGI.escape(api_version.to_s)).sub('{' + 'imageId' + '}', CGI.escape(image_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept'] # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(put_image_request) # return_type return_type = opts[:debug_return_type] || 'PutImage200Response' # auth_names auth_names = opts[:debug_auth_names] || ['personalAccessToken', 'oauth'] = opts.merge( :operation => :"ImagesApi.put_image", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: ImagesApi#put_image\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |