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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +8 -0
  5. data/Gemfile.lock +5 -3
  6. data/Guardfile +3 -1
  7. data/esp_sdk.gemspec +2 -1
  8. data/lib/esp/aws_clients.rb +2 -1
  9. data/lib/esp/commands/commands_tasks.rb +2 -1
  10. data/lib/esp/commands/console.rb +4 -0
  11. data/lib/esp/exceptions.rb +1 -0
  12. data/lib/esp/extensions/active_resource/dirty.rb +51 -0
  13. data/lib/esp/extensions/active_resource/formats/json_api_format.rb +5 -3
  14. data/lib/esp/extensions/active_resource/paginated_collection.rb +71 -38
  15. data/lib/esp/extensions/active_resource/validations.rb +4 -2
  16. data/lib/esp/external_account_creator.rb +4 -1
  17. data/lib/esp/resources/alert.rb +53 -42
  18. data/lib/esp/resources/cloud_trail_event.rb +18 -12
  19. data/lib/esp/resources/concerns/stat_totals.rb +70 -67
  20. data/lib/esp/resources/contact_request.rb +17 -14
  21. data/lib/esp/resources/custom_signature/definition.rb +46 -51
  22. data/lib/esp/resources/custom_signature/result/alert.rb +13 -5
  23. data/lib/esp/resources/custom_signature/result.rb +49 -53
  24. data/lib/esp/resources/custom_signature.rb +52 -61
  25. data/lib/esp/resources/dashboard.rb +11 -5
  26. data/lib/esp/resources/external_account.rb +59 -58
  27. data/lib/esp/resources/metadata.rb +21 -11
  28. data/lib/esp/resources/organization.rb +49 -39
  29. data/lib/esp/resources/region.rb +25 -28
  30. data/lib/esp/resources/report.rb +46 -44
  31. data/lib/esp/resources/reports/export/integration.rb +22 -13
  32. data/lib/esp/resources/resource.rb +4 -3
  33. data/lib/esp/resources/scan_interval.rb +19 -13
  34. data/lib/esp/resources/service.rb +17 -11
  35. data/lib/esp/resources/signature.rb +43 -53
  36. data/lib/esp/resources/stat.rb +72 -55
  37. data/lib/esp/resources/stat_custom_signature.rb +73 -65
  38. data/lib/esp/resources/stat_region.rb +76 -65
  39. data/lib/esp/resources/stat_service.rb +76 -65
  40. data/lib/esp/resources/stat_signature.rb +76 -65
  41. data/lib/esp/resources/sub_organization.rb +51 -60
  42. data/lib/esp/resources/suppression/region.rb +35 -30
  43. data/lib/esp/resources/suppression/signature.rb +35 -29
  44. data/lib/esp/resources/suppression/unique_identifier.rb +27 -22
  45. data/lib/esp/resources/suppression.rb +45 -34
  46. data/lib/esp/resources/tag.rb +20 -11
  47. data/lib/esp/resources/team.rb +56 -58
  48. data/lib/esp/resources/user.rb +35 -32
  49. data/lib/esp/version.rb +1 -1
  50. data/lib/esp.rb +39 -16
  51. data/lib/esp_sdk.rb +1 -0
  52. data/test/esp/extensions/active_resource/dirty_test.rb +81 -0
  53. data/test/esp/extensions/active_resource/formats/json_api_format_test.rb +8 -0
  54. data/test/esp/extensions/active_resource/paginated_collection_test.rb +7 -0
  55. data/test/esp/integration/json_api_format_integration_test.rb +5 -2
  56. data/test/esp/integration/organization_integration_test.rb +1 -1
  57. data/test/esp/resources/custom_signature_test.rb +15 -0
  58. data/test/factories/custom_signatures.rb +0 -10
  59. metadata +21 -3
@@ -9,89 +9,85 @@ module ESP
9
9
  belongs_to :region, class_name: 'ESP::Region'
10
10
  belongs_to :external_account, class_name: 'ESP::ExternalAccount'
11
11
 
12
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Result::Alert>]
12
13
  def alerts
13
14
  return attributes['alerts'] if attributes['alerts'].present?
14
15
  CustomSignature::Result::Alert.for_result(id)
15
16
  end
