use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View in project cloudbreak by hortonworks.
the class CloudStorageParametersConverter method adlsGen2ToCloudView.
public CloudAdlsGen2View adlsGen2ToCloudView(StorageIdentityBase source) {
CloudAdlsGen2View cloudAdlsGen2View = new CloudAdlsGen2View(source.getType());
AdlsGen2CloudStorageV1Parameters adlsGen2 = source.getAdlsGen2();
cloudAdlsGen2View.setAccountKey(adlsGen2.getAccountKey());
cloudAdlsGen2View.setAccountName(adlsGen2.getAccountName());
cloudAdlsGen2View.setSecure(adlsGen2.isSecure());
cloudAdlsGen2View.setManagedIdentity(adlsGen2.getManagedIdentity());
return cloudAdlsGen2View;
}
use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View in project cloudbreak by hortonworks.
the class AzureSetup method validateAdlsGen2FileSystem.
private void validateAdlsGen2FileSystem(SpiFileSystem fileSystem) throws URISyntaxException, InvalidKeyException, StorageException {
CloudAdlsGen2View cloudFileSystem = (CloudAdlsGen2View) fileSystem.getCloudFileSystems().get(0);
String accountName = cloudFileSystem.getAccountName();
String accountKey = cloudFileSystem.getAccountKey();
String connectionString = "DefaultEndpointsProtocol=https;AccountName=" + accountName + ";AccountKey=" + accountKey + ";EndpointSuffix=core.windows.net";
CloudStorageAccount storageAccount = CloudStorageAccount.parse(connectionString);
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
CloudBlobContainer containerReference = blobClient.getContainerReference(TEST_CONTAINER + System.nanoTime());
try {
containerReference.createIfNotExists();
containerReference.delete();
} catch (StorageException e) {
if (e.getCause() instanceof UnknownHostException) {
throw new CloudConnectorException("The provided account does not belong to a valid storage account");
}
}
}
use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildFileSystemViewFromTelemetry.
private Optional<CloudFileSystemView> buildFileSystemViewFromTelemetry(Logging logging) {
if (logging.getStorageLocation() != null) {
if (logging.getS3() != null) {
CloudS3View s3View = new CloudS3View(CloudIdentityType.LOG);
s3View.setInstanceProfile(logging.getS3().getInstanceProfile());
return Optional.of(s3View);
} else if (logging.getAdlsGen2() != null) {
CloudAdlsGen2View adlsGen2View = new CloudAdlsGen2View(CloudIdentityType.LOG);
AdlsGen2CloudStorageV1Parameters adlsGen2Params = logging.getAdlsGen2();
adlsGen2View.setAccountKey(adlsGen2Params.getAccountKey());
adlsGen2View.setAccountName(adlsGen2Params.getAccountName());
adlsGen2View.setSecure(adlsGen2Params.isSecure());
adlsGen2View.setManagedIdentity(adlsGen2Params.getManagedIdentity());
return Optional.of(adlsGen2View);
} else if (logging.getGcs() != null) {
CloudGcsView cloudGcsView = new CloudGcsView(CloudIdentityType.LOG);
cloudGcsView.setServiceAccountEmail(logging.getGcs().getServiceAccountEmail());
return Optional.of(cloudGcsView);
} else if (logging.getCloudwatch() != null) {
CloudS3View s3View = new CloudS3View(CloudIdentityType.LOG);
s3View.setInstanceProfile(logging.getCloudwatch().getInstanceProfile());
return Optional.of(s3View);
}
}
return Optional.empty();
}
use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View in project cloudbreak by hortonworks.
the class StackToCloudStackConverter method buildFileSystemViewFromBackup.
private Optional<CloudFileSystemView> buildFileSystemViewFromBackup(Backup backup) {
if (backup.getStorageLocation() != null) {
if (backup.getS3() != null) {
CloudS3View s3View = new CloudS3View(CloudIdentityType.LOG);
s3View.setInstanceProfile(backup.getS3().getInstanceProfile());
return Optional.of(s3View);
} else if (backup.getAdlsGen2() != null) {
CloudAdlsGen2View adlsGen2View = new CloudAdlsGen2View(CloudIdentityType.LOG);
AdlsGen2CloudStorageV1Parameters adlsGen2Params = backup.getAdlsGen2();
adlsGen2View.setAccountKey(adlsGen2Params.getAccountKey());
adlsGen2View.setAccountName(adlsGen2Params.getAccountName());
adlsGen2View.setSecure(adlsGen2Params.isSecure());
adlsGen2View.setManagedIdentity(adlsGen2Params.getManagedIdentity());
return Optional.of(adlsGen2View);
} else if (backup.getGcs() != null) {
CloudGcsView cloudGcsView = new CloudGcsView(CloudIdentityType.LOG);
cloudGcsView.setServiceAccountEmail(backup.getGcs().getServiceAccountEmail());
return Optional.of(cloudGcsView);
}
}
return Optional.empty();
}
use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View in project cloudbreak by hortonworks.
the class FileSystemConverter method cloudIdentityToAdlsGen2View.
private CloudFileSystemView cloudIdentityToAdlsGen2View(CloudIdentity cloudIdentity) {
CloudAdlsGen2View cloudAdlsGen2View = new CloudAdlsGen2View(cloudIdentity.getIdentityType());
AdlsGen2Identity adlsGen2Identity = cloudIdentity.getAdlsGen2Identity();
if (Objects.isNull(adlsGen2Identity)) {
LOGGER.warn("ADLS Gen2 managed identity with type {} is null.", cloudIdentity.getIdentityType());
return null;
}
cloudAdlsGen2View.setManagedIdentity(adlsGen2Identity.getManagedIdentity());
return cloudAdlsGen2View;
}
Aggregations