use of bio.terra.workspace.model.CloningInstructionsEnum in project terra-cli by DataBiosphere.
the class GcpNotebookControlled method overrideLocationAndInstanceId.
@Test
@DisplayName("override the default location and instance id")
void overrideLocationAndInstanceId() throws IOException {
workspaceCreator.login();
// `terra workspace set --id=$id`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + getWorkspaceId());
// `terra resource create gcp-notebook --name=$name
// --cloning=$cloning --description=$description
// --location=$location --instance-id=$instanceId`
String name = "overrideLocationAndInstanceId";
CloningInstructionsEnum cloning = CloningInstructionsEnum.REFERENCE;
String description = "\"override default location and instance id\"";
String location = "us-central1-b";
// instance id must start with a letter
String instanceId = "a" + UUID.randomUUID().toString();
UFGcpNotebook createdNotebook = TestCommand.runAndParseCommandExpectSuccess(UFGcpNotebook.class, "resource", "create", "gcp-notebook", "--name=" + name, "--cloning=" + cloning, "--description=" + description, "--location=" + location, "--instance-id=" + instanceId);
// check that the properties match
assertEquals(name, createdNotebook.name, "create output matches name");
assertEquals(cloning, createdNotebook.cloningInstructions, "create output matches cloning");
assertEquals(description, createdNotebook.description, "create output matches description");
assertEquals(location, createdNotebook.location, "create output matches location");
assertEquals(instanceId, createdNotebook.instanceId, "create output matches instance id");
// gcp notebooks are always private
assertEquals(AccessScope.PRIVATE_ACCESS, createdNotebook.accessScope, "create output matches access");
assertEquals(workspaceCreator.email.toLowerCase(), createdNotebook.privateUserName.toLowerCase(), "create output matches private user name");
// `terra resource describe --name=$name --format=json`
UFGcpNotebook describeResource = TestCommand.runAndParseCommandExpectSuccess(UFGcpNotebook.class, "resource", "describe", "--name=" + name);
// check that the properties match
assertEquals(name, describeResource.name, "describe resource output matches name");
assertEquals(cloning, describeResource.cloningInstructions, "describe output matches cloning");
assertEquals(description, describeResource.description, "describe output matches description");
assertEquals(location, describeResource.location, "describe resource output matches location");
assertEquals(instanceId, describeResource.instanceId, "describe resource output matches instance id");
// gcp notebooks are always private
assertEquals(AccessScope.PRIVATE_ACCESS, describeResource.accessScope, "describe output matches access");
assertEquals(workspaceCreator.email.toLowerCase(), describeResource.privateUserName.toLowerCase(), "describe output matches private user name");
}
use of bio.terra.workspace.model.CloningInstructionsEnum in project terra-cli by DataBiosphere.
the class BqDatasetReferenced method addWithAllOptions.
@Test
@DisplayName("add a referenced dataset, specifying all options")
void addWithAllOptions() throws IOException {
workspaceCreator.login();
// `terra workspace set --id=$id`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + getWorkspaceId());
// `terra resource add-ref bq-dataset --name=$name --project-id=$projectId
// --dataset-id=$datasetId --cloning=$cloning
// --description=$description --format=json`
String name = "addWithAllOptions";
CloningInstructionsEnum cloning = CloningInstructionsEnum.NOTHING;
String description = "add with all options";
UFBqDataset addedDataset = TestCommand.runAndParseCommandExpectSuccess(UFBqDataset.class, "resource", "add-ref", "bq-dataset", "--name=" + name, "--project-id=" + externalDataset.getProjectId(), "--dataset-id=" + externalDataset.getDatasetId(), "--cloning=" + cloning, "--description=" + description);
// check that the properties match
assertEquals(name, addedDataset.name, "add ref output matches name");
assertEquals(externalDataset.getProjectId(), addedDataset.projectId, "add ref output matches project id");
assertEquals(externalDataset.getDatasetId(), addedDataset.datasetId, "add ref output matches dataset id");
assertEquals(cloning, addedDataset.cloningInstructions, "add ref output matches cloning");
assertEquals(description, addedDataset.description, "add ref output matches description");
// `terra resource describe --name=$name --format=json`
UFBqDataset describeResource = TestCommand.runAndParseCommandExpectSuccess(UFBqDataset.class, "resource", "describe", "--name=" + name);
// check that the properties match
assertEquals(name, describeResource.name, "describe resource output matches name");
assertEquals(externalDataset.getProjectId(), describeResource.projectId, "describe resource output matches project id");
assertEquals(externalDataset.getDatasetId(), describeResource.datasetId, "describe resource output matches dataset id");
assertEquals(cloning, describeResource.cloningInstructions, "describe output matches cloning");
assertEquals(description, describeResource.description, "describe output matches description");
// `terra resources delete --name=$name`
TestCommand.runCommandExpectSuccess("resource", "delete", "--name=" + name, "--quiet");
}
use of bio.terra.workspace.model.CloningInstructionsEnum in project terra-cli by DataBiosphere.
the class BqTableReferenced method addWithAllOptions.
@Test
@DisplayName("add a referenced data table, specifying all options")
void addWithAllOptions() throws IOException {
workspaceCreator.login();
// `terra workspace set --id=$id`
TestCommand.runCommandExpectSuccess("workspace", "set", "--id=" + getWorkspaceId());
// `terra resource add-ref bq-table --name=$name --project-id=$projectId
// --dataset-id=$datasetId --cloning=$cloning
// --description=$description --format=json`
String name = "addWithAllOptions";
CloningInstructionsEnum cloning = CloningInstructionsEnum.NOTHING;
String description = "add with all options";
UFBqTable addedDataTable = TestCommand.runAndParseCommandExpectSuccess(UFBqTable.class, "resource", "add-ref", "bq-table", "--name=" + name, "--project-id=" + externalDataset.getProjectId(), "--dataset-id=" + externalDataset.getDatasetId(), "--table-id=" + externalDataTableName, "--cloning=" + cloning, "--description=" + description);
// check that the properties match
assertEquals(name, addedDataTable.name, "add ref output matches name");
assertEquals(externalDataset.getProjectId(), addedDataTable.projectId, "add ref output matches project id");
assertEquals(externalDataset.getDatasetId(), addedDataTable.datasetId, "add ref output matches dataset id");
assertEquals(externalDataTableName, addedDataTable.dataTableId, "add ref output matches data table id");
assertEquals(cloning, addedDataTable.cloningInstructions, "add ref output matches cloning");
assertEquals(description, addedDataTable.description, "add ref output matches description");
// `terra resource describe --name=$name --format=json`
UFBqTable describeResource = TestCommand.runAndParseCommandExpectSuccess(UFBqTable.class, "resource", "describe", "--name=" + name);
// check that the properties match
assertEquals(name, describeResource.name, "describe resource output matches name");
assertEquals(externalDataset.getProjectId(), describeResource.projectId, "describe resource output matches project id");
assertEquals(externalDataset.getDatasetId(), describeResource.datasetId, "describe resource output matches dataset id");
assertEquals(externalDataTableName, describeResource.dataTableId, "describe resource output matches data table id");
assertEquals(cloning, describeResource.cloningInstructions, "describe output matches cloning");
assertEquals(description, describeResource.description, "describe output matches description");
// `terra resources delete --name=$name`
TestCommand.runCommandExpectSuccess("resource", "delete", "--name=" + name, "--quiet");
}
Aggregations