16
17
 
17
18
  # Not Implemented. You cannot update a CustomSignature::Result.
19
+ #
20
+ # @return [void]
18
21
  def update
19
22
  fail ESP::NotImplementedError
20
23
  end
21
24
 
22
25
  # Not Implemented. You cannot destroy a CustomSignature::Result.
26
+ #
27
+ # @return [void]
23
28
  def destroy
24
29
  fail ESP::NotImplementedError
25
30
  end
26
31
 
27
- # :singleton-method: where
28
- # Return a paginated CustomSignature::Result list filtered by search parameters
29
- #
30
- # ==== Parameters
31
- #
32
- # +clauses+ | Hash of attributes with appended predicates to search, sort and include.
32
+ # @!method self.where(clauses = {})
33
+ # Returns a paginated list filtered by search parameters
33
34
  #
34
- # ===== Valid Clauses
35
+ # *call-seq* -> +super.where(clauses = {})+
35
36
  #
36
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-attributes] for valid arguments
37
+ # @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
38
+ # ===== Valid Clauses
37
39
  #
38
- # :call-seq:
39
- # where(clauses = {})
40
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-attributes] for valid arguments
41
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Result>]
40
42
 
41
- ##
42
- # :singleton-method: find
43
- # Find a CustomSignature::Result by id
43
+ # @!method self.find(id)
44
+ # Find a CustomSignature::Result by id
44
45
  #
45
- # ==== Parameter
46
+ # *call-seq* -> +super.find(id, options = {})+
46
47
  #
47
- # +id+ | Required | The ID of the custom signature result to retrieve
48
+ # @overload find(id)
49
+ # @overload find(id, options = {})
50
+ # @param options [Hash] An optional hash of options.
51
+ # ===== Valid Options
48
52
  #
49
- # +options+ | Optional | A hash of options
53
+ # +include+ | The list of associated objects to return on the initial request.
50
54
  #
51
- # ===== Valid Options
55
+ # ===== Valid Includable Associations
52
56
  #
53
- # +include+ | The list of associated objects to return on the initial request.
54
- #
55
- # ===== Valid Includable Associations
56
- #
57
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-attributes] for valid arguments
58
- #
59
- # :call-seq:
60
- # find(id, options = {})
61
-
62
- # :singleton-method: all
63
- # Return a paginated CustomSignature::Result list
57
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-attributes] for valid arguments
58
+ # @param id [Integer, Numeric, #to_i] Required ID of the custom signature result to retrieve.
59
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Result>]
64
60
 
65
- # :singleton-method: create
66
- # Create a CustomSignature::Result
67
- # :call-seq:
68
- # create(attributes={})
61
+ # @!method self.all
62
+ # Returns a paginated list.
69
63
  #
70
- # ==== Parameter
71
- #
72
- # +attributes+ | Required | A hash of custom signature result attributes
73
- #
74
- # ===== Valid Attributes
75
- #
76
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-create] for valid arguments
77
- #
78
- # ==== Example
79
- #
80
- # signature = "# Demo Ruby Signature\r\nconfigure do |c|\r\n # Set regions to run in. Remove this line to run in all regions.\r\n c.valid_regions = [:us_east_1]\r\n # Override region to display as global. Useful when checking resources\r\n # like IAM that do not have a specific region.\r\n c.display_as = :global\r\n # deep_inspection works with set_data to automically collect\r\n # data fields for each alert. Not required.\r\n c.deep_inspection = [:users]\r\nend\r\n\r\n# Required perform method\r\ndef perform(aws)\r\n list_users = aws.iam.list_users\r\n count = list_users[:users].count\r\n\r\n # Set data for deep_inspection to use\r\n set_data(list_users)\r\n\r\n if count == 0\r\n fail(user_count: count, condition: 'count == 0')\r\n else\r\n pass(user_count: count, condition: 'count >= 1')\r\n end\r\nend\r\n"
81
- # result = ESP::CustomSignature::Result.create(signature: signature, language: "ruby", region_id: 1, external_account_id: 1)
64
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Result>]
82
65
 
