const options = {
headers: {
- HTTP_CSP_ATTUID: 'validationOnlyVspUser'
+ USER_ID: 'validationOnlyVspUser'
}
};
return `${date.getFullYear()}-${z(date.getMonth())}-${z(date.getDate())}_${z(date.getHours())}-${z(date.getMinutes())}`;
}
-function fetchVspId() {
+function fetchVspIdAndVersion() {
let vspId = sessionStorage.getItem('validationAppVspId');
+ let versionId = sessionStorage.getItem('validationAppVersionId');
if (vspId) {
- return Promise.resolve({value: vspId});
+ return Promise.resolve({value: vspId, versionId});
}else {
return RestAPIUtil.fetch('/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/validation-vsp', options)
.then(response => {
- sessionStorage.setItem('validationAppVspId', response.value);
- return Promise.resolve(response);
+ sessionStorage.setItem('validationAppVspId', response.itemId);
+ sessionStorage.setItem('validationAppVersionId', response.version.id);
+ return Promise.resolve({value: response.itemId, versionId: response.version.id});
});
}
function uploadFile(formData) {
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- return RestAPIUtil.post(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate`, formData, options);
+ return RestAPIUtil.post(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate`, formData, options);
});
}
function loadSoftwareProductHeatCandidate(dispatch){
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/manifest`, options)
+ return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/manifest`, options)
.then(response => dispatch({
type: HeatSetupActions.MANIFEST_LOADED,
response
}
function updateHeatCandidate(dispatch, heatCandidate) {
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/manifest`,
+ return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/manifest`,
heatCandidate.heatData, options)
.then(null, error => {
dispatch({
}
function fetchSoftwareProduct() {
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1`, options);
+ return RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}`, options);
});
}
function downloadHeatFile() {
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate`, {
+ RestAPIUtil.fetch(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate`, {
...options,
dataType: 'binary'
})
}
function processAndValidateHeatCandidate(dispatch) {
- return fetchVspId()
+ return fetchVspIdAndVersion()
.then(response => {
- return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/0.1/orchestration-template-candidate/process`, {}, options)
+ return RestAPIUtil.put(`/sdc1/feProxy/onboarding-api/v1.0/vendor-software-products/${response.value}/versions/${response.versionId}/orchestration-template-candidate/process`, {}, options)
.then(response => {
if (response.status === 'Success') {
fetchSoftwareProduct().then(response => {