Class: Orchestrator::Api::ZonesController

Inherits:
Orchestrator::ApiController show all
Defined in:
app/controllers/orchestrator/api/zones_controller.rb

Instance Method Summary collapse

Methods inherited from Base

#options

Instance Method Details

#createObject



30
31
32
33
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 30

def create
    zone = Zone.new(safe_params)
    save_and_respond zone
end

#destroyObject



35
36
37
38
39
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 35

def destroy
    # delete will update CS and zone caches
    @zone.delete
    render :nothing => true
end

#indexObject



14
15
16
17
18
19
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 14

def index
    query = @@elastic.query(params)
    query.sort = [{name: "asc"}]

    respond_with @@elastic.search(query)
end

#showObject



21
22
23
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 21

def show
    respond_with @zone
end

#updateObject



25
26
27
28
# File 'app/controllers/orchestrator/api/zones_controller.rb', line 25

def update
    @zone.update_attributes(safe_params)
    save_and_respond @zone
end