Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
feat(analytics): add capabilities and platforms endpoints (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
radireddy authored and antleblanc committed Mar 29, 2019
1 parent 3dbe13a commit af62838
Show file tree
Hide file tree
Showing 9 changed files with 244 additions and 18 deletions.
118 changes: 117 additions & 1 deletion dist/ovh-api-services.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,104 @@
angular.module("ovh-api-services", ["ngOvhApiWrappers", "ngOvhSwimmingPoll"]);

angular.module("ovh-api-services").service("OvhApiAnalytics", ["$injector", function ($injector) {
"use strict";
return {
Platforms: function () {
return $injector.get("OvhApiAnalyticsPlatforms");
},
Capabilities: function () {
return $injector.get("OvhApiAnalyticsCapabilities");
}
};
}]);

angular.module("ovh-api-services").service("OvhApiAnalyticsCapabilities", ["$injector", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiAnalyticsCapabilitiesV6");
}
};
}]);

angular.module("ovh-api-services").service("OvhApiAnalyticsCapabilitiesV6", ["$resource", "$cacheFactory", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiAnalyticsCapabilitiesV6Query");

var adpResource = $resource("/analytics/capabilities/platforms", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache }
});

adpResource.resetQueryCache = function () {
queryCache.removeAll();
};

return adpResource;
}]);

angular.module("ovh-api-services").service("OvhApiAnalyticsPlatforms", ["$injector", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiAnalyticsPlatformsV6");
}
};
}]);

angular.module("ovh-api-services").service("OvhApiAnalyticsPlatformsV6", ["$resource", "$cacheFactory", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiAnalyticsPlatformsV6");
var queryCache = $cacheFactory("OvhApiAnalyticsPlatformsV6Query");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.resource;
}
};

var adpResource = $resource("/analytics/platforms/:serviceName", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache },
get: { method: "GET", cache: cache },
deploy: {
method: "POST",
interceptor: interceptor
},
getActivity: {
url: "/analytics/platforms/{serviceName}/activity",
method: "GET",
cache: cache
},
getNodes: {
url: "/analytics/platforms/{serviceName}/nodes",
method: "GET",
cache: cache
},
getStatus: {
url: "/analytics/platforms/{serviceName}/status",
method: "GET",
interceptor: interceptor
}
});

adpResource.resetCache = function () {
cache.removeAll();
};

adpResource.resetQueryCache = function () {
queryCache.removeAll();
};

return adpResource;
}]);

