Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setUp(callback) {
/* eslint-disable global-require */
cloudUtilMock = require('@f5devcentral/f5-cloud-libs').util;
computeMock = require('@google-cloud/compute');
fsMock = require('fs');
CloudProvider = require('@f5devcentral/f5-cloud-libs').cloudProvider;
GceCloudProvider = require('../../lib/gceCloudProvider');
/* eslint-enable global-require */
provider = new GceCloudProvider();
provider.compute = {};
cloudUtilMock.getDataFromUrl = function getDataFromUrl(url) {
if (url.endsWith('instance/zone')) {
return q(`projects/734288666861/zones/${region}-a`);
} else if (url.endsWith('instance/name')) {
return q(instanceId);
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const assert = require('assert');
const sinon = require('sinon');
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const DeprovisionHandler = require('../../../../src/lib/deprovisionHandler');
describe('deprovisionHandler', () => {
let provisioningSent;
const bigIpMock = {
onboard: {
provision(provisioning) {
provisioningSent = provisioning;
return Promise.resolve([{}]);
}
}
};
beforeEach(() => {
provisioningSent = [];
'use strict';
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
const assert = chai.assert;
const dns = require('dns');
const netMock = require('net');
const sinon = require('sinon');
const BigIpMock = require('@f5devcentral/f5-cloud-libs').bigIp;
const httpUtilMock = require('@f5devcentral/f5-cloud-libs').httpUtil;
const cloudUtilMock = require('@f5devcentral/f5-cloud-libs').util;
const doUtil = require('../../../../src/lib/doUtil');
describe('doUtil', () => {
const port = '1234';
const socket = {
connectCalls: 0,
numConnectsToFail: 0,
on(event, cb) {
if (event === 'connect') {
this.connectCalls += 1;
if (this.connectCalls > this.numConnectsToFail) {
cb();
}
}
if (event === 'error') {
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const assert = require('assert');
const sinon = require('sinon');
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const ProvisionHandler = require('../../../../src/lib/provisionHandler');
describe('provisionHandler', () => {
let provisioningSent;
const bigIpMock = {
onboard: {
provision(provisioning) {
provisioningSent = provisioning;
return Promise.resolve([{}]);
}
}
};
beforeEach(() => {
provisioningSent = [];
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const childProcess = require('child_process');
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const doUtil = require('./doUtil');
const Logger = require('./logger');
const logger = new Logger(module);
const ENCRYPT_PATH = '/tm/auth/radius-server';
/**
* @module
*
* Utility functions to encrypt and decrypt values.
*
* While encryption can be run remotely, decryption only works when running on a BIG-IP.
*/
module.exports = {
/**
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const fs = require('fs');
const EventEmitter = require('events');
const httpUtil = require('@f5devcentral/f5-cloud-libs').httpUtil;
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const PRODUCTS = require('@f5devcentral/f5-cloud-libs').sharedConstants.PRODUCTS;
const doUtil = require('../lib/doUtil');
const cryptoUtil = require('../lib/cryptoUtil');
const ConfigManager = require('../lib/configManager');
const DeclarationHandler = require('../lib/declarationHandler');
const Logger = require('../lib/logger');
const Response = require('../lib/response');
const ConfigResponse = require('../lib/configResponse');
const InfoResponse = require('../lib/infoResponse');
const InspectResponse = require('../lib/inspectResponse');
const TaskResponse = require('../lib/taskResponse');
const State = require('../lib/state');
const SshUtil = require('../lib/sshUtil');
const Validator = require('../lib/validator');
const STATUS = require('../lib/sharedConstants').STATUS;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const PRODUCTS = require('@f5devcentral/f5-cloud-libs').sharedConstants.PRODUCTS;
const doUtil = require('./doUtil');
const Logger = require('./logger');
const PATHS = require('./sharedConstants').PATHS;
const EVENTS = require('./sharedConstants').EVENTS;
const logger = new Logger(module);
/**
* Handles system parts of a declaration.
*
* @class
*/
class SystemHandler {
/**
* Constructor
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const Logger = require('./logger');
const logger = new Logger(module);
/**
* Handles provisioning parts of a declaration.
*
* @class
*/
class ProvisionHandler {
/**
* Constructor
*
* @param {Object} declaration - Parsed declaration.
* @param {Object} bigIp - BigIp object.
* @param {EventEmitter} - DO event emitter.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const net = require('net');
const exec = require('child_process').exec;
const dns = require('dns');
const BigIp = require('@f5devcentral/f5-cloud-libs').bigIp;
const httpUtil = require('@f5devcentral/f5-cloud-libs').httpUtil;
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const PRODUCTS = require('@f5devcentral/f5-cloud-libs').sharedConstants.PRODUCTS;
const Logger = require('./logger');
const ipF5 = require('../schema/latest/formats').f5ip;
const logger = new Logger(module);
/**
* @module
*/
module.exports = {
/**
* The @f5devcentral/f5-cloud-libs/BigIp object
* @external BigIp
*/
/**
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const cloudUtil = require('@f5devcentral/f5-cloud-libs').util;
const Logger = require('./logger');
const PATHS = require('./sharedConstants').PATHS;
const logger = new Logger(module);
/**
* Handles deleting objects.
*
* @class
*/
class DeleteHandler {
/**
* Constructor
*
* @param {Object} declaration - Parsed declaration of objects to delete.
* @param {Object} bigIp - BigIp object.