Search in sources :

Example 1 with ApiCreatedControlledAzureIp

use of bio.terra.workspace.generated.model.ApiCreatedControlledAzureIp in project terra-workspace-manager by DataBiosphere.

the class ControlledAzureResourceApiController method createAzureIp.

@Override
public ResponseEntity<ApiCreatedControlledAzureIp> createAzureIp(UUID workspaceId, @Valid ApiCreateControlledAzureIpRequestBody body) {
    features.azureEnabledCheck();
    final AuthenticatedUserRequest userRequest = getAuthenticatedInfo();
    ControlledResourceFields commonFields = toCommonFields(workspaceId, body.getCommon(), userRequest);
    ControlledAzureIpResource resource = ControlledAzureIpResource.builder().common(commonFields).ipName(body.getAzureIp().getName()).region(body.getAzureIp().getRegion()).build();
    final ControlledAzureIpResource createdIp = controlledResourceService.createControlledResourceSync(resource, commonFields.getIamRole(), userRequest, body.getAzureIp()).castByEnum(WsmResourceType.CONTROLLED_AZURE_IP);
    var response = new ApiCreatedControlledAzureIp().resourceId(createdIp.getResourceId()).azureIp(createdIp.toApiResource());
    return new ResponseEntity<>(response, HttpStatus.OK);
}
Also used : ControlledAzureIpResource(bio.terra.workspace.service.resource.controlled.cloud.azure.ip.ControlledAzureIpResource) ApiCreatedControlledAzureIp(bio.terra.workspace.generated.model.ApiCreatedControlledAzureIp) ResponseEntity(org.springframework.http.ResponseEntity) AuthenticatedUserRequest(bio.terra.workspace.service.iam.AuthenticatedUserRequest) ControlledResourceFields(bio.terra.workspace.service.resource.controlled.model.ControlledResourceFields)

Aggregations

ApiCreatedControlledAzureIp (bio.terra.workspace.generated.model.ApiCreatedControlledAzureIp)1 AuthenticatedUserRequest (bio.terra.workspace.service.iam.AuthenticatedUserRequest)1 ControlledAzureIpResource (bio.terra.workspace.service.resource.controlled.cloud.azure.ip.ControlledAzureIpResource)1 ControlledResourceFields (bio.terra.workspace.service.resource.controlled.model.ControlledResourceFields)1 ResponseEntity (org.springframework.http.ResponseEntity)1