1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

allow creation and deletion of instrumentations

This commit is contained in:
Kevin Olbrich 2013-12-13 01:29:27 +00:00
parent 62bb091fd3
commit bc9e04c31f
5 changed files with 29 additions and 11 deletions

View file

@ -20,7 +20,7 @@ module Fog
request :list_instrumentations request :list_instrumentations
request :get_instrumentation request :get_instrumentation
request :create_instrumentation request :create_instrumentation
request :delete_instrumentation
model_path 'fog/joyent/models/analytics' model_path 'fog/joyent/models/analytics'

View file

@ -8,17 +8,32 @@ module Fog
attribute :joyent_module, :aliases => 'module' attribute :joyent_module, :aliases => 'module'
attribute :stat attribute :stat
attribute :predicate attribute :predicate
attribute :decomposition attribute :decomposition, :type => :array
attribute :value_dimension, aliases: 'value-dimension' attribute :value_dimension, aliases: 'value-dimension', :type => :integer
attribute :value_arity, aliases: 'value-arity' attribute :value_arity, aliases: 'value-arity'
attribute :retention_time, aliases: 'retention-time' attribute :retention_time, aliases: 'retention-time', :type => :integer
attribute :granularity attribute :granularity, :type => :integer
attribute :idle_max, aliases: 'idle-max' attribute :idle_max, aliases: 'idle-max', :type => :integer
attribute :transformations attribute :transformations, :type => :array
attribute :persist_data, aliases: 'persist-data' attribute :persist_data, aliases: 'persist-data', :type => :boolean
attribute :crtime attribute :crtime, :type => :integer
attribute :value_scope, aliases: 'value-scope' attribute :value_scope, aliases: 'value-scope'
attribute :uris attribute :uris, :type => :array
def save
requires :joyent_module, :stat
munged_attributes = attributes.dup
munged_attributes[:module] = munged_attributes.delete(:joyent_module)
data = service.create_instrumentation(munged_attributes)
merge_attributes(data.body)
true
end
def destroy
requires :id
service.delete_instrumentation(self.identity)
true
end
end end
end end

View file

@ -15,8 +15,11 @@ module Fog
def get(id) def get(id)
data = service.get_instrumentation(id).body data = service.get_instrumentation(id).body
new(data) new(data)
rescue Fog::Compute::Joyent::Errors::NotFound
nil
end end
end end
end end
end end

View file

@ -7,7 +7,7 @@ module Fog
:path => "#{@joyent_username}/analytics/instrumentations", :path => "#{@joyent_username}/analytics/instrumentations",
:method => "POST", :method => "POST",
:body => values, :body => values,
:expects => 200 :expects => [200,201]
) )
end end
end end