use of bio.terra.workspace.model.GitRepoResource in project terra-workspace-manager by DataBiosphere.
the class ReferencedGitRepoLifecycle method testUpdateReference.
private void testUpdateReference(ReferencedGcpResourceApi referencedGcpResourceApi) throws Exception {
String newGitRepoReferenceName = "newGitRepoReferenceName";
String newGitRepoReferenceDescription = "a new description for git repo reference";
GitRepoUtils.updateGitRepoReferenceResource(referencedGcpResourceApi, getWorkspaceId(), gitResourceId, newGitRepoReferenceName, newGitRepoReferenceDescription, /*gitCloneUrl=*/
null);
GitRepoResource updatedResource = referencedGcpResourceApi.getGitRepoReference(getWorkspaceId(), gitResourceId);
assertEquals(newGitRepoReferenceName, updatedResource.getMetadata().getName());
assertEquals(newGitRepoReferenceDescription, updatedResource.getMetadata().getDescription());
}
use of bio.terra.workspace.model.GitRepoResource in project terra-workspace-manager by DataBiosphere.
the class ReferencedGitRepoLifecycle method testGetReference.
private void testGetReference(GitRepoResource gitResource, ReferencedGcpResourceApi referencedGcpResourceApi, ResourceApi resourceApi) throws Exception {
GitRepoResource fetchedGitResource = referencedGcpResourceApi.getGitRepoReference(getWorkspaceId(), gitResourceId);
assertEquals(gitResource, fetchedGitResource);
// Enumerate the reference
ResourceList referenceList = resourceApi.enumerateResources(getWorkspaceId(), 0, 5, /*referenceType=*/
null, /*stewardShipType=*/
null);
assertEquals(1, referenceList.getResources().size());
assertEquals(StewardshipType.REFERENCED, referenceList.getResources().get(0).getMetadata().getStewardshipType());
assertEquals(ResourceType.GIT_REPO, referenceList.getResources().get(0).getMetadata().getResourceType());
}
use of bio.terra.workspace.model.GitRepoResource in project terra-workspace-manager by DataBiosphere.
the class ReferencedGitRepoLifecycle method doUserJourney.
@Override
protected void doUserJourney(TestUserSpecification testUser, WorkspaceApi workspaceApi) throws Exception {
ReferencedGcpResourceApi referencedGcpResourceApi = ClientTestUtils.getReferencedGcpResourceClient(testUser, server);
// Create the reference
GitRepoResource gitResource = GitRepoUtils.makeGitRepoReference(gitRepoAttributes, referencedGcpResourceApi, getWorkspaceId(), MultiResourcesUtils.makeName());
gitResourceId = gitResource.getMetadata().getResourceId();
// Read the reference
ResourceApi resourceApi = ClientTestUtils.getResourceClient(testUser, server);
testGetReference(gitResource, referencedGcpResourceApi, resourceApi);
// Clone the reference
testCloneReference(gitResource, referencedGcpResourceApi, workspaceApi);
// No validation checks yet, we don't validate access to git repos.
// Update the reference
testUpdateReference(referencedGcpResourceApi);
// Delete the reference
referencedGcpResourceApi.deleteGitRepoReference(getWorkspaceId(), gitResourceId);
// Enumerating all resources with no filters should be empty
ResourceList enumerateResult = resourceApi.enumerateResources(getWorkspaceId(), 0, 100, null, null);
assertTrue(enumerateResult.getResources().isEmpty());
}
use of bio.terra.workspace.model.GitRepoResource in project terra-cli by DataBiosphere.
the class GitRepo method addReferenced.
/**
* Add a git repo as a referenced resource in the workspace.
*
* @return the resource that was added
*/
public static GitRepo addReferenced(AddGitRepoParams addGitRepoParams) {
validateEnvironmentVariableName(addGitRepoParams.resourceFields.name);
// call WSM to add the reference.
GitRepoResource addedResource = WorkspaceManagerService.fromContext().createReferencedGitRepo(Context.requireWorkspace().getId(), addGitRepoParams);
logger.info("Created Git repo reference: {}", addedResource);
// convert the WSM object to a CLI object
Context.requireWorkspace().listResourcesAndSync();
return new GitRepo(addedResource);
}
Aggregations