angular.module("ovh-api-services").service("OvhApiAuth", ["$injector", function ($injector) {
"use strict";
return {
Expand Down Expand Up @@ -744,15 +843,23 @@ angular.module("ovh-api-services").service("OvhApiCloudProject", ["$injector", "
},
Volume: function () {
return $injector.get("OvhApiCloudProjectVolume");
},
Network: function () {
return $injector.get("OvhApiCloudProjectNetwork");
},
Quota: function () {
return $injector.get("OvhApiCloudProjectQuota");
}
};

}]);

angular.module("ovh-api-services").service("OvhApiCloudProjectV6", ["$resource", "$q", "OvhApiCloudProject", function ($resource, $q, OvhApiCloudProject) {
angular.module("ovh-api-services").service("OvhApiCloudProjectV6", ["$cacheFactory", "$resource", "$q", "OvhApiCloudProject", function ($cacheFactory, $resource, $q, OvhApiCloudProject) {

"use strict";

var queryCache = $cacheFactory("OvhApiCloudProjectV6Query");

var interceptor = {
response: function (response) {
OvhApiCloudProject.resetCache();
Expand All @@ -763,6 +870,11 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectV6", ["$resource",
var cloudProject = $resource("/cloud/project/:serviceName", {
serviceName: "@serviceName"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: OvhApiCloudProject.cache
Expand Down Expand Up @@ -834,6 +946,10 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectV6", ["$resource",
OvhApiCloudProject.resetCache();
};

cloudProject.resetQueryCache = function () {
queryCache.removeAll();
};

return cloudProject;
}]);

Expand Down
31 changes: 15 additions & 16 deletions dist/ovh-api-services.min.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions src/analytics/analytics.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
angular.module("ovh-api-services").service("OvhApiAnalytics", function ($injector) {
"use strict";
return {
Platforms: function () {
return $injector.get("OvhApiAnalyticsPlatforms");
},
Capabilities: function () {
return $injector.get("OvhApiAnalyticsCapabilities");
}
};
});
8 changes: 8 additions & 0 deletions src/analytics/capabilities/capabilities.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiAnalyticsCapabilities", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiAnalyticsCapabilitiesV6");
}
};
});
17 changes: 17 additions & 0 deletions src/analytics/capabilities/capabilities.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
angular.module("ovh-api-services").service("OvhApiAnalyticsCapabilitiesV6", function ($resource, $cacheFactory) {
"use strict";

var queryCache = $cacheFactory("OvhApiAnalyticsCapabilitiesV6Query");

var adpResource = $resource("/analytics/capabilities/platforms", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache }
});

adpResource.resetQueryCache = function () {
queryCache.removeAll();
};

return adpResource;
});
8 changes: 8 additions & 0 deletions src/analytics/platforms/platforms.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
angular.module("ovh-api-services").service("OvhApiAnalyticsPlatforms", function ($injector) {
"use strict";
return {
v6: function () {
return $injector.get("OvhApiAnalyticsPlatformsV6");
}
};
});
50 changes: 50 additions & 0 deletions src/analytics/platforms/platforms.v6.service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
angular.module("ovh-api-services").service("OvhApiAnalyticsPlatformsV6", function ($resource, $cacheFactory) {
"use strict";

var cache = $cacheFactory("OvhApiAnalyticsPlatformsV6");
var queryCache = $cacheFactory("OvhApiAnalyticsPlatformsV6Query");

var interceptor = {
response: function (response) {
cache.remove(response.config.url);
queryCache.removeAll();
return response.resource;
}
};

var adpResource = $resource("/analytics/platforms/:serviceName", {
serviceName: "@serviceName"
}, {
query: { method: "GET", isArray: true, cache: queryCache },
get: { method: "GET", cache: cache },
deploy: {
method: "POST",
interceptor: interceptor
},
getActivity: {
url: "/analytics/platforms/{serviceName}/activity",
method: "GET",
cache: cache
},
getNodes: {
url: "/analytics/platforms/{serviceName}/nodes",
method: "GET",
cache: cache
},
getStatus: {
url: "/analytics/platforms/{serviceName}/status",
method: "GET",
interceptor: interceptor
}
});

adpResource.resetCache = function () {
cache.removeAll();
};

adpResource.resetQueryCache = function () {
queryCache.removeAll();
};

return adpResource;
});
6 changes: 6 additions & 0 deletions src/cloud/project/cloud-project.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ angular.module("ovh-api-services").service("OvhApiCloudProject", function ($inje
},
Volume: function () {
return $injector.get("OvhApiCloudProjectVolume");
},
Network: function () {
return $injector.get("OvhApiCloudProjectNetwork");
},
Quota: function () {
return $injector.get("OvhApiCloudProjectQuota");
}
};

Expand Down
13 changes: 12 additions & 1 deletion src/cloud/project/cloud-project.v6.service.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
angular.module("ovh-api-services").service("OvhApiCloudProjectV6", function ($resource, $q, OvhApiCloudProject) {
angular.module("ovh-api-services").service("OvhApiCloudProjectV6", function ($cacheFactory, $resource, $q, OvhApiCloudProject) {

"use strict";

var queryCache = $cacheFactory("OvhApiCloudProjectV6Query");

var interceptor = {
response: function (response) {
OvhApiCloudProject.resetCache();
Expand All @@ -12,6 +14,11 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectV6", function ($re
var cloudProject = $resource("/cloud/project/:serviceName", {
serviceName: "@serviceName"
}, {
query: {
method: "GET",
isArray: true,
cache: queryCache
},
get: {
method: "GET",
cache: OvhApiCloudProject.cache
Expand Down Expand Up @@ -83,5 +90,9 @@ angular.module("ovh-api-services").service("OvhApiCloudProjectV6", function ($re
OvhApiCloudProject.resetCache();
};

cloudProject.resetQueryCache = function () {
queryCache.removeAll();
};

return cloudProject;
});

0 comments on commit af62838

Please sign in to comment.