Search in sources :

Example 1 with ApiResourceAttributesUnion

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

the class MakeApiResourceDescriptionTest method mapReferencedBigQueryDatasetTest.

@Test
public void mapReferencedBigQueryDatasetTest() throws Exception {
    String projectId = RandomStringUtils.randomAlphabetic(12);
    String datasetName = RandomStringUtils.randomAlphabetic(12);
    var resource = new ReferencedBigQueryDatasetResource(workspaceId, resourceId, resourceName, description, cloning, projectId, datasetName);
    ApiResourceDescription resourceDescription = resourceController.makeApiResourceDescription(resource);
    validateWsmResource(resourceDescription);
    ApiResourceAttributesUnion union = resourceDescription.getResourceAttributes();
    ApiGcpBigQueryDatasetAttributes attributes = union.getGcpBqDataset();
    assertThat(attributes, is(notNullValue()));
    assertEquals(attributes.getDatasetId(), datasetName);
    assertEquals(attributes.getProjectId(), projectId);
}
Also used : ApiGcpBigQueryDatasetAttributes(bio.terra.workspace.generated.model.ApiGcpBigQueryDatasetAttributes) ApiResourceDescription(bio.terra.workspace.generated.model.ApiResourceDescription) ReferencedBigQueryDatasetResource(bio.terra.workspace.service.resource.referenced.cloud.gcp.bqdataset.ReferencedBigQueryDatasetResource) ApiResourceAttributesUnion(bio.terra.workspace.generated.model.ApiResourceAttributesUnion) BaseUnitTest(bio.terra.workspace.common.BaseUnitTest) Test(org.junit.jupiter.api.Test)

Example 2 with ApiResourceAttributesUnion

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

the class MakeApiResourceDescriptionTest method mapReferencedGcsBucketTest.

@Test
public void mapReferencedGcsBucketTest() throws Exception {
    String bucketName = RandomStringUtils.randomAlphabetic(5).toLowerCase();
    var resource = new ReferencedGcsBucketResource(workspaceId, resourceId, resourceName, description, cloning, bucketName);
    ApiResourceDescription resourceDescription = resourceController.makeApiResourceDescription(resource);
    validateWsmResource(resourceDescription);
    ApiResourceAttributesUnion union = resourceDescription.getResourceAttributes();
    ApiGcpGcsBucketAttributes attributes = union.getGcpGcsBucket();
    assertThat(attributes, is(notNullValue()));
    assertEquals(attributes.getBucketName(), bucketName);
}
Also used : ReferencedGcsBucketResource(bio.terra.workspace.service.resource.referenced.cloud.gcp.gcsbucket.ReferencedGcsBucketResource) ApiResourceDescription(bio.terra.workspace.generated.model.ApiResourceDescription) ApiResourceAttributesUnion(bio.terra.workspace.generated.model.ApiResourceAttributesUnion) ApiGcpGcsBucketAttributes(bio.terra.workspace.generated.model.ApiGcpGcsBucketAttributes) BaseUnitTest(bio.terra.workspace.common.BaseUnitTest) Test(org.junit.jupiter.api.Test)

Example 3 with ApiResourceAttributesUnion

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

the class ControlledAzureDiskResource method toApiAttributesUnion.

@Override
public ApiResourceAttributesUnion toApiAttributesUnion() {
    ApiResourceAttributesUnion union = new ApiResourceAttributesUnion();
    union.azureDisk(toApiAttributes());
    return union;
}
Also used : ApiResourceAttributesUnion(bio.terra.workspace.generated.model.ApiResourceAttributesUnion)

Example 4 with ApiResourceAttributesUnion

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

the class ControlledAzureIpResource method toApiAttributesUnion.

@Override
public ApiResourceAttributesUnion toApiAttributesUnion() {
    ApiResourceAttributesUnion union = new ApiResourceAttributesUnion();
    union.azureIp(toApiAttributes());
    return union;
}
Also used : ApiResourceAttributesUnion(bio.terra.workspace.generated.model.ApiResourceAttributesUnion)

Example 5 with ApiResourceAttributesUnion

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

the class ControlledAzureVmResource method toApiAttributesUnion.

@Override
public ApiResourceAttributesUnion toApiAttributesUnion() {
    ApiResourceAttributesUnion union = new ApiResourceAttributesUnion();
    union.azureVm(toApiAttributes());
    return union;
}
Also used : ApiResourceAttributesUnion(bio.terra.workspace.generated.model.ApiResourceAttributesUnion)

Aggregations

ApiResourceAttributesUnion (bio.terra.workspace.generated.model.ApiResourceAttributesUnion)12 ApiResourceDescription (bio.terra.workspace.generated.model.ApiResourceDescription)5 BaseUnitTest (bio.terra.workspace.common.BaseUnitTest)4 Test (org.junit.jupiter.api.Test)4 ApiDataRepoSnapshotAttributes (bio.terra.workspace.generated.model.ApiDataRepoSnapshotAttributes)1 ApiGcpBigQueryDataTableAttributes (bio.terra.workspace.generated.model.ApiGcpBigQueryDataTableAttributes)1 ApiGcpBigQueryDatasetAttributes (bio.terra.workspace.generated.model.ApiGcpBigQueryDatasetAttributes)1 ApiGcpGcsBucketAttributes (bio.terra.workspace.generated.model.ApiGcpGcsBucketAttributes)1 ApiResourceMetadata (bio.terra.workspace.generated.model.ApiResourceMetadata)1 ReferencedBigQueryDatasetResource (bio.terra.workspace.service.resource.referenced.cloud.gcp.bqdataset.ReferencedBigQueryDatasetResource)1 ReferencedBigQueryDataTableResource (bio.terra.workspace.service.resource.referenced.cloud.gcp.bqdatatable.ReferencedBigQueryDataTableResource)1 ReferencedDataRepoSnapshotResource (bio.terra.workspace.service.resource.referenced.cloud.gcp.datareposnapshot.ReferencedDataRepoSnapshotResource)1 ReferencedGcsBucketResource (bio.terra.workspace.service.resource.referenced.cloud.gcp.gcsbucket.ReferencedGcsBucketResource)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1