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:
parent
62bb091fd3
commit
bc9e04c31f
5 changed files with 29 additions and 11 deletions
|
@ -20,7 +20,7 @@ module Fog
|
|||
request :list_instrumentations
|
||||
request :get_instrumentation
|
||||
request :create_instrumentation
|
||||
|
||||
request :delete_instrumentation
|
||||
|
||||
model_path 'fog/joyent/models/analytics'
|
||||
|
||||
|
|
|
@ -8,17 +8,32 @@ module Fog
|
|||
attribute :joyent_module, :aliases => 'module'
|
||||
attribute :stat
|
||||
attribute :predicate
|
||||
attribute :decomposition
|
||||
attribute :value_dimension, aliases: 'value-dimension'
|
||||
attribute :decomposition, :type => :array
|
||||
attribute :value_dimension, aliases: 'value-dimension', :type => :integer
|
||||
attribute :value_arity, aliases: 'value-arity'
|
||||
attribute :retention_time, aliases: 'retention-time'
|
||||
attribute :granularity
|
||||
attribute :idle_max, aliases: 'idle-max'
|
||||
attribute :transformations
|
||||
attribute :persist_data, aliases: 'persist-data'
|
||||
attribute :crtime
|
||||
attribute :retention_time, aliases: 'retention-time', :type => :integer
|
||||
attribute :granularity, :type => :integer
|
||||
attribute :idle_max, aliases: 'idle-max', :type => :integer
|
||||
attribute :transformations, :type => :array
|
||||
attribute :persist_data, aliases: 'persist-data', :type => :boolean
|
||||
attribute :crtime, :type => :integer
|
||||
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
|
||||
|
|
|
@ -15,8 +15,11 @@ module Fog
|
|||
def get(id)
|
||||
data = service.get_instrumentation(id).body
|
||||
new(data)
|
||||
rescue Fog::Compute::Joyent::Errors::NotFound
|
||||
nil
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ module Fog
|
|||
:path => "#{@joyent_username}/analytics/instrumentations",
|
||||
:method => "POST",
|
||||
:body => values,
|
||||
:expects => 200
|
||||
:expects => [200,201]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue