当前位置: 首页>>代码示例>>Java>>正文


Java GenerateSshPairRequest类代码示例

本文整理汇总了Java中org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest的典型用法代码示例。如果您正苦于以下问题:Java GenerateSshPairRequest类的具体用法?Java GenerateSshPairRequest怎么用?Java GenerateSshPairRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GenerateSshPairRequest类属于org.eclipse.che.api.ssh.shared.dto包,在下文中一共展示了GenerateSshPairRequest类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldMakeGeneratePairRequest

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
@Test
public void shouldMakeGeneratePairRequest() throws Exception {
  // given
  GenerateSshPairRequest sshPairRequest = mock(GenerateSshPairRequest.class);

  // when
  client.generatePair(sshPairRequest);

  // then
  String url = fromUri(SSH_SERVICE_URL).path(SshService.class, "generatePair").build().toString();
  verify(requestFactory).fromUrl(eq(url));
  verify(jsonRequest).usePostMethod();
  verify(jsonRequest).setBody(eq(sshPairRequest));
  verify(jsonRequest).request();
  verify(jsonResponse).asDto(eq(SshPairDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:17,代码来源:HttpSshServiceClientTest.java

示例2: generatePair

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
@Override
public SshPairDto generatePair(GenerateSshPairRequest request) throws ServerException {
  try {
    return requestFactory
        .fromUrl(sshUrl + "/generate")
        .usePostMethod()
        .setBody(request)
        .request()
        .asDto(SshPairDto.class);
  } catch (IOException | ApiException e) {
    throw new ServerException(e);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:HttpSshServiceClient.java

示例3: generateVCSKey

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
public String generateVCSKey(String keyName) throws Exception {
  GenerateSshPairRequest generateSshKeyData =
      newDto(GenerateSshPairRequest.class).withName(keyName).withService(VCS_SERVICE);

  HttpJsonResponse response =
      requestFactory
          .fromUrl(apiEndpoint + "ssh/generate")
          .usePostMethod()
          .setBody(generateSshKeyData)
          .request();
  return response.asDto(SshPairDto.class).getPublicKey();
}
 
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:TestSshServiceClient.java

示例4: generatePair

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
@POST
@Path("generate")
@Consumes(APPLICATION_JSON)
@Produces(APPLICATION_JSON)
@GenerateLink(rel = Constants.LINK_REL_GENERATE_PAIR)
@ApiOperation(
  value = "Generate and stores ssh pair based on the request",
  notes =
      "This operation can be performed only by authorized user,"
          + "this user will be the owner of the created ssh pair",
  response = SshPairDto.class
)
@ApiResponses({
  @ApiResponse(code = 201, message = "The ssh pair successfully generated"),
  @ApiResponse(code = 400, message = "Missed required parameters, parameters are not valid"),
  @ApiResponse(
    code = 409,
    message =
        "Conflict error occurred during the ssh pair generation"
            + "(e.g. The Ssh pair with such name and service already exists)"
  ),
  @ApiResponse(code = 500, message = "Internal server error occurred")
})
public Response generatePair(
    @ApiParam(value = "The configuration to generate the new ssh pair", required = true)
        GenerateSshPairRequest request)
    throws BadRequestException, ServerException, ConflictException {
  requiredNotNull(request, "Generate ssh pair request required");
  requiredNotNull(request.getService(), "Service name required");
  requiredNotNull(request.getName(), "Name required");
  final SshPairImpl generatedPair =
      sshManager.generatePair(getCurrentUserId(), request.getService(), request.getName());

  return Response.status(Response.Status.CREATED)
      .entity(asDto(injectLinks(asDto(generatedPair))))
      .build();
}
 
开发者ID:eclipse,项目名称:che,代码行数:38,代码来源:SshService.java

示例5: generatePair

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
@Override
public Promise<SshPairDto> generatePair(String service, String name) {
  return asyncRequestFactory
      .createPostRequest(
          sshApi + "/generate",
          dtoFactory.createDto(GenerateSshPairRequest.class).withService(service).withName(name))
      .header(HTTPHeader.ACCEPT, MimeType.APPLICATION_JSON)
      .send(unmarshallerFactory.newUnmarshaller(SshPairDto.class));
}
 
开发者ID:eclipse,项目名称:che,代码行数:10,代码来源:SshServiceClientImpl.java

示例6: updateSSHKey

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
@POST
@Path("ssh/generate")
public void updateSSHKey(@HeaderParam(AUTH_HEADER_NAME) String oauthToken) throws ApiException {
  final String host = "github.com";
  SshPair sshPair = null;
  try {
    sshPair = sshServiceClient.getPair("vcs", host);
  } catch (NotFoundException ignored) {
  }

  if (sshPair != null) {
    if (sshPair.getPublicKey() == null) {
      sshServiceClient.removePair("vcs", host);
      sshPair =
          sshServiceClient.generatePair(
              newDto(GenerateSshPairRequest.class).withService("vcs").withName(host));
    }
  } else {
    sshPair =
        sshServiceClient.generatePair(
            newDto(GenerateSshPairRequest.class).withService("vcs").withName(host));
  }

  // update public key
  try {
    githubKeyUploader.uploadKey(sshPair.getPublicKey(), oauthToken);
  } catch (IOException e) {
    LOG.error("Upload github ssh key fail", e);
    throw new GitException(e.getMessage(), e);
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:GitHubService.java

示例7: generatePair

import org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest; //导入依赖的package包/类
/**
 * Generates and store ssh pair for current user.
 *
 * @param request config for generating ssh pair
 * @return instance of generated ssh pair
 * @throws ServerException when some error occurred while generating or saving ssh pair
 */
SshPairDto generatePair(GenerateSshPairRequest request) throws ServerException;
 
开发者ID:eclipse,项目名称:che,代码行数:9,代码来源:SshServiceClient.java


注:本文中的org.eclipse.che.api.ssh.shared.dto.GenerateSshPairRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。