83
- # :method: save
84
- # Create or update a CustomSignature::Result
85
- #
86
- # ===== Valid Attributes
66
+ # @!method self.create(attributes = {})
67
+ # Create a CustomSignature::Result
68
+ # *call-seq* -> +super.create(attributes={})+
69
+ #
70
+ # @param attributes [Hash] Required hash of custom signature result attributes.
71
+ # ===== Valid Attributes
72
+ #
73
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-create] for valid arguments
74
+ # @return [ESP::CustomSignature::Result]
75
+ # @example
76
+ # signature = "# Demo Ruby Signature\r\nconfigure do |c|\r\n # Set regions to run in. Remove this line to run in all regions.\r\n c.valid_regions = [:us_east_1]\r\n # Override region to display as global. Useful when checking resources\r\n # like IAM that do not have a specific region.\r\n c.display_as = :global\r\n # deep_inspection works with set_data to automically collect\r\n # data fields for each alert. Not required.\r\n c.deep_inspection = [:users]\r\nend\r\n\r\n# Required perform method\r\ndef perform(aws)\r\n list_users = aws.iam.list_users\r\n count = list_users[:users].count\r\n\r\n # Set data for deep_inspection to use\r\n set_data(list_users)\r\n\r\n if count == 0\r\n fail(user_count: count, condition: 'count == 0')\r\n else\r\n pass(user_count: count, condition: 'count >= 1')\r\n end\r\nend\r\n"
77
+ # result = ESP::CustomSignature::Result.create(signature: signature, language: "ruby", region_id: 1, external_account_id: 1)
78
+
79
+ # @!method save
80
+ # Create or update a CustomSignature::Result
87
81
  #
88
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-create] for valid arguments
82
+ # ===== Valid Attributes
89
83
  #
90
- # ==== Example
84
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-result-create] for valid arguments
91
85
  #
92
- # signature = "# Demo Ruby Signature\r\nconfigure do |c|\r\n # Set regions to run in. Remove this line to run in all regions.\r\n c.valid_regions = [:us_east_1]\r\n # Override region to display as global. Useful when checking resources\r\n # like IAM that do not have a specific region.\r\n c.display_as = :global\r\n # deep_inspection works with set_data to automically collect\r\n # data fields for each alert. Not required.\r\n c.deep_inspection = [:users]\r\nend\r\n\r\n# Required perform method\r\ndef perform(aws)\r\n list_users = aws.iam.list_users\r\n count = list_users[:users].count\r\n\r\n # Set data for deep_inspection to use\r\n set_data(list_users)\r\n\r\n if count == 0\r\n fail(user_count: count, condition: 'count == 0')\r\n else\r\n pass(user_count: count, condition: 'count >= 1')\r\n end\r\nend\r\n"
93
- # result = ESP::CustomSignature::Result.new(signature: signature, language: "ruby", region_id: 1, external_account_id: 1)
94
- # result.save
86
+ # @return [Boolean]
87
+ # @example
88
+ # signature = "# Demo Ruby Signature\r\nconfigure do |c|\r\n # Set regions to run in. Remove this line to run in all regions.\r\n c.valid_regions = [:us_east_1]\r\n # Override region to display as global. Useful when checking resources\r\n # like IAM that do not have a specific region.\r\n c.display_as = :global\r\n # deep_inspection works with set_data to automically collect\r\n # data fields for each alert. Not required.\r\n c.deep_inspection = [:users]\r\nend\r\n\r\n# Required perform method\r\ndef perform(aws)\r\n list_users = aws.iam.list_users\r\n count = list_users[:users].count\r\n\r\n # Set data for deep_inspection to use\r\n set_data(list_users)\r\n\r\n if count == 0\r\n fail(user_count: count, condition: 'count == 0')\r\n else\r\n pass(user_count: count, condition: 'count >= 1')\r\n end\r\nend\r\n"
89
+ # result = ESP::CustomSignature::Result.new(signature: signature, language: "ruby", region_id: 1, external_account_id: 1)
90
+ # result.save
95
91
  end
96
92
  end
97
93
  end
@@ -3,13 +3,16 @@ module ESP
3
3
  autoload :Definition, File.expand_path(File.dirname(__FILE__) + '/custom_signature/definition')
4
4
  autoload :Result, File.expand_path(File.dirname(__FILE__) + '/custom_signature/result')
5
5
 
