Search in sources :

Example 1 with NoSqlConnector

use of com.sequenceiq.cloudbreak.cloud.NoSqlConnector in project cloudbreak by hortonworks.

the class NoSqlTableCreationModeDeterminerService method getNoSqlTableMetaData.

private NoSqlTableMetadataResponse getNoSqlTableMetaData(LocationAwareCredential locationAwareCredential, String dynamoDbTablename) {
    Credential credential = locationAwareCredential.getCredential();
    String cloudPlatform = credential.getCloudPlatform();
    String location = locationAwareCredential.getLocation();
    NoSqlConnector noSqlConnector = getNoSqlConnector(cloudPlatform);
    CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);
    NoSqlTableMetadataRequest request = NoSqlTableMetadataRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
    return noSqlConnector.getNoSqlTableMetaData(request);
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) LocationAwareCredential(com.sequenceiq.environment.environment.domain.LocationAwareCredential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) NoSqlConnector(com.sequenceiq.cloudbreak.cloud.NoSqlConnector) NoSqlTableMetadataRequest(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataRequest)

Example 2 with NoSqlConnector

use of com.sequenceiq.cloudbreak.cloud.NoSqlConnector in project cloudbreak by hortonworks.

the class S3GuardTableDeleteHandler method deleteNoSqlTable.

private ResponseStatus deleteNoSqlTable(LocationAwareCredential locationAwareCredential, String dynamoDbTablename) {
    Credential credential = locationAwareCredential.getCredential();
    String cloudPlatform = credential.getCloudPlatform();
    String location = locationAwareCredential.getLocation();
    NoSqlConnector noSqlConnector = getNoSqlConnector(cloudPlatform);
    CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential);
    NoSqlTableMetadataRequest noSqlTableMetadataRequest = NoSqlTableMetadataRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
    NoSqlTableMetadataResponse noSqlTableMetaData = noSqlConnector.getNoSqlTableMetaData(noSqlTableMetadataRequest);
    if (ResponseStatus.OK.equals(noSqlTableMetaData.getStatus())) {
        NoSqlTableDeleteRequest request = NoSqlTableDeleteRequest.builder().withCloudPlatform(cloudPlatform).withCredential(cloudCredential).withRegion(location).withTableName(dynamoDbTablename).build();
        NoSqlTableDeleteResponse response = noSqlConnector.deleteNoSqlTable(request);
        return response.getStatus();
    } else {
        return ResponseStatus.OK;
    }
}
Also used : Credential(com.sequenceiq.environment.credential.domain.Credential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) LocationAwareCredential(com.sequenceiq.environment.environment.domain.LocationAwareCredential) CloudCredential(com.sequenceiq.cloudbreak.cloud.model.CloudCredential) NoSqlConnector(com.sequenceiq.cloudbreak.cloud.NoSqlConnector) NoSqlTableMetadataRequest(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataRequest) NoSqlTableDeleteResponse(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse) NoSqlTableDeleteRequest(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest) NoSqlTableMetadataResponse(com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse)

Aggregations

NoSqlConnector (com.sequenceiq.cloudbreak.cloud.NoSqlConnector)2 CloudCredential (com.sequenceiq.cloudbreak.cloud.model.CloudCredential)2 NoSqlTableMetadataRequest (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataRequest)2 Credential (com.sequenceiq.environment.credential.domain.Credential)2 LocationAwareCredential (com.sequenceiq.environment.environment.domain.LocationAwareCredential)2 NoSqlTableDeleteRequest (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteRequest)1 NoSqlTableDeleteResponse (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableDeleteResponse)1 NoSqlTableMetadataResponse (com.sequenceiq.cloudbreak.cloud.model.nosql.NoSqlTableMetadataResponse)1