@itentialopensource/adapter-gcp_compute 0.2.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -1
- package/README.md +85 -12
- package/adapter.js +11822 -9796
- package/adapterBase.js +40 -3
- package/entities/.generic/action.json +5 -5
- package/entities/.system/action.json +1 -1
- package/entities/AcceleratorTypes/action.json +3 -3
- package/entities/Addresses/action.json +5 -5
- package/entities/Autoscalers/action.json +7 -7
- package/entities/BackendBuckets/action.json +8 -8
- package/entities/BackendServices/action.json +11 -11
- package/entities/DiskTypes/action.json +3 -3
- package/entities/Disks/action.json +13 -13
- package/entities/ExternalVpnGateways/action.json +6 -6
- package/entities/FirewallPolicies/action.json +382 -0
- package/entities/FirewallPolicies/mockdatafiles/addFirewallPolicyAssociation-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/addFirewallPolicyRule-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/cloneFirewallPolicyRule-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/deleteFirewallPolicy-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicy-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyAssociation-default.json +7 -0
- package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyIamPolicy-default.json +26 -0
- package/entities/FirewallPolicies/mockdatafiles/getFirewallPolicyRule-default.json +32 -0
- package/entities/FirewallPolicies/mockdatafiles/insertFirewallPolicy-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/listFirewallPolicy-default.json +75 -0
- package/entities/FirewallPolicies/mockdatafiles/listFirewallPolicyAssociations-default.json +12 -0
- package/entities/FirewallPolicies/mockdatafiles/moveFirewallPolicy-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/patchFirewallPolicy-default.json +57 -0
- package/entities/FirewallPolicies/mockdatafiles/patchFirewallPolicyRule-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/removeFirewallPolicyAssociation-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/removeFirewallPolicyRule-default.json +45 -0
- package/entities/FirewallPolicies/mockdatafiles/setFirewallPolicyIamPolicy-default.json +26 -0
- package/entities/FirewallPolicies/mockdatafiles/testFirewallPolicyIamPermissions-default.json +6 -0
- package/entities/FirewallPolicies/schema.json +47 -0
- package/entities/Firewalls/action.json +6 -6
- package/entities/ForwardingRules/action.json +7 -7
- package/entities/GlobalAddresses/action.json +4 -4
- package/entities/GlobalForwardingRules/action.json +6 -6
- package/entities/GlobalNetworkEndpointGroups/action.json +7 -7
- package/entities/GlobalOperations/action.json +5 -5
- package/entities/HealthChecks/action.json +7 -7
- package/entities/HttpHealthChecks/action.json +6 -6
- package/entities/HttpsHealthChecks/action.json +6 -6
- package/entities/Images/action.json +10 -10
- package/entities/InstanceGroupManagers/action.json +20 -20
- package/entities/InstanceGroups/action.json +9 -9
- package/entities/InstanceTemplates/action.json +7 -7
- package/entities/Instances/action.json +40 -40
- package/entities/InterconnectAttachments/action.json +6 -6
- package/entities/InterconnectLocations/action.json +2 -2
- package/entities/Interconnects/action.json +6 -6
- package/entities/LicenseCodes/action.json +2 -2
- package/entities/Licenses/action.json +7 -7
- package/entities/MachineTypes/action.json +3 -3
- package/entities/NetworkEndpointGroups/action.json +9 -9
- package/entities/Networks/action.json +10 -10
- package/entities/NodeGroups/action.json +13 -13
- package/entities/NodeTemplates/action.json +8 -8
- package/entities/NodeTypes/action.json +3 -3
- package/entities/PacketMirrorings/action.json +7 -7
- package/entities/Projects/action.json +13 -13
- package/entities/RegionAutoscalers/action.json +6 -6
- package/entities/RegionBackendServices/action.json +7 -7
- package/entities/RegionCommitments/action.json +4 -4
- package/entities/RegionDiskTypes/action.json +2 -2
- package/entities/RegionDisks/action.json +12 -12
- package/entities/RegionHealthCheckServices/action.json +5 -5
- package/entities/RegionHealthChecks/action.json +6 -6
- package/entities/RegionInstanceGroupManagers/action.json +19 -19
- package/entities/RegionInstanceGroups/action.json +4 -4
- package/entities/RegionNetworkEndpointGroups/action.json +4 -4
- package/entities/RegionNotificationEndpoints/action.json +4 -4
- package/entities/RegionOperations/action.json +4 -4
- package/entities/RegionSslCertificates/action.json +4 -4
- package/entities/RegionTargetHttpProxies/action.json +5 -5
- package/entities/RegionTargetHttpsProxies/action.json +6 -6
- package/entities/RegionUrlMaps/action.json +7 -7
- package/entities/Regions/action.json +2 -2
- package/entities/Reservations/action.json +9 -9
- package/entities/ResourcePolicies/action.json +8 -8
- package/entities/Routers/action.json +10 -10
- package/entities/Routes/action.json +4 -4
- package/entities/SecurityPolicies/action.json +10 -10
- package/entities/Snapshots/action.json +7 -7
- package/entities/SslCertificates/action.json +5 -5
- package/entities/SslPolicies/action.json +6 -6
- package/entities/Subnetworks/action.json +12 -12
- package/entities/TargetGrpcProxies/action.json +5 -5
- package/entities/TargetHttpProxies/action.json +6 -6
- package/entities/TargetHttpsProxies/action.json +9 -9
- package/entities/TargetInstances/action.json +5 -5
- package/entities/TargetPools/action.json +11 -11
- package/entities/TargetSslProxies/action.json +8 -8
- package/entities/TargetTcpProxies/action.json +6 -6
- package/entities/TargetVpnGateways/action.json +5 -5
- package/entities/UrlMaps/action.json +9 -9
- package/entities/VpnGateways/action.json +8 -8
- package/entities/VpnTunnels/action.json +5 -5
- package/entities/ZoneOperations/action.json +4 -4
- package/entities/Zones/action.json +2 -2
- package/error.json +6 -0
- package/package.json +19 -18
- package/pronghorn.json +11625 -10511
- package/propertiesSchema.json +65 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1615068706854.json +95 -0
- package/report/updateReport1642776932883.json +95 -0
- package/sampleProperties.json +7 -3
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +463 -4
- package/test/unit/adapterBaseTestUnit.js +14 -6
- package/test/unit/adapterTestUnit.js +1122 -6
- package/utils/addAuth.js +94 -0
- package/utils/basicGet.js +1 -14
- package/utils/entitiesToDB.js +224 -0
- package/utils/modify.js +4 -4
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +14 -8
- package/utils/tbUtils.js +98 -19
- package/utils/troubleshootingAdapter.js +2 -26
- package/test/integration/adapterTestIntegration_me.js +0 -464
|
@@ -13,7 +13,10 @@ const winston = require('winston');
|
|
|
13
13
|
const { expect } = require('chai');
|
|
14
14
|
const { use } = require('chai');
|
|
15
15
|
const td = require('testdouble');
|
|
16
|
+
const util = require('util');
|
|
17
|
+
const pronghorn = require('../../pronghorn.json');
|
|
16
18
|
|
|
19
|
+
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
17
20
|
const anything = td.matchers.anything();
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
@@ -46,8 +49,8 @@ global.pronghornProps = {
|
|
|
46
49
|
properties: {
|
|
47
50
|
host,
|
|
48
51
|
port,
|
|
49
|
-
base_path: '/compute
|
|
50
|
-
version: '',
|
|
52
|
+
base_path: '/compute',
|
|
53
|
+
version: 'v1',
|
|
51
54
|
cache_location: 'none',
|
|
52
55
|
encode_pathvars: true,
|
|
53
56
|
save_metric: false,
|
|
@@ -64,6 +67,9 @@ global.pronghornProps = {
|
|
|
64
67
|
auth_field: 'header.headers.Authorization',
|
|
65
68
|
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
66
69
|
auth_logging: false,
|
|
70
|
+
client_id: '',
|
|
71
|
+
client_secret: '',
|
|
72
|
+
grant_type: '',
|
|
67
73
|
configureGtoken: {
|
|
68
74
|
email: '',
|
|
69
75
|
scope: 'https://www.googleapis.com/auth/cloud-platform',
|
|
@@ -76,7 +82,8 @@ global.pronghornProps = {
|
|
|
76
82
|
},
|
|
77
83
|
healthcheck: {
|
|
78
84
|
type: 'none',
|
|
79
|
-
frequency: 60000
|
|
85
|
+
frequency: 60000,
|
|
86
|
+
query_object: {}
|
|
80
87
|
},
|
|
81
88
|
throttle: {
|
|
82
89
|
throttle_enabled: false,
|
|
@@ -318,7 +325,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
// require the adapter that we are going to be using
|
|
321
|
-
const GcpCompute = require('../../adapter
|
|
328
|
+
const GcpCompute = require('../../adapter');
|
|
322
329
|
|
|
323
330
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
324
331
|
describe('[integration] GcpCompute Adapter Test', () => {
|
|
@@ -349,6 +356,8 @@ describe('[integration] GcpCompute Adapter Test', () => {
|
|
|
349
356
|
try {
|
|
350
357
|
assert.notEqual(null, a);
|
|
351
358
|
assert.notEqual(undefined, a);
|
|
359
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
360
|
+
assert.equal(checkId, a.id);
|
|
352
361
|
assert.notEqual(null, a.allProps);
|
|
353
362
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
354
363
|
assert.equal(check, a.healthcheckType);
|
|
@@ -30804,5 +30813,455 @@ describe('[integration] GcpCompute Adapter Test', () => {
|
|
|
30804
30813
|
}
|
|
30805
30814
|
}).timeout(attemptTimeout);
|
|
30806
30815
|
});
|
|
30816
|
+
|
|
30817
|
+
describe('#addFirewallPolicyAssociation - errors', () => {
|
|
30818
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30819
|
+
try {
|
|
30820
|
+
a.addFirewallPolicyAssociation('fakedata', { key: 'value' }, null, null, (data, error) => {
|
|
30821
|
+
try {
|
|
30822
|
+
if (stub) {
|
|
30823
|
+
runCommonAsserts(data, error);
|
|
30824
|
+
assert.equal('string', data.response.id);
|
|
30825
|
+
} else {
|
|
30826
|
+
runCommonAsserts(data, error);
|
|
30827
|
+
}
|
|
30828
|
+
saveMockData('FirewallPolicies', 'addFirewallPolicyAssociation', 'default', data);
|
|
30829
|
+
done();
|
|
30830
|
+
} catch (err) {
|
|
30831
|
+
log.error(`Test Failure: ${err}`);
|
|
30832
|
+
done(err);
|
|
30833
|
+
}
|
|
30834
|
+
});
|
|
30835
|
+
} catch (error) {
|
|
30836
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30837
|
+
done(error);
|
|
30838
|
+
}
|
|
30839
|
+
}).timeout(attemptTimeout);
|
|
30840
|
+
});
|
|
30841
|
+
|
|
30842
|
+
describe('#addFirewallPolicyRule - errors', () => {
|
|
30843
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30844
|
+
try {
|
|
30845
|
+
a.addFirewallPolicyRule('fakedata', { key: 'value' }, null, (data, error) => {
|
|
30846
|
+
try {
|
|
30847
|
+
if (stub) {
|
|
30848
|
+
runCommonAsserts(data, error);
|
|
30849
|
+
assert.equal('string', data.response.id);
|
|
30850
|
+
} else {
|
|
30851
|
+
runCommonAsserts(data, error);
|
|
30852
|
+
}
|
|
30853
|
+
saveMockData('FirewallPolicies', 'addFirewallPolicyRule', 'default', data);
|
|
30854
|
+
done();
|
|
30855
|
+
} catch (err) {
|
|
30856
|
+
log.error(`Test Failure: ${err}`);
|
|
30857
|
+
done(err);
|
|
30858
|
+
}
|
|
30859
|
+
});
|
|
30860
|
+
} catch (error) {
|
|
30861
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30862
|
+
done(error);
|
|
30863
|
+
}
|
|
30864
|
+
}).timeout(attemptTimeout);
|
|
30865
|
+
});
|
|
30866
|
+
|
|
30867
|
+
describe('#cloneFirewallPolicyRule - errors', () => {
|
|
30868
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30869
|
+
try {
|
|
30870
|
+
a.cloneFirewallPolicyRule('fakedata', null, null, (data, error) => {
|
|
30871
|
+
try {
|
|
30872
|
+
if (stub) {
|
|
30873
|
+
runCommonAsserts(data, error);
|
|
30874
|
+
assert.equal('string', data.response.id);
|
|
30875
|
+
} else {
|
|
30876
|
+
runCommonAsserts(data, error);
|
|
30877
|
+
}
|
|
30878
|
+
saveMockData('FirewallPolicies', 'cloneFirewallPolicyRule', 'default', data);
|
|
30879
|
+
done();
|
|
30880
|
+
} catch (err) {
|
|
30881
|
+
log.error(`Test Failure: ${err}`);
|
|
30882
|
+
done(err);
|
|
30883
|
+
}
|
|
30884
|
+
});
|
|
30885
|
+
} catch (error) {
|
|
30886
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30887
|
+
done(error);
|
|
30888
|
+
}
|
|
30889
|
+
}).timeout(attemptTimeout);
|
|
30890
|
+
});
|
|
30891
|
+
|
|
30892
|
+
describe('#deleteFirewallPolicy - errors', () => {
|
|
30893
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30894
|
+
try {
|
|
30895
|
+
a.deleteFirewallPolicy('fakedata', null, (data, error) => {
|
|
30896
|
+
try {
|
|
30897
|
+
if (stub) {
|
|
30898
|
+
runCommonAsserts(data, error);
|
|
30899
|
+
assert.equal('string', data.response.id);
|
|
30900
|
+
} else {
|
|
30901
|
+
runCommonAsserts(data, error);
|
|
30902
|
+
}
|
|
30903
|
+
saveMockData('FirewallPolicies', 'deleteFirewallPolicy', 'default', data);
|
|
30904
|
+
done();
|
|
30905
|
+
} catch (err) {
|
|
30906
|
+
log.error(`Test Failure: ${err}`);
|
|
30907
|
+
done(err);
|
|
30908
|
+
}
|
|
30909
|
+
});
|
|
30910
|
+
} catch (error) {
|
|
30911
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30912
|
+
done(error);
|
|
30913
|
+
}
|
|
30914
|
+
}).timeout(attemptTimeout);
|
|
30915
|
+
});
|
|
30916
|
+
|
|
30917
|
+
describe('#getFirewallPolicy - errors', () => {
|
|
30918
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30919
|
+
try {
|
|
30920
|
+
a.getFirewallPolicy('fakedata', (data, error) => {
|
|
30921
|
+
try {
|
|
30922
|
+
if (stub) {
|
|
30923
|
+
runCommonAsserts(data, error);
|
|
30924
|
+
assert.equal('string', data.response.id);
|
|
30925
|
+
} else {
|
|
30926
|
+
runCommonAsserts(data, error);
|
|
30927
|
+
}
|
|
30928
|
+
saveMockData('FirewallPolicies', 'getFirewallPolicy', 'default', data);
|
|
30929
|
+
done();
|
|
30930
|
+
} catch (err) {
|
|
30931
|
+
log.error(`Test Failure: ${err}`);
|
|
30932
|
+
done(err);
|
|
30933
|
+
}
|
|
30934
|
+
});
|
|
30935
|
+
} catch (error) {
|
|
30936
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30937
|
+
done(error);
|
|
30938
|
+
}
|
|
30939
|
+
}).timeout(attemptTimeout);
|
|
30940
|
+
});
|
|
30941
|
+
|
|
30942
|
+
describe('#getFirewallPolicyAssociation - errors', () => {
|
|
30943
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30944
|
+
try {
|
|
30945
|
+
a.getFirewallPolicyAssociation('fakedata', null, (data, error) => {
|
|
30946
|
+
try {
|
|
30947
|
+
if (stub) {
|
|
30948
|
+
runCommonAsserts(data, error);
|
|
30949
|
+
assert.equal('string', data.response.name);
|
|
30950
|
+
} else {
|
|
30951
|
+
runCommonAsserts(data, error);
|
|
30952
|
+
}
|
|
30953
|
+
saveMockData('FirewallPolicies', 'getFirewallPolicyAssociation', 'default', data);
|
|
30954
|
+
done();
|
|
30955
|
+
} catch (err) {
|
|
30956
|
+
log.error(`Test Failure: ${err}`);
|
|
30957
|
+
done(err);
|
|
30958
|
+
}
|
|
30959
|
+
});
|
|
30960
|
+
} catch (error) {
|
|
30961
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30962
|
+
done(error);
|
|
30963
|
+
}
|
|
30964
|
+
}).timeout(attemptTimeout);
|
|
30965
|
+
});
|
|
30966
|
+
|
|
30967
|
+
describe('#getFirewallPolicyIamPolicy - errors', () => {
|
|
30968
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30969
|
+
try {
|
|
30970
|
+
a.getFirewallPolicyIamPolicy('fakedata', null, (data, error) => {
|
|
30971
|
+
try {
|
|
30972
|
+
if (stub) {
|
|
30973
|
+
runCommonAsserts(data, error);
|
|
30974
|
+
assert.equal('BwWWja0YfJA=', data.response.etag);
|
|
30975
|
+
} else {
|
|
30976
|
+
runCommonAsserts(data, error);
|
|
30977
|
+
}
|
|
30978
|
+
saveMockData('FirewallPolicies', 'getFirewallPolicyIamPolicy', 'default', data);
|
|
30979
|
+
done();
|
|
30980
|
+
} catch (err) {
|
|
30981
|
+
log.error(`Test Failure: ${err}`);
|
|
30982
|
+
done(err);
|
|
30983
|
+
}
|
|
30984
|
+
});
|
|
30985
|
+
} catch (error) {
|
|
30986
|
+
log.error(`Adapter Exception: ${error}`);
|
|
30987
|
+
done(error);
|
|
30988
|
+
}
|
|
30989
|
+
}).timeout(attemptTimeout);
|
|
30990
|
+
});
|
|
30991
|
+
|
|
30992
|
+
describe('#getFirewallPolicyRule - errors', () => {
|
|
30993
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
30994
|
+
try {
|
|
30995
|
+
a.getFirewallPolicyRule('fakedata', null, (data, error) => {
|
|
30996
|
+
try {
|
|
30997
|
+
if (stub) {
|
|
30998
|
+
runCommonAsserts(data, error);
|
|
30999
|
+
assert.equal('string', data.response.description);
|
|
31000
|
+
} else {
|
|
31001
|
+
runCommonAsserts(data, error);
|
|
31002
|
+
}
|
|
31003
|
+
saveMockData('FirewallPolicies', 'getFirewallPolicyRule', 'default', data);
|
|
31004
|
+
done();
|
|
31005
|
+
} catch (err) {
|
|
31006
|
+
log.error(`Test Failure: ${err}`);
|
|
31007
|
+
done(err);
|
|
31008
|
+
}
|
|
31009
|
+
});
|
|
31010
|
+
} catch (error) {
|
|
31011
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31012
|
+
done(error);
|
|
31013
|
+
}
|
|
31014
|
+
}).timeout(attemptTimeout);
|
|
31015
|
+
});
|
|
31016
|
+
|
|
31017
|
+
describe('#insertFirewallPolicy - errors', () => {
|
|
31018
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31019
|
+
try {
|
|
31020
|
+
a.insertFirewallPolicy({ key: 'fakedata' }, null, null, (data, error) => {
|
|
31021
|
+
try {
|
|
31022
|
+
if (stub) {
|
|
31023
|
+
runCommonAsserts(data, error);
|
|
31024
|
+
assert.equal('string', data.response.id);
|
|
31025
|
+
} else {
|
|
31026
|
+
runCommonAsserts(data, error);
|
|
31027
|
+
}
|
|
31028
|
+
saveMockData('FirewallPolicies', 'insertFirewallPolicy', 'default', data);
|
|
31029
|
+
done();
|
|
31030
|
+
} catch (err) {
|
|
31031
|
+
log.error(`Test Failure: ${err}`);
|
|
31032
|
+
done(err);
|
|
31033
|
+
}
|
|
31034
|
+
});
|
|
31035
|
+
} catch (error) {
|
|
31036
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31037
|
+
done(error);
|
|
31038
|
+
}
|
|
31039
|
+
}).timeout(attemptTimeout);
|
|
31040
|
+
});
|
|
31041
|
+
|
|
31042
|
+
describe('#listFirewallPolicy - errors', () => {
|
|
31043
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31044
|
+
try {
|
|
31045
|
+
a.listFirewallPolicy(null, null, null, null, null, null, (data, error) => {
|
|
31046
|
+
try {
|
|
31047
|
+
if (stub) {
|
|
31048
|
+
runCommonAsserts(data, error);
|
|
31049
|
+
assert.equal('string', data.response.id);
|
|
31050
|
+
} else {
|
|
31051
|
+
runCommonAsserts(data, error);
|
|
31052
|
+
}
|
|
31053
|
+
saveMockData('FirewallPolicies', 'listFirewallPolicy', 'default', data);
|
|
31054
|
+
done();
|
|
31055
|
+
} catch (err) {
|
|
31056
|
+
log.error(`Test Failure: ${err}`);
|
|
31057
|
+
done(err);
|
|
31058
|
+
}
|
|
31059
|
+
});
|
|
31060
|
+
} catch (error) {
|
|
31061
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31062
|
+
done(error);
|
|
31063
|
+
}
|
|
31064
|
+
}).timeout(attemptTimeout);
|
|
31065
|
+
});
|
|
31066
|
+
|
|
31067
|
+
describe('#listFirewallPolicyAssociations - errors', () => {
|
|
31068
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31069
|
+
try {
|
|
31070
|
+
a.listFirewallPolicyAssociations(null, (data, error) => {
|
|
31071
|
+
try {
|
|
31072
|
+
if (stub) {
|
|
31073
|
+
runCommonAsserts(data, error);
|
|
31074
|
+
assert.equal('string', data.response.kind);
|
|
31075
|
+
} else {
|
|
31076
|
+
runCommonAsserts(data, error);
|
|
31077
|
+
}
|
|
31078
|
+
saveMockData('FirewallPolicies', 'listFirewallPolicyAssociations', 'default', data);
|
|
31079
|
+
done();
|
|
31080
|
+
} catch (err) {
|
|
31081
|
+
log.error(`Test Failure: ${err}`);
|
|
31082
|
+
done(err);
|
|
31083
|
+
}
|
|
31084
|
+
});
|
|
31085
|
+
} catch (error) {
|
|
31086
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31087
|
+
done(error);
|
|
31088
|
+
}
|
|
31089
|
+
}).timeout(attemptTimeout);
|
|
31090
|
+
});
|
|
31091
|
+
|
|
31092
|
+
describe('#moveFirewallPolicy - errors', () => {
|
|
31093
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31094
|
+
try {
|
|
31095
|
+
a.moveFirewallPolicy('fakedata', null, null, (data, error) => {
|
|
31096
|
+
try {
|
|
31097
|
+
if (stub) {
|
|
31098
|
+
runCommonAsserts(data, error);
|
|
31099
|
+
assert.equal('string', data.response.kind);
|
|
31100
|
+
} else {
|
|
31101
|
+
runCommonAsserts(data, error);
|
|
31102
|
+
}
|
|
31103
|
+
saveMockData('FirewallPolicies', 'moveFirewallPolicy', 'default', data);
|
|
31104
|
+
done();
|
|
31105
|
+
} catch (err) {
|
|
31106
|
+
log.error(`Test Failure: ${err}`);
|
|
31107
|
+
done(err);
|
|
31108
|
+
}
|
|
31109
|
+
});
|
|
31110
|
+
} catch (error) {
|
|
31111
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31112
|
+
done(error);
|
|
31113
|
+
}
|
|
31114
|
+
}).timeout(attemptTimeout);
|
|
31115
|
+
});
|
|
31116
|
+
|
|
31117
|
+
describe('#patchFirewallPolicy - errors', () => {
|
|
31118
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31119
|
+
try {
|
|
31120
|
+
a.patchFirewallPolicy('fakedata', { key: 'fakedata' }, null, (data, error) => {
|
|
31121
|
+
try {
|
|
31122
|
+
if (stub) {
|
|
31123
|
+
runCommonAsserts(data, error);
|
|
31124
|
+
assert.equal('string', data.response.kind);
|
|
31125
|
+
} else {
|
|
31126
|
+
runCommonAsserts(data, error);
|
|
31127
|
+
}
|
|
31128
|
+
saveMockData('FirewallPolicies', 'patchFirewallPolicy', 'default', data);
|
|
31129
|
+
done();
|
|
31130
|
+
} catch (err) {
|
|
31131
|
+
log.error(`Test Failure: ${err}`);
|
|
31132
|
+
done(err);
|
|
31133
|
+
}
|
|
31134
|
+
});
|
|
31135
|
+
} catch (error) {
|
|
31136
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31137
|
+
done(error);
|
|
31138
|
+
}
|
|
31139
|
+
}).timeout(attemptTimeout);
|
|
31140
|
+
});
|
|
31141
|
+
|
|
31142
|
+
describe('#patchFirewallPolicyRule - errors', () => {
|
|
31143
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31144
|
+
try {
|
|
31145
|
+
a.patchFirewallPolicyRule('fakedata', { key: 'fakedata' }, null, null, (data, error) => {
|
|
31146
|
+
try {
|
|
31147
|
+
if (stub) {
|
|
31148
|
+
runCommonAsserts(data, error);
|
|
31149
|
+
assert.equal('string', data.response.kind);
|
|
31150
|
+
} else {
|
|
31151
|
+
runCommonAsserts(data, error);
|
|
31152
|
+
}
|
|
31153
|
+
saveMockData('FirewallPolicies', 'patchFirewallPolicyRule', 'default', data);
|
|
31154
|
+
done();
|
|
31155
|
+
} catch (err) {
|
|
31156
|
+
log.error(`Test Failure: ${err}`);
|
|
31157
|
+
done(err);
|
|
31158
|
+
}
|
|
31159
|
+
});
|
|
31160
|
+
} catch (error) {
|
|
31161
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31162
|
+
done(error);
|
|
31163
|
+
}
|
|
31164
|
+
}).timeout(attemptTimeout);
|
|
31165
|
+
});
|
|
31166
|
+
|
|
31167
|
+
describe('#removeFirewallPolicyAssociation - errors', () => {
|
|
31168
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31169
|
+
try {
|
|
31170
|
+
a.removeFirewallPolicyAssociation('fakedata', null, null, (data, error) => {
|
|
31171
|
+
try {
|
|
31172
|
+
if (stub) {
|
|
31173
|
+
runCommonAsserts(data, error);
|
|
31174
|
+
assert.equal('string', data.response.kind);
|
|
31175
|
+
} else {
|
|
31176
|
+
runCommonAsserts(data, error);
|
|
31177
|
+
}
|
|
31178
|
+
saveMockData('FirewallPolicies', 'removeFirewallPolicyAssociation', 'default', data);
|
|
31179
|
+
done();
|
|
31180
|
+
} catch (err) {
|
|
31181
|
+
log.error(`Test Failure: ${err}`);
|
|
31182
|
+
done(err);
|
|
31183
|
+
}
|
|
31184
|
+
});
|
|
31185
|
+
} catch (error) {
|
|
31186
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31187
|
+
done(error);
|
|
31188
|
+
}
|
|
31189
|
+
}).timeout(attemptTimeout);
|
|
31190
|
+
});
|
|
31191
|
+
|
|
31192
|
+
describe('#removeFirewallPolicyRule - errors', () => {
|
|
31193
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31194
|
+
try {
|
|
31195
|
+
a.removeFirewallPolicyRule('fakedata', null, null, (data, error) => {
|
|
31196
|
+
try {
|
|
31197
|
+
if (stub) {
|
|
31198
|
+
runCommonAsserts(data, error);
|
|
31199
|
+
assert.equal('string', data.response.kind);
|
|
31200
|
+
} else {
|
|
31201
|
+
runCommonAsserts(data, error);
|
|
31202
|
+
}
|
|
31203
|
+
saveMockData('FirewallPolicies', 'removeFirewallPolicyRule', 'default', data);
|
|
31204
|
+
done();
|
|
31205
|
+
} catch (err) {
|
|
31206
|
+
log.error(`Test Failure: ${err}`);
|
|
31207
|
+
done(err);
|
|
31208
|
+
}
|
|
31209
|
+
});
|
|
31210
|
+
} catch (error) {
|
|
31211
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31212
|
+
done(error);
|
|
31213
|
+
}
|
|
31214
|
+
}).timeout(attemptTimeout);
|
|
31215
|
+
});
|
|
31216
|
+
|
|
31217
|
+
describe('#setFirewallPolicyIamPolicy - errors', () => {
|
|
31218
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31219
|
+
try {
|
|
31220
|
+
a.setFirewallPolicyIamPolicy('fakedata', { key: 'fakedata' }, (data, error) => {
|
|
31221
|
+
try {
|
|
31222
|
+
if (stub) {
|
|
31223
|
+
runCommonAsserts(data, error);
|
|
31224
|
+
assert.equal('BwWWja0YfJA=', data.response.etag);
|
|
31225
|
+
} else {
|
|
31226
|
+
runCommonAsserts(data, error);
|
|
31227
|
+
}
|
|
31228
|
+
saveMockData('FirewallPolicies', 'setFirewallPolicyIamPolicy', 'default', data);
|
|
31229
|
+
done();
|
|
31230
|
+
} catch (err) {
|
|
31231
|
+
log.error(`Test Failure: ${err}`);
|
|
31232
|
+
done(err);
|
|
31233
|
+
}
|
|
31234
|
+
});
|
|
31235
|
+
} catch (error) {
|
|
31236
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31237
|
+
done(error);
|
|
31238
|
+
}
|
|
31239
|
+
}).timeout(attemptTimeout);
|
|
31240
|
+
});
|
|
31241
|
+
|
|
31242
|
+
describe('#testFirewallPolicyIamPermissions - errors', () => {
|
|
31243
|
+
it('should work if integrated or standalone with mockdata', (done) => {
|
|
31244
|
+
try {
|
|
31245
|
+
a.testFirewallPolicyIamPermissions('fakedata', { key: 'fakedata' }, (data, error) => {
|
|
31246
|
+
try {
|
|
31247
|
+
if (stub) {
|
|
31248
|
+
runCommonAsserts(data, error);
|
|
31249
|
+
assert.notEqual(null, data.response.permissions);
|
|
31250
|
+
} else {
|
|
31251
|
+
runCommonAsserts(data, error);
|
|
31252
|
+
}
|
|
31253
|
+
saveMockData('FirewallPolicies', 'testFirewallPolicyIamPermissions', 'default', data);
|
|
31254
|
+
done();
|
|
31255
|
+
} catch (err) {
|
|
31256
|
+
log.error(`Test Failure: ${err}`);
|
|
31257
|
+
done(err);
|
|
31258
|
+
}
|
|
31259
|
+
});
|
|
31260
|
+
} catch (error) {
|
|
31261
|
+
log.error(`Adapter Exception: ${error}`);
|
|
31262
|
+
done(error);
|
|
31263
|
+
}
|
|
31264
|
+
}).timeout(attemptTimeout);
|
|
31265
|
+
});
|
|
30807
31266
|
});
|
|
30808
31267
|
});
|
|
@@ -60,11 +60,16 @@ global.pronghornProps = {
|
|
|
60
60
|
token_timeout: -1,
|
|
61
61
|
token_cache: 'local',
|
|
62
62
|
auth_field: 'header.headers.Authorization',
|
|
63
|
-
auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
|
|
63
|
+
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
64
|
+
auth_logging: false,
|
|
65
|
+
client_id: '',
|
|
66
|
+
client_secret: '',
|
|
67
|
+
grant_type: ''
|
|
64
68
|
},
|
|
65
69
|
healthcheck: {
|
|
66
70
|
type: 'none',
|
|
67
|
-
frequency: 60000
|
|
71
|
+
frequency: 60000,
|
|
72
|
+
query_object: {}
|
|
68
73
|
},
|
|
69
74
|
throttle: {
|
|
70
75
|
throttle_enabled: false,
|
|
@@ -95,13 +100,16 @@ global.pronghornProps = {
|
|
|
95
100
|
},
|
|
96
101
|
healthcheck_on_timeout: true,
|
|
97
102
|
return_raw: true,
|
|
98
|
-
archiving: false
|
|
103
|
+
archiving: false,
|
|
104
|
+
return_request: false
|
|
99
105
|
},
|
|
100
106
|
proxy: {
|
|
101
107
|
enabled: false,
|
|
102
108
|
host: '',
|
|
103
109
|
port: 1,
|
|
104
|
-
protocol: 'http'
|
|
110
|
+
protocol: 'http',
|
|
111
|
+
username: '',
|
|
112
|
+
password: ''
|
|
105
113
|
},
|
|
106
114
|
ssl: {
|
|
107
115
|
ecdhCurve: '',
|
|
@@ -189,7 +197,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
|
189
197
|
}
|
|
190
198
|
|
|
191
199
|
// require the adapter that we are going to be using
|
|
192
|
-
const AdapterBase = require('../../adapterBase
|
|
200
|
+
const AdapterBase = require('../../adapterBase');
|
|
193
201
|
|
|
194
202
|
// delete the .DS_Store directory in entities -- otherwise this will cause errors
|
|
195
203
|
const dirPath = path.join(__dirname, '../../entities/.DS_Store');
|
|
@@ -309,7 +317,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
309
317
|
});
|
|
310
318
|
it('should return a list of functions', (done) => {
|
|
311
319
|
const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
|
|
312
|
-
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck',
|
|
320
|
+
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck', 'moveEntitiesToDB',
|
|
313
321
|
'refreshProperties', 'runBasicGet', 'runConnectivity', 'runHealthcheck', 'suspend', 'troubleshoot', 'unsuspend', 'updateAdapterConfiguration', 'addListener',
|
|
314
322
|
'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
|
|
315
323
|
'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|