-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse unbound routes #1223
Reuse unbound routes #1223
Changes from 16 commits
fc20731
bf7ab40
dd49d12
c1c6142
3848e51
266e76e
aaffa29
8db1280
9d44456
e241aef
536b2a4
de2f3fc
fda03ad
0a40c93
26bb49c
c10498a
bc7c790
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
.module('cloud-foundry.api') | ||
.run(registerApi); | ||
|
||
var BASE_URL = '/pp/v1/proxy/v2/apps'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the past we've avoided making changes to 'api' files as they were originally auto-generated. Going forward I don't think there's much harm in re-factoring but we need to bear in mind we might auto-generate these files for v3 of the cf api. |
||
|
||
function registerApi($http, apiManager) { | ||
apiManager.register('cloud-foundry.api.Apps', new AppsApi($http)); | ||
} | ||
|
@@ -25,7 +27,7 @@ | |
AssociateRouteWithApp: function (guid, route_guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/routes/' + route_guid + ''; | ||
config.url = BASE_URL + '/' + guid + '/routes/' + route_guid + ''; | ||
config.method = 'PUT'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -45,7 +47,7 @@ | |
CopyAppBitsForApp: function (guid, value, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/copy_bits'; | ||
config.url = BASE_URL + '/' + guid + '/copy_bits'; | ||
config.method = 'POST'; | ||
config.data = value; | ||
|
||
|
@@ -63,7 +65,7 @@ | |
CreateDockerAppExperimental: function (value, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps'; | ||
config.url = BASE_URL + ''; | ||
config.method = 'POST'; | ||
config.data = value; | ||
|
||
|
@@ -81,7 +83,7 @@ | |
CreateApp: function (value, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps'; | ||
config.url = BASE_URL + ''; | ||
config.method = 'POST'; | ||
config.data = value; | ||
|
||
|
@@ -99,7 +101,7 @@ | |
DeleteApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + ''; | ||
config.url = BASE_URL + '/' + guid + ''; | ||
config.method = 'DELETE'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -119,7 +121,7 @@ | |
DownloadsStagedDropletForApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/droplet/download'; | ||
config.url = BASE_URL + '/' + guid + '/droplet/download'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -136,7 +138,7 @@ | |
GetAppSummary: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/summary'; | ||
config.url = BASE_URL + '/' + guid + '/summary'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -154,7 +156,7 @@ | |
GetDetailedStatsForStartedApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/stats'; | ||
config.url = BASE_URL + '/' + guid + '/stats'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -172,7 +174,7 @@ | |
GetEnvForApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/env'; | ||
config.url = BASE_URL + '/' + guid + '/env'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -201,7 +203,7 @@ | |
GetInstanceInformationForStartedApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/instances'; | ||
config.url = BASE_URL + '/' + guid + '/instances'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -218,7 +220,7 @@ | |
ListAllApps: function (params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps'; | ||
config.url = BASE_URL + ''; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -235,7 +237,7 @@ | |
ListAllRoutesForApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/routes'; | ||
config.url = BASE_URL + '/' + guid + '/routes'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -252,7 +254,7 @@ | |
ListAllServiceBindingsForApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/service_bindings'; | ||
config.url = BASE_URL + '/' + guid + '/service_bindings'; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -269,7 +271,7 @@ | |
RemoveRouteFromApp: function (guid, route_guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/routes/' + route_guid + ''; | ||
config.url = BASE_URL + '/' + guid + '/routes/' + route_guid + ''; | ||
config.method = 'DELETE'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -286,7 +288,7 @@ | |
RemoveServiceBindingFromApp: function (guid, service_binding_guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/service_bindings/' + service_binding_guid + ''; | ||
config.url = BASE_URL + '/' + guid + '/service_bindings/' + service_binding_guid + ''; | ||
config.method = 'DELETE'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -303,7 +305,7 @@ | |
RestageApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/restage'; | ||
config.url = BASE_URL + '/' + guid + '/restage'; | ||
config.method = 'POST'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -320,7 +322,7 @@ | |
RetrieveApp: function (guid, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + ''; | ||
config.url = BASE_URL + '/' + guid + ''; | ||
config.method = 'GET'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -337,7 +339,7 @@ | |
TerminateRunningAppInstanceAtGivenIndex: function (guid, index, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + '/instances/' + index + ''; | ||
config.url = BASE_URL + '/' + guid + '/instances/' + index + ''; | ||
config.method = 'DELETE'; | ||
|
||
for (var option in httpConfigOptions) { | ||
|
@@ -354,7 +356,7 @@ | |
UpdateApp: function (guid, value, params, httpConfigOptions) { | ||
var config = {}; | ||
config.params = params; | ||
config.url = '/pp/v1/proxy/v2/apps/' + guid + ''; | ||
config.url = BASE_URL + '/' + guid + ''; | ||
config.method = 'PUT'; | ||
config.data = value; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,8 @@ | |
*/ | ||
function Route(apiManager, modelUtils) { | ||
|
||
var routesApi = apiManager.retrieve('cloud-foundry.api.Routes'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've had some issues in the past where the apiManager/modelManager cannot retrieve the objects when their host function is run first, so will grab them when needed. It's probably best to leave these as is. |
||
|
||
var model = { | ||
route: {}, | ||
checkRouteExists: checkRouteExists, | ||
|
@@ -52,7 +54,7 @@ | |
* @public | ||
*/ | ||
function checkRouteExists(cnsiGuid, domainGuid, host, path, port) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.CheckRouteExists(domainGuid, host, path || '', port || '', {}, modelUtils.makeHttpConfig(cnsiGuid)) | ||
.then(function (response) { | ||
return response.data; | ||
|
@@ -70,7 +72,7 @@ | |
* @public | ||
*/ | ||
function associateAppWithRoute(cnsiGuid, guid, appGuid) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.AssociateAppWithRoute(guid, appGuid, {}, modelUtils.makeHttpConfig(cnsiGuid)); | ||
} | ||
|
||
|
@@ -85,13 +87,13 @@ | |
* @public | ||
*/ | ||
function removeAppFromRoute(cnsiGuid, guid, appGuid) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.RemoveAppFromRoute(guid, appGuid, {}, modelUtils.makeHttpConfig(cnsiGuid)); | ||
} | ||
|
||
function createRoute(cnsiGuid, routeSpec, params) { | ||
var routeParams = params || {}; | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.CreateRoute(routeSpec, routeParams, modelUtils.makeHttpConfig(cnsiGuid)) | ||
.then(function (response) { | ||
return response.data; | ||
|
@@ -109,7 +111,7 @@ | |
* @public | ||
*/ | ||
function deleteRoute(cnsiGuid, guid, recursive) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.DeleteRoute(guid, recursive, {}, modelUtils.makeHttpConfig(cnsiGuid)); | ||
} | ||
|
||
|
@@ -126,7 +128,7 @@ | |
* @public | ||
*/ | ||
function listAllAppsForRoute(cnsiGuid, guid, params, paginate) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.ListAllAppsForRoute(guid, params, modelUtils.makeHttpConfig(cnsiGuid)) | ||
.then(function (response) { | ||
if (paginate) { | ||
|
@@ -163,7 +165,7 @@ | |
* @public | ||
*/ | ||
function listAllAppsForRouteWithoutStore(cnsiGuid, guid, params, paginate) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.ListAllAppsForRoute(guid, params, modelUtils.makeHttpConfig(cnsiGuid)) | ||
.then(function (response) { | ||
if (paginate) { | ||
|
@@ -195,7 +197,7 @@ | |
* @public | ||
*/ | ||
function listAllRouteMappingsForRoute(cnsiGuid, guid, params, paginate) { | ||
return apiManager.retrieve('cloud-foundry.api.Routes') | ||
return routesApi | ||
.ListAllRouteMappingsForRoute(guid, params, modelUtils.makeHttpConfig(cnsiGuid)) | ||
.then(function (response) { | ||
if (!paginate) { | ||
|
@@ -204,7 +206,5 @@ | |
return response.data.resources; | ||
}); | ||
} | ||
|
||
} | ||
|
||
})(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two background-color's are needed