├── source ├── cli │ ├── install.sh │ ├── datalake-describe-cart.js │ ├── package.json │ ├── datalake-describe-required-metadata.js │ ├── datalake-describe-package.js │ ├── datalake-remove-package.js │ ├── datalake-describe-cart-item.js │ ├── datalake-remove-cart-item.js │ ├── datalake-describe-package-datasets.js │ ├── datalake-describe-package-metadata.js │ ├── datalake-search.js │ ├── datalake-add-cart-item.js │ ├── datalake-describe-package-dataset.js │ ├── datalake-remove-package-dataset.js │ ├── datalake-list-groups.js │ ├── datalake-update-package.js │ ├── datalake-checkout-cart.js │ ├── datalake-create-package.js │ ├── datalake-create-package-metadata.js │ ├── datalake-delete-group.js │ ├── datalake-get-package-crawler.js │ ├── datalake-list-package-tables.js │ ├── datalake-execute-package-crawler.js │ ├── datalake-get-group.js │ ├── datalake-update-package-crawler.js │ ├── datalake-get-user-group-list.js │ ├── core │ │ ├── credentials.js │ │ └── apiproxy.js │ ├── datalake-update-group.js │ ├── datalake-create-group.js │ ├── datalake-get-package-table-data.js │ ├── datalake-update-user-group-list.js │ ├── datalake-remove-user-from-group.js │ ├── datalake-upload-package-dataset.js │ ├── datalake-import-package-manifest.js │ └── datalake.js ├── console │ ├── .bowerrc │ ├── app │ │ ├── images │ │ │ ├── favicon.ico │ │ │ ├── data-lake-s3.png │ │ │ ├── data-lake-intro.png │ │ │ ├── data-lake-logo.jpg │ │ │ ├── data-lake-linking.png │ │ │ ├── data-lake-s3-alt.png │ │ │ ├── data-lake-search.png │ │ │ ├── data-lake-intro-alt.png │ │ │ └── data-lake-linking-alt.png │ │ ├── common │ │ │ ├── components │ │ │ │ ├── version │ │ │ │ │ ├── interpolate-filter_test.js │ │ │ │ │ ├── version-directive_test.js │ │ │ │ │ ├── version.js │ │ │ │ │ ├── version-directive.js │ │ │ │ │ ├── interpolate-filter.js │ │ │ │ │ └── version_test.js │ │ │ │ ├── goclick │ │ │ │ │ └── goclick-directive.js │ │ │ │ └── compareTo │ │ │ │ │ └── compareTo-directive.js │ │ │ └── factories │ │ │ │ ├── searchFactory_test.js │ │ │ │ ├── utils.js │ │ │ │ └── profileFactory_test.js │ │ ├── dashboard │ │ │ ├── dashboard_test.js │ │ │ └── dashboard.html │ │ ├── admin │ │ │ ├── users │ │ │ │ ├── users_test.js │ │ │ │ ├── invitation.html │ │ │ │ ├── users.html │ │ │ │ ├── users.js │ │ │ │ └── invitation.js │ │ │ └── groups │ │ │ │ ├── createGroup.html │ │ │ │ └── groups.html │ │ ├── signin │ │ │ ├── signin_test.js │ │ │ └── signin.html │ │ ├── profile │ │ │ ├── changePassword_test.js │ │ │ ├── profile_test.js │ │ │ ├── changePassword.html │ │ │ ├── changePassword.js │ │ │ └── profile.html │ │ ├── main │ │ │ ├── main_test.js │ │ │ └── main.js │ │ ├── search │ │ │ └── search_test.js │ │ ├── confirm │ │ │ ├── confirm_test.js │ │ │ ├── confirm.js │ │ │ └── confirm.html │ │ ├── forgot │ │ │ └── forgot_test.js │ │ └── cart │ │ │ └── cart_test.js │ ├── e2e-tests │ │ ├── protractor.conf.js │ │ └── scenarios.js │ ├── .jshintrc │ ├── .travis.yml │ ├── bower.json │ ├── karma.conf.js │ └── package.json ├── api │ ├── services │ │ ├── logging │ │ │ ├── lib │ │ │ │ ├── index.js │ │ │ │ └── test-setup.spec.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── admin │ │ │ ├── lib │ │ │ │ ├── test-setup.spec.js │ │ │ │ └── access-log.spec.js │ │ │ ├── index.js │ │ │ └── package.json │ │ ├── cart │ │ │ ├── lib │ │ │ │ ├── test-setup.spec.js │ │ │ │ └── access-log.spec.js │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── manifest │ │ │ ├── lib │ │ │ │ ├── test-setup.spec.js │ │ │ │ ├── index.spec.js │ │ │ │ └── index.js │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── package │ │ │ ├── lib │ │ │ │ ├── test-setup.spec.js │ │ │ │ └── access-log.spec.js │ │ │ ├── package.json │ │ │ └── index.js │ │ ├── profile │ │ │ ├── lib │ │ │ │ ├── test-setup.spec.js │ │ │ │ └── access-log.spec.js │ │ │ ├── package.json │ │ │ └── index.js │ │ └── search │ │ │ ├── lib │ │ │ ├── test-setup.spec.js │ │ │ ├── access-log.spec.js │ │ │ └── index.spec.js │ │ │ ├── package.json │ │ │ └── index.js │ └── authorizer │ │ ├── test-setup.spec.js │ │ └── package.json └── resources │ ├── helper │ ├── lib │ │ ├── test-setup.spec.js │ │ └── dynamodb-helper.js │ └── package.json │ ├── access-validator │ ├── access-validator.spec.js │ └── package.json │ └── loader │ ├── package.json │ ├── core │ ├── credentials.js │ └── apiproxy.js │ └── index.js ├── .gitignore ├── CODE_OF_CONDUCT.md ├── deployment └── manifest-generator │ ├── package.json │ └── app.js ├── CHANGELOG.md ├── NOTICE.txt └── .jscsrc /source/cli/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd ./datalake-cli-bundle 3 | npm link 4 | -------------------------------------------------------------------------------- /source/console/.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "app/lib/bower_components" 3 | } 4 | -------------------------------------------------------------------------------- /source/console/app/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/favicon.ico -------------------------------------------------------------------------------- /source/console/app/images/data-lake-s3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-s3.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-intro.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-logo.jpg -------------------------------------------------------------------------------- /source/console/app/images/data-lake-linking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-linking.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-s3-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-s3-alt.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-search.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-intro-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-intro-alt.png -------------------------------------------------------------------------------- /source/console/app/images/data-lake-linking-alt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/aws-data-lake-solution/main/source/console/app/images/data-lake-linking-alt.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/dist 2 | **/.zip 3 | **/.DS_Store 4 | **/node_modules 5 | **/bower_components 6 | **/package-lock.json 7 | /.idea/* 8 | /.scannerwork/* 9 | /docs/online-help/site 10 | /deployment/open-source/ 11 | /source/console/app/lib/app-variables.js 12 | *.swp 13 | -------------------------------------------------------------------------------- /source/api/services/logging/lib/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | let AWS = require('aws-sdk'); 4 | let logging = require('./logging.js'); 5 | 6 | module.exports.respond = function(event, cb) { 7 | 8 | let _logging = new logging(); 9 | _logging.createEntry(event, cb); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /source/api/authorizer/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/resources/helper/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /deployment/manifest-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "manifest-generator", 3 | "version": "2.2", 4 | "private": true, 5 | "description": "Helper utility to create data lake site manifest for deployment", 6 | "main": "app.js", 7 | "license": "Apache-2.0", 8 | "author": { 9 | "name": "aws-solutions-builder" 10 | }, 11 | "dependencies": {} 12 | } 13 | -------------------------------------------------------------------------------- /source/api/services/admin/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/cart/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/logging/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/manifest/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/package/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/profile/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/api/services/search/lib/test-setup.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/resources/access-validator/access-validator.spec.js: -------------------------------------------------------------------------------- 1 | const sinon = require('sinon'); 2 | const chai = require('chai'); 3 | const sinonChai = require('sinon-chai'); 4 | 5 | before(function() { 6 | chai.use(sinonChai); 7 | }); 8 | 9 | beforeEach(function() { 10 | this.sandbox = sinon.sandbox.create(); 11 | }); 12 | 13 | afterEach(function() { 14 | this.sandbox.restore(); 15 | }); 16 | -------------------------------------------------------------------------------- /source/console/e2e-tests/protractor.conf.js: -------------------------------------------------------------------------------- 1 | //jshint strict: false 2 | exports.config = { 3 | 4 | allScriptsTimeout: 11000, 5 | 6 | specs: [ 7 | '*.js' 8 | ], 9 | 10 | capabilities: { 11 | 'browserName': 'chrome' 12 | }, 13 | 14 | baseUrl: 'http://localhost:8000/', 15 | 16 | framework: 'jasmine', 17 | 18 | jasmineNodeOpts: { 19 | defaultTimeoutInterval: 30000 20 | } 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /source/api/services/admin/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | console.log('Loading function'); 4 | let lib = require('./lib'); 5 | 6 | exports.handler = function(event, context, callback) { 7 | console.log(event); 8 | 9 | lib.respond(event, function(error, response) { 10 | if (error) { 11 | console.error(error); 12 | return callback(null, error); 13 | } else { 14 | return callback(null, response); 15 | } 16 | }); 17 | 18 | }; 19 | -------------------------------------------------------------------------------- /source/api/services/logging/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | console.log('Loading function'); 4 | let lib = require('./lib'); 5 | 6 | exports.handler = function(event, context, callback) { 7 | console.log(event); 8 | 9 | lib.respond(event, function(error, response) { 10 | if (error) { 11 | console.error(error); 12 | return callback(error, null); 13 | } else { 14 | return callback(null, response); 15 | } 16 | }); 17 | 18 | }; 19 | -------------------------------------------------------------------------------- /source/console/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "strict": "global", 3 | "globals": { 4 | // Angular 5 | "angular": false, 6 | 7 | // Angular mocks 8 | "module": false, 9 | "inject": false, 10 | 11 | // Jasmine 12 | "jasmine": false, 13 | "describe": false, 14 | "beforeEach": false, 15 | "afterEach": false, 16 | "it": false, 17 | "expect": false, 18 | 19 | // Protractor 20 | "browser": false, 21 | "element": false, 22 | "by": false 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/resources/loader/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "loader", 3 | "description": "Data Lake test harness loader", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "js-base64": "^2.4.9", 13 | "moment": "^2.22.2", 14 | "async": "^0.0.1" 15 | }, 16 | "bundledDependencies": [ 17 | "moment", 18 | "js-base64", 19 | "async" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/interpolate-filter_test.js: -------------------------------------------------------------------------------- 1 | describe('dataLake.version module', function() { 2 | beforeEach(module('dataLake.version')); 3 | 4 | describe('interpolate filter', function() { 5 | beforeEach(module(function($provide) { 6 | $provide.value('version', 'TEST_VER'); 7 | })); 8 | 9 | it('should replace VERSION', inject(function( 10 | interpolateFilter) { 11 | expect(interpolateFilter( 12 | 'before %VERSION% after')).toEqual( 13 | 'before TEST_VER after'); 14 | })); 15 | }); 16 | }); 17 | -------------------------------------------------------------------------------- /source/console/.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | dist: trusty 3 | 4 | language: node_js 5 | node_js: 6 | - '4.5' 7 | 8 | install: 9 | - export DISPLAY=:99.0 10 | - sh -e /etc/init.d/xvfb start 11 | - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - 12 | - sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' 13 | - sudo apt-get update -q 14 | - sudo apt-get install -q google-chrome-stable 15 | 16 | before_script: 17 | - npm install 18 | 19 | script: 20 | - npm run test-single-run 21 | - (npm start > /dev/null &) && (npm run protractor) 22 | -------------------------------------------------------------------------------- /source/console/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-console", 3 | "description": "A user interface console for the Data Lake solution", 4 | "version": "0.1.0", 5 | "private": true, 6 | "dependencies": { 7 | "angular": "~1.5.8", 8 | "angular-ui-router": "~0.3.1", 9 | "angular-messages": "~1.5.8", 10 | "angular-loader": "~1.5.8", 11 | "angular-mocks": "~1.5.8", 12 | "angular-resource": "~1.5.8", 13 | "bootstrap": "~3.3", 14 | "aws-sdk": "*", 15 | "moment": "*", 16 | "underscore": "*", 17 | "jsbn": "*", 18 | "sjcl": "*", 19 | "angular-block-ui": "*" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-cart.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .parse(process.argv); 9 | 10 | //get the signed api credentials 11 | let _creds = new Creds(); 12 | let _authKey = _creds.getAuthSignature(); 13 | 14 | // send api request 15 | let _apiproxy = new ApiProxy(); 16 | let _path = '/prod/cart/'; 17 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 18 | if (err) { 19 | console.log(err); 20 | process.exit(1); 21 | } 22 | 23 | console.log(JSON.stringify(data)); 24 | }); 25 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/version-directive_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.version module', function() { 4 | beforeEach(module('dataLake.version')); 5 | 6 | describe('app-version directive', function() { 7 | it('should print current version', function() { 8 | module(function($provide) { 9 | $provide.value('version', 'TEST_VER'); 10 | }); 11 | inject(function($compile, $rootScope) { 12 | var element = $compile('')($rootScope); 13 | expect(element.text()).toEqual('TEST_VER'); 14 | }); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /source/cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "datalake", 3 | "version": "0.1.0", 4 | "description": "AWS Data Lake Commmand Line Interface", 5 | "main": "datalake.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "bin": { 10 | "datalake": "datalake.js" 11 | }, 12 | "keywords": [ 13 | "AWS", 14 | "Data", 15 | "Lake", 16 | "CLI" 17 | ], 18 | "author": "aws-solutions-builder", 19 | "license": "Apache-2.0", 20 | "dependencies": { 21 | "commander": "^2.9.0", 22 | "js-base64": "^2.4.9", 23 | "request": "^2.88.0", 24 | "moment": "^2.22.2" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/resources/access-validator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "access-validator", 3 | "version": "0.0.1", 4 | "description": "AccessValidator is a auxiliar class to check authentication and Authorization for datalake services", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "private": "true", 10 | "main": "access-validator.js", 11 | "dependencies": { 12 | "underscore": "*" 13 | }, 14 | "devDependencies": { 15 | "aws-sdk-mock": "^4.5.0", 16 | "chai": "^4.2.0", 17 | "chai-things": "^0.2.0", 18 | "mocha": "^6.2.2", 19 | "sinon": "^2.4.1", 20 | "sinon-chai": "^3.3.0" 21 | }, 22 | "scripts": { 23 | "test": "mocha *.spec.js" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-required-metadata.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program.parse(process.argv); 8 | 9 | //get the signed api credentials 10 | let _creds = new Creds(); 11 | let _authKey = _creds.getAuthSignature(); 12 | 13 | // send api request 14 | let _apiproxy = new ApiProxy(); 15 | let _payload = JSON.stringify({ 16 | operation: 'required_metadata' 17 | }); 18 | _apiproxy.sendApiRequest('/prod/packages', 'POST', _payload, _authKey, function(err, data) { 19 | if (err) { 20 | console.log(err); 21 | process.exit(1); 22 | } 23 | 24 | console.log(JSON.stringify(data)); 25 | }); 26 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.packageId) { 12 | console.error('option "--package-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/packages/', program.packageId].join(''); 23 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-remove-package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.packageId) { 12 | console.error('option "--package-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/packages/', program.packageId].join(''); 23 | _apiproxy.sendApiRequest(_path, 'DELETE', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-cart-item.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--cart-item-id ', 'cart item identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.cartItemId) { 12 | console.error('option "--cart-item-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/cart/', program.cartItemId].join(''); 23 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-remove-cart-item.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--cart-item-id ', 'cart item identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.cartItemId) { 12 | console.error('option "--cart-item-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/cart/', program.cartItemId].join(''); 23 | _apiproxy.sendApiRequest(_path, 'DELETE', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-package-datasets.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.packageId) { 12 | console.error('option "--package-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/packages/', program.packageId, '/datasets'].join(''); 23 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-package-metadata.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .parse(process.argv); 10 | 11 | if (!program.packageId) { 12 | console.error('option "--package-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = ['/prod/packages/', program.packageId, '/metadata'].join(''); 23 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 24 | if (err) { 25 | console.log(err); 26 | process.exit(1); 27 | } 28 | 29 | console.log(JSON.stringify(data)); 30 | }); 31 | -------------------------------------------------------------------------------- /source/cli/datalake-search.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--terms ', 'search terms') 9 | .parse(process.argv); 10 | 11 | if (!program.terms) { 12 | console.error('option "--terms " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | let _terms = program.terms.replace(/ /g, '+') 21 | 22 | // send api request 23 | let _apiproxy = new ApiProxy(); 24 | let _path = ['/prod/search?term', _terms].join('='); 25 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 26 | if (err) { 27 | console.log(err); 28 | process.exit(1); 29 | } 30 | 31 | console.log(JSON.stringify(data)); 32 | }); 33 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [2.1.1] - 2019-08-28 8 | ### Added 9 | - CHANGELOG templated file 10 | 11 | ## [2.2.0] - 2019-12-18 12 | ### Updated 13 | - Migrated lambda function runtimes to Nodejs 12.x 14 | - Changes to shell script and manifest generator to fix build pipeline 15 | - Fixed unit test failures for api/services/package 16 | - Updated Software License to Apache 2.0 license and added 3rd party library licenses to License.txt 17 | - Updated package.json for all modules to specify library version numbers 18 | - Added 'Update' event type for custom lambda resource to allow CloudFormation Stack to be updated from version 2.1 19 | - Fix for GitHub issues #38, #37, #34, #28, #26, #24 -------------------------------------------------------------------------------- /source/cli/datalake-add-cart-item.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package json object') 9 | .parse(process.argv); 10 | 11 | if (!program.packageId) { 12 | console.error('option "--package-id " argument required'); 13 | process.exit(1); 14 | } 15 | 16 | //get the signed api credentials 17 | let _creds = new Creds(); 18 | let _authKey = _creds.getAuthSignature(); 19 | 20 | // send api request 21 | let _apiproxy = new ApiProxy(); 22 | let _path = '/prod/cart/new'; 23 | let _payload = JSON.stringify({ 24 | package_id: program.packageId 25 | }); 26 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 27 | if (err) { 28 | console.log(err); 29 | process.exit(1); 30 | } 31 | 32 | console.log(JSON.stringify(data)); 33 | }); 34 | -------------------------------------------------------------------------------- /source/cli/datalake-describe-package-dataset.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .option('--dataset-id ', 'dataset identifier') 10 | .parse(process.argv); 11 | 12 | if (!program.packageId) { 13 | console.error('option "--package-id " argument required'); 14 | process.exit(1); 15 | } 16 | 17 | if (!program.datasetId) { 18 | console.error('option "--dataset-id " argument required'); 19 | process.exit(1); 20 | } 21 | 22 | //get the signed api credentials 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | // send api request 27 | let _apiproxy = new ApiProxy(); 28 | let _path = ['/prod/packages/', program.packageId, '/datasets/', program.datasetId].join(''); 29 | _apiproxy.sendApiRequest(_path, 'GET', null, _authKey, function(err, data) { 30 | if (err) { 31 | console.log(err); 32 | process.exit(1); 33 | } 34 | 35 | console.log(JSON.stringify(data)); 36 | }); 37 | -------------------------------------------------------------------------------- /source/cli/datalake-remove-package-dataset.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .option('--dataset-id ', 'dataset identifier') 10 | .parse(process.argv); 11 | 12 | if (!program.packageId) { 13 | console.error('option "--package-id " argument required'); 14 | process.exit(1); 15 | } 16 | 17 | if (!program.datasetId) { 18 | console.error('option "--dataset-id " argument required'); 19 | process.exit(1); 20 | } 21 | 22 | //get the signed api credentials 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | // send api request 27 | let _apiproxy = new ApiProxy(); 28 | let _path = ['/prod/packages/', program.packageId, '/datasets/', program.datasetId].join(''); 29 | _apiproxy.sendApiRequest(_path, 'DELETE', null, _authKey, function(err, data) { 30 | if (err) { 31 | console.log(err); 32 | process.exit(1); 33 | } 34 | 35 | console.log(JSON.stringify(data)); 36 | }); 37 | -------------------------------------------------------------------------------- /source/cli/datalake-list-groups.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // get the signed api credentials 9 | //----------------------------------------------------------------------------- 10 | let _creds = new Creds(); 11 | let _authKey = _creds.getAuthSignature(); 12 | 13 | //----------------------------------------------------------------------------- 14 | // send api request 15 | //----------------------------------------------------------------------------- 16 | let _apiproxy = new ApiProxy(); 17 | let _path = `/prod/admin/groups/`; 18 | let _payload = JSON.stringify({ 19 | }); 20 | 21 | //----------------------------------------------------------------------------- 22 | // print result 23 | //----------------------------------------------------------------------------- 24 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 25 | if (err) { 26 | console.log(err); 27 | process.exit(1); 28 | } 29 | 30 | console.log(JSON.stringify(data)); 31 | }); 32 | -------------------------------------------------------------------------------- /source/console/e2e-tests/scenarios.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /* https://github.com/angular/protractor/blob/master/docs/toc.md */ 4 | 5 | describe('my app', function() { 6 | 7 | 8 | it('should automatically redirect to /dashboard when location hash/fragment is empty', function() { 9 | browser.get('index.html'); 10 | expect(browser.getLocationAbsUrl()).toMatch("/dashboard"); 11 | }); 12 | 13 | 14 | describe('dashboard', function() { 15 | 16 | beforeEach(function() { 17 | browser.get('#/dashboard'); 18 | }); 19 | 20 | 21 | it('should render view1 when user navigates to /view1', function() { 22 | expect(element.all(by.css('[ng-view] p')).first().getText()). 23 | toMatch(/partial for view 1/); 24 | }); 25 | 26 | }); 27 | 28 | 29 | describe('view2', function() { 30 | 31 | beforeEach(function() { 32 | browser.get('#/view2'); 33 | }); 34 | 35 | 36 | it('should render view2 when user navigates to /view2', function() { 37 | expect(element.all(by.css('[ng-view] p')).first().getText()). 38 | toMatch(/partial for view 2/); 39 | }); 40 | 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /source/api/services/logging/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-logging-service", 3 | "description": "A microservice function for logging data lake activity", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "moment": "^2.22.2", 13 | "underscore": "^1.9.1" 14 | }, 15 | "devDependencies": { 16 | "chai": "^4.2.0", 17 | "sinon": "^2.4.1", 18 | "sinon-chai": "^3.3.0", 19 | "mocha": "^6.2.2", 20 | "aws-sdk-mock": "^4.5.0", 21 | "npm-run-all": "^4.1.5" 22 | }, 23 | "scripts": { 24 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 25 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 26 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 27 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 28 | "build": "npm-run-all -s build-init build:copy build:install", 29 | "zip": "cd dist && zip -rq data-lake-logging-service.zip ." 30 | }, 31 | "bundledDependencies": [ 32 | "moment", 33 | "underscore" 34 | ] 35 | } -------------------------------------------------------------------------------- /source/cli/datalake-update-package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'package identifier') 9 | .option('--package-name ', 'Updated package name') 10 | .option('--package-description ', 'Updated package description') 11 | .parse(process.argv); 12 | 13 | if (!program.packageId) { 14 | console.error('option "--package-id " argument required'); 15 | process.exit(1); 16 | } 17 | 18 | let _payload = {}; 19 | 20 | if (program.packageName) { 21 | _payload.name = program.packageName; 22 | } 23 | 24 | if (program.packageDescription) { 25 | _payload.description = program.packageDescription; 26 | } 27 | 28 | //get the signed api credentials 29 | let _creds = new Creds(); 30 | let _authKey = _creds.getAuthSignature(); 31 | 32 | // send api request 33 | let _apiproxy = new ApiProxy(); 34 | let _path = ['/prod/packages/', program.packageId].join(''); 35 | _apiproxy.sendApiRequest(_path, 'PUT', JSON.stringify(_payload), _authKey, function(err, data) { 36 | if (err) { 37 | console.log(err); 38 | process.exit(1); 39 | } 40 | 41 | console.log(JSON.stringify(data)); 42 | }); 43 | -------------------------------------------------------------------------------- /source/cli/datalake-checkout-cart.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--format ', 'Manifest format', 'SIGNED_URL') 9 | .option('--package-id ', 'package json object') 10 | .parse(process.argv); 11 | 12 | if (!program.format) { 13 | console.error('option "--format " argument required'); 14 | process.exit(1); 15 | } 16 | 17 | if (program.format !== 'SIGNED_URL' && program.format !== 'BUCKET_KEY') { 18 | console.error('option "--format " argument required to be SIGNED_URL or BUCKET_KEY'); 19 | process.exit(1); 20 | } 21 | 22 | //get the signed api credentials 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | // send api request 27 | let _apiproxy = new ApiProxy(); 28 | let _format = program.format === 'BUCKET_KEY' ? 'bucket-key' : 'signed-url'; 29 | let _path = '/prod/cart/'; 30 | let _payload = JSON.stringify({ 31 | operation: 'checkout', 32 | format: _format 33 | }); 34 | 35 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 36 | if (err) { 37 | console.log(err); 38 | process.exit(1); 39 | } 40 | 41 | console.log(JSON.stringify(data)); 42 | }); 43 | -------------------------------------------------------------------------------- /source/api/services/manifest/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-manifest-service", 3 | "description": "A microservice function for importing and generating data lake manifest files", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "shortid": "^2.2.13", 13 | "moment": "^2.22.2", 14 | "underscore": "^1.9.1" 15 | }, 16 | "devDependencies": { 17 | "aws-sdk-mock": "^4.5.0", 18 | "chai": "^4.2.0", 19 | "mocha": "^6.2.2", 20 | "npm-run-all": "^4.1.5", 21 | "sinon": "^2.4.1", 22 | "sinon-chai": "^3.3.0" 23 | }, 24 | "scripts": { 25 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 26 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 27 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 28 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 29 | "build": "npm-run-all -s build-init build:copy build:install", 30 | "zip": "cd dist && zip -rq data-lake-manifest-service.zip ." 31 | }, 32 | "bundledDependencies": [ 33 | "moment", 34 | "shortid", 35 | "underscore" 36 | ] 37 | } -------------------------------------------------------------------------------- /source/console/app/dashboard/dashboard_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.dashboard module', function() { 4 | 5 | var dashboardCtrl; 6 | var $scope; 7 | var $state; 8 | var $localStorage; 9 | 10 | beforeEach(module('ui.router')); 11 | beforeEach(module('dataLake.utils')); 12 | beforeEach(module('dataLake.dashboard')); 13 | 14 | beforeEach(inject(function($controller, $rootScope, _$state_) { 15 | $scope = $rootScope.$new(); //get a childscope 16 | 17 | $state = _$state_; 18 | spyOn($state, 'go'); 19 | 20 | dashboardCtrl = $controller('DashboardCtrl', { 21 | $scope: $scope, 22 | $state: $state, 23 | $localStorage: $localStorage 24 | }); //Pass it as argument as $scope's value 25 | })); 26 | 27 | describe('dashboard controller', function() { 28 | 29 | it('should be created', function() { 30 | //spec body 31 | expect(dashboardCtrl).toBeDefined(); 32 | $scope.$apply(); 33 | expect($scope.showIntroModal).toEqual(true); 34 | }); 35 | 36 | it('should change state to search when searching', function() { 37 | 38 | $scope.search('test'); 39 | expect($state.go).toHaveBeenCalledWith('search', { 40 | terms: 'test' 41 | }); 42 | 43 | }); 44 | 45 | }); 46 | }); 47 | -------------------------------------------------------------------------------- /source/api/authorizer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-authorizer", 3 | "description": "A Lambda function for authorizing access to the Data Lake API", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "moment": "^2.22.2", 13 | "underscore": "^1.9.1", 14 | "jsonwebtoken": "^8.3.0", 15 | "jwk-to-pem": "^2.0.0", 16 | "request": "^2.88.0", 17 | "js-base64": "^2.4.9" 18 | }, 19 | "devDependencies": { 20 | "chai": "^4.2.0", 21 | "sinon": "^2.4.1", 22 | "sinon-chai": "^3.3.0", 23 | "mocha": "^6.2.2", 24 | "aws-sdk-mock": "^4.5.0", 25 | "npm-run-all": "^4.1.5" 26 | }, 27 | "scripts": { 28 | "test": "mocha *.spec.js", 29 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist", 30 | "build:copy": "cp index.js dist/", 31 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 32 | "build": "npm-run-all -s build-init build:copy build:install", 33 | "zip": "cd dist && zip -rq data-lake-authorizer.zip ." 34 | }, 35 | "bundledDependencies": [ 36 | "moment", 37 | "jsonwebtoken", 38 | "jwk-to-pem", 39 | "request", 40 | "underscore", 41 | "js-base64" 42 | ] 43 | } -------------------------------------------------------------------------------- /source/cli/datalake-create-package.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-name ', 'Name of the package') 9 | .option('--package-description ', 'Description of the package') 10 | .option('--metadata ', 'List of metadata to assign to the package') 11 | .parse(process.argv); 12 | 13 | if (!program.packageName) { 14 | console.error('option "--package-name " argument required'); 15 | process.exit(1); 16 | } 17 | 18 | if (!program.packageDescription) { 19 | console.error('option "--package-description " argument required'); 20 | process.exit(1); 21 | } 22 | 23 | let _payload = { 24 | package: { 25 | name: program.packageName, 26 | description: program.packageDescription 27 | } 28 | }; 29 | 30 | if (program.metadata) { 31 | _payload.metadata = JSON.parse(program.metadata); 32 | } 33 | 34 | //get the signed api credentials 35 | let _creds = new Creds(); 36 | let _authKey = _creds.getAuthSignature(); 37 | 38 | // send api request 39 | let _apiproxy = new ApiProxy(); 40 | _apiproxy.sendApiRequest('/prod/packages/new', 'POST', JSON.stringify(_payload), _authKey, function(err, data) { 41 | if (err) { 42 | console.log(err); 43 | process.exit(1); 44 | } 45 | 46 | console.log(JSON.stringify(data)); 47 | }); 48 | -------------------------------------------------------------------------------- /source/cli/datalake-create-package-metadata.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | program 8 | .option('--package-id ', 'The package identifier') 9 | .option('--metadata ', 'List of metadata to assign to the package') 10 | .parse(process.argv); 11 | 12 | if (!program.packageId) { 13 | console.error('option "--package-id " argument required'); 14 | process.exit(1); 15 | } 16 | 17 | if (!program.metadata) { 18 | console.error('option "--metadata " argument required'); 19 | process.exit(1); 20 | } 21 | 22 | //get the signed api credentials 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | // send api request 27 | let _apiproxy = new ApiProxy(); 28 | let _path = ['/prod/packages/', program.packageId, '/metadata/new'].join(''); 29 | let _passedMetadata = []; 30 | try { 31 | _passedMetadata = JSON.parse(program.metadata); 32 | } catch (ex) { 33 | console.error('Invalid JSON passed for metadata parameter.'); 34 | process.exit(1); 35 | } 36 | 37 | let _metadata = { 38 | metadata: _passedMetadata 39 | } 40 | _apiproxy.sendApiRequest(_path, 'POST', JSON.stringify(_metadata), _authKey, function(err, data) { 41 | if (err) { 42 | console.log(err); 43 | process.exit(1); 44 | } 45 | 46 | console.log(JSON.stringify(data)); 47 | }); 48 | -------------------------------------------------------------------------------- /source/api/services/cart/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-cart-service", 3 | "description": "A Lambda function for interacting with the data lake cart", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "shortid": "^2.2.13", 13 | "moment": "^2.22.2", 14 | "underscore": "^1.9.1", 15 | "jsonschema": "^1.2.4", 16 | "access-validator": "file:../../../resources/access-validator/" 17 | }, 18 | "devDependencies": { 19 | "chai": "^4.2.0", 20 | "sinon": "^2.4.1", 21 | "sinon-chai": "^3.3.0", 22 | "mocha": "^6.2.2", 23 | "aws-sdk-mock": "^4.5.0", 24 | "npm-run-all": "^4.1.5" 25 | }, 26 | "scripts": { 27 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 28 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 29 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 30 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 31 | "build": "npm-run-all -s build-init build:copy build:install", 32 | "zip": "cd dist && zip -rq data-lake-cart-service.zip ." 33 | }, 34 | "bundledDependencies": [ 35 | "moment", 36 | "shortid", 37 | "underscore", 38 | "jsonschema" 39 | ] 40 | } -------------------------------------------------------------------------------- /source/api/services/profile/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-profile-service", 3 | "description": "A Lambda function for interacting with the data lake user profiles", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "shortid": "^2.2.13", 13 | "moment": "^2.22.2", 14 | "underscore": "^1.9.1", 15 | "hat": "^0.0.3", 16 | "access-validator": "file:../../../resources/access-validator/" 17 | }, 18 | "devDependencies": { 19 | "aws-sdk-mock": "^4.5.0", 20 | "chai": "^4.2.0", 21 | "mocha": "^6.2.2", 22 | "npm-run-all": "^4.1.5", 23 | "sinon": "^2.4.1", 24 | "sinon-chai": "^3.3.0" 25 | }, 26 | "scripts": { 27 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 28 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 29 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 30 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 31 | "build": "npm-run-all -s build-init build:copy build:install", 32 | "zip": "cd dist && zip -rq data-lake-profile-service.zip ." 33 | }, 34 | "bundledDependencies": [ 35 | "moment", 36 | "shortid", 37 | "underscore", 38 | "hat" 39 | ] 40 | } -------------------------------------------------------------------------------- /source/resources/helper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-helper", 3 | "description": "Data Lake custom resource helper Lambda function", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "elasticsearch": "^14.2.2", 13 | "http-aws-es": "^4.0.0", 14 | "moment": "^2.22.2", 15 | "underscore": "^1.9.1", 16 | "password-generator": "^2.2.0", 17 | "uuid": "^3.3.2", 18 | "mime-types": "^2.1.20" 19 | }, 20 | "devDependencies": { 21 | "aws-sdk-mock": "^4.5.0", 22 | "chai": "^4.2.0", 23 | "mocha": "^6.2.2", 24 | "npm-run-all": "^4.1.5", 25 | "sinon": "^2.4.1", 26 | "sinon-chai": "^3.3.0" 27 | }, 28 | "scripts": { 29 | "test": "mocha lib/*.spec.js", 30 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 31 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 32 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 33 | "build": "npm-run-all -s build-init build:copy build:install", 34 | "zip": "cd dist && zip -rq data-lake-helper.zip ." 35 | }, 36 | "bundledDependencies": [ 37 | "elasticsearch", 38 | "http-aws-es", 39 | "moment", 40 | "underscore", 41 | "password-generator", 42 | "uuid" 43 | ] 44 | } -------------------------------------------------------------------------------- /source/api/services/search/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-search-service", 3 | "description": "A microservice function for interacting with the data lake elasticsearch cluster", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "elasticsearch": "^14.2.2", 13 | "http-aws-es": "^4.0.0", 14 | "moment": "^2.22.2", 15 | "underscore": "^1.9.1", 16 | "access-validator": "file:../../../resources/access-validator/" 17 | }, 18 | "devDependencies": { 19 | "aws-sdk-mock": "^4.5.0", 20 | "chai": "^4.2.0", 21 | "mocha": "^6.2.2", 22 | "npm-run-all": "^4.1.5", 23 | "sinon": "^2.4.1", 24 | "sinon-chai": "^3.3.0" 25 | }, 26 | "scripts": { 27 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 28 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 29 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 30 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 31 | "build": "npm-run-all -s build-init build:copy build:install", 32 | "zip": "cd dist && zip -rq data-lake-search-service.zip ." 33 | }, 34 | "bundledDependencies": [ 35 | "elasticsearch", 36 | "underscore", 37 | "http-aws-es", 38 | "moment", 39 | "underscore" 40 | ] 41 | } -------------------------------------------------------------------------------- /source/api/services/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-package-service", 3 | "description": "A microservice function for interacting with the data lake packages", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "moment": "^2.22.2", 13 | "underscore": "^1.9.1", 14 | "jsonschema": "^1.2.4", 15 | "shortid": "^2.2.13", 16 | "uuid": "^3.3.2", 17 | "access-validator": "file:../../../resources/access-validator/" 18 | }, 19 | "devDependencies": { 20 | "aws-sdk-mock": "^4.5.0", 21 | "chai": "^4.2.0", 22 | "chai-things": "^0.2.0", 23 | "mocha": "^6.2.2", 24 | "npm-run-all": "^4.1.5", 25 | "sinon": "^2.4.1", 26 | "sinon-chai": "^3.3.0" 27 | }, 28 | "scripts": { 29 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 30 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 31 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 32 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 33 | "build": "npm-run-all -s build-init build:copy build:install", 34 | "zip": "cd dist && zip -rq data-lake-package-service.zip ." 35 | }, 36 | "bundledDependencies": [ 37 | "moment", 38 | "underscore", 39 | "jsonschema", 40 | "shortid" 41 | ] 42 | } -------------------------------------------------------------------------------- /source/console/app/admin/users/users_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.admin.users spec', function() { 4 | 5 | var adminUsersCtrl; 6 | var $scope; 7 | var $state; 8 | var $blockUI; 9 | 10 | beforeEach(module('ui.router')); 11 | beforeEach(module('dataLake.utils')); 12 | beforeEach(module('dataLake.admin.users')); 13 | 14 | beforeEach(inject(function($controller, $rootScope, _$state_, adminUserFactory) { 15 | $scope = $rootScope.$new(); 16 | 17 | $state = _$state_; 18 | spyOn($state, 'go'); 19 | 20 | var users = [{ 21 | email: 'user@amazon.com', 22 | name: 'Test User' 23 | }, { 24 | email: 'user2@amazon.com', 25 | name: 'Test User 2' 26 | }]; 27 | 28 | spyOn(adminUserFactory, 'listUsers').and.callFake(function(cb) { 29 | cb(null, users);
 30 | }); 31 | 32 | $blockUI = { 33 | start: function() {}, 34 | stop: function() {} 35 | }; 36 | 37 | adminUsersCtrl = $controller('AdminUsersCtrl', { 38 | $scope: $scope, 39 | $state: $state, 40 | $blockUI: $blockUI, 41 | adminUserFactory: adminUserFactory 42 | }); 43 | })); 44 | 45 | describe('cart controller', function() { 46 | 47 | it('should be created', function() { 48 | //spec body 49 | expect(adminUsersCtrl).toBeDefined(); 50 | $scope.$apply(); 51 | expect($scope.users.length).toEqual(2); 52 | }); 53 | 54 | }); 55 | }); 56 | -------------------------------------------------------------------------------- /source/cli/datalake-delete-group.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--name ', 'The name of the group to be deleted.') 12 | .parse(process.argv); 13 | 14 | if (!program.name) { 15 | console.error('option "--name " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/admin/groups/${encodeURI(program.name)}/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'DELETE', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/cli/datalake-get-package-crawler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--package-id ', 'package identifier') 12 | .parse(process.argv); 13 | 14 | if (!program.packageId) { 15 | console.error('option "--package-id " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/packages/${program.packageId}/crawler/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/cli/datalake-list-package-tables.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--package-id ', 'package identifier') 12 | .parse(process.argv); 13 | 14 | if (!program.packageId) { 15 | console.error('option "--package-id " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/packages/${program.packageId}/tables/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/cli/datalake-execute-package-crawler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--package-id ', 'package identifier') 12 | .parse(process.argv); 13 | 14 | if (!program.packageId) { 15 | console.error('option "--package-id " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/packages/${program.packageId}/crawler/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/cli/datalake-get-group.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--name ', 'The name of the group to retrive information.') 12 | .parse(process.argv); 13 | 14 | if (!program.name) { 15 | console.error('option "--name " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/admin/groups/${encodeURI(program.name)}/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/cli/datalake-update-package-crawler.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--package-id ', 'package identifier') 12 | .parse(process.argv); 13 | 14 | if (!program.packageId) { 15 | console.error('option "--package-id " argument required'); 16 | process.exit(1); 17 | } 18 | 19 | //----------------------------------------------------------------------------- 20 | // get the signed api credentials 21 | //----------------------------------------------------------------------------- 22 | let _creds = new Creds(); 23 | let _authKey = _creds.getAuthSignature(); 24 | 25 | //----------------------------------------------------------------------------- 26 | // send api request 27 | //----------------------------------------------------------------------------- 28 | let _apiproxy = new ApiProxy(); 29 | let _path = `/prod/packages/${program.packageId}/crawler/`; 30 | let _payload = JSON.stringify({ 31 | }); 32 | 33 | //----------------------------------------------------------------------------- 34 | // print result 35 | //----------------------------------------------------------------------------- 36 | _apiproxy.sendApiRequest(_path, 'PUT', _payload, _authKey, function(err, data) { 37 | if (err) { 38 | console.log(err); 39 | process.exit(1); 40 | } 41 | 42 | console.log(JSON.stringify(data)); 43 | }); 44 | -------------------------------------------------------------------------------- /source/console/karma.conf.js: -------------------------------------------------------------------------------- 1 | //jshint strict: false 2 | module.exports = function(config) { 3 | config.set({ 4 | 5 | basePath: './app', 6 | 7 | files: [ 8 | 'lib/cognito/aws-cognito-sdk.min.js', 9 | 'lib/cognito/amazon-cognito-identity.min.js', 10 | 'lib/bower_components/angular/angular.js', 11 | 'lib/bower_components/angular-resource/angular-resource.js', 12 | 'lib/bower_components/angular-ui-router/release/angular-ui-router.js', 13 | 'lib/bower_components/angular-mocks/angular-mocks.js', 14 | 'lib/bower_components/underscore/underscore-min.js', 15 | 'lib/bower_components/moment/min/moment.min.js', 16 | 'lib/app-variables.js', 17 | 'common/components/**/*.js', 18 | 'common/factories/*.js', 19 | 'common/services/*.js', 20 | 'main/*.js', 21 | 'dashboard/*.js', 22 | 'signin/*.js', 23 | 'signup/*.js', 24 | 'confirm/*.js', 25 | 'forgot/*.js', 26 | 'search/*.js', 27 | 'profile/*.js', 28 | 'cart/*.js', 29 | 'admin/users/*.js' 30 | ], 31 | 32 | autoWatch: true, 33 | 34 | frameworks: ['jasmine'], 35 | 36 | browsers: ['Chrome'], 37 | 38 | plugins: [ 39 | 'karma-chrome-launcher', 40 | 'karma-firefox-launcher', 41 | 'karma-jasmine', 42 | 'karma-junit-reporter' 43 | ], 44 | 45 | reporters: ['progress'], 46 | 47 | junitReporter: { 48 | outputFile: 'test_out/unit.xml', 49 | suite: 'unit' 50 | } 51 | 52 | }); 53 | }; 54 | -------------------------------------------------------------------------------- /source/cli/datalake-get-user-group-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--user-id ', 'Username of account to list groups.') 12 | .parse(process.argv); 13 | 14 | if (!program.userId) { 15 | console.error('option "--user-id " argument required'); 16 | process.exit(1); 17 | } 18 | program.userId = encodeURIComponent(program.userId); 19 | 20 | //----------------------------------------------------------------------------- 21 | // get the signed api credentials 22 | //----------------------------------------------------------------------------- 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | //----------------------------------------------------------------------------- 27 | // send api request 28 | //----------------------------------------------------------------------------- 29 | let _apiproxy = new ApiProxy(); 30 | let _path = `/prod/admin/groups/membership/${program.userId}`; 31 | let _payload = JSON.stringify({ 32 | }); 33 | 34 | //----------------------------------------------------------------------------- 35 | // print result 36 | //----------------------------------------------------------------------------- 37 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 38 | if (err) { 39 | console.log(err); 40 | process.exit(1); 41 | } 42 | 43 | console.log(JSON.stringify(data)); 44 | }); 45 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/version.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.version', [ 21 | 'dataLake.version.interpolate-filter', 22 | 'dataLake.version.version-directive' 23 | ]) 24 | 25 | .value('version', APP_VERSION); 26 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/version-directive.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.version.version-directive', []) 21 | 22 | .directive('appVersion', ['version', function(version) { 23 | return function(scope, elm, attrs) { 24 | elm.text(version); 25 | }; 26 | }]); 27 | -------------------------------------------------------------------------------- /source/cli/core/credentials.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | let Base64 = require('js-base64').Base64; 3 | let moment = require('moment'); 4 | let crypto = require('crypto'); 5 | 6 | let credentials = (function() { 7 | 8 | let credentials = function() {}; 9 | 10 | credentials.prototype.getAuthSignature = function() { 11 | if (!process.env.DATALAKE_ACCESS_KEY) { 12 | console.error('DATALAKE_ACCESS_KEY environment variable is not defined.'); 13 | process.exit(1); 14 | } 15 | 16 | if (!process.env.DATALAKE_SECRET_ACCESS_KEY) { 17 | console.error('DATALAKE_SECRET_ACCESS_KEY environment variable is not defined.'); 18 | process.exit(1); 19 | } 20 | 21 | if (!process.env.DATALAKE_ENDPOINT_HOST) { 22 | console.error('DATALAKE_ENDPOINT_HOST environment variable is not defined.'); 23 | process.exit(1); 24 | } 25 | 26 | // 'SJxiAV_R:f10e347df150638393502dfc8466d18b' 27 | let kDate = crypto.createHmac('sha256', "DATALAKE4" + process.env.DATALAKE_SECRET_ACCESS_KEY) 28 | .update(moment().utc().format('YYYYMMDD')); 29 | 30 | let kEndpoint = crypto.createHmac('sha256', kDate.digest('base64')).update(process.env.DATALAKE_ENDPOINT_HOST); 31 | 32 | let kService = crypto.createHmac('sha256', kEndpoint.digest('base64')).update('datalake'); 33 | 34 | let kSigning = crypto.createHmac('sha256', kService.digest('base64')).update("datalake4_request"); 35 | 36 | let _signature = kSigning.digest('base64'); 37 | 38 | let _apiKey = [process.env.DATALAKE_ACCESS_KEY, _signature].join(':'); 39 | let _authKey = Base64.encode(_apiKey); 40 | return _authKey; 41 | }; 42 | 43 | return credentials; 44 | 45 | })(); 46 | 47 | module.exports = credentials; 48 | -------------------------------------------------------------------------------- /source/api/services/admin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-admin-service", 3 | "description": "A microservice function for admin functionality of the data lake", 4 | "main": "index.js", 5 | "author": { 6 | "name": "aws-solutions-builder" 7 | }, 8 | "license": "Apache-2.0", 9 | "version": "0.0.1", 10 | "private": "true", 11 | "dependencies": { 12 | "shortid": "^2.2.13", 13 | "moment": "^2.22.2", 14 | "underscore": "^1.9.1", 15 | "jsonwebtoken": "^8.3.0", 16 | "jwk-to-pem": "^2.0.0", 17 | "request": "^2.88.0", 18 | "password-generator": "^2.2.0", 19 | "hat": "^0.0.3", 20 | "js-base64": "^2.4.9", 21 | "access-validator": "file:../../../resources/access-validator/" 22 | }, 23 | "devDependencies": { 24 | "aws-sdk-mock": "^4.5.0", 25 | "chai": "^4.2.0", 26 | "chai-things": "^0.2.0", 27 | "mocha": "^6.2.2", 28 | "npm-run-all": "^4.1.5", 29 | "sinon": "^2.4.1", 30 | "sinon-chai": "^3.3.0" 31 | }, 32 | "scripts": { 33 | "test": "NODE_PATH=./node_modules mocha lib/*.spec.js", 34 | "build-init": "rm -rf dist && rm -f archive.zip && mkdir dist && mkdir dist/lib", 35 | "build:copy": "cp index.js dist/ && cp -r lib/*.js dist/lib", 36 | "build:install": "cp package.json dist/ && cd dist && npm install --production", 37 | "build": "npm-run-all -s build-init build:copy build:install", 38 | "zip": "cd dist && zip -rq data-lake-admin-service.zip ." 39 | }, 40 | "bundledDependencies": [ 41 | "moment", 42 | "shortid", 43 | "jsonwebtoken", 44 | "jwk-to-pem", 45 | "request", 46 | "password-generator", 47 | "hat", 48 | "js-base64" 49 | ] 50 | } -------------------------------------------------------------------------------- /source/console/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "data-lake-console", 3 | "private": true, 4 | "version": "0.0.0", 5 | "description": "A starter project for AngularJS", 6 | "repository": "https://github.com/angular/angular-seed", 7 | "license": "Apache-2.0", 8 | "devDependencies": { 9 | "bower": "^1.8.8", 10 | "http-server": "^0.9.0", 11 | "jasmine-core": "^2.4.1", 12 | "karma": "^0.13.22", 13 | "karma-chrome-launcher": "^0.2.3", 14 | "karma-firefox-launcher": "^0.1.7", 15 | "karma-jasmine": "^0.3.8", 16 | "karma-junit-reporter": "^0.4.1", 17 | "protractor": "^3.2.2" 18 | }, 19 | "scripts": { 20 | "postinstall": "bower install --allow-root", 21 | "prestart": "npm install", 22 | "start": "http-server -a localhost -p 8000 -c-1 ./app", 23 | "pretest": "npm install", 24 | "test": "karma start karma.conf.js", 25 | "test-single-run": "karma start karma.conf.js --single-run", 26 | "preupdate-webdriver": "npm install", 27 | "update-webdriver": "webdriver-manager update", 28 | "preprotractor": "npm run update-webdriver", 29 | "protractor": "protractor e2e-tests/protractor.conf.js", 30 | "update-index-async": "node -e \"var fs=require('fs'),indexFile='app/index-async.html',loaderFile='app/bower_components/angular-loader/angular-loader.min.js',loaderText=fs.readFileSync(loaderFile,'utf-8').split(/sourceMappingURL=angular-loader.min.js.map/).join('sourceMappingURL=bower_components/angular-loader/angular-loader.min.js.map'),indexText=fs.readFileSync(indexFile,'utf-8').split(/\\/\\/@@NG_LOADER_START@@[\\s\\S]*\\/\\/@@NG_LOADER_END@@/).join('//@@NG_LOADER_START@@\\n'+loaderText+' //@@NG_LOADER_END@@');fs.writeFileSync(indexFile,indexText);\"" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /source/resources/loader/core/credentials.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | let Base64 = require('js-base64').Base64; 3 | let moment = require('moment'); 4 | let crypto = require('crypto'); 5 | 6 | let credentials = (function() { 7 | 8 | let credentials = function() {}; 9 | 10 | credentials.prototype.getAuthSignature = function() { 11 | if (!process.env.DATALAKE_ACCESS_KEY) { 12 | console.error('DATALAKE_ACCESS_KEY environment variable is not defined.'); 13 | process.exit(1); 14 | } 15 | 16 | if (!process.env.DATALAKE_SECRET_ACCESS_KEY) { 17 | console.error('DATALAKE_SECRET_ACCESS_KEY environment variable is not defined.'); 18 | process.exit(1); 19 | } 20 | 21 | if (!process.env.DATALAKE_ENDPOINT_HOST) { 22 | console.error('DATALAKE_ENDPOINT_HOST environment variable is not defined.'); 23 | process.exit(1); 24 | } 25 | 26 | // 'SJxiAV_R:f10e347df150638393502dfc8466d18b' 27 | let kDate = crypto.createHmac('sha256', "DATALAKE4" + process.env.DATALAKE_SECRET_ACCESS_KEY) 28 | .update(moment().utc().format('YYYYMMDD')); 29 | 30 | let kEndpoint = crypto.createHmac('sha256', kDate.digest('base64')).update(process.env.DATALAKE_ENDPOINT_HOST); 31 | 32 | let kService = crypto.createHmac('sha256', kEndpoint.digest('base64')).update('datalake'); 33 | 34 | let kSigning = crypto.createHmac('sha256', kService.digest('base64')).update("datalake4_request"); 35 | 36 | let _signature = kSigning.digest('base64'); 37 | 38 | let _apiKey = [process.env.DATALAKE_ACCESS_KEY, _signature].join(':'); 39 | let _authKey = Base64.encode(_apiKey); 40 | return _authKey; 41 | }; 42 | 43 | return credentials; 44 | 45 | })(); 46 | 47 | module.exports = credentials; 48 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/interpolate-filter.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.version.interpolate-filter', []) 21 | 22 | .filter('interpolate', ['version', function(version) { 23 | return function(text) { 24 | return String(text).replace(/\%VERSION\%/mg, version); 25 | }; 26 | }]); 27 | -------------------------------------------------------------------------------- /source/cli/datalake-update-group.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--name ', 'The name of the group to be updated.') 12 | .option('--description ', 'A string containing the description of the group') 13 | .parse(process.argv); 14 | 15 | if (!program.name) { 16 | console.error('option "--name " argument required'); 17 | process.exit(1); 18 | } 19 | 20 | //----------------------------------------------------------------------------- 21 | // get the signed api credentials 22 | //----------------------------------------------------------------------------- 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | //----------------------------------------------------------------------------- 27 | // send api request 28 | //----------------------------------------------------------------------------- 29 | let _apiproxy = new ApiProxy(); 30 | let _path = `/prod/admin/groups/${encodeURI(program.name)}/`; 31 | let _payload = JSON.stringify({ 32 | action: 'updateGroup', 33 | description: program.description ? program.description : "" 34 | }); 35 | 36 | //----------------------------------------------------------------------------- 37 | // print result 38 | //----------------------------------------------------------------------------- 39 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 40 | if (err) { 41 | console.log(err); 42 | process.exit(1); 43 | } 44 | 45 | console.log(JSON.stringify(data)); 46 | }); 47 | -------------------------------------------------------------------------------- /source/cli/datalake-create-group.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--name ', 'The name of the group. Must be unique and satisfy regular expression pattern [\p{L}\p{M}\p{S}\p{N}\p{P}]+') 12 | .option('--description ', 'A string containing the description of the group') 13 | .parse(process.argv); 14 | 15 | if (!program.name) { 16 | console.error('option "--name " argument required'); 17 | process.exit(1); 18 | } 19 | 20 | //----------------------------------------------------------------------------- 21 | // get the signed api credentials 22 | //----------------------------------------------------------------------------- 23 | let _creds = new Creds(); 24 | let _authKey = _creds.getAuthSignature(); 25 | 26 | //----------------------------------------------------------------------------- 27 | // send api request 28 | //----------------------------------------------------------------------------- 29 | let _apiproxy = new ApiProxy(); 30 | let _path = `/prod/admin/groups/${encodeURI(program.name)}/`; 31 | let _payload = JSON.stringify({ 32 | description: program.description ? program.description : "" 33 | }); 34 | 35 | //----------------------------------------------------------------------------- 36 | // print result 37 | //----------------------------------------------------------------------------- 38 | _apiproxy.sendApiRequest(_path, 'PUT', _payload, _authKey, function(err, data) { 39 | if (err) { 40 | console.log(err); 41 | process.exit(1); 42 | } 43 | 44 | console.log(JSON.stringify(data)); 45 | }); 46 | -------------------------------------------------------------------------------- /source/cli/datalake-get-package-table-data.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--package-id ', 'package identifier') 12 | .option('--table-name ', 'catalog table name') 13 | .parse(process.argv); 14 | 15 | if (!program.packageId) { 16 | console.error('option "--package-id " argument required'); 17 | process.exit(1); 18 | } 19 | if (!program.tableName) { 20 | console.error('option "--table-name " argument required'); 21 | process.exit(1); 22 | } 23 | 24 | //----------------------------------------------------------------------------- 25 | // get the signed api credentials 26 | //----------------------------------------------------------------------------- 27 | let _creds = new Creds(); 28 | let _authKey = _creds.getAuthSignature(); 29 | 30 | //----------------------------------------------------------------------------- 31 | // send api request 32 | //----------------------------------------------------------------------------- 33 | let _apiproxy = new ApiProxy(); 34 | let _path = `/prod/packages/${program.packageId}/tables/${encodeURI(program.tableName)}`; 35 | let _payload = JSON.stringify({ 36 | }); 37 | 38 | //----------------------------------------------------------------------------- 39 | // print result 40 | //----------------------------------------------------------------------------- 41 | _apiproxy.sendApiRequest(_path, 'GET', _payload, _authKey, function(err, data) { 42 | if (err) { 43 | console.log(err); 44 | process.exit(1); 45 | } 46 | 47 | console.log(JSON.stringify(data)); 48 | }); 49 | -------------------------------------------------------------------------------- /source/console/app/admin/groups/createGroup.html: -------------------------------------------------------------------------------- 1 |

Create a group

2 |

Create a new group by entering the group's name and description.

3 |
4 | 5 | {{awsUiAlert.header}} 6 | {{awsUiAlert.content}} 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |

16 | 17 |
18 | 19 | 20 |
21 |
22 |
23 |
24 | -------------------------------------------------------------------------------- /source/console/app/common/components/version/version_test.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | describe('dataLake.version module', function() { 21 | beforeEach(module('dataLake.version')); 22 | 23 | describe('version service', function() { 24 | it('should return current version', inject(function( 25 | version) { 26 | expect(version).toEqual(APP_VERSION); 27 | })); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /source/api/services/package/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | 'use strict'; 15 | 16 | console.log('Loading function'); 17 | let lib = require('./lib'); 18 | 19 | exports.handler = function(event, context, callback) { 20 | console.log(event); 21 | 22 | lib.respond(event, function(error, response) { 23 | if (error) { 24 | console.error(error); 25 | return callback(null, error); 26 | } else { 27 | return callback(null, response); 28 | } 29 | }); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /source/api/services/search/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | 'use strict'; 15 | 16 | console.log('Loading function'); 17 | let lib = require('./lib'); 18 | 19 | exports.handler = function(event, context, callback) { 20 | console.log(event); 21 | 22 | lib.respond(event, function(error, response) { 23 | if (error) { 24 | console.error(error); 25 | return callback(null, error); 26 | } else { 27 | return callback(null, response); 28 | } 29 | }); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /source/cli/core/apiproxy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | let https = require('https'); 3 | 4 | let apiproxy = (function() { 5 | 6 | let apiproxy = function() {}; 7 | 8 | apiproxy.prototype.sendApiRequest = function(path, method, body, authkey, cb) { 9 | if (!process.env.DATALAKE_ENDPOINT_HOST) { 10 | console.error('DATALAKE_ENDPOINT_HOST environment variable is not defined.'); 11 | process.exit(1); 12 | } 13 | 14 | let _options = buildRequestOptionSet(path, method, authkey); 15 | let request = https.request(_options, function(response) { 16 | // data is streamed in chunks from the server 17 | // so we have to handle the "data" event 18 | let buffer = '', 19 | data, 20 | route; 21 | 22 | response.on('data', function(chunk) { 23 | buffer += chunk; 24 | }); 25 | 26 | response.on('end', function(err) { 27 | data = JSON.parse(buffer); 28 | cb(null, data); 29 | }); 30 | }); 31 | 32 | if (body) { 33 | request.write(body); 34 | } 35 | 36 | request.end(); 37 | 38 | request.on('error', (e) => { 39 | console.error(e); 40 | cb(['Error occurred when sending', process.env.APIG_ENDPOINT_HOST, path, 'request.'].join( 41 | ' '), null); 42 | }); 43 | }; 44 | 45 | let buildRequestOptionSet = function(apipath, apimethod, authkey) { 46 | let _options = { 47 | hostname: process.env.DATALAKE_ENDPOINT_HOST, 48 | port: 443, 49 | path: apipath, 50 | method: apimethod, 51 | headers: { 52 | Auth: ['ak', authkey].join(':') 53 | } 54 | }; 55 | return _options; 56 | }; 57 | 58 | return apiproxy; 59 | 60 | })(); 61 | 62 | module.exports = apiproxy; 63 | -------------------------------------------------------------------------------- /source/console/app/signin/signin_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.signin spec', function() { 4 | 5 | var signinCtrl; 6 | var $scope; 7 | var $state; 8 | var $q; 9 | var deferred; 10 | var $blockUI; 11 | 12 | beforeEach(module('ui.router')); 13 | beforeEach(module('dataLake.signin')); 14 | beforeEach(module('dataLake.service.auth')); 15 | 16 | beforeEach(inject(function($controller, $rootScope, _$state_, _$q_, authService) { 17 | $scope = $rootScope.$new(); //get a childscope 18 | 19 | $state = _$state_; 20 | spyOn($state, 'go'); 21 | 22 | $q = _$q_; 23 | deferred = _$q_.defer(); 24 | spyOn(authService, 'signin').and.returnValue(deferred.promise); 25 | 26 | $blockUI = { 27 | start: function() {}, 28 | stop: function() {} 29 | }; 30 | 31 | signinCtrl = $controller('SigninCtrl', { 32 | $scope: $scope, 33 | $state: $state, 34 | authService: authService, 35 | $blockUI: $blockUI 36 | }); //Pass it as argument as $scope's value 37 | })); 38 | 39 | describe('signin controller', function() { 40 | 41 | it('can get an instance of SigninCtrl', function() { 42 | //spec body 43 | expect(signinCtrl).toBeDefined(); 44 | }); 45 | 46 | it('should go to confirm state when password change required', function() { 47 | $scope.signin({ 48 | email: 'user@amazon.com', 49 | password: 'password' 50 | }, true); 51 | deferred.resolve({ 52 | state: 'new_password_required' 53 | }); 54 | $scope.$apply(); 55 | expect($state.go).toHaveBeenCalledWith('confirm', { 56 | email: 'user@amazon.com', 57 | password: 'password' 58 | }); 59 | }); 60 | 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /source/resources/loader/core/apiproxy.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | let https = require('https'); 3 | 4 | let apiproxy = (function() { 5 | 6 | let apiproxy = function() {}; 7 | 8 | apiproxy.prototype.sendApiRequest = function(path, method, body, authkey, cb) { 9 | if (!process.env.DATALAKE_ENDPOINT_HOST) { 10 | console.error('DATALAKE_ENDPOINT_HOST environment variable is not defined.'); 11 | process.exit(1); 12 | } 13 | 14 | let _options = buildRequestOptionSet(path, method, authkey); 15 | let request = https.request(_options, function(response) { 16 | // data is streamed in chunks from the server 17 | // so we have to handle the "data" event 18 | let buffer = '', 19 | data, 20 | route; 21 | 22 | response.on('data', function(chunk) { 23 | buffer += chunk; 24 | }); 25 | 26 | response.on('end', function(err) { 27 | data = JSON.parse(buffer); 28 | cb(null, data); 29 | }); 30 | }); 31 | 32 | if (body) { 33 | request.write(body); 34 | } 35 | 36 | request.end(); 37 | 38 | request.on('error', (e) => { 39 | console.error(e); 40 | cb(['Error occurred when sending', process.env.APIG_ENDPOINT_HOST, path, 'request.'].join( 41 | ' '), null); 42 | }); 43 | }; 44 | 45 | let buildRequestOptionSet = function(apipath, apimethod, authkey) { 46 | let _options = { 47 | hostname: process.env.DATALAKE_ENDPOINT_HOST, 48 | port: 443, 49 | path: apipath, 50 | method: apimethod, 51 | headers: { 52 | Auth: ['ak', authkey].join(':') 53 | } 54 | }; 55 | return _options; 56 | }; 57 | 58 | return apiproxy; 59 | 60 | })(); 61 | 62 | module.exports = apiproxy; 63 | -------------------------------------------------------------------------------- /source/cli/datalake-update-user-group-list.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--user-id ', 'Username of account to be updated.') 12 | .option('--group-set ', 'List of groups that the user currently belongs to.') 13 | .parse(process.argv); 14 | 15 | if (!program.userId) { 16 | console.error('option "--user-id " argument required'); 17 | process.exit(1); 18 | } 19 | 20 | if (!program.groupSet) { 21 | console.error('option "--group-set " argument required'); 22 | process.exit(1); 23 | } 24 | 25 | //----------------------------------------------------------------------------- 26 | // get the signed api credentials 27 | //----------------------------------------------------------------------------- 28 | let _creds = new Creds(); 29 | let _authKey = _creds.getAuthSignature(); 30 | 31 | //----------------------------------------------------------------------------- 32 | // send api request 33 | //----------------------------------------------------------------------------- 34 | let _apiproxy = new ApiProxy(); 35 | let _path = `/prod/admin/groups/membership/${program.userId}`; 36 | let _payload = JSON.stringify({ 37 | groupSet: JSON.parse(program.groupSet) 38 | }); 39 | 40 | //----------------------------------------------------------------------------- 41 | // print result 42 | //----------------------------------------------------------------------------- 43 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 44 | if (err) { 45 | console.log(err); 46 | process.exit(1); 47 | } 48 | 49 | console.log(JSON.stringify(data)); 50 | }); 51 | -------------------------------------------------------------------------------- /source/console/app/profile/changePassword_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.profile.changepassword module', function() { 4 | 5 | var changePasswordCtrl; 6 | var $scope; 7 | var $state; 8 | var $q; 9 | var $stateParams; 10 | var $blockUI; 11 | var deferred; 12 | 13 | beforeEach(module('ui.router')); 14 | beforeEach(module('dataLake.utils')); 15 | beforeEach(module('dataLake.main')); 16 | beforeEach(module('dataLake.profile.changepassword')); 17 | 18 | beforeEach(inject(function($controller, $rootScope, _$q_, _$state_, authService) { 19 | $scope = $rootScope.$new(); //get a childscope 20 | 21 | $state = _$state_; 22 | spyOn($state, 'go'); 23 | 24 | $q = _$q_; 25 | deferred = _$q_.defer(); 26 | spyOn(authService, 'changePassword').and.returnValue(deferred.promise); 27 | 28 | $blockUI = { 29 | start: function() {}, 30 | stop: function() {} 31 | }; 32 | 33 | changePasswordCtrl = $controller('ChangePasswordCtrl', { 34 | $scope: $scope, 35 | $state: $state, 36 | $stateParams: $stateParams, 37 | $blockUI: $blockUI, 38 | authService: authService 39 | }); //Pass it as argument as $scope's value 40 | 41 | })); 42 | 43 | describe('changepassword controller', function() { 44 | 45 | it('should be created', function() { 46 | expect(changePasswordCtrl).toBeDefined(); 47 | $scope.$digest(); 48 | }); 49 | 50 | it('should change password if change password called', function() { 51 | $scope.changePassword({ 52 | oldPassword: 'test123', 53 | newPassword: '321test' 54 | }, true); 55 | deferred.resolve('password changed'); 56 | $scope.$apply(); 57 | expect($state.go).toHaveBeenCalledWith('profile', {}); 58 | }); 59 | 60 | }); 61 | }); 62 | -------------------------------------------------------------------------------- /source/api/services/cart/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | console.log('Loading function'); 21 | let lib = require('./lib'); 22 | 23 | exports.handler = function(event, context, callback) { 24 | console.log(event); 25 | 26 | lib.respond(event, function(error, response) { 27 | if (error) { 28 | console.error(error); 29 | return callback(null, error); 30 | } else { 31 | return callback(null, response); 32 | } 33 | }); 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /source/api/services/profile/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | console.log('Loading function'); 21 | let lib = require('./lib'); 22 | 23 | exports.handler = function(event, context, callback) { 24 | console.log(event); 25 | 26 | lib.respond(event, function(error, response) { 27 | if (error) { 28 | console.error(error); 29 | return callback(null, error); 30 | } else { 31 | return callback(null, response); 32 | } 33 | }); 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /source/api/services/manifest/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | console.log('Loading function'); 21 | let lib = require('./lib'); 22 | 23 | exports.handler = function(event, context, callback) { 24 | console.log(event); 25 | 26 | lib.respond(event, function(error, response) { 27 | if (error) { 28 | console.error(error); 29 | return callback(error, null); 30 | } else { 31 | return callback(null, response); 32 | } 33 | }); 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /source/cli/datalake-remove-user-from-group.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | 7 | //----------------------------------------------------------------------------- 8 | // validate input 9 | //----------------------------------------------------------------------------- 10 | program 11 | .option('--user-id ', 'Username of account to be removed from the user pool group.') 12 | .option('--group-name ', 'The name of the group to be updated.') 13 | .parse(process.argv); 14 | 15 | if (!program.userId) { 16 | console.error('option "--user-id " argument required'); 17 | process.exit(1); 18 | } 19 | if (!program.groupName) { 20 | console.error('option "--group-name " argument required'); 21 | process.exit(1); 22 | } 23 | 24 | //----------------------------------------------------------------------------- 25 | // get the signed api credentials 26 | //----------------------------------------------------------------------------- 27 | let _creds = new Creds(); 28 | let _authKey = _creds.getAuthSignature(); 29 | 30 | //----------------------------------------------------------------------------- 31 | // send api request 32 | //----------------------------------------------------------------------------- 33 | let _apiproxy = new ApiProxy(); 34 | let _path = `/prod/admin/groups/${encodeURI(program.groupName)}/`; 35 | let _payload = JSON.stringify({ 36 | action: 'removeUserFromGroup', 37 | userId: program.userId 38 | }); 39 | 40 | //----------------------------------------------------------------------------- 41 | // print result 42 | //----------------------------------------------------------------------------- 43 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 44 | if (err) { 45 | console.log(err); 46 | process.exit(1); 47 | } 48 | 49 | console.log(JSON.stringify(data)); 50 | }); 51 | -------------------------------------------------------------------------------- /source/console/app/admin/users/invitation.html: -------------------------------------------------------------------------------- 1 |

Create a user invitation

2 |

Create a new user invitation by entering the user's name, email and role.

3 |
4 | 5 | Service Error 6 | An unexpected error occurred when attempting to create the user invite. 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

19 | 20 |
21 | 22 | 23 |
24 |
25 |
26 |
27 | -------------------------------------------------------------------------------- /source/console/app/common/components/goclick/goclick-directive.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.goclick.goClick-directive', []) 21 | 22 | .directive('goClick', function($window) { 23 | return function(scope, element, attrs) { 24 | var path; 25 | 26 | attrs.$observe('goClick', function(val) { 27 | path = val; 28 | }); 29 | 30 | element.bind('click', function() { 31 | scope.$apply(function() { 32 | $window.open(path, '_blank'); 33 | }); 34 | }); 35 | }; 36 | }); 37 | -------------------------------------------------------------------------------- /source/console/app/main/main_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.main module', function() { 4 | 5 | var mainCtrl; 6 | var mockDataSrv; 7 | var $scope; 8 | var $state; 9 | var $q; 10 | var $location; 11 | var authDeferred; 12 | 13 | beforeEach(module('ui.router')); 14 | beforeEach(module('dataLake.utils')); 15 | beforeEach(module('dataLake.main')); 16 | 17 | beforeEach(inject(function($controller, $rootScope, _$state_, _$q_, authService, cartFactory) { 18 | $scope = $rootScope.$new(); //get a childscope 19 | 20 | $state = _$state_; 21 | spyOn($state, 'go'); 22 | 23 | $q = _$q_; 24 | authDeferred = _$q_.defer(); 25 | spyOn(authService, 'getUserInfo').and.returnValue(authDeferred.promise); 26 | spyOn(authService, 'signOut').and.returnValue(authDeferred.promise); 27 | 28 | spyOn(cartFactory, 'getCartCount').and.callFake(function(cb) { 29 | cb(null, 0);
 30 | }); 31 | 32 | mainCtrl = $controller('MainCtrl', { 33 | $scope: $scope, 34 | $state: $state, 35 | $location: $location, 36 | $rootScope: $rootScope, 37 | authService: authService, 38 | cartFactory: cartFactory 39 | }); 40 | })); 41 | 42 | describe('main controller', function() { 43 | 44 | it('should be created', function() { 45 | authDeferred.resolve({ 46 | email: 'user@amazon.com', 47 | name: 'User Name', 48 | username: 'user_amazon_com', 49 | display_name: 'User Name' 50 | }); 51 | expect(mainCtrl).toBeDefined(); 52 | $scope.$apply(); 53 | expect($scope.username).toEqual('User Name'); 54 | expect($scope.cartCount).toEqual(0); 55 | }); 56 | 57 | it('should change state to signin when selecting to sign out', function() { 58 | authDeferred.resolve(true); 59 | $scope.signout(); 60 | expect($state.go).toHaveBeenCalledWith('signin', {}); 61 | 62 | }); 63 | 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /source/console/app/search/search_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.search module', function() { 4 | 5 | var searchCtrl; 6 | var $scope; 7 | var $state; 8 | var $stateParams; 9 | var $sce; 10 | var $_; 11 | var $blockUI; 12 | 13 | beforeEach(module('ui.router')); 14 | beforeEach(module('dataLake.utils')); 15 | beforeEach(module('dataLake.main')); 16 | beforeEach(module('dataLake.search')); 17 | 18 | beforeEach(inject(function($controller, $rootScope, $stateParams, searchFactory) { 19 | $scope = $rootScope.$new(); //get a childscope 20 | 21 | spyOn(searchFactory, 'search').and.callFake(function(terms, cb) { 22 | cb(null, [{ 23 | name: 'test package', 24 | description: 'description for test item', 25 | updated_at: '2016-11-01T12:00:00Z' 26 | }]);
 27 | }); 28 | 29 | $blockUI = { 30 | start: function() {}, 31 | stop: function() {} 32 | }; 33 | 34 | searchCtrl = $controller('SearchCtrl', { 35 | $scope: $scope, 36 | $state: $state, 37 | $stateParams: $stateParams, 38 | $sce: $sce, 39 | $_: $_, 40 | $blockUI: $blockUI, 41 | searchFactory: searchFactory 42 | }); //Pass it as argument as $scope's value 43 | })); 44 | 45 | describe('search controller', function() { 46 | 47 | it('should be created', function() { 48 | expect(searchCtrl).toBeDefined(); 49 | }); 50 | 51 | it('should return results when searching', function() { 52 | // Use `moment` here as result is dependent on local timezone 53 | var name = ['test package', '[', moment('2016-11-01T12:00:00Z').format('M/D/YYYY hh:mm:ss A'), ']'].join(' '); 54 | 55 | $scope.search('myterm'); 56 | expect($scope.results[0]).toEqual({ 57 | name: name, 58 | description: 'description for test item', 59 | updated_at: '2016-11-01T12:00:00Z' 60 | }); 61 | }); 62 | 63 | }); 64 | }); 65 | -------------------------------------------------------------------------------- /source/console/app/confirm/confirm_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.confirm module', function() { 4 | 5 | var confirmCtrl; 6 | var $scope; 7 | var $state; 8 | var $stateParams; 9 | var $q; 10 | var deferred; 11 | 12 | beforeEach(module('ui.router')); 13 | beforeEach(module('dataLake.confirm')); 14 | beforeEach(module('dataLake.service.auth')); 15 | 16 | beforeEach(inject(function($controller, $rootScope, _$state_, _$q_, authService) { 17 | $scope = $rootScope.$new(); //get a childscope 18 | 19 | $state = _$state_; 20 | spyOn($state, 'go'); 21 | 22 | $q = _$q_; 23 | deferred = _$q_.defer(); 24 | spyOn(authService, 'signin').and.returnValue(deferred.promise); 25 | 26 | $stateParams = { 27 | email: 'user@amazon.com', 28 | password: 'test123**' 29 | }; 30 | 31 | confirmCtrl = $controller('ConfirmCtrl', { 32 | $scope: $scope, 33 | $state: $state, 34 | $stateParams: $stateParams, 35 | authService: authService 36 | }); //Pass it as argument as $scope's value 37 | })); 38 | 39 | describe('confirm controller', function() { 40 | 41 | it('should be created', function() { 42 | //spec body 43 | expect(confirmCtrl).toBeDefined(); 44 | }); 45 | 46 | it('should update password when confirming new password succeeds', function() { 47 | $scope.setPassword({ 48 | newPassword: 'test12312341234!!' 49 | }, true); 50 | deferred.resolve(); 51 | $scope.$apply(); 52 | expect($state.go).toHaveBeenCalledWith('dashboard', {}); 53 | }); 54 | 55 | it('should show error when confirming new password fails', function() { 56 | $scope.setPassword({ 57 | newPassword: 'test12312341234!!' 58 | }, true); 59 | deferred.reject(); 60 | $scope.$apply(); 61 | expect($scope.errormessage).toEqual( 62 | 'An unexpected error has occurred. Please try again.'); 63 | }); 64 | 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /NOTICE.txt: -------------------------------------------------------------------------------- 1 | Data Lake Solution 2 | 3 | Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. 4 | Licensed under the Apache License Version 2.0 (the "License"). You may not use this file except 5 | in compliance with the License. A copy of the License is located at http://www.apache.org/licenses/ 6 | or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, 7 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. See the License for the 8 | specific language governing permissions and limitations under the License. 9 | 10 | ********************** 11 | THIRD PARTY COMPONENTS 12 | ********************** 13 | This software includes third party software subject to the following copyrights: 14 | 15 | Angular under the Massachusetts Institute of Technology (MIT) license 16 | angular-block-ui under the Massachusetts Institute of Technology (MIT) license 17 | angular-loader under the Massachusetts Institute of Technology (MIT) license 18 | angular-messages under the Massachusetts Institute of Technology (MIT) license 19 | angular-resource under the Massachusetts Institute of Technology (MIT) license 20 | angular-ui-router under the Massachusetts Institute of Technology (MIT) license 21 | AWS SDK under the Apache License Version 2.0 22 | Bootstrap under the Massachusetts Institute of Technology (MIT) license 23 | Stanford Javascript Crypto Library under the BSD license or under the GNU GPL, version 2.0 24 | Underscore.js under the Massachusetts Institute of Technology (MIT) license 25 | Moment.js under the Massachusetts Institute of Technology (MIT) license 26 | js-base64 under the Massachusetts Institute of Technology (MIT) license 27 | jsonwebtoken under the Massachusetts Institute of Technology (MIT) license 28 | jwk-to-pem under the Apache License Version 2.0 29 | shortid under the Massachusetts Institute of Technology (MIT) license 30 | jsonschema under the Massachusetts Institute of Technology (MIT) license 31 | bundle.js under the Massachusetts Institute of Technology (MIT) license 32 | amazon-cognito-auth under the Apache License Version 2.0 33 | amazon-cognito-identity under the Amazon Software License 34 | aws-cognito-sdk under the Amazon Software License 35 | -------------------------------------------------------------------------------- /source/console/app/common/components/compareTo/compareTo-directive.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.compareTo.compareTo-directive', []) 21 | 22 | .directive('compareTo', [function() { 23 | return { 24 | require: 'ngModel', 25 | scope: { 26 | compareTo: '=' 27 | }, 28 | link: function(scope, element, attributes, ngModel) { 29 | 30 | ngModel.$validators.compareTo = function(modelValue) { 31 | return modelValue == scope.compareTo; 32 | }; 33 | 34 | scope.$watch('otherModelValue', function() { 35 | ngModel.$validate(); 36 | }); 37 | } 38 | }; 39 | }]); 40 | -------------------------------------------------------------------------------- /source/api/services/admin/lib/access-log.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | 6 | let AccessLog = require('./access-log.js'); 7 | 8 | describe('AccessLog', function() { 9 | describe('#logEvent', function() { 10 | 11 | afterEach(function() { 12 | AWS.restore('DynamoDB.DocumentClient'); 13 | AWS.restore('Lambda'); 14 | }); 15 | 16 | it('should log an event when logging is enabled', function(done) { 17 | 18 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 19 | callback(null, { 20 | Item: { 21 | setting: { 22 | auditLogging: true 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | AWS.mock('Lambda', 'invoke', function(params, callback) { 29 | callback(null, 'completed invoke'); 30 | }); 31 | 32 | let _accessLog = new AccessLog(); 33 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 34 | 'testing event', 35 | 'success', 36 | function(err, data) { 37 | if (err) done(err); 38 | else done(); 39 | } 40 | ); 41 | }); 42 | 43 | it('should not log an event when logging is disabled', function(done) { 44 | 45 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 46 | callback(null, { 47 | Item: { 48 | setting: { 49 | auditLogging: false 50 | } 51 | } 52 | }); 53 | }); 54 | 55 | let _accessLog = new AccessLog(); 56 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 57 | 'testing event', 58 | 'success', 59 | function(err, data) { 60 | if (err) done(err); 61 | else done(); 62 | } 63 | ); 64 | }); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /source/api/services/cart/lib/access-log.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | 6 | let AccessLog = require('./access-log.js'); 7 | 8 | describe('AccessLog', function() { 9 | describe('#logEvent', function() { 10 | 11 | afterEach(function() { 12 | AWS.restore('DynamoDB.DocumentClient'); 13 | AWS.restore('Lambda'); 14 | }); 15 | 16 | it('should log an event when logging is enabled', function(done) { 17 | 18 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 19 | callback(null, { 20 | Item: { 21 | setting: { 22 | auditLogging: true 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | AWS.mock('Lambda', 'invoke', function(params, callback) { 29 | callback(null, 'completed invoke'); 30 | }); 31 | 32 | let _accessLog = new AccessLog(); 33 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 34 | 'testing event', 35 | 'success', 36 | function(err, data) { 37 | if (err) done(err); 38 | else done(); 39 | } 40 | ); 41 | }); 42 | 43 | it('should not log an event when logging is disabled', function(done) { 44 | 45 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 46 | callback(null, { 47 | Item: { 48 | setting: { 49 | auditLogging: false 50 | } 51 | } 52 | }); 53 | }); 54 | 55 | let _accessLog = new AccessLog(); 56 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 57 | 'testing event', 58 | 'success', 59 | function(err, data) { 60 | if (err) done(err); 61 | else done(); 62 | } 63 | ); 64 | }); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /source/api/services/package/lib/access-log.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | let AccessLog = require('./access-log'); 6 | 7 | describe('AccessLog', function() { 8 | describe('#logEvent', function() { 9 | 10 | afterEach(function() { 11 | AWS.restore('DynamoDB.DocumentClient'); 12 | AWS.restore('Lambda'); 13 | }); 14 | 15 | 16 | it('should log an event when logging is enabled', function(done) { 17 | 18 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 19 | callback(null, { 20 | Item: { 21 | setting: { 22 | auditLogging: true 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | AWS.mock('Lambda', 'invoke', function(params, callback) { 29 | callback(null, 'completed invoke'); 30 | }); 31 | 32 | let _accessLog = new AccessLog(); 33 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 34 | 'testing event', 35 | 'success', 36 | function(err, data) { 37 | if (err) done(err); 38 | else done(); 39 | } 40 | ); 41 | }); 42 | 43 | it('should not log an event when logging is disabled', function(done) { 44 | 45 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 46 | callback(null, { 47 | Item: { 48 | setting: { 49 | auditLogging: false 50 | } 51 | } 52 | }); 53 | }); 54 | 55 | let _accessLog = new AccessLog(); 56 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 57 | 'testing event', 58 | 'success', 59 | function(err, data) { 60 | if (err) done(err); 61 | else done(); 62 | } 63 | ); 64 | }); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /source/api/services/profile/lib/access-log.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | 6 | let AccessLog = require('./access-log.js'); 7 | 8 | describe('AccessLog', function() { 9 | describe('#logEvent', function() { 10 | 11 | afterEach(function() { 12 | AWS.restore('DynamoDB.DocumentClient'); 13 | AWS.restore('Lambda'); 14 | }); 15 | 16 | it('should log an event when logging is enabled', function(done) { 17 | 18 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 19 | callback(null, { 20 | Item: { 21 | setting: { 22 | auditLogging: true 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | AWS.mock('Lambda', 'invoke', function(params, callback) { 29 | callback(null, 'completed invoke'); 30 | }); 31 | 32 | let _accessLog = new AccessLog(); 33 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 34 | 'testing event', 35 | 'success', 36 | function(err, data) { 37 | if (err) done(err); 38 | else done(); 39 | } 40 | ); 41 | }); 42 | 43 | it('should not log an event when logging is disabled', function(done) { 44 | 45 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 46 | callback(null, { 47 | Item: { 48 | setting: { 49 | auditLogging: false 50 | } 51 | } 52 | }); 53 | }); 54 | 55 | let _accessLog = new AccessLog(); 56 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 57 | 'testing event', 58 | 'success', 59 | function(err, data) { 60 | if (err) done(err); 61 | else done(); 62 | } 63 | ); 64 | }); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /source/api/services/search/lib/access-log.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | 6 | let AccessLog = require('../../search/lib/access-log.js'); 7 | 8 | describe('AccessLog', function() { 9 | describe('#logEvent', function() { 10 | 11 | afterEach(function() { 12 | AWS.restore('DynamoDB.DocumentClient'); 13 | AWS.restore('Lambda'); 14 | }); 15 | 16 | it('should log an event when logging is enabled', function(done) { 17 | 18 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 19 | callback(null, { 20 | Item: { 21 | setting: { 22 | auditLogging: true 23 | } 24 | } 25 | }); 26 | }); 27 | 28 | AWS.mock('Lambda', 'invoke', function(params, callback) { 29 | callback(null, 'completed invoke'); 30 | }); 31 | 32 | let _accessLog = new AccessLog(); 33 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 34 | 'testing event', 35 | 'success', 36 | function(err, data) { 37 | if (err) done(err); 38 | else done(); 39 | } 40 | ); 41 | }); 42 | 43 | it('should not log an event when logging is disabled', function(done) { 44 | 45 | AWS.mock('DynamoDB.DocumentClient', 'get', function(params, callback) { 46 | callback(null, { 47 | Item: { 48 | setting: { 49 | auditLogging: false 50 | } 51 | } 52 | }); 53 | }); 54 | 55 | let _accessLog = new AccessLog(); 56 | _accessLog.logEvent('test', 'test-service', 'sampleuser', 57 | 'testing event', 58 | 'success', 59 | function(err, data) { 60 | if (err) done(err); 61 | else done(); 62 | } 63 | ); 64 | }); 65 | }); 66 | }); 67 | -------------------------------------------------------------------------------- /source/console/app/admin/groups/groups.html: -------------------------------------------------------------------------------- 1 |
2 |

Group Management

3 |

Manage the groups of the data lake. Begin by selecting a group you want to manage.

4 |
5 | 6 | {{awsUiAlert.header}} 7 | {{awsUiAlert.content}} 8 | 9 |
10 |
11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 |
NameCreationDate
27 | 29 | {{group.GroupName}}{{group.CreationDate}}
37 | 38 |
42 |
43 |
-------------------------------------------------------------------------------- /source/console/app/common/factories/searchFactory_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.factory.search spec', function() { 4 | 5 | var searchFactory; 6 | var $resource; 7 | var $state; 8 | var $q; 9 | var deferred; 10 | var $httpBackend; 11 | 12 | beforeEach(module('ui.router')); 13 | beforeEach(module('dataLake.factory.search')); 14 | 15 | beforeEach(inject(function($injector, _$q_, _$state_, authService) { 16 | $state = _$state_; 17 | spyOn($state, 'go'); 18 | 19 | $httpBackend = $injector.get('$httpBackend'); 20 | 21 | $q = _$q_; 22 | deferred = _$q_.defer(); 23 | spyOn(authService, 'getUserAccessToken').and.returnValue(deferred.promise); 24 | 25 | searchFactory = $injector.get('searchFactory', { 26 | $resource: $resource, 27 | $state: $state, 28 | authService: authService 29 | }); //Pass it as argument as $scope's value 30 | 31 | })); 32 | 33 | describe('search factory', function() { 34 | 35 | it('should be created', function() { 36 | expect(searchFactory).toBeDefined(); 37 | }); 38 | 39 | it('should return results when searched', function() { 40 | var _url = [APIG_ENDPOINT, '/search?term=test'].join(''); 41 | $httpBackend.expectGET(_url).respond({ 42 | Items: [{ 43 | name: 'test package', 44 | description: 'description for test item' 45 | }] 46 | }); 47 | 48 | var observer = { 49 | result: {}, 50 | callback: function(data) { 51 | this.result = data; 52 | } 53 | }; 54 | 55 | searchFactory.search('test', function(err, data) { 56 | observer.callback(data); 57 | }); 58 | 59 | deferred.resolve({ 60 | token: 'test-token' 61 | }); 62 | 63 | $httpBackend.flush(); 64 | 65 | // expect(result.username).toEqual('test'); 66 | expect(observer.result[0]).toEqual({ 67 | name: 'test package', 68 | description: 'description for test item' 69 | }); 70 | }); 71 | 72 | }); 73 | }); 74 | -------------------------------------------------------------------------------- /source/api/services/manifest/lib/index.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | const cAssert = require('chai').assert; 6 | const expect = require('chai').expect; 7 | 8 | let lib = require('../../manifest/lib/'); 9 | 10 | describe('Index', function() { 11 | 12 | beforeEach(function() { 13 | var payload = { 14 | event: { 15 | headers: { 16 | Auth: 'testauth-12345' 17 | } 18 | } 19 | }; 20 | 21 | AWS.mock('Lambda', 'invoke', function(params, callback) { 22 | let _payload = JSON.parse(params.Payload); 23 | if (_payload.authorizationToken === 'testauth-12345') { 24 | let data = JSON.stringify({ 25 | auth_status: 'authorized', 26 | auth_status_reason: 'User has the valid role for requested operation', 27 | userid: 'testuser', 28 | role: 'Member' 29 | }); 30 | 31 | callback(null, { 32 | Payload: data 33 | }); 34 | } else { 35 | let data = JSON.stringify({ 36 | auth_status: 'Unauthorized', 37 | auth_status_reason: 'Invalid access token' 38 | }); 39 | 40 | callback(null, { 41 | Payload: data 42 | }); 43 | } 44 | }); 45 | }); 46 | 47 | afterEach(function() { 48 | AWS.restore('Lambda'); 49 | }); 50 | 51 | describe('#respond', function() { 52 | 53 | it('should return unathorized with no valid auth token', function(done) { 54 | 55 | var invalidPayload = { 56 | headers: { 57 | Auth: 'badtoken' 58 | } 59 | }; 60 | 61 | lib.respond(invalidPayload, function(err, data) { 62 | if (err) { 63 | expect(err.error.message).to.be.equal( 64 | 'User is not authorized to perform the requested action.' 65 | ); 66 | done(); 67 | } else { 68 | done('Test failed with no error callback'); 69 | } 70 | }); 71 | }); 72 | 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /source/api/services/search/lib/index.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let assert = require('assert'); 4 | let AWS = require('aws-sdk-mock'); 5 | const cAssert = require('chai').assert; 6 | const expect = require('chai').expect; 7 | 8 | let lib = require('../../search/lib/'); 9 | 10 | describe('Index', function() { 11 | 12 | beforeEach(function() { 13 | var payload = { 14 | event: { 15 | headers: { 16 | Auth: 'testauth-12345' 17 | } 18 | } 19 | }; 20 | 21 | AWS.mock('Lambda', 'invoke', function(params, callback) { 22 | let _payload = JSON.parse(params.Payload); 23 | if (_payload.authorizationToken === 'testauth-12345') { 24 | let data = JSON.stringify({ 25 | auth_status: 'authorized', 26 | auth_status_reason: 'User has the valid role for requested operation', 27 | userid: 'testuser', 28 | role: 'Member' 29 | }); 30 | 31 | callback(null, { 32 | Payload: data 33 | }); 34 | } else { 35 | let data = JSON.stringify({ 36 | auth_status: 'Unauthorized', 37 | auth_status_reason: 'Invalid access token' 38 | }); 39 | 40 | callback(null, { 41 | Payload: data 42 | }); 43 | } 44 | }); 45 | }); 46 | 47 | afterEach(function() { 48 | AWS.restore('Lambda'); 49 | }); 50 | 51 | describe('#respond', function() { 52 | 53 | it('should return unathorized with no valid auth token', function(done) { 54 | 55 | var invalidPayload = { 56 | headers: { 57 | Auth: 'badtoken' 58 | } 59 | }; 60 | 61 | lib.respond(invalidPayload, function(err, data) { 62 | if (err) { 63 | expect(err.body).to.be.equal( 64 | '{"error":{"message":"User is not authorized to perform the requested action."}}' 65 | ); 66 | done(); 67 | } else { 68 | done('Test failed with no error callback'); 69 | } 70 | }); 71 | }); 72 | 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /source/console/app/common/factories/utils.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.utils', []) 21 | 22 | .factory('$_', function() { 23 | return window._; 24 | }) 25 | 26 | .factory('$blockUI', function($document) { 27 | return { 28 | start: function() { 29 | var _body = $document.find('body').eq(0); 30 | _body.addClass('block-ui-active block-ui-visible'); 31 | }, 32 | stop: function() { 33 | var _body = $document.find('body').eq(0); 34 | _body.removeClass('block-ui-active'); 35 | _body.removeClass('block-ui-visible'); 36 | } 37 | }; 38 | }) 39 | 40 | .factory('$localstorage', ['$window', function($window) { 41 | return { 42 | set: function(key, value) { 43 | $window.localStorage[key] = value; 44 | }, 45 | remove: function(key) { 46 | $window.localStorage.removeItem(key); 47 | }, 48 | get: function(key, defaultValue) { 49 | return $window.localStorage[key] || defaultValue; 50 | }, 51 | setObject: function(key, value) { 52 | $window.localStorage[key] = JSON.stringify(value); 53 | }, 54 | getObject: function(key) { 55 | return JSON.parse($window.localStorage[key] || '{}'); 56 | } 57 | }; 58 | }]); 59 | -------------------------------------------------------------------------------- /source/console/app/common/factories/profileFactory_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.factory.profile spec', function() { 4 | 5 | var profileFactory; 6 | var $resource; 7 | var $state; 8 | var $q; 9 | var deferred; 10 | var $httpBackend; 11 | 12 | beforeEach(module('ui.router')); 13 | beforeEach(module('dataLake.factory.profile')); 14 | 15 | beforeEach(inject(function($injector, _$q_, _$state_, authService) { 16 | $state = _$state_; 17 | spyOn($state, 'go'); 18 | 19 | $httpBackend = $injector.get('$httpBackend'); 20 | 21 | $q = _$q_; 22 | deferred = _$q_.defer(); 23 | spyOn(authService, 'getUserAccessToken').and.returnValue(deferred.promise); 24 | 25 | profileFactory = $injector.get('profileFactory', { 26 | $resource: $resource, 27 | $state: $state, 28 | authService: authService 29 | }); //Pass it as argument as $scope's value 30 | 31 | })); 32 | 33 | describe('profile factory', function() { 34 | 35 | it('should be created', function() { 36 | expect(profileFactory).toBeDefined(); 37 | }); 38 | 39 | it('should return user profile information', function() { 40 | var _url = [APIG_ENDPOINT, '/profile'].join(''); 41 | $httpBackend.expectGET(_url).respond({ 42 | hostname: 'faketest.amazon.com' 43 | }); 44 | 45 | var observer = { 46 | result: {}, 47 | callback: function(data) { 48 | this.result = data; 49 | } 50 | }; 51 | 52 | profileFactory.getProfile(function(err, data) { 53 | observer.callback(data); 54 | }); 55 | 56 | deferred.resolve({ 57 | token: 'test-token' 58 | }); 59 | 60 | $httpBackend.flush(); 61 | expect(observer.result.hostname).toEqual('faketest.amazon.com'); 62 | }); 63 | 64 | it('should create secret access key', function() { 65 | var _url = [APIG_ENDPOINT, '/profile/apikey'].join(''); 66 | $httpBackend.expectGET(_url).respond({ 67 | key: 'fakesecretaccesskey' 68 | }); 69 | 70 | var observer = { 71 | result: {}, 72 | callback: function(data) { 73 | this.result = data; 74 | } 75 | }; 76 | 77 | profileFactory.getApiKey(function(err, data) { 78 | observer.callback(data); 79 | }); 80 | 81 | deferred.resolve({ 82 | token: 'test-token' 83 | }); 84 | 85 | $httpBackend.flush(); 86 | expect(observer.result.key).toEqual('fakesecretaccesskey'); 87 | }); 88 | 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /source/console/app/confirm/confirm.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.confirm', []) 21 | 22 | .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { 23 | $stateProvider.state('confirm', { 24 | url: '/confirm', 25 | params: { 26 | email: '', 27 | password: '' 28 | }, 29 | views: { 30 | '': { 31 | templateUrl: 'confirm/confirm.html', 32 | controller: 'ConfirmCtrl' 33 | } 34 | }, 35 | activeWithFederation: false 36 | }); 37 | }]) 38 | 39 | .controller('ConfirmCtrl', function($scope, $state, $stateParams, authService) { 40 | 41 | $scope.errormessage = ''; 42 | 43 | $scope.setPassword = function(newuser, isValid) { 44 | if (isValid) { 45 | newuser.email = $stateParams.email; 46 | newuser.password = $stateParams.password; 47 | 48 | authService.signin(newuser, 'password_challenge').then(function() { 49 | $state.go('dashboard', {}); 50 | }, function(msg) { 51 | $scope.errormessage = 'An unexpected error has occurred. Please try again.'; 52 | return; 53 | }); 54 | 55 | } else { 56 | $scope.errormessage = 'There are still invalid fields.'; 57 | } 58 | }; 59 | 60 | }); 61 | -------------------------------------------------------------------------------- /source/console/app/admin/users/users.html: -------------------------------------------------------------------------------- 1 |

User Management

2 |

Manage the users of the data lake. Begin by selecting a user you want to manage.

3 |
4 | 5 | Service error 6 | An unexpected error has occurred while retrieving users. 7 | 8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | 49 | 50 | 51 |
UsernameEmailNameRoleEnabledRegistration Status
30 | 32 | {{user.user_id}}{{user.email}}{{user.name}}{{user.role}} 38 | 39 | 40 | {{user.status == 'CONFIRMED' ? 'Confirmed' : 'Pending'}}
47 | 48 |
52 |
53 | -------------------------------------------------------------------------------- /source/console/app/profile/profile_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.profile module', function() { 4 | 5 | var profileCtrl; 6 | var $scope; 7 | var $state; 8 | var $stateParams; 9 | var $blockUI; 10 | var $q; 11 | var authDeferred; 12 | var profileDeferred; 13 | 14 | beforeEach(module('ui.router')); 15 | beforeEach(module('dataLake.utils')); 16 | beforeEach(module('dataLake.main')); 17 | beforeEach(module('dataLake.profile')); 18 | 19 | beforeEach(inject(function($controller, $rootScope, _$q_, _$state_, authService, profileFactory) { 20 | $scope = $rootScope.$new(); //get a childscope 21 | 22 | $state = _$state_; 23 | spyOn($state, 'go'); 24 | 25 | $q = _$q_; 26 | authDeferred = _$q_.defer(); 27 | spyOn(authService, 'getUserInfo').and.returnValue(authDeferred.promise); 28 | spyOn(profileFactory, 'getProfile').and.callFake(function(cb) { 29 | cb(null, { 30 | hostname: 'faketest.amazon.com' 31 | });
 32 | }); 33 | 34 | spyOn(profileFactory, 'getApiKey').and.callFake(function(cb) { 35 | cb(null, { 36 | key: 'fakesecretaccesskey' 37 | });
 38 | }); 39 | 40 | $blockUI = { 41 | start: function() {}, 42 | stop: function() {} 43 | }; 44 | 45 | profileCtrl = $controller('ProfileCtrl', { 46 | $scope: $scope, 47 | $state: $state, 48 | $stateParams: $stateParams, 49 | $blockUI: $blockUI, 50 | authService: authService, 51 | profileFactory: profileFactory 52 | }); //Pass it as argument as $scope's value 53 | 54 | })); 55 | 56 | describe('profile controller', function() { 57 | 58 | it('should be created', function() { 59 | 60 | expect(profileCtrl).toBeDefined(); 61 | authDeferred.resolve({ 62 | email: 'user@amazon.com', 63 | name: 'User Name', 64 | username: 'user_amazon_com', 65 | display_name: 'User Name' 66 | }); 67 | 68 | $scope.$apply(); 69 | expect($scope.user.email).toEqual('user@amazon.com'); 70 | expect($scope.user.username).toEqual('user_amazon_com'); 71 | expect($scope.user.display_name).toEqual('User Name'); 72 | }); 73 | 74 | it('should change state to changePassword when selecting to change password', function() { 75 | 76 | $scope.changePassword(); 77 | expect($state.go).toHaveBeenCalledWith('changePassword', {}); 78 | 79 | }); 80 | 81 | it('should generate a secret access key', function() { 82 | 83 | $scope.generateSecretKey(); 84 | expect($scope.secret.key).toEqual('fakesecretaccesskey'); 85 | 86 | }); 87 | 88 | }); 89 | }); 90 | -------------------------------------------------------------------------------- /source/console/app/forgot/forgot_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.forgot module', function() { 4 | 5 | var forgotCtrl; 6 | var $scope; 7 | var $state; 8 | var $q; 9 | var deferred; 10 | 11 | beforeEach(module('ui.router')); 12 | beforeEach(module('dataLake.forgot')); 13 | beforeEach(module('dataLake.service.auth')); 14 | 15 | beforeEach(inject(function($controller, $rootScope, _$q_, _$state_, authService) { 16 | $scope = $rootScope.$new(); //get a childscope 17 | 18 | $state = _$state_; 19 | spyOn($state, 'go'); 20 | 21 | $q = _$q_; 22 | deferred = _$q_.defer(); 23 | spyOn(authService, 'forgot').and.returnValue(deferred.promise); 24 | spyOn(authService, 'resetPassword').and.returnValue(deferred.promise); 25 | 26 | forgotCtrl = $controller("ForgotCtrl", { 27 | $scope: $scope, 28 | $state: $state, 29 | authService: authService 30 | }); //Pass it as argument as $scope's value 31 | })); 32 | 33 | describe('forgot controller', function() { 34 | 35 | it('should be created', function() { 36 | //spec body 37 | expect(forgotCtrl).toBeDefined(); 38 | }); 39 | 40 | it('should initiate congnito email when forgot password', function() { 41 | $scope.forgotPassword({ 42 | email: 'user@amazon.com' 43 | }, true); 44 | deferred.resolve(); 45 | $scope.$apply(); 46 | expect($scope.showVerification).toEqual(true); 47 | }); 48 | 49 | it('should show error when forgot password fails', function() { 50 | $scope.forgotPassword({ 51 | email: 'user@amazon.com' 52 | }, true); 53 | deferred.reject(); 54 | $scope.$apply(); 55 | expect($scope.errormessage).toEqual( 56 | 'An unexpected error has occurred. Please try again.'); 57 | }); 58 | 59 | it('should go to signin after changing password', function() { 60 | $scope.changePassword({ 61 | email: 'user@amazon.com', 62 | verificationCode: '12345', 63 | password: 'test123&*2' 64 | }, true); 65 | deferred.resolve(); 66 | $scope.$apply(); 67 | expect($state.go).toHaveBeenCalledWith('signin', {}); 68 | }); 69 | 70 | it('should show error when changing password fails', function() { 71 | $scope.changePassword({ 72 | email: 'user@amazon.com', 73 | verificationCode: '12345', 74 | password: 'test123&*2' 75 | }, true); 76 | deferred.reject(); 77 | $scope.$apply(); 78 | expect($scope.errormessage).toEqual( 79 | 'An unexpected error has occurred. Please try again.'); 80 | }); 81 | 82 | }); 83 | }); 84 | -------------------------------------------------------------------------------- /source/console/app/profile/changePassword.html: -------------------------------------------------------------------------------- 1 |

2 | Change your password 3 | 4 |

5 |

Change the password for your data lake account. To create change your password enter your existing password, the new password and click the Change Password button.

6 |
7 | 8 | Service error 9 | An unexpected error has occurred while retrieving users. 10 | 11 |
12 |
13 | 14 | Password complexity requirements 15 | Password must be at least 8 characters, and must include at least one upper case letter, one lower case letter, and one numeric digit. 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |

28 | 29 |
30 | 31 | 32 |
33 |
34 |
35 |
36 | -------------------------------------------------------------------------------- /source/resources/loader/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let moment = require('moment'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | let async = require('async'); 7 | 8 | //get the signed api credentials 9 | let _creds = new Creds(); 10 | let _authKey = _creds.getAuthSignature(); 11 | 12 | let sendMockData = function(data, cb) { 13 | 14 | let _payload = data; 15 | 16 | // send api request 17 | let _apiproxy = new ApiProxy(); 18 | _apiproxy.sendApiRequest('/prod/packages/new', 'POST', JSON.stringify(_payload), _authKey, function(err, data) { 19 | if (err) { 20 | // cb(err, null); 21 | console.log([moment().format('YYYY-MM-DD HH:mm:ss'), 'data load failed..'].join(' ')); 22 | return cb(null, [moment().format('YYYY-MM-DD HH:mm:ss'), 'data load failed..'].join(' ')); 23 | } 24 | 25 | console.log([moment().format('YYYY-MM-DD HH:mm:ss'), 'data loaded succesfully..'].join(' ')); 26 | return cb(null, [moment().format('YYYY-MM-DD HH:mm:ss'), 'data loaded succesfully..'].join(' ')); 27 | }); 28 | }; 29 | 30 | let loadMockData = function(mockdata, index, cb) { 31 | if (index < mockdata.length) { 32 | var _index = index; 33 | sendMockData(mockdata[_index], function(err, data) { 34 | if (err) { 35 | console.log(err); 36 | process.exit(1); 37 | } 38 | 39 | console.log([data, _index].join(' ')); 40 | 41 | }); 42 | 43 | index++; 44 | if ((index % 10) === 0) { 45 | setTimeout(function() { 46 | loadMockData(mockdata, index, cb); 47 | }, 4000); 48 | } else { 49 | loadMockData(mockdata, index, cb); 50 | } 51 | 52 | } else { 53 | cb(null, 'done processing mock data'); 54 | } 55 | }; 56 | 57 | let validateJSON = function(body) { 58 | try { 59 | let data = JSON.parse(body); 60 | return data; 61 | } catch (e) { 62 | // failed to parse 63 | console.log('Manifest file contains invalid JSON.'); 64 | return null; 65 | } 66 | }; 67 | 68 | let fs = require('fs'); 69 | let file = './MOCK_DATA.json'; 70 | fs.readFile(file, 'utf8', function(err, data) { 71 | if (err) { 72 | console.log('Unable to read mock data file'); 73 | console.log(err); 74 | process.exit(1); 75 | } 76 | 77 | let _mockdata = validateJSON(data); 78 | if (_mockdata) { 79 | 80 | loadMockData(_mockdata, 0, function(err, resp) { 81 | if (err) { 82 | console.log('Error occurred loading mock data file'); 83 | console.log(err); 84 | process.exit(1); 85 | } 86 | 87 | console.log(resp); 88 | }); 89 | 90 | } else { 91 | console.log('Invalid JSON in mock data file'); 92 | process.exit(1); 93 | } 94 | 95 | }); 96 | -------------------------------------------------------------------------------- /source/console/app/signin/signin.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 62 |
63 | -------------------------------------------------------------------------------- /source/console/app/confirm/confirm.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 49 |
50 | -------------------------------------------------------------------------------- /source/cli/datalake-upload-package-dataset.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | const path = require('path'); 7 | const fs = require('fs'); 8 | const https = require("https"); 9 | const request = require('request'); 10 | 11 | program 12 | .option('--package-id ', 'package identifier') 13 | .option('--file ', 'path to dataset file') 14 | .option('--content-type ', 'content type of dataset file') 15 | .parse(process.argv); 16 | 17 | if (!program.packageId) { 18 | console.error('option "--package-id " argument required'); 19 | process.exit(1); 20 | } 21 | 22 | if (!program.file) { 23 | console.error('option "--file " argument required'); 24 | process.exit(1); 25 | } 26 | 27 | if (!program.contentType) { 28 | console.error('option "--content-type " argument required'); 29 | process.exit(1); 30 | } 31 | 32 | let _stats = fs.lstat(program.file, function(err, stats) { 33 | if (err) { 34 | console.error('error accessing provided --file argument'); 35 | process.exit(1); 36 | } 37 | 38 | //get the signed api credentials 39 | let _creds = new Creds(); 40 | let _authKey = _creds.getAuthSignature(); 41 | 42 | // send api request 43 | let _apiproxy = new ApiProxy(); 44 | let _basename = path.basename(program.file); 45 | 46 | let _payload = JSON.stringify({ 47 | name: _basename, 48 | type: 'dataset', 49 | content_type: program.contentType 50 | }); 51 | let _path = ['/prod/packages/', program.packageId, '/datasets/new'].join(''); 52 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 53 | if (err) { 54 | console.log(err); 55 | process.exit(1); 56 | } 57 | 58 | let _stream = fs.createReadStream(program.file); 59 | 60 | var options = { 61 | url: data.uploadUrl, 62 | headers: { 63 | 'Content-Type': program.contentType, 64 | 'Content-Length': stats.size 65 | } 66 | }; 67 | 68 | fs.createReadStream(program.file).pipe(request.put(options).on('response', function(response) { 69 | 70 | if (response.statusCode !== 200) { 71 | console.log('The manifest entry was created, but the file failed to upload.'); 72 | process.exit(1); 73 | } 74 | 75 | let _datasetPath = ['/prod/packages/', program.packageId, '/datasets/', 76 | data.dataset_id 77 | ].join(''); 78 | _apiproxy.sendApiRequest(_datasetPath, 'GET', null, _authKey, function( 79 | err, dataset) { 80 | if (err) { 81 | console.log(err); 82 | process.exit(1); 83 | } 84 | 85 | console.log(JSON.stringify(dataset)); 86 | }); 87 | 88 | })); 89 | }); 90 | }); 91 | -------------------------------------------------------------------------------- /.jscsrc: -------------------------------------------------------------------------------- 1 | { 2 | "disallowSpacesInNamedFunctionExpression": { 3 | "beforeOpeningRoundBrace": true 4 | }, 5 | "disallowSpacesInFunctionDeclaration": { 6 | "beforeOpeningRoundBrace": true 7 | }, 8 | "disallowSpacesInsideBrackets": true, 9 | "disallowEmptyBlocks": true, 10 | "disallowSpacesInCallExpression": true, 11 | "disallowSpacesInsideArrayBrackets": true, 12 | "disallowSpacesInsideParentheses": true, 13 | "disallowQuotedKeysInObjects": true, 14 | "disallowSpaceAfterObjectKeys": true, 15 | "requireSpaceBeforeObjectValues": true, 16 | "disallowSpaceAfterPrefixUnaryOperators": true, 17 | "disallowSpaceBeforePostfixUnaryOperators": true, 18 | "disallowSpaceBeforeBinaryOperators": [ 19 | "," 20 | ], 21 | "disallowMixedSpacesAndTabs": true, 22 | "disallowTrailingWhitespace": true, 23 | "requireTrailingComma": false, 24 | "requireSpaceAfterComma": true, 25 | "disallowYodaConditions": true, 26 | "disallowKeywords": ["with"], 27 | "disallowKeywordsOnNewLine": ["else"], 28 | "disallowMultipleLineBreaks": true, 29 | "disallowMultipleLineStrings": true, 30 | "disallowMultipleVarDecl": true, 31 | "disallowSpaceBeforeComma": true, 32 | "disallowSpaceBeforeSemicolon": true, 33 | "disallowSpacesInsideTemplateStringPlaceholders": true, 34 | "disallowArrayDestructuringReturn": true, 35 | "requireSpaceBeforeBlockStatements": true, 36 | "requireParenthesesAroundIIFE": true, 37 | "requireSpacesInConditionalExpression": true, 38 | "requireBlocksOnNewline": 1, 39 | "requireCommaBeforeLineBreak": true, 40 | "requireSpaceBeforeBinaryOperators": true, 41 | "requireSpaceAfterBinaryOperators": true, 42 | "requireCamelCaseOrUpperCaseIdentifiers": { 43 | "ignoreProperties": true 44 | }, 45 | "requireDollarBeforejQueryAssignment": true, 46 | "requireLineFeedAtFileEnd": true, 47 | "requireCapitalizedConstructors": true, 48 | "requireDotNotation": true, 49 | "requireSpacesInForStatement": true, 50 | "requireSpacesInsideObjectBrackets": "all", 51 | "requireSpaceBetweenArguments": true, 52 | "requireCurlyBraces": [ 53 | "do" 54 | ], 55 | "requireSpaceAfterKeywords": [ 56 | "if", 57 | "else", 58 | "for", 59 | "while", 60 | "do", 61 | "switch", 62 | "case", 63 | "return", 64 | "try", 65 | "catch", 66 | "typeof" 67 | ], 68 | "requirePaddingNewLinesBeforeLineComments": { 69 | "allExcept": "firstAfterCurly" 70 | }, 71 | "requirePaddingNewLinesAfterBlocks": true, 72 | "requireSemicolons": true, 73 | "requireShorthandArrowFunctions": true, 74 | "requireSpacesInsideImportedObjectBraces": true, 75 | "safeContextKeyword": "_this", 76 | "validateLineBreaks": "LF", 77 | "validateQuoteMarks": { 78 | "mark": "'", 79 | "escape": true, 80 | "ignoreJSX": true 81 | }, 82 | "validateIndentation": 4, 83 | "maximumLineLength": { 84 | "value": 120, 85 | "allExcept": ["urlComments"] 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /source/console/app/admin/users/users.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.admin.users', ['dataLake.main', 'dataLake.utils', 'dataLake.factory.admin']) 21 | 22 | .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, 23 | $urlRouterProvider) { 24 | $stateProvider.state('admin_users', { 25 | url: '/admin/users', 26 | views: { 27 | '': { 28 | templateUrl: 'main/main.html', 29 | controller: 'MainCtrl' 30 | }, 31 | '@admin_users': { 32 | templateUrl: 'admin/users/users.html', 33 | controller: 'AdminUsersCtrl' 34 | } 35 | }, 36 | adminAuthenticate: true, 37 | activeWithFederation: true 38 | }); 39 | }]) 40 | 41 | .filter('encodeURIComponent', function($window) { 42 | return $window.encodeURIComponent; 43 | }) 44 | 45 | .controller('AdminUsersCtrl', function($scope, $state, $blockUI, adminUserFactory) { 46 | 47 | $scope.results = []; 48 | $scope.showerror = false; 49 | $scope.federatedLogin = FEDERATED_LOGIN; 50 | 51 | var getUsers = function() { 52 | $blockUI.start(); 53 | adminUserFactory.listUsers(function(err, users) { 54 | if (err) { 55 | console.log('error', err); 56 | $scope.showerror = true; 57 | $blockUI.stop(); 58 | return; 59 | } 60 | 61 | $scope.users = users; 62 | $blockUI.stop(); 63 | }); 64 | }; 65 | 66 | $scope.refresh = function() { 67 | getUsers(); 68 | }; 69 | 70 | getUsers(); 71 | 72 | }); 73 | -------------------------------------------------------------------------------- /deployment/manifest-generator/app.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | const fs = require('fs'); 21 | const path = require('path'); 22 | 23 | let getFileList = function(path) { 24 | let fileInfo; 25 | let filesFound; 26 | let fileList = []; 27 | 28 | filesFound = fs.readdirSync(path); 29 | for (let i = 0; i < filesFound.length; i++) { 30 | fileInfo = fs.lstatSync([path, filesFound[i]].join('/')); 31 | if (fileInfo.isFile()) { 32 | fileList.push(filesFound[i]); 33 | } 34 | 35 | if (fileInfo.isDirectory()) { 36 | console.log([path, filesFound[i]].join('/')); 37 | } 38 | } 39 | 40 | return fileList; 41 | }; 42 | 43 | // List all files in a directory in Node.js recursively in a synchronous fashion 44 | let walkSync = function(dir, filelist) { 45 | // let filelist = []; //getFileList('./temp/site'); 46 | let files = fs.readdirSync(dir); 47 | filelist = filelist || []; 48 | files.forEach(function(file) { 49 | if (fs.statSync(path.join(dir, file)).isDirectory()) { 50 | filelist = walkSync(path.join(dir, file), filelist); 51 | } else { 52 | filelist.push(path.join(dir, file)); 53 | } 54 | }); 55 | 56 | return filelist; 57 | }; 58 | 59 | let _filelist = []; 60 | let _manifest = { 61 | files: [] 62 | }; 63 | walkSync(process.argv[2]+'/site', _filelist); 64 | 65 | for (let i = 0; i < _filelist.length; i++) { 66 | _manifest.files.push(_filelist[i].replace(process.argv[2]+'/site/', '')); 67 | }; 68 | 69 | console.log(_manifest); 70 | fs.writeFile(process.argv[2]+'/data-lake-site-manifest.json', JSON.stringify(_manifest, null), function (err, data) { 71 | if (err) throw err; 72 | }); 73 | -------------------------------------------------------------------------------- /source/console/app/profile/changePassword.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.profile.changepassword', ['dataLake.main', 'dataLake.utils', 'dataLake.service.auth']) 21 | 22 | .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, 23 | $urlRouterProvider) { 24 | $stateProvider.state('changePassword', { 25 | url: '/profile/changepassword', 26 | views: { 27 | '': { 28 | templateUrl: 'main/main.html', 29 | controller: 'MainCtrl' 30 | }, 31 | '@changePassword': { 32 | templateUrl: 'profile/changePassword.html', 33 | controller: 'ChangePasswordCtrl' 34 | } 35 | }, 36 | authenticate: true, 37 | activeWithFederation: false 38 | }); 39 | }]) 40 | 41 | .controller('ChangePasswordCtrl', function($scope, $state, $stateParams, $blockUI, authService) { 42 | 43 | $scope.changeinfo = { 44 | newPassword: '' 45 | }; 46 | $scope.showError = false; 47 | 48 | $scope.changePassword = function(newinfo, isValid) { 49 | $blockUI.start(); 50 | if (isValid) { 51 | authService.changePassword(newinfo.oldPassword, newinfo.newPassword).then(function(resp) { 52 | $blockUI.stop(); 53 | $state.go('profile', {}); 54 | }, 55 | function(msg) { 56 | $blockUI.stop(); 57 | $scope.showError = true; 58 | console.log('Unable to change the user password.'); 59 | return; 60 | }); 61 | } else { 62 | $scope.showError = true; 63 | $blockUI.stop(); 64 | } 65 | }; 66 | 67 | }); 68 | -------------------------------------------------------------------------------- /source/api/services/manifest/lib/index.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | let AWS = require('aws-sdk'); 21 | 22 | let manifest = require('./manifest.js'); 23 | 24 | module.exports.respond = function(event, cb) { 25 | 26 | let _authCheckPayload = { 27 | authcheck: ['admin', 'member'], 28 | authorizationToken: event.authorizationToken 29 | }; 30 | 31 | let _response = ''; 32 | 33 | // invoke data-lake-admin-service function to verify if user has 34 | // proper role for requested action 35 | let params = { 36 | FunctionName: 'data-lake-admin-service', 37 | InvocationType: 'RequestResponse', 38 | LogType: 'None', 39 | Payload: JSON.stringify(_authCheckPayload) 40 | }; 41 | let lambda = new AWS.Lambda(); 42 | lambda.invoke(params, function(err, data) { 43 | if (err) { 44 | console.log(err); 45 | return cb(err, null); 46 | } 47 | 48 | let _ticket = JSON.parse(data.Payload); 49 | console.log('Authorization check result: ' + _ticket.auth_status); 50 | if (_ticket.auth_status === 'authorized') { 51 | 52 | let _manifest = new manifest(); 53 | 54 | if (event.operation === 'import') { 55 | _manifest.import(event, cb); 56 | } else if (event.operation === 'generate') { 57 | _manifest.generate(event, cb); 58 | } else { 59 | return cb('Invalid operation request to manifest service.', null); 60 | } 61 | 62 | } else { 63 | return cb({ 64 | error: { 65 | message: 'User is not authorized to perform the requested action.' 66 | } 67 | }, null); 68 | } 69 | 70 | }); 71 | 72 | } 73 | -------------------------------------------------------------------------------- /source/console/app/main/main.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.main', ['dataLake.factory.cart']) 21 | 22 | .controller('MainCtrl', function($scope, $state, $location, $rootScope, authService, cartFactory) { 23 | 24 | $scope.username = ''; 25 | $scope.cartCount = 0; 26 | $scope.showadmin = false; 27 | $scope.showUsers = false; 28 | $scope.showGroups = false; 29 | 30 | authService.getUserInfo().then(function(result) { 31 | $rootScope.username = result.display_name; 32 | $scope.username = $rootScope.username; 33 | if (result.role.toLowerCase() !== 'admin') { 34 | var myEl = angular.element(document.querySelector('#adminMenu')); 35 | myEl.empty(); 36 | } else { 37 | $scope.showadmin = true; 38 | $scope.showUsers = true; 39 | $scope.showGroups = !FEDERATED_LOGIN; 40 | } 41 | }, function(msg) { 42 | console.log('Unable to retrieve the user session.'); 43 | $state.go('signin', {}); 44 | }); 45 | 46 | $scope.$watch(function() { 47 | return cartFactory.cartCount; 48 | }, function(NewValue, OldValue) { 49 | $scope.cartCount = NewValue; 50 | if ($scope.$$phase != '$digest') { 51 | $scope.$apply(); 52 | } 53 | }); 54 | 55 | cartFactory.getCartCount(function(err, count) { 56 | if (err) { 57 | console.log('error', err); 58 | return; 59 | } 60 | }); 61 | 62 | $scope.getMenuClass = function(path) { 63 | return ($location.path().substr(0, path.length) === path) ? 'active' : ''; 64 | }; 65 | 66 | $scope.signout = function() { 67 | if (authService.signOut()) { 68 | $state.go('signin', {}); 69 | } 70 | }; 71 | 72 | }); 73 | -------------------------------------------------------------------------------- /source/resources/helper/lib/dynamodb-helper.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | let moment = require('moment'); 21 | let AWS = require('aws-sdk'); 22 | 23 | let creds = new AWS.EnvironmentCredentials('AWS'); // Lambda provided credentials 24 | const dynamoConfig = { 25 | credentials: creds, 26 | region: process.env.AWS_REGION 27 | }; 28 | const docClient = new AWS.DynamoDB.DocumentClient(dynamoConfig); 29 | const ddbTable = 'data-lake-settings'; 30 | 31 | /** 32 | * Helper function to interact with dynamodb for data lake cfn custom resource. 33 | * 34 | * @class dynamoDBHelper 35 | */ 36 | let dynamoDBHelper = (function() { 37 | 38 | /** 39 | * @class dynamoDBHelper 40 | * @constructor 41 | */ 42 | let dynamoDBHelper = function() {}; 43 | 44 | /** 45 | * Saves the app configuration settings for the data lake at deployment. 46 | * @param {string} settings - Settings to save in data-lake-settings. 47 | * @param {saveAppConfigSettings~requestCallback} cb - The callback that handles the response. 48 | */ 49 | dynamoDBHelper.prototype.saveDataLakeConfigSettings = function(appConfig, cb) { 50 | let _setting = { 51 | setting_id: 'app-config', 52 | type: 'config', 53 | created_at: moment.utc().format(), 54 | updated_at: moment.utc().format(), 55 | setting: appConfig 56 | }; 57 | 58 | let params = { 59 | TableName: ddbTable, 60 | Item: _setting 61 | }; 62 | 63 | docClient.put(params, function(err, data) { 64 | if (err) { 65 | return cb(err, null); 66 | } 67 | 68 | return cb(null, _setting); 69 | }); 70 | }; 71 | 72 | return dynamoDBHelper; 73 | 74 | })(); 75 | 76 | module.exports = dynamoDBHelper; 77 | -------------------------------------------------------------------------------- /source/cli/datalake-import-package-manifest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | let program = require('commander'); 4 | let Creds = require('./core/credentials.js'); 5 | let ApiProxy = require('./core/apiproxy.js'); 6 | const path = require('path'); 7 | const fs = require('fs'); 8 | const https = require('https'); 9 | const request = require('request'); 10 | 11 | program 12 | .option('--package-id ', 'package identifier') 13 | .option('--file ', 'path to manifest file') 14 | .parse(process.argv); 15 | 16 | if (!program.packageId) { 17 | console.error('option "--package-id " argument required'); 18 | process.exit(1); 19 | } 20 | 21 | if (!program.file) { 22 | console.error('option "--file " argument required'); 23 | process.exit(1); 24 | } 25 | 26 | let _stats = fs.lstat(program.file, function(err, stats) { 27 | if (err) { 28 | console.error('error accessing provided --file argument'); 29 | process.exit(1); 30 | } 31 | 32 | //get the signed api credentials 33 | let _creds = new Creds(); 34 | let _authKey = _creds.getAuthSignature(); 35 | 36 | // send api request 37 | let _apiproxy = new ApiProxy(); 38 | let _basename = path.basename(program.file); 39 | 40 | let _payload = JSON.stringify({ 41 | name: _basename, 42 | type: 'manifest', 43 | content_type: 'application/json' 44 | }); 45 | let _path = ['/prod/packages/', program.packageId, '/datasets/new'].join(''); 46 | _apiproxy.sendApiRequest(_path, 'POST', _payload, _authKey, function(err, data) { 47 | if (err) { 48 | console.log(err); 49 | process.exit(1); 50 | } 51 | 52 | let _stream = fs.createReadStream(program.file); 53 | 54 | var options = { 55 | url: data.uploadUrl, 56 | headers: { 57 | 'Content-Type': 'application/json', 58 | 'Content-Length': stats.size 59 | } 60 | }; 61 | 62 | fs.createReadStream(program.file).pipe(request.put(options).on('response', function(response) { 63 | if (response.statusCode !== 200) { 64 | console.log('The manifest entry was created, but the file failed to upload.'); 65 | process.exit(1); 66 | } 67 | 68 | let _processPath = ['/prod/packages/', program.packageId, '/datasets/', data.dataset_id, 69 | '/process' 70 | ].join(''); 71 | _apiproxy.sendApiRequest(_processPath, 'POST', '{}', _authKey, function(err, 72 | resp) { 73 | if (err) { 74 | console.log(err); 75 | process.exit(1); 76 | } 77 | 78 | let _datasetPath = ['/prod/packages/', program.packageId, '/datasets/', 79 | data.dataset_id 80 | ].join(''); 81 | _apiproxy.sendApiRequest(_datasetPath, 'GET', null, _authKey, function( 82 | err, dataset) { 83 | if (err) { 84 | console.log(err); 85 | process.exit(1); 86 | } 87 | 88 | console.log(JSON.stringify(dataset)); 89 | }); 90 | 91 | }); 92 | })); 93 | }); 94 | }); 95 | -------------------------------------------------------------------------------- /source/console/app/cart/cart_test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | describe('dataLake.cart spec', function() { 4 | 5 | var cartCtrl; 6 | var $scope; 7 | var $state; 8 | var $blockUI; 9 | 10 | beforeEach(module('ui.router')); 11 | beforeEach(module('dataLake.utils')); 12 | beforeEach(module('dataLake.cart')); 13 | 14 | beforeEach(inject(function($controller, $rootScope, $_, _$state_, cartFactory) { 15 | $scope = $rootScope.$new(); //get a childscope 16 | 17 | $state = _$state_; 18 | spyOn($state, 'go'); 19 | 20 | var cartItems = [{ 21 | item_id: 1, 22 | name: 'test package', 23 | description: 'description for test item', 24 | cart_item_status: 'pending' 25 | }, { 26 | item_id: 2, 27 | name: 'generated package', 28 | description: 'description for generated item', 29 | cart_item_status: 'generated' 30 | }]; 31 | 32 | spyOn(cartFactory, 'listCart').and.callFake(function(cb) { 33 | cb(null, cartItems);
 34 | }); 35 | 36 | spyOn(cartFactory, 'getCartCount').and.callFake(function(cb) { 37 | cb(null, cartItems.length);
 38 | }); 39 | 40 | spyOn(cartFactory, 'deleteCartItem').and.callFake(function(itemid, cb) { 41 | cartItems.splice(0, 1); 42 | cb(null, {}); 43 | }); 44 | 45 | spyOn(cartFactory, 'checkoutCart').and.callFake(function(type, cb) { 46 | cartItems[0].cart_item_status = 'generated'; 47 | cb(null, 'manifest file generation initiated'); 48 | }); 49 | 50 | $blockUI = { 51 | start: function() {}, 52 | stop: function() {} 53 | }; 54 | 55 | cartCtrl = $controller('CartCtrl', { 56 | $scope: $scope, 57 | $state: $state, 58 | $blockUI: $blockUI, 59 | $_: $_, 60 | cartFactory: cartFactory 61 | }); //Pass it as argument as $scope's value 62 | })); 63 | 64 | describe('cart controller', function() { 65 | 66 | it('should be created', function() { 67 | //spec body 68 | expect(cartCtrl).toBeDefined(); 69 | $scope.$apply(); 70 | expect($scope.cart.length).toEqual(1); 71 | expect($scope.manifests.length).toEqual(1); 72 | }); 73 | 74 | it('should remove an item when deleting cart item succeeds', function() { 75 | $scope.removeCartItem(1); 76 | $scope.$apply(); 77 | expect($scope.cart.length).toEqual(0); 78 | expect($scope.manifests.length).toEqual(1); 79 | }); 80 | 81 | it('should show manifest options when checking out succeeds', function() { 82 | $scope.checkout(); 83 | $scope.$apply(); 84 | expect($scope.showCheckoutModal).toEqual(true); 85 | }); 86 | 87 | it('should initiate manifest creation after selecting check out options', function() { 88 | $scope.generateManifest('bucket-key'); 89 | $scope.$apply(); 90 | expect($scope.showCheckoutModal).toEqual(false); 91 | expect($scope.cart.length).toEqual(0); 92 | expect($scope.manifests.length).toEqual(2); 93 | }); 94 | 95 | }); 96 | }); 97 | -------------------------------------------------------------------------------- /source/console/app/admin/users/invitation.js: -------------------------------------------------------------------------------- 1 | /********************************************************************************************************************* 2 | * Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. * 3 | * * 4 | * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance * 5 | * with the License. A copy of the License is located at * 6 | * * 7 | * http://www.apache.org/licenses/LICENSE-2.0 * 8 | * * 9 | * or in the 'license' file accompanying this file. This file is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES * 10 | * OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions * 11 | * and limitations under the License. * 12 | *********************************************************************************************************************/ 13 | 14 | /** 15 | * @author Solution Builders 16 | */ 17 | 18 | 'use strict'; 19 | 20 | angular.module('dataLake.admin.invitation', ['dataLake.main', 'dataLake.utils', 'dataLake.factory.admin']) 21 | 22 | .config(['$stateProvider', '$urlRouterProvider', function($stateProvider, 23 | $urlRouterProvider) { 24 | $stateProvider.state('admin_invitation', { 25 | url: '/admin/invite', 26 | views: { 27 | '': { 28 | templateUrl: 'main/main.html', 29 | controller: 'MainCtrl' 30 | }, 31 | '@admin_invitation': { 32 | templateUrl: 'admin/users/invitation.html', 33 | controller: 'AdminInvitationCtrl' 34 | } 35 | }, 36 | adminAuthenticate: true, 37 | activeWithFederation: false 38 | }); 39 | }]) 40 | 41 | .controller('AdminInvitationCtrl', function($scope, $state, $stateParams, $blockUI, adminInvitationFactory) { 42 | 43 | $scope.showCreateError = false; 44 | $scope.roles = [{ 45 | value: 'Member', 46 | text: 'Member' 47 | }, { 48 | value: 'Admin', 49 | text: 'Admin' 50 | }]; 51 | $scope.newinvite = { 52 | role: 'Member' 53 | }; 54 | 55 | var _token = ''; 56 | 57 | $scope.createInvitation = function(newinvite, isValid) { 58 | $blockUI.start(); 59 | if (isValid) { 60 | adminInvitationFactory.createInvitation(newinvite, function(err, 61 | data) { 62 | if (err) { 63 | console.log('error', err); 64 | $scope.showCreateError = true; 65 | $blockUI.stop(); 66 | return; 67 | } 68 | 69 | $state.go('admin_users', {}); 70 | }); 71 | } else { 72 | $scope.showCreateError = true; 73 | $blockUI.stop(); 74 | } 75 | }; 76 | 77 | }); 78 | -------------------------------------------------------------------------------- /source/cli/datalake.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | 'use strict'; 4 | 5 | const program = require('commander'); 6 | 7 | program 8 | .version('%%VERSION%%') 9 | .command('add-cart-item [parameters]', 'adds a package to the user\'s cart') 10 | .command('checkout-cart [parameters]', 'checks out a user\'s cart to generate manifest files for pending cart items') 11 | .command('create-group [parameters]', 'Creates a new group in the data lake Amazon Cognito user pool.') 12 | .command('create-package [parameters]', 'creates a new data lake package') 13 | .command('create-package-metadata [parameters]', 'creates a new data lake package') 14 | .command('delete-group [parameters]', 'Deletes the specified group from the data lake Amazon Cognito user pool. Currently only groups with no members can be deleted.') 15 | .command('describe-cart [parameters]', 'describes a user\'s cart') 16 | .command('describe-cart-item [parameters]', 'describes a item in the user\'s cart') 17 | .command('describe-package [parameters]', 'describes the details of a package') 18 | .command('describe-package-dataset [parameters]', 'describes a dataset associated to a package') 19 | .command('describe-package-datasets [parameters]', 'describes the datasets associated with a package') 20 | .command('describe-package-metadata [parameters]', 'describes the metadata associated with a package') 21 | .command('describe-required-metadata', 'list the required metadata for packages') 22 | .command('execute-package-crawler [parameters]', 'Starts a crawler for the specified package, regardless of what is scheduled. If the crawler is already running, the request is ignored.') 23 | .command('get-group [parameters]', 'Retrieves a group from the data lake Amazon Cognito user pool.') 24 | .command('get-package-crawler [parameters]', 'Retrieves crawler metadata for a specified package.') 25 | .command('get-package-table-data [parameters]', 'Retrieves the external link to view table data in Amazon Athena.') 26 | .command('get-user-group-list [parameters]', 'Lists the groups that the user belongs to.') 27 | .command('import-package-manifest [parameters]', 'uploads a new import manifest file for a package') 28 | .command('list-groups [parameters]', 'Retrieves data lake groups from Amazon Cognito group pool.') 29 | .command('list-package-tables [parameters]', 'Retrieves the definitions of some or all of the tables in a given package.') 30 | .command('remove-cart-item [parameters]', 'removes a package from the user\'s cart') 31 | .command('remove-package [parameters]', 'removes a package from the data lake') 32 | .command('remove-package-dataset [parameters]', 'removes a dataset from a package') 33 | .command('remove-user-from-group [parameters]', 'Remove the specified user from the specified group.') 34 | .command('search [parameters]', 'search data lake') 35 | .command('update-group [parameters]', 'Updates the specified group with the specified attributes.') 36 | .command('update-package [parameters]', 'overwrites the details for a package') 37 | .command('update-package-crawler [parameters]', 'Update the package crawler. If the package does not have one, a new crawler is created.') 38 | .command('update-user-group-list [parameters]', 'Updates the list of groups that the user belongs to.') 39 | .command('upload-package-dataset [parameters]', 'uploads a new dataset file for a package'); 40 | 41 | program.parse(process.argv); -------------------------------------------------------------------------------- /source/console/app/profile/profile.html: -------------------------------------------------------------------------------- 1 |

2 | {{user.display_name}} 3 | 4 |

5 |
6 |

General Information

7 | 8 | {{awsUiAlert.header}} 9 | {{awsUiAlert.content}} 10 | 11 |
12 |

Your Data Lake user account information. Please contact your administrator for further information.

13 | 14 | {{user.username}} 15 | 16 | 17 | {{user.display_name}} 18 | 19 | 20 | {{user.email}} 21 | 22 | 23 | {{user.role}} 24 | 25 | 26 | 27 | 28 |

API Access

29 |
30 |

You have not been granted access to the Data Lake API. Please contact your administrator to request access.

31 |
32 |
33 |

Your Data Lake API credentials are listed below. Please contact your administrator for further information.

34 | 35 | {{profile.hostname}} 36 | 37 | 38 | {{user.accesskey}} 39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 | 47 | 48 |

Your secret access key has been created successfully.

49 |

50 |

You can recreate this secret access key any time.

51 |

{{secret.key}}

52 |
53 | 54 | 55 | 56 |
57 | -------------------------------------------------------------------------------- /source/console/app/dashboard/dashboard.html: -------------------------------------------------------------------------------- 1 | 2 |

Dashboard

3 |
4 |
5 |
Packages
6 |
7 |
Visible: {{accessiblePackages}}
8 |
Owned: {{ownedPackages}}
9 |
10 |
11 |
Getting Started
12 |
13 | Read our documentation to learn more about AWS Data Lake. 14 |
15 |
16 |
Feedback
17 |
18 | Tell us what you think about the AWS Data Lake. 19 |
20 |
21 |
22 |

Search the data lake to discover and access data relevant to your business needs. Begin by entering a search term browse the available datasets.

23 |
24 | 25 |
26 |
27 |
28 | 29 |
30 |
31 | 32 |
33 |
34 |
35 |
36 | 37 | 38 | 39 |
40 |

The data lake solution helps you easily tag, search, share, and govern datasets across your organization or with other external organizations.

41 | 42 |
43 |
44 |

The data lake solution is built on the secure, durable, highly-scalable Amazon Simple Storage Service (Amazon S3).

45 | 46 |
47 |
48 |

Upload datasets directly, link existing datasets in Amazon S3 and even link data in other AWS accounts.

49 | 50 |
51 |
52 |

Search across the data lake solution, find data sets of interest and create manifest files to explore the value of the data for your needs.

53 | 54 |
55 |
56 | 57 | 58 | 59 |
60 | --------------------------------------------------------------------------------