Class: Telnyx::Resources::Storage::Buckets

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/storage/buckets.rb,
lib/telnyx/resources/storage/buckets/usage.rb,
lib/telnyx/resources/storage/buckets/ssl_certificate.rb

Overview

Presigned object URL operations

Defined Under Namespace

Classes: SslCertificate, Usage

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Buckets

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 Buckets.

Parameters:



54
55
56
57
58
# File 'lib/telnyx/resources/storage/buckets.rb', line 54

def initialize(client:)
  @client = client
  @ssl_certificate = Telnyx::Resources::Storage::Buckets::SslCertificate.new(client: client)
  @usage = Telnyx::Resources::Storage::Buckets::Usage.new(client: client)
end

Instance Attribute Details

#ssl_certificateTelnyx::Resources::Storage::Buckets::SslCertificate (readonly)

SSL certificate operations



10
11
12
# File 'lib/telnyx/resources/storage/buckets.rb', line 10

def ssl_certificate
  @ssl_certificate
end

#usageTelnyx::Resources::Storage::Buckets::Usage (readonly)

Bucket Usage operations



14
15
16
# File 'lib/telnyx/resources/storage/buckets.rb', line 14

def usage
  @usage
end

Instance Method Details

#create_presigned_url(object_name, bucket_name:, ttl: nil, request_options: {}) ⇒ Telnyx::Models::Storage::BucketCreatePresignedURLResponse

Returns a timed and authenticated URL to download (GET) or upload (PUT) an object. This is the equivalent to AWS S3’s “presigned” URL. Please note that Telnyx performs authentication differently from AWS S3 and you MUST NOT use the presign method of AWS s3api CLI or SDK to generate the presigned URL.

Refer to: developers.telnyx.com/docs/cloud-storage/presigned-urls

Parameters:

  • object_name (String)

    Path param: The name of the object

  • bucket_name (String)

    Path param: The name of the bucket

  • ttl (Integer)

    Body param: The time to live of the token in seconds

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/telnyx/resources/storage/buckets.rb', line 36

def create_presigned_url(object_name, params)
  parsed, options = Telnyx::Storage::BucketCreatePresignedURLParams.dump_request(params)
  bucket_name =
    parsed.delete(:bucket_name) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["storage/buckets/%1$s/%2$s/presigned_url", bucket_name, object_name],
    body: parsed,
    model: Telnyx::Models::Storage::BucketCreatePresignedURLResponse,
    options: options
  )
end