6
- ##
7
6
  # The organization this custom signature belongs to.
7
+ #
8
+ # @return [ESP::Organization]
8
9
  belongs_to :organization, class_name: 'ESP::Organization'
10
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature::Definition>]
9
11
  has_many :definitions, class_name: 'ESP::CustomSignature::Definition'
10
12
 
11
- ##
12
13
  # The collection of teams that belong to the custom_signature.
14
+ #
15
+ # @return [ActiveResource::PaginatedCollection<ESP::Team>]
13
16
  def teams
14
17
  return attributes['teams'] if attributes['teams'].present?
15
18
  Team.where(custom_signatures_id_eq: id)
@@ -17,89 +20,77 @@ module ESP
17
20
 
18
21
  # Create a suppression for this custom signature.
19
22
  #
20
- # ==== Parameter
21
- #
22
- # +arguments+ | Required | A hash of signature suppression attributes
23
- #
24
- # ===== Valid Arguments
25
- #
26
- # See {API documentation}[http://api-docs.evident.io?ruby#suppression-create] for valid arguments
23
+ # @param arguments [Hash] Required hash of signature suppression attributes
24
+ # ===== Valid Arguments
27
25
  #
28
- # ==== Example
26
+ # See {API documentation}[http://api-docs.evident.io?ruby#suppression-create] for valid arguments
27
+ # @return [ESP::Suppression::Signature]
28
+ # @example
29
29
  # suppress(regions: ['us_east_1'], external_account_ids: [5], reason: 'My very good reason for creating this suppression')
30
30
  def suppress(arguments = {})
31
31
  arguments = arguments.with_indifferent_access
32
32
  ESP::Suppression::Signature.create(custom_signature_ids: [id], regions: Array(arguments[:regions]), external_account_ids: Array(arguments[:external_account_ids]), reason: arguments[:reason])
33
33
  end
34
34
 
35
- # :singleton-method: where
36
- # Return a paginated CustomSignature list filtered by search parameters
35
+ # @!method self.where(clauses = {})
36
+ # Find a list of custom signatures filtered by search parameters.
37
37
  #
38
- # ==== Parameters
38
+ # *call-seq* -> +super.where(clauses = {})+
39
39
  #
40
- # +clauses+ | Hash of attributes with appended predicates to search, sort and include.
40
+ # @param clauses [Hash] Attributes with appended predicates to search, sort, and include.
41
+ # ===== Valid Clauses
41
42
  #
42
- # ===== Valid Clauses
43
- #
44
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-attributes] for valid arguments
45
- #
46
- # :call-seq:
47
- # where(clauses = {})
43
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-attributes] for valid arguments
44
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature>]
48
45
 
49
- ##
50
- # :singleton-method: find
51
- # Find a CustomSignature by id
52
- #
53
- # ==== Parameter
54
- #
55
- # +id+ | Required | The ID of the custom signature to retrieve
46
+ # @!method self.find(id, options = {})
47
+ # Find a CustomSignature by id
56
48
  #
57
- # +options+ | Optional | A hash of options
49
+ # *call-seq* -> +super.find(id, options = {})+
58
50
  #
59
- # ===== Valid Options
51
+ # @param id [Integer, Numeric, #to_i] Required ID of the custom signature to retrieve.
52
+ # @param options [Hash] Optional hash of options.
53
+ # ===== Valid Options
60
54
  #
61
- # +include+ | The list of associated objects to return on the initial request.
55
+ # +include+ | The list of associated objects to return on the initial request.
62
56
  #
63
- # ===== Valid Includable Associations
57
+ # ===== Valid Includable Associations
64
58
  #
65
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-attributes] for valid arguments
66
- #
67
- # :call-seq:
68
- # find(id, options = {})
69
-
70
- # :singleton-method: all
71
- # Return a paginated CustomSignature list
59
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-attributes] for valid arguments
60
+ # @return [ESP::CustomSignature]
72
61
 
73
- # :singleton-method: create
74
- # Create a CustomSignature
75
- # :call-seq:
76
- # create(attributes={})
77
- #
78
- # ==== Parameter
79
- #
80
- # +attributes+ | Required | A hash of custom signature attributes
62
+ # @!method self.all
63
+ # Return a paginated CustomSignature list
81
64
  #
