Class: Vultr::BlockStorageResource
- Inherits:
-
Resource
- Object
- Resource
- Vultr::BlockStorageResource
show all
- Defined in:
- lib/vultr/resources/block_storage.rb
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#attach(block_id:) ⇒ Object
24
25
26
|
# File 'lib/vultr/resources/block_storage.rb', line 24
def attach(block_id:)
post_request("blocks/#{block_id}/attach", body: {})
end
|
#create(**attributes) ⇒ Object
8
9
10
|
# File 'lib/vultr/resources/block_storage.rb', line 8
def create(**attributes)
BlockStorage.new post_request("blocks", body: attributes).body.dig("block")
end
|
#delete(block_id:) ⇒ Object
20
21
22
|
# File 'lib/vultr/resources/block_storage.rb', line 20
def delete(block_id:)
delete_request("blocks/#{block_id}")
end
|
#detach(block_id:) ⇒ Object
28
29
30
|
# File 'lib/vultr/resources/block_storage.rb', line 28
def detach(block_id:)
post_request("blocks/#{block_id}/detach", body: {})
end
|
#list(**params) ⇒ Object
3
4
5
6
|
# File 'lib/vultr/resources/block_storage.rb', line 3
def list(**params)
response = get_request("blocks", params: params)
Collection.from_response(response, key: "blocks", type: BlockStorage)
end
|
#retrieve(block_id:) ⇒ Object
12
13
14
|
# File 'lib/vultr/resources/block_storage.rb', line 12
def retrieve(block_id:)
BlockStorage.new get_request("blocks/#{block_id}").body.dig("block")
end
|
#update(block_id:, **attributes) ⇒ Object
16
17
18
|
# File 'lib/vultr/resources/block_storage.rb', line 16
def update(block_id:, **attributes)
patch_request("blocks/#{block_id}", body: attributes)
end
|