List of usage examples for com.amazonaws.services.codebuild.model CreateProjectResult getProject
public Project getProject()
Information about the build project that was created.
From source file:ProjectFactory.java
License:Open Source License
public String createProject(String projectName, String description, ProjectSource source, ProjectArtifacts artifacts, ProjectEnvironment environment, String serviceIAMRole, String timeout, String encryptionKey) throws Exception { ListProjectsRequest lpRequest;//from w w w .j av a2 s . co m ListProjectsResult lpResult; List<String> projects = new ArrayList<String>(); String nextToken = null; do { lpRequest = new ListProjectsRequest().withNextToken(nextToken); lpResult = cbClient.listProjects(lpRequest); nextToken = lpResult.getNextToken(); projects.addAll(lpResult.getProjects()); } while (nextToken != null); if (projects.contains(projectName)) { UpdateProjectResult upResult = cbClient.updateProject( new UpdateProjectRequest().withName(projectName).withDescription(description).withSource(source) .withArtifacts(artifacts).withEnvironment(environment).withServiceRole(serviceIAMRole) .withTimeoutInMinutes(Validation.parseInt(timeout)).withEncryptionKey(encryptionKey)); return upResult.getProject().getName(); } else { CreateProjectResult cpResult = cbClient.createProject( new CreateProjectRequest().withName(projectName).withDescription(description).withSource(source) .withArtifacts(artifacts).withEnvironment(environment).withServiceRole(serviceIAMRole) .withTimeoutInMinutes(Validation.parseInt(timeout)).withEncryptionKey(encryptionKey)); return cpResult.getProject().getName(); } }