Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
parky128 committed Feb 7, 2019
0 parents commit b5dc2be
Show file tree
Hide file tree
Showing 13 changed files with 5,079 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
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.DS_Store
node_modules

# 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*

# Generated output
dist
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.
165 changes: 165 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
@alertlogic/aims
=========

A client for working with the AIMS Alert Logic API.

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

## Disclaimer

Until the release of version 1.0.0 all current minor version increments may be backwards incompatible. Please bear this in mind when developing against this library. Should you have any further questions, please do not hesitate to contact us as [[email protected]](mailto:[email protected])

## Installation

npm install @alertlogic/aims --save

## Usage

var AIMSClient = require('@alertlogic/aims').AIMSClient; //commonjs - e.g. node
import { AIMSClient } from '@alertlogic/aims'; //ES2015 - e.g. Angular, TS projects

Get Account Details

AIMSClient.getAccountDetails(accountId)
accountId: '1234'

Get Managed Accounts

AIMSClient.getManagedAccounts(accountId, queryParams)
accountId: '1234'
queryParams: {
active: true,
relationship: 'bills_to|managed|managing'
}

Enbale or disabled MFA requirement on account

AIMSClient.requireMFA(accountId, bool)
accountId: '1234',
bool: true|false

Authenticate a user

AIMSClient.authenticate(params, username, password, mfa_code);
params: {
service_name: 'aims',
path: '/authenticate'
},
username: '[email protected]',
password: 'IAmNotAValidUser!@#$',
mfa_code: '123456'

Change a users password

AIMSClient.changePassword(email, password, newPassword)
email: '[email protected]',
password: IAmNotAValidUser!@#$',
newPassword: 'ANewPasswordOfMyChoosing'

Reconstitute a logged in users identity from their AIMS Token

AIMClient.tokenInfo()

Initiate a password reset

AIMSClient.initiateReset(email, returnTo)
email: '[email protected]'',
returnTo: 'https://URLForLoginPurposes'

Complete a password reset

AIMSClient.resetWithToken(token, password)
token: 'ProvidedInEmail',
password: 'ANewPasswordOfMyChoosing'

Create a role

AIMSClient.createRole(accountId, name, permissions)
accountId: '1234',
name: 'This Is My New Role',
permissions: '{"*:own:*:*": "allowed", "aims:own:grant:*":"allowed"}'

Delete a role

AIMSClient.deleteRole(accountId, roleId)
accountId: '1234',
roleId: 'UUID-GOES-HERE'

Get Global Role

AIMSClient.getGlobalRole(roleId)
roleId: 'UUID-GOES-HERE'

Get Account Role

AIMSClient.getAccountRole(accountId, roleId)
accountId: '1234',
roleId: 'UUID-GOES-HERE'

Get all Global Roles

AIMSClient.getGlobalRoles()

Get all Account Roles

AIMSClient.getAccountRoles(accountId)
accountId: '1234'

Update a Role

AIMSClient.updateRole(accountId, name, permissions)
accountId: '1234',
name: 'The New Role Name',
permissions: '{"*:own:*:*": "allowed", "aims:own:grant:*":"allowed"}'

Update a Role Name

AIMSClient.updateRole(accountId, name)
accountId: '1234',
name: 'The New Role Name',

Update Role Permissions

AIMSClient.updateRole(accountId, permissions)
accountId: '1234',
permissions: '{"*:own:*:*": "allowed", "aims:own:grant:*":"allowed"}'

Enroll a Users MFA Device

AIMSClient.enrollMFA(uri, codes)
uri: 'otpauth://totp/Alert%20Logic:[email protected]?secret=GFZSA5CINFJSA4ZTNNZDG5BAKM2EMMZ7&issuer=Alert%20Logic&algorithm=SHA1',
codes: ["123456", "456789"]

Remove a Users MFA Device

AIMSClient.deleteMFA(email)
email: '[email protected]'

## Interactive

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

npm run interactive

NOTE - You must build the sources before running this command, see Building section below

## Tests

npm test

## Contributing

The sources are written in Typescript and follow the tslint airbnb style.

## Building

To generate a production build

npm run build

To generate a development build

npm run build-dev

Builds will be be generated into a `dist` folder and will contain commonjs and umd bundles that will be consumed depending on the module system in whichever environment you are using.
Loading

0 comments on commit b5dc2be

Please sign in to comment.