README.md in esp_sdk-1.0.1 vs README.md in esp_sdk-1.0.2
- old
+ new
@@ -29,26 +29,26 @@
# Optional :version
# Default and current version 'v1'
api = EspSdk::Api.new(email: 'me@google.com', password: 'password', version: 'optional')
## Configuration
-
+
api.config => #<EspSdk::Configure:0x00000102890f28 @email="me@gmail.com", @version="v1", @uri="https://api.evident.io/api", @token="6_4wys1a2FhqsECstavC", @token_expires_at=Fri, 19 Sep 2014 15:39:10 UTC +00:00>
-
+
# Authorization token
api.config.token => "6_4wys1a2FhqsECstavC"
-
+
# Token expiration. ActiveSupport::TimeWithZone
api.config.token_expires_at => Fri, 19 Sep 2014 15:39:10 UTC +00:00
-
+
# Authorization email
api.config.email => "me@gmail.com"
## End points array
# Current and all endpoints in a single array
-
+
api.end_points =>
[
[0] #<EspSdk::EndPoints::Reports:0x000001019bc498 @config=#<EspSdk::Configure:0x00000102890f28 @email="me@gmail.com", @version="v1", @uri="https://api.evident.io/api", @token="6_4wys1a2FhqsECstavC", @token_expires_at=Fri, 19 Sep 2014 15:39:10 UTC +00:00>>,
[1] #<EspSdk::EndPoints::Users:0x000001019bc038 @config=#<EspSdk::Configure:0x00000102890f28 @email="me@gmail.com", @version="v1", @uri="https://api.evident.io/api", @token="6_4wys1a2FhqsECstavC", @token_expires_at=Fri, 19 Sep 2014 15:39:10 UTC +00:00>>,
[2] #<EspSdk::EndPoints::ExternalAccounts:0x000001028a3ab0 @config=#<EspSdk::Configure:0x00000102890f28 @email="me@gmail.com", @version="v1", @uri="https://api.evident.io/api", @token="6_4wys1a2FhqsECstavC", @token_expires_at=Fri, 19 Sep 2014 15:39:10 UTC +00:00>>,
@@ -63,30 +63,30 @@
]
## Reports end point
### List action
# List action is a pageable response with a total of 5 reports per page.
- api.reports.list =>
+ api.reports.list =>
{
"id" => 130,
"created_at" => "2014-08-06T19:59:57.540Z",
"team" => "Evident"
}
-
+
# Current page
api.reports.current_page
-
+
# Next page sets current_page with the next page results.
api.reports.next_page
-
+
# Previous page sets current_page with the previous page results.
api.reports.prev_page
### Show action
# Show a specific report
# Required :id
- api.reports.show(id: 130) =>
+ api.reports.show(id: 130) =>
{
"report" => 130,
"created_at" => "2014-08-06T19:59:57.540Z",
"team" => "Evident",
"alerts" => [
@@ -105,11 +105,11 @@
"bucket" => "evident-prod",
"deep_inspection" => nil
}
},
}
-
+
# Current record shows the current record
api.reports.current_record
## Dashboard end point
@@ -322,11 +322,11 @@
### Timewarp action
#### This endpoint is used for returning dashboard stats at a specific hour in the past
# Required params: time: => '1413999010' Unix Time
# The time is floored and has five minutes subtracted. Then adds an hour for the end time. Any reports between that hour will have their stats returned.
- # EX:
+ # EX:
# start_time = DateTime.strptime('1413999010','%s').at_beginning_of_hour - 5.minutes
# end_time = start_time + 1.hour
api.dashboard.timewarp(time: '1413999010') =>
{
"enterprise" => false,
@@ -567,17 +567,90 @@
}
}
]
}
+## External Accounts end point
+### List action
+ # list is a pageable response of 25 total external accounts per page
+ api.external_accounts.list =>
+ [
+ [0] {
+ "id" => 1,
+ "created_at" => "2014-10-22T16:23:19.615Z",
+ "updated_at" => "2014-11-03T21:39:36.891Z",
+ "organization_id" => 1,
+ "nickname" => "Ops",
+ "team_id" => 1,
+ "sub_organization_id" => 1,
+ "arn" => "arn:aws:iam::12345:role/evident_service_role",
+ "external_id" => "External ID"
+ }
+ ]
+ # Current page
+ api.external_accounts.current_page
+ # Next page sets current page with the next page results.
+ api.external_accounts.next_page
+
+ # Prev page sets current page with the previous page results.
+ api.external_accounts.prev_page
+
+### Show action
+ # Show a specific external account
+ # Required :id
+ api.external_accounts.show(id: 1) =>
+ {
+ "id" => 1,
+ "created_at" => "2014-10-22T16:23:19.615Z",
+ "updated_at" => "2014-11-03T21:39:36.891Z",
+ "organization_id" => 1,
+ "nickname" => "Ops",
+ "team_id" => 1,
+ "sub_organization_id" => 1,
+ "arn" => "arn:aws:iam::12345:role/evident_service_role",
+ "external_id" => "External ID"
+ }
+
+ # Current record
+ api.external_accounts.current_record
+
+### Update action
+ # Update a specific external account
+ # Required :id
+ api.external_accounts.update(id: 1, nickname: 'Dev Ops') =>
+ {
+ "id" => 1,
+ "created_at" => "2014-10-22T16:23:19.615Z",
+ "updated_at" => "2014-11-03T21:39:36.891Z",
+ "organization_id" => 1,
+ "nickname" => "Dev Ops",
+ "team_id" => 1,
+ "sub_organization_id" => 1,
+ "arn" => "arn:aws:iam::12345:role/evident_service_role",
+ "external_id" => "External ID"
+ }
+
+### Destroy action
+ # Destroy a specific external account
+ # Required :id
+ api.external_accounts.destroy(id: 1) =>
+ {
+ "success" => "Dev Ops has been destroyed"
+ }
+
+### Create action
+ # Create a new external account
+
+
+
## Services end point
#### *Note this end point is a read only end point, and requires the user to have manager role access
#### This end point can be used to for retrieving a service id to apply to a custom signature. Example your custom signature targets EC2 services.
### List action
# list is a pageable response of 25 total signatures per page
- api.services.list =>
+ api.services.list =>
[
[ 4] {
"id" => 5,
"name" => "EC2",
"code" => "EC2",
@@ -587,12 +660,12 @@
]
### Show action
# Show a specific signature
# Required :id
-
- api.show(id: 5) =>
+
+ api.services.show(id: 5) =>
{
"id" => 5,
"name" => "EC2",
"code" => "EC2",
"created_at" => "2014-07-15T16:45:43.457Z",
@@ -602,11 +675,11 @@
## Custom Signatures end point
### List action
# List is a pageable response of 25 total signatures per page
- api.custom_signatures.list =>
+ api.custom_signatures.list =>
[
[ 0] {
"id" => 4,
"organization_id" => 1,
"signature" => "// Demo Signature\r\ndsl.configure(function(c) {\r\n c.module = 'check_user_count_javascript'; // Required\r\n c.identifier = 'AWS:GLO-001'; // Required unique identifier for this signature\r\n c.description = 'Check IAM user count'; // Required short description\r\n c.valid_regions = ['us_east_1']; // Only run in us_east_1\r\n c.display_as = 'global'; // Display as region global instead of region us_east_1\r\n});\r\n\r\n// Required perform function\r\nfunction perform(aws) {\r\n try {\r\n var count = aws.iam.list_users().users.length || 0;\r\n if (count === 0) {\r\n return dsl.fail({\r\n user_count: count,\r\n condition: 'count == 0' });\r\n } else {\r\n return dsl.pass({\r\n user_count: count,\r\n condition: 'count >= 1' });\r\n }\r\n }\r\n catch(err) {\r\n return dsl.error({error: err.message});\r\n }\r\n}\r\n",
@@ -620,24 +693,24 @@
"identifier" => nil,
"service_id" => nil,
"deleted_at" => nil
}
}
-
+
# Current page
api.custom_signatures.current_page
-
+
# Next page sets current page with the next page results.
api.custom_signatures.next_page
-
+
# Prev page sets current page with the previous page results.
api.custom_signatures.prev_page
-
+
### Show action
# Show a specific custom signature
# Required :id
-
+
api.custom_signatures.show(id: 4) =>
{
"id" => 4,
"organization_id" => 1,
"signature" => "// Demo Signature\r\ndsl.configure(function(c) {\r\n c.module = 'check_user_count_javascript'; // Required\r\n c.identifier = 'AWS:GLO-001'; // Required unique identifier for this signature\r\n c.description = 'Check IAM user count'; // Required short description\r\n c.valid_regions = ['us_east_1']; // Only run in us_east_1\r\n c.display_as = 'global'; // Display as region global instead of region us_east_1\r\n});\r\n\r\n// Required perform function\r\nfunction perform(aws) {\r\n try {\r\n var count = aws.iam.list_users().users.length || 0;\r\n if (count === 0) {\r\n return dsl.fail({\r\n user_count: count,\r\n condition: 'count == 0' });\r\n } else {\r\n return dsl.pass({\r\n user_count: count,\r\n condition: 'count >= 1' });\r\n }\r\n }\r\n catch(err) {\r\n return dsl.error({error: err.message});\r\n }\r\n}\r\n",
@@ -700,17 +773,17 @@
# Required :id
api.custom_signatures.destroy(id: 97) =>
{
"success" => "Demo Signature has been destroyed"
}
-
+
### Run action
# Run a custom signature
# Required :id => ID of the custom signature to run
# Required :external_account_id => ID of the external account to use
# Required :regions => Array of regions to run the signature in
-
+
api.custom_signatures.run(id: 1, external_account_id: 1, regions: [:us_east_1]) =>
{
"alerts" => [
[0] {
"info" => {
@@ -757,11 +830,11 @@
}
]
}
### Run Raw action
- # Run a raw custom signature
+ # Run a raw custom signature
# Required: :signature => JavaScript signature to run as a string
# Required :external_account_id => ID of the external account to use
# Required :regions => Array of regions to run the signature in
api.custom_signatures.run_raw(signature: "Javascript", regions: [:us_east_1], external_account_id: 1) =>
{
@@ -810,15 +883,15 @@
}
}
]
}
-
+
## Signatures end point
### List action
# List is a pageable response of 25 total signatures per page.
- api.signatures.list =>
+ api.signatures.list =>
[
[ 0] {
"id" => 35,
"name" => "Global Telnet",
"description" => "Globally Accessible Administrative Port -- Telnet (tcp/23)",
@@ -833,24 +906,24 @@
"service" => {
"name" => "EC2"
}
},
]
-
+
# Current page
api.signatures.current_page
-
+
# Next page sets current page with the next page results.
api.signatures.next_page
-
+
# Prev page sets current page with the previous page results.
api.signatures.prev_page
### Show action
# Show a specific signature
# Required :id
- api.signatures.show(id: 35) =>
+ api.signatures.show(id: 35) =>
{
"id" => 35,
"name" => "Global Telnet",
"description" => "Globally Accessible Administrative Port -- Telnet (tcp/23)",
"provider" => "AWS",
@@ -911,17 +984,17 @@
[36] "non_default_vpc_nacl"
]
}
### Run action
-
+
# Run an Evident Signature
Required :signature_name => name of signature to run
Required :external_account_id => ID of the external account with the ARN/External ID to use
Required :regions => Array of regions to run the signature in
# Requires manager role access
-
+
api.signatures.run(signature_name: 'validate_cloud_formation_template', regions: [:us_east_1], external_account_id: 1)
{
"alerts" => [
[0] {
"info" => {
@@ -1000,11 +1073,11 @@
"plan_setup_complete" => true,
"enable_sso" => false,
"sso_idp_id" => nil
}
-
+
### Update action
# Update your organizations information
# Required :id
# Valid Params :name
api.organizations.update(id: 1, name: 'Updated Name') =>
@@ -1038,17 +1111,17 @@
"name" => "Evident",
"created_at" => "2014-06-23T18:53:25.531Z",
"updated_at" => "2014-09-03T12:32:50.472Z"
}
]
-
+
# Current page
api.sub_organizations.current_page
-
+
# Next page sets current page with the next page results.
api.sub_organizations.next_page
-
+
# Prev page sets current page with the previous page results.
api.sub_organizations.prev_page
### Show action
# Show a specific sub organization
@@ -1095,11 +1168,11 @@
api.sub_organizations.destroy(id: 3) =>
{
"success" => "Test has been destroyed"
}
-
+
## Teams end point
### List action
# List is a pageable response of 25 total signatures per page.
api.teams.list =>
[
@@ -1111,17 +1184,17 @@
"updated_at" => "2014-06-23T18:53:25.552Z",
"organization_id" => 1,
"deleted_at" => nil
},
]
-
+
# Current page
api.teams.current_page
-
+
# Next page sets current page with the next page results.
api.teams.next_page
-
+
# Prev page sets current page with the previous page results.
api.teams.prev_page
### Show action
# Show a specific team
@@ -1174,10 +1247,10 @@
api.teams.destroy(id: 52) =>
{
"success" => "New Name has been destroyed"
}
-
+
## Contributing
1. Fork it ( https://github.com/[my-github-username]/esp_sdk/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)