82
- # ===== Valid Attributes
83
- #
84
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-create] for valid arguments
65
+ # @return [ActiveResource::PaginatedCollection<ESP::CustomSignature>]
66
+
67
+ # @!method self.create(attributes = {})
68
+ # Create a CustomSignature
69
+ # *call-seq* -> +super.create(attributes={})+
85
70
  #
86
- # ==== Example
71
+ # @param attributes [Hash] Required hash of custom signature attributes.
72
+ # ===== Valid Attributes
87
73
  #
88
- # custom_signature = ESP::CustomSignature.create(description: "A test custom signature.", identifier: "AWS::IAM::001", name: "Test Signature", risk_level: "Medium")
74
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-create] for valid arguments
75
+ # @return [ESP::CustomSignature]
76
+ # @example
77
+ # custom_signature = ESP::CustomSignature.create(description: "A test custom signature.", identifier: "AWS::IAM::001", name: "Test Signature", risk_level: "Medium")
89
78
 
90
- # :method: save
91
- # Create or update a CustomSignature
79
+ # @!method save
80
+ # Create or update a CustomSignature
92
81
  #
93
- # ===== Valid Attributes
82
+ # ===== Valid Attributes
94
83
  #
95
- # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-create] for valid arguments
84
+ # See {API documentation}[http://api-docs.evident.io?ruby#custom-signature-create] for valid arguments
96
85
  #
97
- # ==== Example
98
- #
99
- # custom_signature = ESP::CustomSignature.new(description: "A test custom signature.", identifier: "AWS::IAM::001", name: "Test Signature", risk_level: "Medium")
100
- # custom_signature.save
86
+ # @return [Boolean]
87
+ # @example
88
+ # custom_signature = ESP::CustomSignature.new(description: "A test custom signature.", identifier: "AWS::IAM::001", name: "Test Signature", risk_level: "Medium")
89
+ # custom_signature.save
101
90
 
102
- # :method: destroy
103
- # Delete a CustomSignature
91
+ # @!method destroy
92
+ # Delete a CustomSignature
93
+ #
94
+ # @return [self]
104
95
  end
105
96
  end
@@ -3,6 +3,8 @@ module ESP
3
3
  # Not Implemented. You cannot search for a Dashboard.
4
4
  #
5
5
  # Regular ARELlike methods are disabled.
6
+ #
7
+ # @return [void]
6
8
  def self.find(*)
7
9
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the .recent method.'
8
10
  end
@@ -10,26 +12,30 @@ module ESP
10
12
  # Not Implemented. You cannot search for a Dashboard.
11
13
  #
12
14
  # Regular ARELlike methods are disabled.
15
+ #
16
+ # @return [void]
13
17
  def self.where(*)
14
18
  fail ESP::NotImplementedError, 'Regular ARELlike methods are disabled. Use the .recent method.'
15
19
  end
16
20
 
17
21
  # Not Implemented. You cannot create or update a Dashboard.
22
+ #
23
+ # @return [void]
18
24
  def save
19
25
  fail ESP::NotImplementedError
20
26
  end
21
27
 
22
28
  # Not Implemented. You cannot destroy a Dashboard.
29
+ #
30
+ # @return [void]
23
31
  def destroy
24
32
  fail ESP::NotImplementedError
25
33
  end
26
34
 
27
- # Returns a Dashboard object with data from reports run in the last 2 hours
28
- #
29
- # ==== Note
35
+ # @api private
36
+ # Returns with data from reports run in the last 2 hours
30
37
  #
31
- # The dashboard is used internally for the dashboard page on esp.evident.io and is therefore not considered
32
- # part of the public API and may change without notice.
38
+ # @return [ESP::Dashboard]
33
39
  def self.recent
34
40
  # call find_every directly since find is overridden/not implemented
35
41
  find_every from: "#{prefix}dashboard/recent.#{format.extension}"
@@ -1,111 +1,112 @@
1
1
  module ESP
2
2
  class ExternalAccount < ESP::Resource
3
- ##
4
3
  # The organization the external account belongs to.
4
+ #
5
+ # @return [ESP::Organization]
5
6
  belongs_to :organization, class_name: 'ESP::Organization'
6
7
 
