Class: Vultr::ObjectStorageResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/vultr/resources/object_storage.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Vultr::Resource

Instance Method Details

#create(**attributes) ⇒ Object



8
9
10
# File 'lib/vultr/resources/object_storage.rb', line 8

def create(**attributes)
  ObjectStorage.new post_request("object-storage", body: attributes).body.dig("object_storage")
end

#delete(object_storage_id:) ⇒ Object



20
21
22
# File 'lib/vultr/resources/object_storage.rb', line 20

def delete(object_storage_id:)
  delete_request("object-storage/#{object_storage_id}")
end

#list(**params) ⇒ Object



3
4
5
6
# File 'lib/vultr/resources/object_storage.rb', line 3

def list(**params)
  response = get_request("object-storage", params: params)
  Collection.from_response(response, key: "object_storages", type: ObjectStorage)
end

#list_clusters(**params) ⇒ Object



28
29
30
31
# File 'lib/vultr/resources/object_storage.rb', line 28

def list_clusters(**params)
  response = get_request("object-storage/clusters", params: params)
  Collection.from_response(response, key: "clusters", type: Object)
end

#regenerate_keys(object_storage_id:) ⇒ Object



24
25
26
# File 'lib/vultr/resources/object_storage.rb', line 24

def regenerate_keys(object_storage_id:)
  Object.new post_request("object-storage/#{object_storage_id}/regenerate-keys", body: {}).body
end

#retrieve(object_storage_id:) ⇒ Object



12
13
14
# File 'lib/vultr/resources/object_storage.rb', line 12

def retrieve(object_storage_id:)
  ObjectStorage.new get_request("object-storage/#{object_storage_id}").body.dig("object_storage")
end

#update(object_storage_id:, **attributes) ⇒ Object



16
17
18
# File 'lib/vultr/resources/object_storage.rb', line 16

def update(object_storage_id:, **attributes)
  put_request("object-storage/#{object_storage_id}", body: attributes)
end