use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.
the class DeleteProjectFlightIntegrationTest method assertProjectExists.
private Project assertProjectExists(ResourceId resourceId) throws Exception {
Resource resource = bufferDao.retrieveResource(resourceId).get();
Project project = rmCow.projects().get(resource.cloudResourceUid().getGoogleProjectUid().getProjectId()).execute();
assertEquals("ACTIVE", project.getState());
return project;
}
use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.
the class DeleteProjectFlightIntegrationTest method assertProjectDeleting.
private void assertProjectDeleting(String projectId) throws Exception {
// Project is ready for deletion
Project project = rmCow.projects().get(projectId).execute();
assertEquals("DELETE_REQUESTED", project.getState());
}
use of com.blackducksoftware.bdio2.model.Project in project terra-resource-buffer by DataBiosphere.
the class DeleteProjectStep method doStep.
@Override
public StepResult doStep(FlightContext flightContext) throws InterruptedException, RetryException {
String projectId = flightContext.getInputParameters().get(CLOUD_RESOURCE_UID, CloudResourceUid.class).getGoogleProjectUid().getProjectId();
try {
Optional<Project> project = retrieveProject(rmCow, projectId);
if (project.isEmpty() || isProjectDeleting(project.get())) {
// Skip if project does not exist, or is being deleted. We know that the project is
// created by Resource Buffer Service hence Resource Buffer Service should have owner
// permission. So we assume 403 in this case
// means that the project does not exist.
logger.info("Project id: {} is deleted or being deleted", projectId);
return StepResult.getStepResultSuccess();
}
OperationCow<?> operation = rmCow.operations().operationCow(rmCow.projects().delete(projectId).execute());
pollUntilSuccess(operation, Duration.ofSeconds(5), Duration.ofMinutes(5));
} catch (IOException e) {
logger.info("Error when deleting GCP project", e);
return new StepResult(StepStatus.STEP_RESULT_FAILURE_RETRY, e);
}
return StepResult.getStepResultSuccess();
}
use of com.blackducksoftware.bdio2.model.Project in project blackduck-common by blackducksoftware.
the class Bdio2Factory method createLegacyBdio2Document.
/**
* @deprecated (Use createBdio2Document instead when the ProjectDependencyGraph has an accurate ProjectDependency)
*/
@Deprecated
public Bdio2Document createLegacyBdio2Document(BdioMetadata bdioMetadata, DependencyGraph dependencyGraph, ProjectInfo projectInfo, ExternalId projectExternalId) {
Project project = createProject(projectInfo.getNameVersion(), projectExternalId, true);
Pair<List<Project>, List<Component>> subprojectsAndComponents = createAndLinkComponents(dependencyGraph, project);
return new Bdio2Document(bdioMetadata, project, subprojectsAndComponents.getLeft(), subprojectsAndComponents.getRight());
}
use of com.blackducksoftware.bdio2.model.Project in project blackduck-common by blackducksoftware.
the class Bdio2Factory method createBdioMetadata.
private BdioMetadata createBdioMetadata(String codeLocationName, ProjectInfo projectInfo, ZonedDateTime creationDateTime, ProductList productList) {
BdioMetadata metadata = new BdioMetadata().id(LegacyUtilities.toNameUri(codeLocationName)).name(codeLocationName).project(projectInfo.getNameVersion().getName()).projectVersion(projectInfo.getNameVersion().getVersion()).creationDateTime(creationDateTime).publisher(productList);
projectInfo.getProjectGroup().ifPresent(metadata::projectGroup);
projectInfo.getCorrelationId().ifPresent(metadata::correlationId);
projectInfo.getGitInfo().getSourceRevision().ifPresent(metadata::sourceRevision);
projectInfo.getGitInfo().getSourceBranch().ifPresent(metadata::sourceBranch);
projectInfo.getGitInfo().getSourceRepository().map(URL::toString).ifPresent(metadata::sourceRepository);
return metadata;
}
Aggregations