esp_sdk 2.5.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +8 -0
- data/Gemfile.lock +5 -3
- data/Guardfile +3 -1
- data/esp_sdk.gemspec +2 -1
- data/lib/esp/aws_clients.rb +2 -1
- data/lib/esp/commands/commands_tasks.rb +2 -1
- data/lib/esp/commands/console.rb +4 -0
- data/lib/esp/exceptions.rb +1 -0
- data/lib/esp/extensions/active_resource/dirty.rb +51 -0
- data/lib/esp/extensions/active_resource/formats/json_api_format.rb +5 -3
- data/lib/esp/extensions/active_resource/paginated_collection.rb +71 -38
- data/lib/esp/extensions/active_resource/validations.rb +4 -2
- data/lib/esp/external_account_creator.rb +4 -1
- data/lib/esp/resources/alert.rb +53 -42
- data/lib/esp/resources/cloud_trail_event.rb +18 -12
- data/lib/esp/resources/concerns/stat_totals.rb +70 -67
- data/lib/esp/resources/contact_request.rb +17 -14
- data/lib/esp/resources/custom_signature/definition.rb +46 -51
- data/lib/esp/resources/custom_signature/result/alert.rb +13 -5
- data/lib/esp/resources/custom_signature/result.rb +49 -53
- data/lib/esp/resources/custom_signature.rb +52 -61
- data/lib/esp/resources/dashboard.rb +11 -5
- data/lib/esp/resources/external_account.rb +59 -58
- data/lib/esp/resources/metadata.rb +21 -11
- data/lib/esp/resources/organization.rb +49 -39
- data/lib/esp/resources/region.rb +25 -28
- data/lib/esp/resources/report.rb +46 -44
- data/lib/esp/resources/reports/export/integration.rb +22 -13
- data/lib/esp/resources/resource.rb +4 -3
- data/lib/esp/resources/scan_interval.rb +19 -13
- data/lib/esp/resources/service.rb +17 -11
- data/lib/esp/resources/signature.rb +43 -53
- data/lib/esp/resources/stat.rb +72 -55
- data/lib/esp/resources/stat_custom_signature.rb +73 -65
- data/lib/esp/resources/stat_region.rb +76 -65
- data/lib/esp/resources/stat_service.rb +76 -65
- data/lib/esp/resources/stat_signature.rb +76 -65
- data/lib/esp/resources/sub_organization.rb +51 -60
- data/lib/esp/resources/suppression/region.rb +35 -30
- data/lib/esp/resources/suppression/signature.rb +35 -29
- data/lib/esp/resources/suppression/unique_identifier.rb +27 -22
- data/lib/esp/resources/suppression.rb +45 -34
- data/lib/esp/resources/tag.rb +20 -11
- data/lib/esp/resources/team.rb +56 -58
- data/lib/esp/resources/user.rb +35 -32
- data/lib/esp/version.rb +1 -1
- data/lib/esp.rb +39 -16
- data/lib/esp_sdk.rb +1 -0
- data/test/esp/extensions/active_resource/dirty_test.rb +81 -0
- data/test/esp/extensions/active_resource/formats/json_api_format_test.rb +8 -0
- data/test/esp/extensions/active_resource/paginated_collection_test.rb +7 -0
- data/test/esp/integration/json_api_format_integration_test.rb +5 -2
- data/test/esp/integration/organization_integration_test.rb +1 -1
- data/test/esp/resources/custom_signature_test.rb +15 -0
- data/test/factories/custom_signatures.rb +0 -10
- metadata +21 -3
data/lib/esp/resources/alert.rb
CHANGED
@@ -1,60 +1,64 @@
|
|
1
1
|
module ESP
|
2
2
|
class Alert < ESP::Resource
|
3
|
-
##
|
4
3
|
# Returns the external account associated with this alert.
|
4
|
+
# @return [ESP::ExternalAccount]
|
5
5
|
belongs_to :external_account, class_name: 'ESP::ExternalAccount'
|
6
6
|
|
7
|
-
##
|
8
7
|
# Returns the region associated with this alert.
|
8
|
+
# @return [ESP::Region]
|
9
9
|
belongs_to :region, class_name: 'ESP::Region'
|
10
10
|
|
11
|
-
##
|
12
11
|
# Returns the region associated with this alert. Either a signature or custom signature but not both will be present.
|
12
|
+
# @return [ESP::Signature]
|
13
13
|
belongs_to :signature, class_name: 'ESP::Signature'
|
14
14
|
|
15
|
-
##
|
16
15
|
# Returns the custom signature associated with this alert. Either a signature or custom signature but not both will be present.
|
16
|
+
# @return [ESP::CustomSignature]
|
17
17
|
belongs_to :custom_signature, class_name: 'ESP::CustomSignature'
|
18
18
|
|
19
|
-
##
|
20
19
|
# Returns the suppression associated with this alert. If present the alert was suppressed.
|
20
|
+
# @return [ESP::Suppression]
|
21
21
|
belongs_to :suppression, class_name: 'ESP::Suppression'
|
22
22
|
|
23
|
-
##
|
24
23
|
# Returns the cloud trail events associated with this alert. These may be added up to 10 minutes after the alert was created
|
24
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CloudTrailEvent>]
|
25
25
|
has_many :cloud_trail_events, class_name: 'ESP::CloudTrailEvent'
|
26
26
|
|
27
|
-
##
|
28
27
|
# Returns the tags associated with this alert.
|
28
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Tag>]
|
29
29
|
has_many :tags, class_name: 'ESP::Tag'
|
30
30
|
|
31
|
-
##
|
32
31
|
# Returns the metadata associated with this alert.
|
32
|
+
#
|
33
|
+
# @return [ESP::Metadata]
|
33
34
|
def metadata
|
34
35
|
ESP::Metadata.for_alert(id)
|
35
36
|
end
|
36
37
|
|
37
38
|
# Not Implemented. You cannot create or update an Alert.
|
39
|
+
#
|
40
|
+
# @return [void]
|
38
41
|
def save
|
39
42
|
fail ESP::NotImplementedError
|
40
43
|
end
|
41
44
|
|
42
|
-
# Not Implemented. You cannot destroy
|
45
|
+
# Not Implemented. You cannot destroy an Alert.
|
46
|
+
#
|
47
|
+
# @return [void]
|
43
48
|
def destroy
|
44
49
|
fail ESP::NotImplementedError
|
45
50
|
end
|
46
51
|
|
47
|
-
# Returns
|
52
|
+
# Returns alerts for the given report_id
|
48
53
|
#
|
49
|
-
#
|
54
|
+
# *call-seq* -> +super.where(clauses)+
|
50
55
|
#
|
51
|
-
#
|
56
|
+
# @param clauses [Hash] Required hash of attributes with appended predicates to search, sort and include.
|
57
|
+
# ===== Valid Clauses
|
52
58
|
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# ==== Example
|
59
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#searching-alerts] for valid arguments
|
60
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Alert>]
|
61
|
+
# @example
|
58
62
|
# alerts = ESP::Alert.where(report_id: 54, status_eq: 'fail', signature_risk_level_in: ['High'], include: 'signature')
|
59
63
|
def self.where(clauses = {})
|
60
64
|
clauses = clauses.with_indifferent_access
|
@@ -65,25 +69,30 @@ module ESP
|
|
65
69
|
|
66
70
|
# Find an Alert by id
|
67
71
|
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
72
|
+
# @overload find(id)
|
73
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the alert to retrieve.
|
74
|
+
# @overload find(id, options)
|
75
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the alert to retrieve.
|
76
|
+
# @param options [Hash]
|
77
|
+
# ===== Valid Options
|
78
|
+
#
|
79
|
+
# +include+ | The list of associated objects to return on the initial request.
|
80
|
+
#
|
81
|
+
# ===== Valid Includable Associations
|
82
|
+
#
|
83
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#searching-alerts] for valid arguments
|
84
|
+
# @overload find(scope, options)
|
85
|
+
# *call-seq* -> +super.all(options)+
|
86
|
+
# @api private
|
87
|
+
# @param scope [Object] *Example:* +:all+
|
88
|
+
# @param options [Hash] +{ params: { report_id: Integer } }+
|
89
|
+
# @raise [ArgumentError] if no +report_id+ is supplied.
|
90
|
+
# @return [ESP::Alert]
|
91
|
+
# @example
|
92
|
+
# alert = ESP::Alert.find(1)
|
93
|
+
# alert = ESP::Alert.find(1, include: 'tags,external_account.team')
|
94
|
+
# alert = ESP::Alert.find(:all, params: { report_id: 5 })
|
84
95
|
#
|
85
|
-
# :call-seq:
|
86
|
-
# find(id, options = {})
|
87
96
|
def self.find(*arguments)
|
88
97
|
scope = arguments.slice!(0)
|
89
98
|
options = (arguments.slice!(0) || {}).with_indifferent_access
|
@@ -93,31 +102,33 @@ module ESP
|
|
93
102
|
all(from: "#{from}.json", params: params)
|
94
103
|
end
|
95
104
|
|
96
|
-
|
105
|
+
# @private
|
106
|
+
def self.for_report(report_id)
|
97
107
|
fail ArgumentError, "You must supply a report id." unless report_id.present?
|
98
108
|
"#{prefix}reports/#{report_id}/alerts"
|
99
109
|
end
|
100
110
|
|
101
111
|
# Suppress the signature associated with this alert.
|
102
|
-
# ==== Parameter
|
103
112
|
#
|
104
|
-
#
|
113
|
+
# @param reason [String] Required reason for creating the suppression.
|
114
|
+
# @return [ESP::Suppression::Signature]
|
105
115
|
def suppress_signature(reason = nil)
|
106
116
|
suppress(Suppression::Signature, reason)
|
107
117
|
end
|
108
118
|
|
109
119
|
# Suppress the region associated with this alert.
|
110
|
-
# ==== Parameter
|
111
120
|
#
|
112
|
-
#
|
121
|
+
# @param reason [String] Required reason for creating the suppression.
|
122
|
+
# @return [ESP::Suppression::Region]
|
113
123
|
def suppress_region(reason = nil)
|
114
124
|
suppress(Suppression::Region, reason)
|
115
125
|
end
|
116
126
|
|
117
127
|
# Suppress the unique identifier associated with this alert.
|
118
|
-
# ==== Parameter
|
119
128
|
#
|
120
|
-
#
|
129
|
+
# @param reason [String] Required reason for creating the suppression.
|
130
|
+
# @return [ESP::Suppression::UniqueIdentifier]
|
131
|
+
# @raise [ArgumentError] if no +reason+ is supplied.
|
121
132
|
def suppress_unique_identifier(reason = nil)
|
122
133
|
suppress(Suppression::UniqueIdentifier, reason)
|
123
134
|
end
|
@@ -1,28 +1,33 @@
|
|
1
1
|
module ESP
|
2
2
|
class CloudTrailEvent < ESP::Resource
|
3
3
|
# Not Implemented. You cannot search for a CloudTrailEvent.
|
4
|
+
#
|
5
|
+
# @return [void]
|
4
6
|
def self.where(*)
|
5
7
|
fail ESP::NotImplementedError
|
6
8
|
end
|
7
9
|
|
8
10
|
# Not Implemented. You cannot create or update a CloudTrailEvent.
|
11
|
+
#
|
12
|
+
# @return [void]
|
9
13
|
def save
|
10
14
|
fail ESP::NotImplementedError
|
11
15
|
end
|
12
16
|
|
13
17
|
# Not Implemented. You cannot destroy a CloudTrailEvent.
|
18
|
+
#
|
19
|
+
# @return [void]
|
14
20
|
def destroy
|
15
21
|
fail ESP::NotImplementedError
|
16
22
|
end
|
17
23
|
|
18
|
-
# Returns
|
19
|
-
# Convenience method to use instead of
|
24
|
+
# Returns cloud trail events for the given +alert_id+.
|
25
|
+
# Convenience method to use instead of {.find} since an +alert_id+ is required to return cloud trail events.
|
20
26
|
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
# ==== Example
|
27
|
+
# @param alert_id [Integer, Numeric, #to_i] Required ID of the alert to retrieve cloud trail events for.
|
28
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CloudTrailEvent>]
|
29
|
+
# @raise [ArgumentError] if no +alert_id+ is provided.
|
30
|
+
# @example
|
26
31
|
# alerts = ESP::CloudTrailEvent.for_alert(1194)
|
27
32
|
def self.for_alert(alert_id = nil)
|
28
33
|
fail ArgumentError, "You must supply an alert id." unless alert_id.present?
|
@@ -32,12 +37,13 @@ module ESP
|
|
32
37
|
|
33
38
|
# Find a CloudTrailEvent by id
|
34
39
|
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
# +id+ | Required | The ID of the cloud trail event to retrieve
|
40
|
+
# *call-seq* -> +super.find(id)+
|
38
41
|
#
|
39
|
-
#
|
40
|
-
#
|
42
|
+
# @overload find(id)
|
43
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the cloud trail event to retrieve
|
44
|
+
# @return [ESP::CloudTrailEvent]
|
45
|
+
# @example
|
46
|
+
# alert = ESP::CloudTrailEvent.find(1)
|
41
47
|
def self.find(*arguments)
|
42
48
|
scope = arguments.slice!(0)
|
43
49
|
options = (arguments.slice!(0) || {}).with_indifferent_access
|
@@ -1,79 +1,82 @@
|
|
1
|
-
module ESP
|
2
|
-
#
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
def destroy
|
9
|
-
fail ESP::NotImplementedError
|
10
|
-
end
|
1
|
+
module ESP
|
2
|
+
# @private
|
3
|
+
module StatTotals
|
4
|
+
# Not Implemented. You cannot create or update a Stat.
|
5
|
+
def save
|
6
|
+
fail ESP::NotImplementedError
|
7
|
+
end
|
11
8
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
# Not Implemented. You cannot delete a Stat.
|
10
|
+
def destroy
|
11
|
+
fail ESP::NotImplementedError
|
12
|
+
end
|
16
13
|
|
17
|
-
|
18
|
-
|
19
|
-
|
14
|
+
# We only add new_1w* and old* fields as the new_1w field includes the counts from new_1h and new_1d.
|
15
|
+
def total
|
16
|
+
attributes.select { |a, _v| a.match(/new_1w|old/) }.values.reduce(:+)
|
17
|
+
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
# Stat#total_pass
|
24
|
-
# Stat#total_fail
|
25
|
-
# Stat#total_warn
|
26
|
-
# Stat#total_error
|
27
|
-
# Stat#total_info
|
28
|
-
define_method "total_#{status}" do
|
29
|
-
attributes.select { |a, _v| a.match(/new_1w|old/) && a.match(/#{status}/) }.values.reduce(:+)
|
19
|
+
def total_suppressed
|
20
|
+
attributes.select { |a, _v| a.match(/suppressed_/) }.values.reduce(:+)
|
30
21
|
end
|
31
22
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
# Stat#total_new_1d_error
|
42
|
-
# Stat#total_new_1d_info
|
43
|
-
# Stat#total_new_1w_pass
|
44
|
-
# Stat#total_new_1w_fail
|
45
|
-
# Stat#total_new_1w_error
|
46
|
-
# Stat#total_new_1w_info
|
47
|
-
# Stat#total_new_1w_warn
|
48
|
-
# Stat#total_old_fail
|
49
|
-
# Stat#total_old_pass
|
50
|
-
# Stat#total_old_warn
|
51
|
-
# Stat#total_old_error
|
52
|
-
# Stat#total_old_info
|
53
|
-
%w(new_1h new_1d new_1w old).each do |time|
|
54
|
-
define_method "total_#{time}_#{status}" do
|
55
|
-
attributes.select { |a| a.match(/#{time}/) && a.match(/#{status}/) }.values.reduce(:+)
|
23
|
+
%w(fail warn error pass info).each do |status|
|
24
|
+
# Defines the following methods:
|
25
|
+
# Stat#total_pass
|
26
|
+
# Stat#total_fail
|
27
|
+
# Stat#total_warn
|
28
|
+
# Stat#total_error
|
29
|
+
# Stat#total_info
|
30
|
+
define_method "total_#{status}" do
|
31
|
+
attributes.select { |a, _v| a.match(/new_1w|old/) && a.match(/#{status}/) }.values.reduce(:+)
|
56
32
|
end
|
57
|
-
end
|
58
33
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
34
|
+
# Defines the following methods:
|
35
|
+
# Stat#total_new_1h_pass
|
36
|
+
# Stat#total_new_1h_fail
|
37
|
+
# Stat#total_new_1h_warn
|
38
|
+
# Stat#total_new_1h_error
|
39
|
+
# Stat#total_new_1h_info
|
40
|
+
# Stat#total_new_1d_pass
|
41
|
+
# Stat#total_new_1d_fail
|
42
|
+
# Stat#total_new_1d_warn
|
43
|
+
# Stat#total_new_1d_error
|
44
|
+
# Stat#total_new_1d_info
|
45
|
+
# Stat#total_new_1w_pass
|
46
|
+
# Stat#total_new_1w_fail
|
47
|
+
# Stat#total_new_1w_error
|
48
|
+
# Stat#total_new_1w_info
|
49
|
+
# Stat#total_new_1w_warn
|
50
|
+
# Stat#total_old_fail
|
51
|
+
# Stat#total_old_pass
|
52
|
+
# Stat#total_old_warn
|
53
|
+
# Stat#total_old_error
|
54
|
+
# Stat#total_old_info
|
55
|
+
%w(new_1h new_1d new_1w old).each do |time|
|
56
|
+
define_method "total_#{time}_#{status}" do
|
57
|
+
attributes.select { |a| a.match(/#{time}/) && a.match(/#{status}/) }.values.reduce(:+)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Defines the following methods:
|
62
|
+
# Stat#total_suppressed_pass
|
63
|
+
# Stat#total_suppressed_fail
|
64
|
+
# Stat#total_suppressed_warn
|
65
|
+
# Stat#total_suppressed_error
|
66
|
+
define_method "total_suppressed_#{status}" do
|
67
|
+
attributes.select { |a| a.match(/suppressed_/) && a.match(/#{status}/) }.values.reduce(:+)
|
68
|
+
end
|
66
69
|
end
|
67
|
-
end
|
68
70
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
# Defines the following methods:
|
72
|
+
# Stat#total_new_1h
|
73
|
+
# Stat#total_new_1d
|
74
|
+
# Stat#total_new_1w
|
75
|
+
# Stat#total_old
|
76
|
+
%w(new_1h new_1d new_1w old).each do |time|
|
77
|
+
define_method "total_#{time}" do
|
78
|
+
attributes.select { |a| a.match(/#{time}/) }.values.reduce(:+)
|
79
|
+
end
|
77
80
|
end
|
78
81
|
end
|
79
82
|
end
|
@@ -2,42 +2,45 @@ module ESP
|
|
2
2
|
# Use contact requests to send a support or feature request to Evident.io.
|
3
3
|
class ContactRequest < ESP::Resource
|
4
4
|
# Not Implemented. You cannot search for ContactRequest.
|
5
|
+
#
|
6
|
+
# @return [void]
|
5
7
|
def self.find(*)
|
6
8
|
fail ESP::NotImplementedError
|
7
9
|
end
|
8
10
|
|
9
11
|
# Not Implemented. You cannot search for ContactRequest.
|
12
|
+
#
|
13
|
+
# @return [void]
|
10
14
|
def self.where(*)
|
11
15
|
fail ESP::NotImplementedError
|
12
16
|
end
|
13
17
|
|
14
18
|
# Not Implemented. You cannot update a ContactRequest.
|
19
|
+
#
|
20
|
+
# @return [void]
|
15
21
|
def update
|
16
22
|
fail ESP::NotImplementedError
|
17
23
|
end
|
18
24
|
|
19
25
|
# Not Implemented. You cannot destroy a ContactRequest.
|
26
|
+
#
|
27
|
+
# @return [void]
|
20
28
|
def destroy
|
21
29
|
fail ESP::NotImplementedError
|
22
30
|
end
|
23
31
|
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
# ==== Parameter
|
28
|
-
#
|
29
|
-
# +attributes+ | Required | A hash of contact request attributes
|
30
|
-
#
|
31
|
-
# ===== Valid Attributes
|
32
|
-
#
|
33
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#contact-request-create] for valid arguments
|
32
|
+
# @!method self.create(attributes={})
|
33
|
+
# Create a contact request.
|
34
34
|
#
|
35
|
+
# *call-seq* -> +create(attributes={})+
|
35
36
|
#
|
36
|
-
#
|
37
|
-
#
|
37
|
+
# @param attributes [Hash] Required hash of contact request attributes
|
38
|
+
# ===== Valid Attributes
|
38
39
|
#
|
39
|
-
#
|
40
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#contact-request-create] for valid arguments
|
41
|
+
# @return [ESP::ContactRequest]
|
42
|
+
# @example
|
43
|
+
# contact_request = ESP::ContactRequest.create(request_type: 'feature', title: 'My great feature idea', description: 'This is my idea for a really useful feature...')
|
40
44
|
#
|
41
|
-
# contact_request = ESP::ContactRequest.create(request_type: 'feature', title: 'My great feature idea', description: 'This is my idea for a really useful feature...')
|
42
45
|
end
|
43
46
|
end
|
@@ -6,6 +6,7 @@ module ESP
|
|
6
6
|
belongs_to :custom_signature, class_name: 'ESP::CustomSignature'
|
7
7
|
has_many :results, class_name: 'ESP::CustomSignature::Result'
|
8
8
|
|
9
|
+
# @return [Net::HTTPSuccess, false]
|
9
10
|
def activate
|
10
11
|
patch(:activate).tap do |response|
|
11
12
|
load_attributes_from_response(response)
|
@@ -16,6 +17,7 @@ module ESP
|
|
16
17
|
false
|
17
18
|
end
|
18
19
|
|
20
|
+
# @return [Net::HTTPSuccess, false]
|
19
21
|
def archive
|
20
22
|
patch(:archive).tap do |response|
|
21
23
|
load_attributes_from_response(response)
|
@@ -26,75 +28,68 @@ module ESP
|
|
26
28
|
false
|
27
29
|
end
|
28
30
|
|
29
|
-
#
|
30
|
-
#
|
31
|
+
# @!method self.where(clauses = {})
|
32
|
+
# Return a list filtered by search parameters
|
31
33
|
#
|
32
|
-
#
|
34
|
+
# *call-seq* -> +super.where(clauses = {})+
|
33
35
|
#
|
34
|
-
#
|
36
|
+
# @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
|
37
|
+
# ===== Valid Clauses
|
35
38
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-attributes] for valid arguments
|
39
|
-
#
|
40
|
-
# :call-seq:
|
41
|
-
# where(clauses = {})
|
39
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-attributes] for valid arguments
|
40
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Definition>]
|
42
41
|
|
43
|
-
|
44
|
-
#
|
45
|
-
# Find a CustomSignature::Definition by id
|
46
|
-
#
|
47
|
-
# ==== Parameter
|
42
|
+
# @!method self.find(id)
|
43
|
+
# Find a CustomSignature::Definition by id
|
48
44
|
#
|
49
|
-
# +id
|
45
|
+
# *call-seq* -> +find(id, options = {})+
|
50
46
|
#
|
51
|
-
#
|
47
|
+
# @overload find(id)
|
48
|
+
# @overload find(id, options = {})
|
49
|
+
# @param options | Optional | A hash of options
|
50
|
+
# ===== Valid Options
|
52
51
|
#
|
53
|
-
#
|
52
|
+
# +include+ | The list of associated objects to return on the initial request.
|
54
53
|
#
|
55
|
-
#
|
54
|
+
# ===== Valid Includable Associations
|
56
55
|
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
# :call-seq:
|
62
|
-
# find(id, options = {})
|
63
|
-
|
64
|
-
# :singleton-method: all
|
65
|
-
# Return a paginated CustomSignature::Definition list
|
56
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-attributes] for valid arguments
|
57
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the custom signature definition to retrieve
|
58
|
+
# @return [ESP::CustomSignature::Definition]
|
66
59
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
# :call-seq:
|
70
|
-
# create(attributes={})
|
60
|
+
# @!method self.all
|
61
|
+
# Return a paginated list
|
71
62
|
#
|
72
|
-
#
|
73
|
-
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-create] for valid arguments
|
63
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Definition>]
|
64
|
+
|
65
|
+
# @!method self.create(attributes = {})
|
66
|
+
# Create a CustomSignature::Definition
|
67
|
+
# *call-seq* -> +super.create(attributes={})+
|
79
68
|
#
|
80
|
-
#
|
69
|
+
# @param attributes [Hash] Required hash of custom signature definition attributes.
|
70
|
+
# ===== Valid Attributes
|
81
71
|
#
|
82
|
-
#
|
72
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-create] for valid arguments
|
73
|
+
# @return [ESP::CustomSignature::Definition
|
74
|
+
# @example
|
75
|
+
# definition = ESP::CustomSignature::Definition.create(custom_signature_id: 1)
|
83
76
|
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
# ===== Valid Attributes
|
77
|
+
# @!method save
|
78
|
+
# Create or update a CustomSignature::Definition
|
88
79
|
#
|
89
|
-
#
|
80
|
+
# ===== Valid Attributes
|
90
81
|
#
|
91
|
-
#
|
82
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-definition-create] for valid arguments
|
92
83
|
#
|
93
|
-
#
|
94
|
-
#
|
84
|
+
# @return [Boolean]
|
85
|
+
# @example
|
86
|
+
# definition = ESP::CustomSignature::Definition.new(custom_signature_id: 1)
|
87
|
+
# definition.save
|
95
88
|
|
96
|
-
#
|
97
|
-
#
|
89
|
+
# @!method destroy
|
90
|
+
# Delete a CustomSignature::Definition
|
91
|
+
#
|
92
|
+
# @return [self]
|
98
93
|
end
|
99
94
|
end
|
100
95
|
end
|
@@ -8,11 +8,9 @@ module ESP
|
|
8
8
|
|
9
9
|
# Returns all the alerts for a custom signature result identified by the custom_signature_result_id parameter.
|
10
10
|
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#alert-attributes] for valid arguments
|
11
|
+
# @param custom_signature_result_id [Integer, Numeric, #to_i] Required ID of the custom signature result to retrieve alerts for
|
12
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Result::Alert>]
|
13
|
+
# @raise [ArgumentError] if no +custom_signature_result_id+ is supplied.
|
16
14
|
def self.for_result(custom_signature_result_id = nil)
|
17
15
|
fail ArgumentError, "You must supply a custom signature result id." unless custom_signature_result_id.present?
|
18
16
|
# call find_every directly since find is overriden/not implemented
|
@@ -22,6 +20,8 @@ module ESP
|
|
22
20
|
# Not Implemented. You cannot search for CustomSignature::Result::Alert.
|
23
21
|
#
|
24
22
|
# Regular ARELlike methods are disabled.
|
23
|
+
#
|
24
|
+
# @return [void]
|
25
25
|
def self.find(*)
|
26
26
|
fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the .for_result method.'
|
27
27
|
end
|
@@ -29,21 +29,29 @@ module ESP
|
|
29
29
|
# Not Implemented. You cannot search for CustomSignature::Result::Alert.
|
30
30
|
#
|
31
31
|
# Regular ARELlike methods are disabled.
|
32
|
+
#
|
33
|
+
# @return [void]
|
32
34
|
def self.where(*)
|
33
35
|
fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the .for_result method.'
|
34
36
|
end
|
35
37
|
|
36
38
|
# Not Implemented. You cannot create a CustomSignature::Result::Alert.
|
39
|
+
#
|
40
|
+
# @return [void]
|
37
41
|
def create
|
38
42
|
fail ESP::NotImplementedError
|
39
43
|
end
|
40
44
|
|
41
45
|
# Not Implemented. You cannot update a CustomSignature::Result::Alert.
|
46
|
+
#
|
47
|
+
# @return [void]
|
42
48
|
def update
|
43
49
|
fail ESP::NotImplementedError
|
44
50
|
end
|
45
51
|
|
46
52
|
# Not Implemented. You cannot destroy a CustomSignature::Result::Alert.
|
53
|
+
#
|
54
|
+
# @return [void]
|
47
55
|
def destroy
|
48
56
|
fail ESP::NotImplementedError
|
49
57
|
end
|