Class: OpenC3::Bucket

Inherits:
Object show all
Defined in:
lib/openc3/utilities/bucket.rb

Direct Known Subclasses

AwsBucket

Defined Under Namespace

Classes: NotFound

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBucket

Returns a new instance of Bucket.



36
37
38
# File 'lib/openc3/utilities/bucket.rb', line 36

def initialize
  # Setup the client instance
end

Class Method Details

.getClientObject



28
29
30
31
32
33
34
# File 'lib/openc3/utilities/bucket.rb', line 28

def self.getClient
  raise 'OPENC3_CLOUD environment variable is required' unless ENV['OPENC3_CLOUD']
  # Base is AwsBucket which works with MINIO, Enterprise implements additional
  bucket_class = ENV['OPENC3_CLOUD'].capitalize + 'Bucket'
  klass = OpenC3.require_class('openc3/utilities/'+bucket_class.class_name_to_filename)
  klass.new
end

Instance Method Details

#check_object(bucket:, key:, retries: true) ⇒ Object

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/openc3/utilities/bucket.rb', line 72

def check_object(bucket:, key:, retries: true)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#create(bucket) ⇒ Object

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/openc3/utilities/bucket.rb', line 40

def create(bucket)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#delete(bucket) ⇒ Object

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/openc3/utilities/bucket.rb', line 52

def delete(bucket)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#delete_object(bucket:, key:) ⇒ Object

Raises:

  • (NotImplementedError)


76
77
78
# File 'lib/openc3/utilities/bucket.rb', line 76

def delete_object(bucket:, key:)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#delete_objects(bucket:, keys:) ⇒ Object

Raises:

  • (NotImplementedError)


80
81
82
# File 'lib/openc3/utilities/bucket.rb', line 80

def delete_objects(bucket:, keys:)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#ensure_public(bucket) ⇒ Object

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/openc3/utilities/bucket.rb', line 44

def ensure_public(bucket)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#exist?(bucket) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/openc3/utilities/bucket.rb', line 48

def exist?(bucket)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#get_object(bucket:, key:, path: nil) ⇒ Object

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/openc3/utilities/bucket.rb', line 56

def get_object(bucket:, key:, path: nil)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#list_files(bucket:, path:, only_directories: false, metadata: false) ⇒ Object

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/openc3/utilities/bucket.rb', line 64

def list_files(bucket:, path:, only_directories: false, metadata: false)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#list_objects(bucket:, prefix: nil, max_request: nil, max_total: nil) ⇒ Object

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/openc3/utilities/bucket.rb', line 60

def list_objects(bucket:, prefix: nil, max_request: nil, max_total: nil)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#presigned_request(bucket:, key:, method:, internal: true) ⇒ Object

Raises:

  • (NotImplementedError)


84
85
86
# File 'lib/openc3/utilities/bucket.rb', line 84

def presigned_request(bucket:, key:, method:, internal: true)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#put_object(bucket:, key:, body:, content_type: nil, cache_control: nil, metadata: nil) ⇒ Object

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/openc3/utilities/bucket.rb', line 68

def put_object(bucket:, key:, body:, content_type: nil, cache_control: nil, metadata: nil)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end