use of bio.terra.workspace.generated.model.ApiCreatedControlledAzureDisk in project terra-workspace-manager by DataBiosphere.
the class ControlledAzureResourceApiController method createAzureDisk.
@Override
public ResponseEntity<ApiCreatedControlledAzureDisk> createAzureDisk(UUID workspaceId, ApiCreateControlledAzureDiskRequestBody body) {
features.azureEnabledCheck();
final AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
ControlledResourceFields commonFields = toCommonFields(workspaceId, body.getCommon(), userRequest);
ControlledAzureDiskResource resource = ControlledAzureDiskResource.builder().common(commonFields).diskName(body.getAzureDisk().getName()).region(body.getAzureDisk().getRegion()).size(body.getAzureDisk().getSize()).build();
// TODO: make createDisk call async once we have things working e2e
final ControlledAzureDiskResource createdDisk = controlledResourceService.createControlledResourceSync(resource, commonFields.getIamRole(), userRequest, body.getAzureDisk()).castByEnum(WsmResourceType.CONTROLLED_AZURE_DISK);
var response = new ApiCreatedControlledAzureDisk().resourceId(createdDisk.getResourceId()).azureDisk(createdDisk.toApiResource());
return new ResponseEntity<>(response, HttpStatus.OK);
}
Aggregations