Class: ESP::Signature
- Inherits:
-
Resource
- Object
- ActiveResource::Base
- Resource
- ESP::Signature
- Defined in:
- lib/esp/resources/signature.rb
Class Method Summary collapse
-
.all ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
Return a paginated Signature list.
-
.find(id) ⇒ ESP::Signature
Find a Signature by id.
-
.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
Return a paginated Signature list filtered by search parameters.
Instance Method Summary collapse
-
#destroy ⇒ void
Not Implemented.
-
#run(arguments = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Alert>, self
Run this signature.
-
#run!(arguments = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Alert>
Run this signature.
-
#save ⇒ void
Not Implemented.
-
#service ⇒ ESP::Service
The service this signature belongs to.
-
#suppress(arguments = {}) ⇒ ESP::Suppression::Signature
Create a suppression for this signature.
Methods included from Dirty
#changed_attributes, #original_attributes, #original_attributes=
Methods included from LoadWithOriginalAttributes
Class Method Details
.all ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
Return a paginated Signature list
|
# File 'lib/esp/resources/signature.rb', line 107
|
.find(id) ⇒ ESP::Signature .find(id, options = {}) ⇒ ESP::Signature
Find a Signature by id
call-seq -> super.find(id, options = {})
|
# File 'lib/esp/resources/signature.rb', line 89
|
.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Signature>
Return a paginated Signature list filtered by search parameters
call-seq -> super.where(clauses = {})
|
# File 'lib/esp/resources/signature.rb', line 78
|
Instance Method Details
#destroy ⇒ void
This method returns an undefined value.
Not Implemented. You cannot destroy a Signature.
18 19 20 |
# File 'lib/esp/resources/signature.rb', line 18 def destroy fail ESP::NotImplementedError end |
#run(arguments = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Alert>, self
Run this signature. Returns a collection of alerts. If not successful, returns a Signature object with the errors object populated.
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/esp/resources/signature.rb', line 51 def run(arguments = {}) arguments = arguments.with_indifferent_access attributes['external_account_id'] ||= arguments[:external_account_id] attributes['region'] ||= arguments[:region] response = connection.post("#{self.class.prefix}signatures/#{id}/run.json", to_json) ESP::Alert.send(:instantiate_collection, self.class.format.decode(response.body)) rescue ActiveResource::BadRequest, ActiveResource::ResourceInvalid, ActiveResource::ResourceNotFound => error load_remote_errors(error, true) self.code = error.response.code self end |
#run!(arguments = {}) ⇒ ActiveResource::PaginatedCollection<ESP::Alert>
Run this signature. Returns a collection of alerts. Throws an error if not successful.
32 33 34 35 36 37 |
# File 'lib/esp/resources/signature.rb', line 32 def run!(arguments = {}) result = run(arguments) return result if result.is_a?(ActiveResource::Collection) result. = result.errors..join(' ') fail(ActiveResource::ResourceInvalid.new(result)) # rubocop:disable Style/RaiseArgs end |
#save ⇒ void
This method returns an undefined value.
Not Implemented. You cannot create or update a Signature.
11 12 13 |
# File 'lib/esp/resources/signature.rb', line 11 def save fail ESP::NotImplementedError end |
#service ⇒ ESP::Service
The service this signature belongs to.
6 |
# File 'lib/esp/resources/signature.rb', line 6 belongs_to :service, class_name: 'ESP::Service' |
#suppress(arguments = {}) ⇒ ESP::Suppression::Signature
Create a suppression for this signature.
73 74 75 76 |
# File 'lib/esp/resources/signature.rb', line 73 def suppress(arguments = {}) arguments = arguments.with_indifferent_access ESP::Suppression::Signature.create(signature_ids: [id], regions: Array(arguments[:regions]), external_account_ids: Array(arguments[:external_account_ids]), reason: arguments[:reason]) end |