This repository has been archived by the owner on Apr 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add binding/unbinding endpoints
- Loading branch information
Showing
5 changed files
with
114 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerNic', $injector => ({ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerPhysicalInterface', $injector => ({ | ||
v6() { | ||
return $injector.get('OvhApiDedicatedServerNicV6'); | ||
return $injector.get('OvhApiDedicatedServerPhysicalInterfaceV6'); | ||
}, | ||
})); |
63 changes: 47 additions & 16 deletions
63
src/api/dedicated/server/nic/dedicated-server.nic.v6.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,61 @@ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerNicV6', ($resource, $cacheFactory) => { | ||
const otherCache = $cacheFactory('OvhApiDedicatedServerNicV6'); | ||
const queryCache = $cacheFactory('OvhApiDedicatedServerNicV6Query'); | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerPhysicalInterfaceV6', ($resource, $cacheFactory) => { | ||
const cache = $cacheFactory('OvhApiDedicatedServerPhysicalInterfaceV6'); | ||
|
||
const dedicatedServerNicResource = $resource('/dedicated/server/:serverName/networkInterfaceController', { | ||
const interceptor = { | ||
response(response) { | ||
dedicatedServerPhysicalInterfaceResource.resetCache(); | ||
return response.data; | ||
}, | ||
}; | ||
|
||
const dedicatedServerPhysicalInterfaceResource = $resource('/dedicated/server/:serverName/networkInterfaceController', { | ||
serverName: '@serverName', | ||
}, { | ||
query: { method: 'GET', cache: queryCache, isArray: true }, | ||
query: { | ||
method: 'GET', | ||
cache, | ||
isArray: true, | ||
params: { | ||
linkType: '@linkType', | ||
}, | ||
}, | ||
get: { | ||
url: '/dedicated/server/:serverName/networkInterfaceController/:mac', | ||
method: 'GET', | ||
cache: otherCache, | ||
cache, | ||
}, | ||
mrtg: { | ||
url: '/dedicated/server/:serverName/networkInterfaceController/:mac/mrtg', | ||
method: 'GET', | ||
cache, | ||
isArray: true, | ||
params: { | ||
period: '@period', | ||
type: '@type', | ||
}, | ||
}, | ||
bind: { | ||
url: '/dedicated/server/:serverName/networkInterfaceController/:mac/bind', | ||
method: 'POST', | ||
interceptor, | ||
params: { | ||
virtualNetworkInterface: '@virtualNetworkInterface', | ||
}, | ||
}, | ||
unbind: { | ||
url: '/dedicated/server/:serverName/networkInterfaceController/:mac/unbind', | ||
method: 'POST', | ||
interceptor, | ||
}, | ||
}); | ||
|
||
dedicatedServerNicResource.resetAllCache = function resetAllCache() { | ||
dedicatedServerNicResource.resetOtherCache(); | ||
dedicatedServerNicResource.resetQueryCache(); | ||
}; | ||
|
||
dedicatedServerNicResource.resetOtherCache = function resetOtherCache() { | ||
otherCache.removeAll(); | ||
dedicatedServerPhysicalInterfaceResource.resetAllCache = function resetAllCache() { | ||
dedicatedServerPhysicalInterfaceResource.resetCache(); | ||
}; | ||
|
||
dedicatedServerNicResource.resetQueryCache = function resetQueryCache() { | ||
queryCache.removeAll(); | ||
dedicatedServerPhysicalInterfaceResource.resetCache = function resetCache() { | ||
cache.removeAll(); | ||
}; | ||
|
||
return dedicatedServerNicResource; | ||
return dedicatedServerPhysicalInterfaceResource; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerVni', $injector => ({ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerVirtualInterface', $injector => ({ | ||
v6() { | ||
return $injector.get('OvhApiDedicatedServerVniV6'); | ||
return $injector.get('OvhApiDedicatedServerVirtualInterfaceV6'); | ||
}, | ||
})); |
75 changes: 59 additions & 16 deletions
75
src/api/dedicated/server/vni/dedicated-server.vni.v6.service.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,73 @@ | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerVniV6', ($resource, $cacheFactory) => { | ||
const otherCache = $cacheFactory('OvhApiDedicatedServerVniV6'); | ||
const queryCache = $cacheFactory('OvhApiDedicatedServerVniV6Query'); | ||
angular.module('ovh-api-services').service('OvhApiDedicatedServerVirtualInterfaceV6', ($resource, $cacheFactory) => { | ||
const cache = $cacheFactory('OvhApiDedicatedServerVirtualInterfaceV6'); | ||
|
||
const dedicatedServerVniResource = $resource('/dedicated/server/:serverName/virtualNetworkInterface', { | ||
const interceptor = { | ||
response(response) { | ||
dedicatedServerVirtualInterfaceResource.resetCache(); | ||
return response.data; | ||
}, | ||
}; | ||
|
||
const dedicatedServerVirtualInterfaceResource = $resource('/dedicated/server/:serverName/virtualNetworkInterface', { | ||
serverName: '@serverName', | ||
}, { | ||
query: { method: 'GET', cache: queryCache, isArray: true }, | ||
query: { | ||
method: 'GET', | ||
cache, | ||
isArray: true, | ||
params: { | ||
enabled: '@enabled', | ||
mode: '@mode', | ||
name: '@name', | ||
vrack: '@vrack', | ||
}, | ||
}, | ||
create: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface', | ||
method: 'POST', | ||
interceptor, | ||
params: { | ||
mode: '@mode', | ||
name: '@name', | ||
}, | ||
}, | ||
get: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface/:uuid', | ||
method: 'GET', | ||
cache: otherCache, | ||
cache, | ||
}, | ||
update: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface/:uuid', | ||
method: 'PUT', | ||
interceptor, | ||
params: { | ||
VirtualNetworkInterface: '@virtualNetworkInterface', | ||
}, | ||
}, | ||
delete: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface/:uuid', | ||
method: 'DELETE', | ||
interceptor, | ||
}, | ||
enable: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface/:uuid/enable', | ||
method: 'POST', | ||
interceptor, | ||
}, | ||
disable: { | ||
url: '/dedicated/server/:serverName/virtualNetworkInterface/:uuid/disable', | ||
method: 'POST', | ||
interceptor, | ||
}, | ||
}); | ||
|
||
dedicatedServerVniResource.resetAllCache = function resetAllCache() { | ||
dedicatedServerVniResource.resetOtherCache(); | ||
dedicatedServerVniResource.resetQueryCache(); | ||
}; | ||
|
||
dedicatedServerVniResource.resetOtherCache = function resetOtherCache() { | ||
otherCache.removeAll(); | ||
dedicatedServerVirtualInterfaceResource.resetAllCache = function resetAllCache() { | ||
dedicatedServerVirtualInterfaceResource.resetCache(); | ||
}; | ||
|
||
dedicatedServerVniResource.resetQueryCache = function resetQueryCache() { | ||
queryCache.removeAll(); | ||
dedicatedServerVirtualInterfaceResource.resetCache = function resetCache() { | ||
cache.removeAll(); | ||
}; | ||
|
||
return dedicatedServerVniResource; | ||
return dedicatedServerVirtualInterfaceResource; | ||
}); |