src/app/shared/api/rbd.service.ts
Methods |
constructor(http: HttpClient, rbdConfigurationService: RbdConfigurationService)
|
|||||||||
Defined in src/app/shared/api/rbd.service.ts:15
|
|||||||||
Parameters :
|
cloneSnapshot | ||||||||||
cloneSnapshot(poolName, rbdName, snapshotName, request)
|
||||||||||
Defined in src/app/shared/api/rbd.service.ts:104
|
||||||||||
Parameters :
Returns :
any
|
copy | ||||||||
copy(poolName, rbdName, rbd)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:53
|
||||||||
Parameters :
Returns :
any
|
create | ||||
create(rbd)
|
||||
Defined in src/app/shared/api/rbd.service.ts:18
|
||||
Parameters :
Returns :
any
|
createSnapshot | ||||||||
createSnapshot(poolName, rbdName, snapshotName)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:69
|
||||||||
Parameters :
Returns :
any
|
defaultFeatures |
defaultFeatures()
|
Defined in src/app/shared/api/rbd.service.ts:65
|
Returns :
any
|
delete | ||||||
delete(poolName, rbdName)
|
||||||
Defined in src/app/shared/api/rbd.service.ts:22
|
||||||
Parameters :
Returns :
any
|
deleteSnapshot | ||||||||
deleteSnapshot(poolName, rbdName, snapshotName)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:112
|
||||||||
Parameters :
Returns :
any
|
flatten | ||||||
flatten(poolName, rbdName)
|
||||||
Defined in src/app/shared/api/rbd.service.ts:59
|
||||||
Parameters :
Returns :
any
|
get | ||||||
get(poolName, rbdName)
|
||||||
Defined in src/app/shared/api/rbd.service.ts:30
|
||||||
Parameters :
Returns :
any
|
list |
list()
|
Defined in src/app/shared/api/rbd.service.ts:34
|
Returns :
any
|
listTrash |
listTrash()
|
Defined in src/app/shared/api/rbd.service.ts:118
|
Returns :
any
|
moveTrash | ||||||||
moveTrash(poolName, rbdName, delay)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:122
|
||||||||
Parameters :
Returns :
any
|
protectSnapshot | ||||||||||
protectSnapshot(poolName, rbdName, snapshotName, isProtected)
|
||||||||||
Defined in src/app/shared/api/rbd.service.ts:87
|
||||||||||
Parameters :
Returns :
any
|
purgeTrash | ||||
purgeTrash(poolName)
|
||||
Defined in src/app/shared/api/rbd.service.ts:130
|
||||
Parameters :
Returns :
any
|
removeTrash | |||||||||||||||
removeTrash(poolName, imageId, imageName, force)
|
|||||||||||||||
Defined in src/app/shared/api/rbd.service.ts:144
|
|||||||||||||||
Parameters :
Returns :
any
|
renameSnapshot | ||||||||||
renameSnapshot(poolName, rbdName, snapshotName, newSnapshotName)
|
||||||||||
Defined in src/app/shared/api/rbd.service.ts:78
|
||||||||||
Parameters :
Returns :
any
|
restoreTrash | ||||||||
restoreTrash(poolName, imageId, newImageName)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:136
|
||||||||
Parameters :
Returns :
any
|
rollbackSnapshot | ||||||||
rollbackSnapshot(poolName, rbdName, snapshotName)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:96
|
||||||||
Parameters :
Returns :
any
|
update | ||||||||
update(poolName, rbdName, rbd)
|
||||||||
Defined in src/app/shared/api/rbd.service.ts:26
|
||||||||
Parameters :
Returns :
any
|
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { map } from 'rxjs/operators';
import { cdEncode, cdEncodeNot } from '../decorators/cd-encode';
import { RbdConfigurationService } from '../services/rbd-configuration.service';
import { ApiModule } from './api.module';
import { RbdPool } from './rbd.model';
@cdEncode
@Injectable({
providedIn: ApiModule
})
export class RbdService {
constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {}
create(rbd) {
return this.http.post('api/block/image', rbd, { observe: 'response' });
}
delete(poolName, rbdName) {
return this.http.delete(`api/block/image/${poolName}/${rbdName}`, { observe: 'response' });
}
update(poolName, rbdName, rbd) {
return this.http.put(`api/block/image/${poolName}/${rbdName}`, rbd, { observe: 'response' });
}
get(poolName, rbdName) {
return this.http.get(`api/block/image/${poolName}/${rbdName}`);
}
list() {
return this.http.get<RbdPool[]>('api/block/image').pipe(
map((pools) =>
pools.map((pool) => {
pool.value.map((image) => {
if (!image.configuration) {
return image;
}
image.configuration.map((option) =>
Object.assign(option, this.rbdConfigurationService.getOptionByName(option.name))
);
return image;
});
return pool;
})
)
);
}
copy(poolName, rbdName, rbd) {
return this.http.post(`api/block/image/${poolName}/${rbdName}/copy`, rbd, {
observe: 'response'
});
}
flatten(poolName, rbdName) {
return this.http.post(`api/block/image/${poolName}/${rbdName}/flatten`, null, {
observe: 'response'
});
}
defaultFeatures() {
return this.http.get('api/block/image/default_features');
}
createSnapshot(poolName, rbdName, @cdEncodeNot snapshotName) {
const request = {
snapshot_name: snapshotName
};
return this.http.post(`api/block/image/${poolName}/${rbdName}/snap`, request, {
observe: 'response'
});
}
renameSnapshot(poolName, rbdName, snapshotName, @cdEncodeNot newSnapshotName) {
const request = {
new_snap_name: newSnapshotName
};
return this.http.put(`api/block/image/${poolName}/${rbdName}/snap/${snapshotName}`, request, {
observe: 'response'
});
}
protectSnapshot(poolName, rbdName, snapshotName, @cdEncodeNot isProtected) {
const request = {
is_protected: isProtected
};
return this.http.put(`api/block/image/${poolName}/${rbdName}/snap/${snapshotName}`, request, {
observe: 'response'
});
}
rollbackSnapshot(poolName, rbdName, snapshotName) {
return this.http.post(
`api/block/image/${poolName}/${rbdName}/snap/${snapshotName}/rollback`,
null,
{ observe: 'response' }
);
}
cloneSnapshot(poolName, rbdName, snapshotName, request) {
return this.http.post(
`api/block/image/${poolName}/${rbdName}/snap/${snapshotName}/clone`,
request,
{ observe: 'response' }
);
}
deleteSnapshot(poolName, rbdName, snapshotName) {
return this.http.delete(`api/block/image/${poolName}/${rbdName}/snap/${snapshotName}`, {
observe: 'response'
});
}
listTrash() {
return this.http.get(`api/block/image/trash/`);
}
moveTrash(poolName, rbdName, delay) {
return this.http.post(
`api/block/image/${poolName}/${rbdName}/move_trash`,
{ delay: delay },
{ observe: 'response' }
);
}
purgeTrash(poolName) {
return this.http.post(`api/block/image/trash/purge/?pool_name=${poolName}`, null, {
observe: 'response'
});
}
restoreTrash(poolName, imageId, newImageName) {
return this.http.post(
`api/block/image/trash/${poolName}/${imageId}/restore`,
{ new_image_name: newImageName },
{ observe: 'response' }
);
}
removeTrash(poolName, imageId, imageName, force = false) {
return this.http.delete(
`api/block/image/trash/${poolName}/${imageId}/?image_name=${imageName}&force=${force}`,
{ observe: 'response' }
);
}
}