@@ -683,6 +683,7 @@ var __exportName = 'splunkjs';
683
683
this.version = params.version || "default";
684
684
this.timeout = params.timeout || 0;
685
685
this.autologin = true;
686
+ this.instanceType = "";
686
687
687
688
// Initialize autologin
688
689
// The reason we explicitly check to see if 'autologin'
@@ -717,16 +718,17 @@ var __exportName = 'splunkjs';
717
718
718
719
// We perform the bindings so that every function works
719
720
// properly when it is passed as a callback.
720
- this._headers = utils.bind(this, this._headers);
721
- this.fullpath = utils.bind(this, this.fullpath);
722
- this.urlify = utils.bind(this, this.urlify);
723
- this.get = utils.bind(this, this.get);
724
- this.del = utils.bind(this, this.del);
725
- this.post = utils.bind(this, this.post);
726
- this.login = utils.bind(this, this.login);
727
- this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
728
- this._requestWrapper = utils.bind(this, this._requestWrapper);
729
- this.getVersion = utils.bind(this, this.getVersion);
721
+ this._headers = utils.bind(this, this._headers);
722
+ this.fullpath = utils.bind(this, this.fullpath);
723
+ this.urlify = utils.bind(this, this.urlify);
724
+ this.get = utils.bind(this, this.get);
725
+ this.del = utils.bind(this, this.del);
726
+ this.post = utils.bind(this, this.post);
727
+ this.login = utils.bind(this, this.login);
728
+ this._shouldAutoLogin = utils.bind(this, this._shouldAutoLogin);
729
+ this._requestWrapper = utils.bind(this, this._requestWrapper);
730
+ this.getInfo = utils.bind(this, this.getInfo);
731
+ this.disableV2SearchApi = utils.bind(this, this.disableV2SearchApi);
730
732
},
731
733
732
734
/**
@@ -897,19 +899,21 @@ var __exportName = 'splunkjs';
897
899
* @method splunkjs.Context
898
900
* @private
899
901
*/
900
- getVersion : function (callback) {
902
+ getInfo : function (callback) {
901
903
var that = this;
902
904
var url = this.paths.info;
903
905
904
906
callback = callback || function() {};
905
907
906
908
var wrappedCallback = function(err, response) {
907
909
var hasVersion = !!(!err && response.data && response.data.generator.version);
910
+ let hasInstanceType = !!(!err && response.data && response.data.generator["instance_type"]);
908
911
909
912
if (err || !hasVersion) {
910
913
callback(err || "No version found", false);
911
914
}
912
915
else {
916
+ that.instanceType = hasInstanceType ? response.data.generator["instance_type"] : "";
913
917
that.version = response.data.generator.version;
914
918
that.http.version = that.version;
915
919
callback(null, true);
@@ -954,7 +958,7 @@ var __exportName = 'splunkjs';
954
958
}
955
959
else {
956
960
that.sessionKey = response.data.sessionKey;
957
- that.getVersion (callback);
961
+ that.getInfo (callback);
958
962
}
959
963
};
960
964
return this.http.post(
@@ -1131,6 +1135,16 @@ var __exportName = 'splunkjs';
1131
1135
}
1132
1136
}
1133
1137
return 0;
1138
+ },
1139
+
1140
+ disableV2SearchApi: function(){
1141
+ let val;
1142
+ if(this.instanceType.toLowerCase() == "cloud"){
1143
+ val = this.versionCompare("9.0.2209");
1144
+ }else{
1145
+ val = this.versionCompare("9.0.2")
1146
+ }
1147
+ return val < 0;
1134
1148
}
1135
1149
});
1136
1150
@@ -2910,7 +2924,7 @@ var __exportName = 'splunkjs';
2910
2924
params.q = query;
2911
2925
2912
2926
// Pre-9.0 uses GET and v1 endpoint
2913
- if (this.versionCompare("9.0") < 0 ) {
2927
+ if (this.disableV2SearchApi() ) {
2914
2928
return this.get(Paths.parser, params, function(err, response) {
2915
2929
if (err) {
2916
2930
callback(err);
@@ -4433,6 +4447,12 @@ var __exportName = 'splunkjs';
4433
4447
*/
4434
4448
init: function(service, namespace) {
4435
4449
this._super(service, this.path(), namespace);
4450
+ },
4451
+ create: function(params, callback){
4452
+ if(this.service.app == '-' || this.service.owner == '-'){
4453
+ throw new Error("While creating StoragePasswords, namespace cannot have wildcards.");
4454
+ }
4455
+ this._super(params,callback);
4436
4456
}
4437
4457
});
4438
4458
@@ -5688,7 +5708,7 @@ var __exportName = 'splunkjs';
5688
5708
*/
5689
5709
path: function () {
5690
5710
// Pre-9.0 uses v1 endpoint
5691
- if (this.versionCompare("9.0") < 0 ) {
5711
+ if (this.disableV2SearchApi() ) {
5692
5712
return Paths.jobs + "/" + encodeURIComponent(this.name);
5693
5713
}
5694
5714
// Post-9.0 uses v2 endpoint
@@ -5713,6 +5733,7 @@ var __exportName = 'splunkjs';
5713
5733
// Passing the service version and versionCompare to this.path() before instantiating splunkjs.Service.Entity.
5714
5734
this.version = service.version;
5715
5735
this.versionCompare = service.versionCompare;
5736
+ this.disableV2SearchApi = service.disableV2SearchApi;
5716
5737
5717
5738
this.name = sid;
5718
5739
this._super(service, this.path(), namespace);
@@ -5837,7 +5858,7 @@ var __exportName = 'splunkjs';
5837
5858
var eventsPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/events";
5838
5859
// Splunk version pre-9.0 doesn't support v2
5839
5860
// v1(GET), v2(POST)
5840
- if (this.versionCompare("9.0") < 0 ) {
5861
+ if (this.disableV2SearchApi() ) {
5841
5862
eventsPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/events";
5842
5863
return this.get(eventsPath, params, function(err, response) {
5843
5864
if (err) {
@@ -5953,7 +5974,7 @@ var __exportName = 'splunkjs';
5953
5974
var resultsPreviewPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/results_preview";
5954
5975
// Splunk version pre-9.0 doesn't support v2
5955
5976
// v1(GET), v2(POST)
5956
- if (this.versionCompare("9.0") < 0 ) {
5977
+ if (this.disableV2SearchApi() ) {
5957
5978
resultsPreviewPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/results_preview";
5958
5979
return this.get(resultsPreviewPath, params, function(err, response) {
5959
5980
if (err) {
@@ -6006,7 +6027,7 @@ var __exportName = 'splunkjs';
6006
6027
var resultsPath = Paths.jobsV2 + "/" + encodeURIComponent(this.name) + "/results";
6007
6028
// Splunk version pre-9.0 doesn't support v2
6008
6029
// v1(GET), v2(POST)
6009
- if (this.versionCompare("9.0") < 0 ) {
6030
+ if (this.disableV2SearchApi() ) {
6010
6031
resultsPath = Paths.jobs + "/" + encodeURIComponent(this.name) + "/results";
6011
6032
return this.get(resultsPath, params, function(err, response) {
6012
6033
if (err) {
@@ -6347,7 +6368,7 @@ var __exportName = 'splunkjs';
6347
6368
*/
6348
6369
path: function () {
6349
6370
// Pre-9.0 uses v1 endpoint
6350
- if (this.versionCompare("9.0") < 0 ) {
6371
+ if (this.disableV2SearchApi() ) {
6351
6372
return Paths.jobs;
6352
6373
}
6353
6374
// Post-9.0 uses v2 endpoint
@@ -6385,6 +6406,7 @@ var __exportName = 'splunkjs';
6385
6406
// Passing the service version and versionCompare to this.path() before instantiating splunkjs.Service.Collection.
6386
6407
this.version = service.version;
6387
6408
this.versionCompare = service.versionCompare;
6409
+ this.disableV2SearchApi = service.disableV2SearchApi;
6388
6410
6389
6411
this._super(service, this.path(), namespace);
6390
6412
// We perform the bindings so that every function works
@@ -29945,7 +29967,7 @@ module.exports={
29945
29967
"_args": [
29946
29968
[
29947
29969
29948
- "/Users/tpavlik/src/enterprise/semantic-versioning /splunk-sdk-javascript"
29970
+ "/Users/abhis/Documents/JS /splunk-sdk-javascript"
29949
29971
]
29950
29972
],
29951
29973
"_development": true,
@@ -29971,7 +29993,7 @@ module.exports={
29971
29993
],
29972
29994
"_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
29973
29995
"_spec": "6.5.4",
29974
- "_where": "/Users/tpavlik/src/enterprise/semantic-versioning /splunk-sdk-javascript",
29996
+ "_where": "/Users/abhis/Documents/JS /splunk-sdk-javascript",
29975
29997
"author": {
29976
29998
"name": "Fedor Indutny",
29977
29999
@@ -39855,7 +39877,7 @@ module.exports={
39855
39877
"_args": [
39856
39878
[
39857
39879
39858
- "/Users/tpavlik/src/enterprise/semantic-versioning /splunk-sdk-javascript"
39880
+ "/Users/abhis/Documents/JS /splunk-sdk-javascript"
39859
39881
]
39860
39882
],
39861
39883
@@ -39879,13 +39901,13 @@ module.exports={
39879
39901
],
39880
39902
"_resolved": "https://registry.npmjs.org/needle/-/needle-3.0.0.tgz",
39881
39903
"_spec": "3.0.0",
39882
- "_where": "/Users/tpavlik/src/enterprise/semantic-versioning /splunk-sdk-javascript",
39904
+ "_where": "/Users/abhis/Documents/JS /splunk-sdk-javascript",
39883
39905
"author": {
39884
39906
"name": "Tomás Pollak",
39885
39907
39886
39908
},
39887
39909
"bin": {
39888
- "needle": "bin/needle"
39910
+ "needle": "./ bin/needle"
39889
39911
},
39890
39912
"bugs": {
39891
39913
"url": "https://github.com/tomas/needle/issues"
@@ -55692,7 +55714,7 @@ function extend() {
55692
55714
},{}],259:[function(require,module,exports){
55693
55715
module.exports={
55694
55716
"name": "splunk-sdk",
55695
- "version": "1.11 .0",
55717
+ "version": "1.12 .0",
55696
55718
"description": "SDK for usage with the Splunk REST API",
55697
55719
"homepage": "http://dev.splunk.com",
55698
55720
"main": "index.js",
0 commit comments