7
- ##
8
8
  # The sub_organization the external account belongs to.
9
+ #
10
+ # @return [ESP::SubOrganization]
9
11
  belongs_to :sub_organization, class_name: 'ESP::SubOrganization'
10
12
 
11
- ##
12
13
  # The team the external account belongs to.
14
+ #
15
+ # @return [ESP::Team]
13
16
  belongs_to :team, class_name: 'ESP::Team'
14
17
 
15
- ##
16
18
  # The collection of reports that belong to the team.
19
+ #
20
+ # @return [ActiveResource::PaginatedCollection<ESP::Report>]
17
21
  has_many :reports, class_name: 'ESP::Report'
18
22
 
19
23
  # Helper to generate an external id.
20
24
  # Called automatically when creating an ExternalAccount if +external_id+ is not already set.
25
+ #
26
+ # @return [String]
21
27
  def generate_external_id
22
28
  SecureRandom.uuid
23
29
  end
24
30
 
25
31
  # This instance method is called by the #save method when new? is true.
26
- def create # :nodoc:
32
+ #
33
+ # @private
34
+ def create
27
35
  attributes['external_id'] ||= generate_external_id
28
36
  super
29
37
  end
30
38
 
31
39
  # Returns a collection of scan_intervals for the external account
32
40
  #
33
- # ==== Example
34
- #
41
+ # @return [ActiveResource::PaginatedCollection<ESP::ScanInterval>]
42
+ # @example
35
43
  # external_account = ESP::ExternalAccount.find(345)
36
44
  # scan_intervals = external_account.scan_intervals
37
45
  def scan_intervals
38
46
  ESP::ScanInterval.for_external_account(id)
39
47
  end
40
48
 
41
- # :singleton-method: where
42
- # Return a paginated ExternalAccount list filtered by search parameters
43
- #
44
- # ==== Parameters
49
+ # @!method self.where(clauses = {})
50
+ # Return a paginated ExternalAccount list filtered by search parameters
45
51
  #
46
- # +clauses+ | Hash of attributes with appended predicates to search, sort and include.
52
+ # *call-seq* -> +super.where(clauses = {})+
47
53
  #
48
- # ===== Valid Clauses
54
+ # @param clauses [Hash] A hash of attributes with appended predicates to search, sort and include.
55
+ # ===== Valid Clauses
49
56
  #
50
- # See {API documentation}[http://api-docs.evident.io?ruby#external-account-attributes] for valid arguments
51
- #
52
- # :call-seq:
53
- # where(clauses = {})
57
+ # See {API documentation}[http://api-docs.evident.io?ruby#external-account-attributes] for valid arguments
58
+ # @return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
54
59
 
55
- ##
56
- # :singleton-method: find
57
- # Find an ExternalAccount by id
58
- #
59
- # ==== Parameter
60
+ # @!method self.find(id)
61
+ # Find an ExternalAccount by id
60
62
  #
61
- # +id+ | Required | The ID of the external account to retrieve
63
+ # *call-seq* -> +super.find(id, options = {})+
62
64
  #
63
- # +options+ | Optional | A hash of options
65
+ # @overload find(id)
66
+ # @overload find(id, options = {})
67
+ # @param options [Hash] An optional hash of options.
68
+ # ===== Valid Options
64
69
  #
65
- # ===== Valid Options
70
+ # +include+ | The list of associated objects to return on the initial request.
66
71
  #
67
- # +include+ | The list of associated objects to return on the initial request.
72
+ # ===== Valid Includable Associations
68
73
  #
69
- # ===== Valid Includable Associations
70
- #
71
- # See {API documentation}[http://api-docs.evident.io?ruby#external-account-attributes] for valid arguments
72
- #
73
- # :call-seq:
74
- # find(id, options = {})
75
-
76
- # :singleton-method: all
77
- # Return a paginated CustomSignature list
74
+ # See {API documentation}[http://api-docs.evident.io?ruby#external-account-attributes] for valid arguments
75
+ # @param id [Integer, Numberic, #to_i] Required ID of the external account to retrieve.
76
+ # @return [ESP::ExternalAccount]
78
77
 
