Class: Vultr::SnapshotsResource
Instance Attribute Summary
Attributes inherited from Resource
#client
Instance Method Summary
collapse
Methods inherited from Resource
#initialize
Instance Method Details
#create(**attributes) ⇒ Object
8
9
10
|
# File 'lib/vultr/resources/snapshots.rb', line 8
def create(**attributes)
Snapshot.new post_request("snapshots", body: attributes).body.dig("snapshot")
end
|
#create_from_url(url) ⇒ Object
16
17
18
|
# File 'lib/vultr/resources/snapshots.rb', line 16
def create_from_url(url)
Snapshot.new post_request("snapshots/create-from-url", body: {url: url}).body.dig("snapshot")
end
|
#delete(snapshot_id:) ⇒ Object
24
25
26
|
# File 'lib/vultr/resources/snapshots.rb', line 24
def delete(snapshot_id:)
delete_request("snapshots/#{snapshot_id}")
end
|
#list(**params) ⇒ Object
3
4
5
6
|
# File 'lib/vultr/resources/snapshots.rb', line 3
def list(**params)
response = get_request("snapshots", params: params)
Collection.from_response(response, key: "snapshots", type: Snapshot)
end
|
#retrieve(snapshot_id:) ⇒ Object
12
13
14
|
# File 'lib/vultr/resources/snapshots.rb', line 12
def retrieve(snapshot_id:)
Snapshot.new get_request("snapshots/#{snapshot_id}").body.dig("snapshot")
end
|
#update(snapshot_id:, **attributes) ⇒ Object
20
21
22
|
# File 'lib/vultr/resources/snapshots.rb', line 20
def update(snapshot_id:, **attributes)
put_request("snapshots/#{snapshot_id}", body: attributes)
end
|