Sha256: 54c8a521f01d21468032cb88b4655c185cafd6947ba493cc85dd7b4e08b02dbf

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

class SnapshotsController < ApplicationController
  respond_to :json
  include Util

  def index
  end

  def create
    volume_ids = params[:ids]
    response = []
    volume_ids.each do |volume_id|
      data = {
        :volume_id => volume_id
      }
      response << DcmgrResource::VolumeSnapshot.create(data)
    end
    render :json => response
  end

  def destroy
    snapshot_ids = params[:ids]
    response = []
    snapshot_ids.each do |snapshot_id|
      response << DcmgrResource::VolumeSnapshot.delete(snapshot_id)
    end
    render :json => response
  end

  def list
    data = {
      :start => params[:start].to_i - 1,
      :limit => params[:limit]
    }
    snapshots = DcmgrResource::VolumeSnapshot.list(data)
    respond_with(snapshots[0], :to => [:json])
  end

  def show
    snapshot_id = params[:id]
    detail = DcmgrResource::VolumeSnapshot.show(snapshot_id)
    respond_with(detail,:to => [:json])
  end
  
  def total
   total_resource = DcmgrResource::VolumeSnapshot.total_resource
   render :json => total_resource
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wakame-vdc-webui-10.12.0 app/controllers/snapshots_controller.rb
wakame-vdc-webui-10.11.0 app/controllers/snapshots_controller.rb