79
- # :singleton-method: create
80
- # Create an ExternalAccount.
81
- # :call-seq:
82
- # create(attributes={})
83
- #
84
- # ==== Parameter
85
- #
86
- # +attributes+ | Required | A hash of external account attributes
78
+ # @!method self.all
79
+ # Return a paginated list
87
80
  #
88
- # ===== Valid Attributes
89
- #
90
- # See {API documentation}[http://api-docs.evident.io?ruby#external-account-create] for valid arguments
81
+ # @return [ActiveResource::PaginatedCollection<ESP::ExternalAccount>]
82
+
83
+ # @!method self.create(attributes = {})
84
+ # Create an ExternalAccount.
85
+ # *call-seq* -> +super.create(attributes={})+
91
86
  #
92
- # ==== Example
87
+ # @param attributes [Hash] Required hash of external account attributes.
88
+ # ===== Valid Attributes
93
89
  #
94
- # external_account = ESP::ExternalAccount.create(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)
90
+ # See {API documentation}[http://api-docs.evident.io?ruby#external-account-create] for valid arguments
91
+ # @return [ESP::ExternalAccount]
92
+ # @example
93
+ # external_account = ESP::ExternalAccount.create(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)
95
94
 
96
- # :method: save
97
- # Create or update an ExternalAccount.
95
+ # @!method save
96
+ # Create or update an ExternalAccount.
98
97
  #
99
- # ===== Valid Attributes
98
+ # ===== Valid Attributes
100
99
  #
101
- # See {API documentation}[http://api-docs.evident.io?ruby#external-account-create] for valid arguments
100
+ # See {API documentation}[http://api-docs.evident.io?ruby#external-account-create] for valid arguments
102
101
  #
103
- # ==== Example
104
- #
105
- # external_account = ESP::ExternalAccount.new(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)
106
- # external_account.save
102
+ # @return [Boolean]
103
+ # @example
104
+ # external_account = ESP::ExternalAccount.new(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)
105
+ # external_account.save
107
106
 
108
- # :method: destroy
109
- # Delete a CustomSignature
107
+ # @!method destroy
108
+ # Delete an ExternalAccount
109
+ #
110
+ # @return [self]
110
111
  end
111
112
  end
@@ -1,28 +1,33 @@
1
1
  module ESP
2
2
  class Metadata < ESP::Resource
3
3
  # Not Implemented. You cannot search for Metadata.
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 Metadata.
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 Metadata.
18
+ #
19
+ # @return [void]
14
20
  def destroy
15
21
  fail ESP::NotImplementedError
16
22
  end
17
23
 
18
24
  # Returns a metadata object for the given alert_id
19
- # Convenience method to use instead of ::find since an alert_id is required to return metadata.
25
+ # Convenience method to use instead of {.find} since an alert_id is required to return metadata.
20
26
  #
21
- # ==== Parameter
22
- #
23
- # +alert_id+ | Required | The ID of the alert to retrieve metadata for
24
- #
25
- # ==== Example
27
+ # @param alert_id [Integer, Numeric, #to_i] Required ID of the alert to retrieve metadata for.
28
+ # @return [ESP::Metadata]
29
+ # @raise [ArgumentError] if no +alert_id+ is supplied.
30
+ # @example
26
31
  # alerts = ESP::Metadata.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,17 @@ module ESP
32
37
 
33
38
  # Find a Metadata object by id
34
39
  #
35
- # ==== Parameter
36
- #
37
- # +id+ | Required | The ID of the metadata object to retrieve
40
+ # *call-seq* -> +super.find(id)+
38
41
  #
39
- # :call-seq:
40
- # find(id)
42
+ # @overload find(id)
43
+ # @param id [Integer, Numeric, #to_i] Required ID of the metadata object to retrieve.
44
+ # @overload find(scope, options)
45
+ # *call-seq* -> +super.find(:one, options)+
46
+ # @api private
47
+ # @param scope [Object] *Example:* +:one+
48
+ # @param options [Hash] +params: { alert_id: Integer }+
49
+ # @raise [ArgumentError] if no +alert_id+ is supplied.
50
+ # @return [ESP::Metadata]
41
51
  def self.find(*arguments)
42
52
  scope = arguments.slice!(0)
43
53
  options = (arguments.slice!(0) || {}).with_indifferent_access