esp_sdk 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -1,85 +1,95 @@
|
|
1
1
|
module ESP
|
2
2
|
class Organization < ESP::Resource
|
3
|
-
##
|
4
3
|
# The collection of teams that belong to the organization.
|
4
|
+
#
|
5
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Team>]
|
5
6
|
has_many :teams, class_name: 'ESP::Team'
|
6
7
|
|
7
|
-
##
|
8
8
|
# The collection of sub_organizations that belong to the organization.
|
9
|
+
#
|
10
|
+
# @return [ActiveResource::PaginatedCollection<ESP::SubOrganization>]
|
9
11
|
has_many :sub_organizations, class_name: 'ESP::SubOrganization'
|
10
12
|
|
11
|
-
##
|
12
13
|
# The collection of users that belong to the organization.
|
14
|
+
#
|
15
|
+
# @return [ActiveResource::PaginatedCollection<ESP::User>]
|
13
16
|
has_many :users, class_name: 'ESP::User'
|
14
17
|
|
15
|
-
##
|
16
18
|
# The collection of reports that belong to the organization.
|
19
|
+
#
|
20
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Report>]
|
17
21
|
has_many :reports, class_name: 'ESP::Report'
|
18
22
|
|
19
|
-
##
|
20
23
|
# The collection of external_accounts that belong to the organization.
|
24
|
+
#
|
25
|
+
# @return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
|
21
26
|
has_many :external_accounts, class_name: 'ESP::ExternalAccount'
|
22
27
|
|
23
|
-
##
|
24
28
|
# The collection of organizations that belong to the organization.
|
29
|
+
#
|
30
|
+
# @return [ActiveResource::PaginatedCollection<ESP::CustomSignature>]
|
25
31
|
has_many :custom_signatures, class_name: 'ESP::CustomSignature'
|
26
32
|
|
27
33
|
# Not Implemented. You cannot create an Organization.
|
28
|
-
|
34
|
+
#
|
35
|
+
# @private
|
36
|
+
def create
|
29
37
|
fail ESP::NotImplementedError
|
30
38
|
end
|
31
39
|
|
32
40
|
# Not Implemented. You cannot destroy an Organization.
|
41
|
+
#
|
42
|
+
# @return [void]
|
33
43
|
def destroy
|
34
44
|
fail ESP::NotImplementedError
|
35
45
|
end
|
36
46
|
|
37
|
-
#
|
38
|
-
#
|
47
|
+
# @!method self.where(clauses = {})
|
48
|
+
# Return a paginated list filtered by search parameters.
|
39
49
|
#
|
40
|
-
#
|
50
|
+
# *call-seq* -> +super.where(clauses = {})+
|
41
51
|
#
|
42
|
-
#
|
52
|
+
# @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
|
53
|
+
# ===== Valid Clauses
|
43
54
|
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#organization-attributes] for valid arguments
|
47
|
-
#
|
48
|
-
# :call-seq:
|
49
|
-
# where(clauses = {})
|
55
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#organization-attributes] for valid arguments
|
56
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Organization>]
|
50
57
|
|
51
|
-
|
52
|
-
#
|
53
|
-
# Find a Organization by id
|
54
|
-
#
|
55
|
-
# ==== Parameter
|
56
|
-
#
|
57
|
-
# +id+ | Required | The ID of the organization to retrieve
|
58
|
+
# @!method self.find(id)
|
59
|
+
# Find an Organization by id
|
58
60
|
#
|
59
|
-
# +options
|
61
|
+
# *call-seq* -> +super.find(id, options = {})+
|
60
62
|
#
|
61
|
-
#
|
63
|
+
# @overload find(id)
|
64
|
+
# @overload find(id, options = {})
|
65
|
+
# @param options [Hash] Optional hash of options.
|
66
|
+
# ===== Valid Options
|
62
67
|
#
|
63
|
-
#
|
68
|
+
# +include+ | The list of associated objects to return on the initial request.
|
64
69
|
#
|
65
|
-
#
|
70
|
+
# ===== Valid Includable Associations
|
66
71
|
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
# find(id, options = {})
|
72
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#organization-attributes] for valid arguments
|
73
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the organization to retrieve.
|
74
|
+
# @return [ESP::Organization]
|
71
75
|
|
72
|
-
#
|
73
|
-
#
|
76
|
+
# @!method self.all
|
77
|
+
# Return a paginated list.
|
78
|
+
#
|
79
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Organization>]
|
74
80
|
|
75
|
-
#
|
81
|
+
# @!method self.create
|
76
82
|
# Not Implemented. You cannot create an Organization.
|
83
|
+
#
|
84
|
+
# @return [void]
|
77
85
|
|
78
|
-
#
|
79
|
-
#
|
86
|
+
# @!method save
|
87
|
+
# Update an Organization.
|
88
|
+
#
|
89
|
+
# ===== Valid Attributes
|
80
90
|
#
|
81
|
-
#
|
91
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#organization-update] for valid arguments
|
82
92
|
#
|
83
|
-
#
|
93
|
+
# @return [Boolean]
|
84
94
|
end
|
85
95
|
end
|
data/lib/esp/resources/region.rb
CHANGED
@@ -1,58 +1,55 @@
|
|
1
1
|
module ESP
|
2
2
|
class Region < ESP::Resource
|
3
3
|
# Not Implemented. You cannot create or update a CloudTrailEvent.
|
4
|
+
#
|
5
|
+
# @return [void]
|
4
6
|
def save
|
5
7
|
fail ESP::NotImplementedError
|
6
8
|
end
|
7
9
|
|
8
10
|
# Not Implemented. You cannot destroy a an CloudTrailEvent.
|
11
|
+
#
|
12
|
+
# @return [void]
|
9
13
|
def destroy
|
10
14
|
fail ESP::NotImplementedError
|
11
15
|
end
|
12
16
|
|
13
17
|
# Create a suppression for this region.
|
14
18
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
# +arguments+ | Required | A hash of region suppression attributes
|
18
|
-
#
|
19
|
-
# ===== Valid Arguments
|
20
|
-
#
|
21
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#suppression-create] for valid arguments
|
19
|
+
# @param arguments [Hash] Required hash of region suppression attributes.
|
20
|
+
# ===== Valid Arguments
|
22
21
|
#
|
23
|
-
#
|
22
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#suppression-create] for valid arguments
|
23
|
+
# @return [ESP::Suppression::Region]
|
24
|
+
# @example
|
24
25
|
# suppress(external_account_ids: [5], reason: 'My very good reason for creating this suppression')
|
25
26
|
def suppress(arguments = {})
|
26
27
|
arguments = arguments.with_indifferent_access
|
27
28
|
ESP::Suppression::Region.create(regions: [code], external_account_ids: Array(arguments[:external_account_ids]), reason: arguments[:reason])
|
28
29
|
end
|
29
30
|
|
30
|
-
#
|
31
|
-
#
|
31
|
+
# @!method self.where(clauses = {})
|
32
|
+
# Return a paginated Region list filtered by search parameters
|
32
33
|
#
|
33
|
-
#
|
34
|
+
# *call-seq* -> +super.where(clauses = {})+
|
34
35
|
#
|
35
|
-
#
|
36
|
+
# @param clauses [Hash] A hash of attributes with appended predicates to search and sort by.
|
37
|
+
# ===== Valid Clauses
|
36
38
|
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#region-attributes] for valid arguments
|
40
|
-
#
|
41
|
-
# :call-seq:
|
42
|
-
# where(clauses = {})
|
39
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#region-attributes] for valid arguments
|
40
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Region>]
|
43
41
|
|
44
|
-
|
45
|
-
#
|
46
|
-
# Find a Region by id
|
42
|
+
# @!method self.find(id)
|
43
|
+
# Find a Region by id
|
47
44
|
#
|
48
|
-
#
|
45
|
+
# *call-seq* -> +super.find(id)+
|
49
46
|
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# :call-seq:
|
53
|
-
# find(id)
|
47
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the region to retrieve.
|
48
|
+
# @return [ESP::Region]
|
54
49
|
|
55
|
-
#
|
56
|
-
#
|
50
|
+
# @!method self.all
|
51
|
+
# Return a paginated list.
|
52
|
+
#
|
53
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Region>]
|
57
54
|
end
|
58
55
|
end
|
data/lib/esp/resources/report.rb
CHANGED
@@ -4,43 +4,52 @@ module ESP
|
|
4
4
|
autoload :Integration, File.expand_path(File.dirname(__FILE__) + '/reports/export/integration')
|
5
5
|
end
|
6
6
|
|
7
|
-
##
|
8
7
|
# The organization the report belongs to.
|
8
|
+
#
|
9
|
+
# @return [ESP::Organization]
|
9
10
|
belongs_to :organization, class_name: 'ESP::Organization'
|
10
11
|
|
11
|
-
##
|
12
12
|
# The sub_organization the report belongs to.
|
13
|
+
#
|
14
|
+
# @return [ESP::SubOrganization]
|
13
15
|
belongs_to :sub_organization, class_name: 'ESP::SubOrganization'
|
14
16
|
|
15
|
-
##
|
16
17
|
# The team the report belongs to.
|
18
|
+
#
|
19
|
+
# @return [ESP::Team]
|
17
20
|
belongs_to :team, class_name: 'ESP::Team'
|
18
21
|
|
19
|
-
##
|
20
22
|
# The external_account the report belongs to.
|
23
|
+
#
|
24
|
+
# @return [ESP::ExternalAccount]
|
21
25
|
belongs_to :external_account, class_name: 'ESP::ExternalAccount'
|
22
26
|
|
23
27
|
# Not Implemented. You cannot update a Report.
|
28
|
+
#
|
29
|
+
# @return [void]
|
24
30
|
def update
|
25
31
|
fail ESP::NotImplementedError
|
26
32
|
end
|
27
33
|
|
28
34
|
# Not Implemented. You cannot destroy a Report.
|
35
|
+
#
|
36
|
+
# @return [void]
|
29
37
|
def destroy
|
30
38
|
fail ESP::NotImplementedError
|
31
39
|
end
|
32
40
|
|
33
41
|
# Enqueue a report to be run for the given team.
|
34
42
|
# Returns a Report object with a status of 'queued' and an id
|
35
|
-
# ==== Attribute
|
36
|
-
#
|
37
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#report-create] for valid arguments
|
38
43
|
#
|
39
44
|
# Periodically check the API
|
40
45
|
# ESP::Report.find(<id>)
|
41
46
|
# until status is 'complete'.
|
42
47
|
#
|
43
48
|
# If not successful, returns a Report object with the errors object populated.
|
49
|
+
#
|
50
|
+
# @param arguments [Hash] See {API documentation}[http://api-docs.evident.io?ruby#report-create] for valid arguments
|
51
|
+
# @return [ESP::Report]
|
52
|
+
# @raise [ArgumentError] if +team_id: Integer+ is not supplied.
|
44
53
|
def self.create(arguments = {})
|
45
54
|
fail ArgumentError, "You must supply a team id." unless arguments.with_indifferent_access[:team_id].present?
|
46
55
|
super
|
@@ -50,16 +59,12 @@ module ESP
|
|
50
59
|
|
51
60
|
# Returns a paginated collection of alerts for the report
|
52
61
|
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#alert-attributes] for valid arguments
|
60
|
-
#
|
61
|
-
# ==== Example
|
62
|
-
#
|
62
|
+
# @overload alerts()
|
63
|
+
# @overload alerts(arguments = {})
|
64
|
+
# @param arguments [Hash] An optional hash of search criteria to filter the returned collection.
|
65
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#alert-attributes] for valid arguments.
|
66
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Alert>]
|
67
|
+
# @example
|
63
68
|
# report = ESP::Report.find(345)
|
64
69
|
# alerts = report.alerts(status_eq: 'fail', signature_risk_level_in: ['High'])
|
65
70
|
def alerts(arguments = {})
|
@@ -67,46 +72,43 @@ module ESP
|
|
67
72
|
end
|
68
73
|
|
69
74
|
# Returns the stats for this report
|
75
|
+
#
|
76
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Stat>]
|
70
77
|
def stat
|
71
78
|
ESP::Stat.for_report(id)
|
72
79
|
end
|
73
80
|
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
# ==== Parameters
|
81
|
+
# @!method self.where(clauses = {})
|
82
|
+
# Return a paginated Report list filtered by search parameters
|
78
83
|
#
|
79
|
-
# +clauses
|
84
|
+
# *call-seq* -> +super.where(clauses = {})+
|
80
85
|
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
# :call-seq:
|
86
|
-
# where(clauses = {})
|
86
|
+
# @param clauses [Hash] Hash of attributes with appended predicates to search, sort and include.
|
87
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#report-attributes] for valid arguments
|
88
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Report>]
|
87
89
|
|
88
|
-
|
89
|
-
#
|
90
|
-
# Find a Report by id
|
91
|
-
#
|
92
|
-
# ==== Parameter
|
90
|
+
# @!method self.find(id)
|
91
|
+
# Find a Report by id
|
93
92
|
#
|
94
|
-
# +id
|
93
|
+
# *call-seq* -> +super.find(id, options = {})+
|
95
94
|
#
|
96
|
-
#
|
95
|
+
# @overload find(id)
|
96
|
+
# @overload find(id, options = {})
|
97
|
+
# @param options [Hash] Optional hash of options.
|
98
|
+
# ===== Valid Options
|
97
99
|
#
|
98
|
-
#
|
100
|
+
# +include+ | The list of associated objects to return on the initial request.
|
99
101
|
#
|
100
|
-
#
|
102
|
+
# ===== Valid Includable Associations
|
101
103
|
#
|
102
|
-
#
|
104
|
+
# See {API documentation}[http://api-docs.evident.io?ruby#report-attributes] for valid arguments
|
103
105
|
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
# :call-seq:
|
107
|
-
# find(id, options = {})
|
106
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the report to retrieve.
|
107
|
+
# @return [ESP::Report]
|
108
108
|
|
109
|
-
#
|
110
|
-
#
|
109
|
+
# @!method self.all
|
110
|
+
# Return a paginated Report list
|
111
|
+
#
|
112
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Report>]
|
111
113
|
end
|
112
114
|
end
|
@@ -3,35 +3,44 @@ module ESP
|
|
3
3
|
module Export
|
4
4
|
class Integration < ESP::Resource
|
5
5
|
self.prefix += "reports/export/"
|
6
|
-
|
6
|
+
|
7
|
+
# @!method self.create(attributes = {})
|
8
|
+
# Enqueue reports to be exported to the given integration
|
9
|
+
# Returns a Report::Export::Integration object if successful
|
10
|
+
#
|
11
|
+
# If not successful, returns a Report::Export::Integration object with the errors object populated.
|
12
|
+
#
|
13
|
+
# @param attributes [Hash] See {API documentation}[http://api-docs.evident.io?ruby#report-export] for valid arguments
|
14
|
+
# @return [ESP::Report::Export::Integration]
|
15
|
+
|
16
|
+
# Not Implemented. You cannot search for Report::Export::Integration.
|
17
|
+
#
|
18
|
+
# @return [void]
|
7
19
|
def self.where(*)
|
8
20
|
fail ESP::NotImplementedError
|
9
21
|
end
|
10
22
|
|
11
|
-
# Not Implemented. You cannot search for
|
23
|
+
# Not Implemented. You cannot search for Report::Export::Integration.
|
24
|
+
#
|
25
|
+
# @return [void]
|
12
26
|
def self.find(*)
|
13
27
|
fail ESP::NotImplementedError
|
14
28
|
end
|
15
29
|
|
16
|
-
# Not Implemented. You cannot update a
|
30
|
+
# Not Implemented. You cannot update a Report::Export::Integration.
|
31
|
+
#
|
32
|
+
# @return [void]
|
17
33
|
def update
|
18
34
|
fail ESP::NotImplementedError
|
19
35
|
end
|
20
36
|
|
21
|
-
# Not Implemented. You cannot destroy a
|
37
|
+
# Not Implemented. You cannot destroy a Report::Export::Integration.
|
38
|
+
#
|
39
|
+
# @return [void]
|
22
40
|
def destroy
|
23
41
|
fail ESP::NotImplementedError
|
24
42
|
end
|
25
43
|
|
26
|
-
# :singleton-method: create
|
27
|
-
# Enqueue reports to be exported to the given integration
|
28
|
-
# Returns a Report::Export::Integration object if successful
|
29
|
-
# ==== Attribute
|
30
|
-
#
|
31
|
-
# See {API documentation}[http://api-docs.evident.io?ruby#report-export] for valid arguments
|
32
|
-
#
|
33
|
-
# If not successful, returns a Report::Export::Integration object with the errors object populated.
|
34
|
-
|
35
44
|
protected
|
36
45
|
|
37
46
|
# A success message gets returned, so just return the response instead of parsing for attributes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module ESP
|
2
|
-
|
2
|
+
# @private
|
3
|
+
class Resource < ActiveResource::Base
|
3
4
|
self.site = ESP.site
|
4
5
|
self.proxy = ESP.http_proxy
|
5
6
|
self.format = ActiveResource::Formats::JsonAPIFormat
|
@@ -16,7 +17,7 @@ module ESP
|
|
16
17
|
def serializable_hash(*)
|
17
18
|
h = attributes.extract!('included')
|
18
19
|
h['data'] = { 'type' => self.class.to_s.underscore.sub('esp/', '').pluralize,
|
19
|
-
'attributes' =>
|
20
|
+
'attributes' => changed_attributes.except('id', 'type', 'created_at', 'updated_at', 'relationships') }
|
20
21
|
h['data']['id'] = id if id.present?
|
21
22
|
h
|
22
23
|
end
|
@@ -63,7 +64,7 @@ module ESP
|
|
63
64
|
# Need to set from so paginated collection can use it for page calls.
|
64
65
|
object.tap do |collection|
|
65
66
|
collection.from = options['from']
|
66
|
-
collection.original_params = options
|
67
|
+
collection.original_params = options.fetch('params', {})
|
67
68
|
end
|
68
69
|
end
|
69
70
|
|
@@ -1,21 +1,28 @@
|
|
1
1
|
module ESP
|
2
2
|
class ScanInterval < ESP::Resource
|
3
|
-
##
|
4
3
|
# The external account the scan interval belongs to
|
4
|
+
#
|
5
|
+
# @return [ESP::ExternalAccount]
|
5
6
|
belongs_to :external_account, class_name: 'ESP::ExternalAccount'
|
6
7
|
|
7
|
-
##
|
8
8
|
# The service the scan interval belongs to
|
9
|
+
#
|
10
|
+
# @return [ESP::Service]
|
9
11
|
belongs_to :service, class_name: 'ESP::Service'
|
10
12
|
|
11
13
|
# Find a Scan Interval by id
|
12
14
|
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
# +id+ | Required | The ID of the scan interval to retrieve
|
15
|
+
# *call-seq* -> +super.find(id)+
|
16
16
|
#
|
17
|
-
#
|
18
|
-
#
|
17
|
+
# @overload find(id)
|
18
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the scan interval to retrieve.
|
19
|
+
# @overload find(scope, options)
|
20
|
+
# *call-seq* -> +super.all(options)+
|
21
|
+
# @api private
|
22
|
+
# @param scope [Object] *Example:* +:all+
|
23
|
+
# @param options [Hash] +params: { external_account_id: Interger }+
|
24
|
+
# @raise [ArgumentError] if no +external_account_id+ is supplied.
|
25
|
+
# @return [ESP::ScanInterval]
|
19
26
|
def self.find(*arguments)
|
20
27
|
scope = arguments.slice!(0)
|
21
28
|
options = (arguments.slice!(0) || {}).with_indifferent_access
|
@@ -29,13 +36,12 @@ module ESP
|
|
29
36
|
end
|
30
37
|
|
31
38
|
# Returns a collection of scan_intervals for the given external_account_id
|
32
|
-
# Convenience method to use instead of
|
33
|
-
#
|
34
|
-
# ==== Parameters
|
35
|
-
#
|
36
|
-
# +external_account_id+ | Required | The ID of the external account to retrieve scan intervals for
|
39
|
+
# Convenience method to use instead of {.find} since an external_account_id is required to return alerts.
|
37
40
|
#
|
38
|
-
#
|
41
|
+
# @param external_account_id [Integer, Numeric] Required ID of the external account to retrieve scan intervals for.
|
42
|
+
# @return [ActiveResource::PaginatedCollection<ESP::ScanInterval>]
|
43
|
+
# @raise [ArgumentError] if no +external_account_id+ is supplied.
|
44
|
+
# @example
|
39
45
|
# alerts = ESP::ScanInterval.for_external_account(54)
|
40
46
|
def self.for_external_account(external_account_id = nil)
|
41
47
|
fail ArgumentError, "You must supply an external account id." unless external_account_id.present?
|
@@ -1,36 +1,42 @@
|
|
1
1
|
module ESP
|
2
2
|
class Service < ESP::Resource
|
3
|
-
##
|
4
3
|
# The collection of signatures associated with this service.
|
4
|
+
#
|
5
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Signature>]
|
5
6
|
has_many :signatures, class_name: 'ESP::Signature'
|
6
7
|
|
7
8
|
# Not Implemented. You cannot search for a Tag.
|
9
|
+
#
|
10
|
+
# @return [void]
|
8
11
|
def self.where(*)
|
9
12
|
fail ESP::NotImplementedError
|
10
13
|
end
|
11
14
|
|
12
15
|
# Not Implemented. You cannot create or update a Service.
|
16
|
+
#
|
17
|
+
# @return [void]
|
13
18
|
def save
|
14
19
|
fail ESP::NotImplementedError
|
15
20
|
end
|
16
21
|
|
17
22
|
# Not Implemented. You cannot destroy a Service.
|
23
|
+
#
|
24
|
+
# @return [void]
|
18
25
|
def destroy
|
19
26
|
fail ESP::NotImplementedError
|
20
27
|
end
|
21
28
|
|
22
|
-
|
23
|
-
#
|
24
|
-
# Find a Service by id
|
25
|
-
#
|
26
|
-
# ==== Parameter
|
29
|
+
# @!method self.find(id)
|
30
|
+
# Find a Service by id
|
27
31
|
#
|
28
|
-
# +id+
|
32
|
+
# *call-seq* -> +super.find(id)+
|
29
33
|
#
|
30
|
-
#
|
31
|
-
#
|
34
|
+
# @param id [Integer, Numeric, #to_i] Required ID of the service to retrieve.
|
35
|
+
# @return [ESP::Service]
|
32
36
|
|
33
|
-
#
|
34
|
-
#
|
37
|
+
# @!method self.all
|
38
|
+
# Return a paginated Service list
|
39
|
+
#
|
40
|
+
# @return [ActiveResource::PaginatedCollection<ESP::Service>]
|
35
41
|
end
|
36
42
|
end
|