Class: Openlayer::Resources::Storage::PresignedURL

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/resources/storage/presigned_url.rb,
sig/openlayer/resources/storage/presigned_url.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PresignedURL

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of PresignedURL.

Parameters:



65
66
67
# File 'lib/openlayer/resources/storage/presigned_url.rb', line 65

def initialize(client:)
  @client = client
end

Instance Method Details

#create(object_name:, request_options: {}) ⇒ Openlayer::Models::Storage::PresignedURLCreateResponse

Retrieve a presigned url to post storage artifacts.

Parameters:

Returns:

See Also:



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/openlayer/resources/storage/presigned_url.rb', line 18

def create(params)
  parsed, options = Openlayer::Storage::PresignedURLCreateParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :post,
    path: "storage/presigned-url",
    query: query.transform_keys(object_name: "objectName"),
    model: Openlayer::Models::Storage::PresignedURLCreateResponse,
    options: options
  )
end

#retrieve(storage_uri:, request_options: {}) ⇒ Openlayer::Models::Storage::PresignedURLRetrieveResponse

Exchange a storageUri for a short-lived presigned url you can download the object from.

Use it to collect anything the platform stored on your behalf -- for example the archive a framework export leaves behind, whose storageUri comes back in the background task's outputs.

The workspace is taken from the API key, so there is nothing else to send. The url is only issued for objects your workspace owns, and 404 covers both "no such object" and "not yours".

Parameters:

Returns:

See Also:



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/openlayer/resources/storage/presigned_url.rb', line 50

def retrieve(params)
  parsed, options = Openlayer::Storage::PresignedURLRetrieveParams.dump_request(params)
  query = Openlayer::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "storage/presigned-url",
    query: query.transform_keys(storage_uri: "storageUri"),
    model: Openlayer::Models::Storage::PresignedURLRetrieveResponse,
    options: options
  )
end