Represents a storage box
List all storage boxes
HCloud::StorageBox.all
Search storage boxes
HCloud::StorageBox.where(name: "my_storage_box")
HCloud::StorageBox.where(label_selector: { environment: "production" })
Find storage box by ID
HCloud::StorageBox.find(1)
Create storage box
storage_box = HCloud::StorageBox.new(name: "my_storage_box", storage_box_type: "bx20", location: "fsn1", password: "my_password")
storage_box.create
storage_box.created?
firewall = HCloud::StorageBox.create(name: "my_storage_box", storage_box_type: "bx20", location: "fsn1", password: "my_password")
Update storage box
storage_box = HCloud::StorageBox.find(1)
storage_box.name = "another_storage_box"
storage_box.update
Delete storage box
storage_box = HCloud::StorageBox.find(1)
storage_box.delete
storage_box.deleted?
List storage box contents
storage_box = HCloud::StorageBox.find(1)
storage_box.contents
storage_box = HCloud::StorageBox.find(1)
storage_box.contents(folder: "photos")
Actions
List actions
actions = HCloud::StorageBox.find(1).actions
Sort actions
HCloud::StorageBox.find(1).actions.sort(finished: :desc)
HCloud::StorageBox.find(1).actions.sort(:command, finished: :asc)
Search actions
HCloud::StorageBox.find(1).actions.where(command: "start_resource")
HCloud::StorageBox.find(1).actions.where(status: "success")
Find action by ID
HCloud::StorageBox.find(1).actions.find(1)
Resource-specific actions
Change type
HCloud::StorageBox.find(1).change_type(storage_box_type: "bx21")
Reset password
HCloud::StorageBox.find(1).reset_password(password: "mypassword")
Update access settings
HCloud::StorageBox.find(1).update_access_settings(samba_enabled: false, ssh_enabled: true, webdav_enabled: false, zfs_enabled: false, reachable_externally: false)
Enable snapshot plan
HCloud::StorageBox.find(1).enable_snapshot_plan(max_snapshots: 10, minute: 30, hour: 3, day_of_week: nil, day_of_month: nil)
Disable snapshot plan
HCloud::StorageBox.find(1).disable_snapshot_plan
Rollback snapshot
HCloud::StorageBox.find(1).rollback_snapshot(snapshot_id: 42)
Change protection
HCloud::StorageBox.find(1).change_protection(delete: true)