Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BarrySkidmore committed Jan 23, 2019
0 parents commit 9e5baa3
Show file tree
Hide file tree
Showing 14 changed files with 2,035 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[*.{js,jsx,ts,tsx,vue}]
indent_style = space
indent_size = 2
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
**/vendor/*.js
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
"extends": "airbnb-base"
};
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.DS_Store
node_modules
/dist

# local env files
.env.local
.env.*.local

# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw*
7 changes: 7 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2018 ALERT LOGIC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
@alertlogic/environments
=========

A client for interacting with the Alert Logic Environments Public API.

This library uses @alertlogic/client as its HTTP provider interface.

## Installation

npm install @alertlogic/environments --save

## Usage

var EnvironmentsClient = require('@alertlogic/environments')

Add Environment

EnvironmentsClient.addEnvironment(accountId, environment)
accountId: '1234',
environment: '{"type":"aws", "type_id": "123456789012", "defender_support":true, "defender_location_id":"defender-us-denver", "discover":true, "scan":false}'

Delete Environment

EnvironmentsClient.deleteEnvironment(accountId, environmentId)
accountId: '1234',
environmentId: 'UUID-GOES-HERE'

Get Environment

EnvironmentsClient.getEnvironment(accountId, environmentId, queryParams)
accountId: '1234',
environmentId: 'UUID-GOES-HERE',
queryParams: {
type: 'aws',
type_id: ,
defender_support: true|false,
discover: true|false,
scan: true|false,
mode: 'automatic|guided|readonly|none',
deleted_since: ,
}

Get accounts with environments

EnvironmentsClient.getAccounts(accountId)
accountId: '1234'
queryParams: {
type: 'aws',
type_id: ,
defender_support: true|false,
discover: true|false,
scan: true|false,
mode: 'automatic|guided|readonly|none',
deleted_since: ,
}

Get Environments

EnvironmentsClient.getEnvironments(accountId, queryParams)
accountId: '1234'
queryParams: {
type: 'aws',
type_id: ,
defender_support: true|false,
discover: true|false,
scan: true|false,
mode: 'automatic|guided|readonly|none',
deleted_since: ,
}

Update Environment

EnvironmentsClient.updateEnvironment(accountId, environmentId, environment)
accountId: '1234',
environmentId: 'UUID-GOES-HERE',
environment: '{"name":"environment5", "credential_id": "77C12B2C-8340-4AFD-AB25-4D0581443A5E", "scope": { "include": [{"type": "vpc", "key": "/aws/us-east-1/vpc/vpc-1234"}], "exclude": [{"type": "subnet","key": "/aws/us-east-1/subnet/subnet-35f42c6c"}]}, "enabled":true}'

Update Environment Status

EnvironmentsClient.updateEnvironmentStatus(accountId, environmentId, status)
accountId: '1234',
environmentId: 'UUID-GOES-HERE',
status: '{"status":"ok", "timestamp": 1471277293, "details":"status is ok now"}'

## Interactive

Loads the library into memory and stays in an interactive node shell.

npm run interactive

## Tests

npm test

## Linting

npm run lint

## Contributing

This repository follows the eslint airbnb style.

## Release History

* 0.1.0 Initial release
22 changes: 22 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Type definitions for @al/environments 0.1.0
// Project: https://github.com/alertlogic/environments-client
// Definitions by: Barry Skidmore <https://github.com/BarrySkidmore>

import { AIMSAccount, AIMSSession, UserTimeStamp } from '@al/session';
import { ClientRequestParams } from '@al/client'

declare module '@al/environments';

export function addEnvironment(accountId: string, environment: any): Promise<any>;

export function deleteEnvironment(accountId: string, environmentId: string): Promise<any>;

export function getAccounts(accountId: string, queryParams: any): Promise<any>;

export function getEnvironment(accountId: string, environmentId: string, queryParams: any): Promise<any>;

export function getEnvironments(accountId: string, queryParams: any): Promise<any>;

export function updateEnvironment(accountId: string, environmentId: string, environment: any): Promise<any>;

export function updateEnvironmentStatus(accountId: string, environmentId: string, status: any): Promise<any>;
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let EnvironmentsClient = require('./src/index.js');

EnvironmentsClient = new EnvironmentsClient();

module.exports = EnvironmentsClient;
Loading

0 comments on commit 9e5baa3

Please sign in to comment.