use of org.alien4cloud.git.model.GitHardcodedCredential in project alien4cloud by alien4cloud.
the class ApplicationEnvironmentGitController method getByEnvironmentId.
@ApiOperation(value = "Retrieve information about a git repository using environment Id.")
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("isAuthenticated()")
public RestResponse<GitLocation> getByEnvironmentId(@ApiParam(value = "Application id", required = true) @PathVariable String applicationId, @ApiParam(value = "Environment id", required = true) @PathVariable String environmentId) {
checkEnvironmentAuthorization(applicationId, environmentId);
GitLocation gitLocation = gitLocationDao.findDeploymentSetupLocation(applicationId, environmentId);
if (gitLocation.isLocal()) {
gitLocation.setUrl(GitLocation.LOCAL_PREFIX);
}
gitLocation.setCredential(new GitHardcodedCredential());
return RestResponseBuilder.<GitLocation>builder().data(gitLocation).build();
}
use of org.alien4cloud.git.model.GitHardcodedCredential in project alien4cloud by alien4cloud.
the class ApplicationVariableGitController method getByEnvironmentId.
@ApiOperation(value = "Retrieve information about a git repository using environment Id.")
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("isAuthenticated()")
public RestResponse<GitLocation> getByEnvironmentId(@ApiParam(value = "Application id", required = true) @PathVariable String applicationId) {
applicationService.checkAndGetApplication(applicationId, ApplicationRole.APPLICATION_MANAGER);
GitLocation gitLocation = gitLocationDao.findApplicationVariablesLocation(applicationId);
if (gitLocation.isLocal()) {
gitLocation.setUrl(GitLocation.LOCAL_PREFIX);
}
gitLocation.setCredential(new GitHardcodedCredential());
return RestResponseBuilder.<GitLocation>builder().data(gitLocation).build();
}
use of org.alien4cloud.git.model.GitHardcodedCredential in project alien4cloud by alien4cloud.
the class ApplicationVariableGitController method updateToCustomGit.
@ApiOperation(value = "Update the remote git repository parameters for storing application variables.")
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> updateToCustomGit(@ApiParam(value = "Application id", required = true) @PathVariable String applicationId, @Valid @RequestBody UpdateGitLocationRequest request) {
applicationService.checkAndGetApplication(applicationId, ApplicationRole.APPLICATION_MANAGER);
String id = GitLocation.IdBuilder.forApplicationVariables(applicationId);
GitLocation gitLocation = GitLocation.builder().id(id).gitType(GitType.ApplicationVariables).branch(request.getBranch()).credential(new GitHardcodedCredential(request.getUsername(), request.getPassword())).path(request.getPath()).url(request.getUrl()).build();
gitLocationService.updateToRemoteGit(gitLocation);
return RestResponseBuilder.<Void>builder().build();
}
use of org.alien4cloud.git.model.GitHardcodedCredential in project alien4cloud by alien4cloud.
the class ApplicationEnvironmentGitController method updateToCustomGit.
@ApiOperation(value = "Update the remote git repository parameters for storing environment deployment config")
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
@PreAuthorize("isAuthenticated()")
@Audit
public RestResponse<Void> updateToCustomGit(@ApiParam(value = "Application id", required = true) @PathVariable String applicationId, @ApiParam(value = "Environment id", required = true) @PathVariable String environmentId, @Valid @RequestBody UpdateGitLocationRequest request) {
checkEnvironmentAuthorization(applicationId, environmentId);
String id = GitLocation.IdBuilder.forDeploymentSetup(applicationId, environmentId);
GitLocation gitLocation = GitLocation.builder().id(id).gitType(GitLocation.GitType.DeploymentConfig).branch(request.getBranch()).credential(new GitHardcodedCredential(request.getUsername(), request.getPassword())).path(request.getPath()).url(request.getUrl()).build();
gitLocationService.updateToRemoteGit(gitLocation);
return RestResponseBuilder.<Void>builder().build();
}
Aggregations