Search in sources :

Example 1 with CloudGcsView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView in project cloudbreak by hortonworks.

the class CloudStorageParametersConverter method gcsToCloudView.

public CloudGcsView gcsToCloudView(GcsCloudStorageV1Parameters source) {
    CloudGcsView cloudGcsView = new CloudGcsView(CloudIdentityType.LOG);
    cloudGcsView.setServiceAccountEmail(source.getServiceAccountEmail());
    return cloudGcsView;
}
Also used : CloudGcsView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)

Example 2 with CloudGcsView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView 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();
}
Also used : CloudGcsView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) CloudAdlsGen2View(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View) CloudS3View(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View)

Example 3 with CloudGcsView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView 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();
}
Also used : CloudGcsView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView) AdlsGen2CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters) CloudAdlsGen2View(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View) CloudS3View(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View)

Example 4 with CloudGcsView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView in project cloudbreak by hortonworks.

the class FileSystemConverter method convertGcsLegacy.

private CloudGcsView convertGcsLegacy(GcsFileSystem source) {
    CloudGcsView cloudGcsView = new CloudGcsView(CloudIdentityType.LOG);
    cloudGcsView.setServiceAccountEmail(source.getServiceAccountEmail());
    return cloudGcsView;
}
Also used : CloudGcsView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)

Example 5 with CloudGcsView

use of com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView in project cloudbreak by hortonworks.

the class FileSystemConverter method cloudIdentityToGcsView.

private CloudGcsView cloudIdentityToGcsView(CloudIdentity cloudIdentity) {
    CloudGcsView cloudGcsView = new CloudGcsView(cloudIdentity.getIdentityType());
    GcsIdentity gcsIdentity = cloudIdentity.getGcsIdentity();
    if (Objects.isNull(gcsIdentity)) {
        LOGGER.warn("GCS identity is null. Identity type is {}", cloudIdentity.getIdentityType());
        return null;
    }
    cloudGcsView.setServiceAccountEmail(gcsIdentity.getServiceAccountEmail());
    return cloudGcsView;
}
Also used : GcsIdentity(com.sequenceiq.cloudbreak.domain.cloudstorage.GcsIdentity) CloudGcsView(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)

Aggregations

CloudGcsView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudGcsView)9 Instance (com.google.api.services.compute.model.Instance)2 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 CloudResource (com.sequenceiq.cloudbreak.cloud.model.CloudResource)2 SpiFileSystem (com.sequenceiq.cloudbreak.cloud.model.SpiFileSystem)2 CloudAdlsGen2View (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudAdlsGen2View)2 CloudFileSystemView (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudFileSystemView)2 CloudS3View (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View)2 AdlsGen2CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.AdlsGen2CloudStorageV1Parameters)2 GoogleJsonResponseException (com.google.api.client.googleapis.json.GoogleJsonResponseException)1 Compute (com.google.api.services.compute.Compute)1 Insert (com.google.api.services.compute.Compute.Instances.Insert)1 AttachedDisk (com.google.api.services.compute.model.AttachedDisk)1 InstanceGroup (com.google.api.services.compute.model.InstanceGroup)1 Metadata (com.google.api.services.compute.model.Metadata)1 Items (com.google.api.services.compute.model.Metadata.Items)1 Operation (com.google.api.services.compute.model.Operation)1 Scheduling (com.google.api.services.compute.model.Scheduling)1 ServiceAccount (com.google.api.services.compute.model.ServiceAccount)1 Iam (com.google.api.services.iam.v1.Iam)1