Sha256: bfaf9ca1b6b7a62e16e1bde841cf9866d921ee98a06ddb1f6054b961cb745459

Contents?: true

Size: 1.08 KB

Versions: 2

Compression:

Stored size: 1.08 KB

Contents

module Vultr
  class ObjectStorageResource < Resource
    def list(**params)
      response = get_request("object-storage", params: params)
      Collection.from_response(response, key: "object_storages", type: ObjectStorage)
    end

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

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

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

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

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

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vultr-2.0.0 lib/vultr/resources/object_storage.rb
vultr-1.0.0 lib/vultr/resources/object_storage.rb