Package com.sequenceiq.cloudbreak.domain

Examples of com.sequenceiq.cloudbreak.domain.Credential


    public static String getUserCerFileName(Credential credential, String user) {
        return String.format("%s/%s/%s.cer", getCertificateFolder(user), credential.getId(), user);
    }

    public File getCertificateFile(Long credentialId, CbUser user) {
        Credential credential = credentialRepository.findOne(credentialId);
        if (credential == null) {
            throw new NotFoundException(String.format("Credential '%s' not found", credentialId));
        }
        return new File(getUserCerFileName(credential, azureStackUtil.emailAsFolder(user)));
    }
View Full Code Here


        }
    }

    @Override
    public Credential get(Long id) {
        Credential credential = credentialRepository.findOne(id);
        if (credential == null) {
            throw new NotFoundException(String.format("Credential '%s' not found.", id));
        } else {
            return credential;
        }
View Full Code Here

    @Override
    public Credential create(CbUser user, Credential credential) {
        MDCBuilder.buildMdcContext(credential);
        LOGGER.debug("Creating credential: [User: '{}', Account: '{}']", user.getUsername(), user.getAccount());
        Credential savedCredential = null;
        credential.setOwner(user.getUserId());
        credential.setAccount(user.getAccount());
        try {
            savedCredential = credentialRepository.save(credential);
        } catch (DataIntegrityViolationException ex) {
View Full Code Here

        return savedCredential;
    }

    @Override
    public void delete(Long id) {
        Credential credential = credentialRepository.findOne(id);
        if (credential == null) {
            throw new NotFoundException(String.format("Credential '%s' not found.", id));
        }
        credentialRepository.delete(credential);
        websocketService.sendToTopicUser(credential.getOwner(), WebsocketEndPoint.CREDENTIAL,
                new StatusMessage(credential.getId(), credential.getName(), Status.DELETE_COMPLETED.name()));
    }
View Full Code Here

    private RetryingStackUpdater retryingStackUpdater;

    @Override
    public void setupProvisioning(Stack stack) {
        MDCBuilder.buildMdcContext(stack);
        Credential credential = stack.getCredential();
        String emailAsFolder = azureStackUtil.emailAsFolder(stack.getOwner());

        String filePath = AzureCertificateService.getUserJksFileName(credential, emailAsFolder);
        AzureClient azureClient = azureStackUtil.createAzureClient(credential, filePath);
        if (!azureClient.isImageAvailable(azureStackUtil.getOsImageName(credential))) {
View Full Code Here

    }

    @RequestMapping(value = "credentials/{credentialId}", method = RequestMethod.GET)
    @ResponseBody
    public ResponseEntity<CredentialJson> getCredential(@ModelAttribute("user") CbUser user, @PathVariable Long credentialId) {
        Credential credential = credentialService.get(credentialId);
        return new ResponseEntity<>(convert(credential), HttpStatus.OK);
    }
View Full Code Here

        FileCopyUtils.copy(Files.readAllBytes(cerFile.toPath()), response.getOutputStream());
        return null;
    }

    private ResponseEntity<IdJson> createCredential(CbUser user, CredentialJson credentialRequest, Boolean publicInAccount) {
        Credential credential = convert(credentialRequest);
        credential.setPublicInAccount(publicInAccount);
        credential = credentialService.create(user, credential);
        return new ResponseEntity<>(new IdJson(credential.getId()), HttpStatus.CREATED);
    }
View Full Code Here

        credential = credentialService.create(user, credential);
        return new ResponseEntity<>(new IdJson(credential.getId()), HttpStatus.CREATED);
    }

    private Credential convert(CredentialJson json) {
        Credential ret = null;
        switch (json.getCloudPlatform()) {
            case AWS:
                ret = awsCredentialConverter.convert(json);
                break;
            case AZURE:
View Full Code Here

    @Autowired
    private StackRepository stackRepository;

    public StackDescription describeStackWithResources(Stack actualStack) {
        Stack stack = stackRepository.findById(actualStack.getId());
        Credential credential = stack.getCredential();
        final CloudPlatform cloudPlatform = credential.cloudPlatform();
        if (cloudPlatform.isWithTemplate()) {
            return cloudPlatformConnectors.get(cloudPlatform).describeStackWithResources(stack, stack.getCredential());
        } else {
            try {
                DetailedStackDescription dSD = new DetailedStackDescription();
View Full Code Here

    @Before
    public void setUp() {
        underTest = new ClusterRequestHandler();
        MockitoAnnotations.initMocks(this);
        Credential credential = AwsConnectorTestUtil.createAwsCredential();
        Template awsTemplate = AwsConnectorTestUtil.createAwsTemplate();
        stackEvent = new Event<>(ServiceTestUtils.createStack(awsTemplate, credential));
        stackEvent.setKey(AMBARI_STARTED);
    }
View Full Code Here

TOP

Related Classes of com.sequenceiq.cloudbreak.domain.Credential

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.