Search in sources :

Example 6 with StorageLocationBase

use of com.sequenceiq.common.api.cloudstorage.StorageLocationBase in project cloudbreak by hortonworks.

the class CloudStorageManifesterTest method whenConfigIsProvidedReturnFileSystemParameters.

@Test
public void whenConfigIsProvidedReturnFileSystemParameters() {
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    mockFileSystemResponseForCloudbreakClient();
    SdxCluster sdxCluster = new SdxCluster();
    SdxClusterRequest sdxClusterRequest = new SdxClusterRequest();
    sdxCluster.setInitiatorUserCrn(USER_CRN);
    sdxCluster.setClusterName("sdx-cluster");
    SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
    cloudStorageRequest.setBaseLocation("s3a://example-path");
    cloudStorageRequest.setFileSystemType(FileSystemType.S3);
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile("instance:profile");
    cloudStorageRequest.setS3(s3Params);
    sdxClusterRequest.setCloudStorage(cloudStorageRequest);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("AWS");
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setBlueprintName(exampleBlueprintName);
    CloudStorageRequest cloudStorageConfigReq = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initCloudStorageRequest(environment, clusterV4Request, sdxCluster, sdxClusterRequest));
    StorageLocationBase singleRequest = cloudStorageConfigReq.getLocations().iterator().next();
    assertEquals(1, cloudStorageConfigReq.getIdentities().size());
    assertEquals(CloudIdentityType.ID_BROKER, cloudStorageConfigReq.getIdentities().iterator().next().getType());
    assertEquals(1, cloudStorageConfigReq.getLocations().size());
    assertEquals(CloudStorageCdpService.RANGER_AUDIT, singleRequest.getType());
    assertEquals("ranger/example-path", singleRequest.getValue());
    verify(storageValidationService).validateCloudStorage("AWS", cloudStorageRequest);
}
Also used : SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.jupiter.api.Test)

Example 7 with StorageLocationBase

use of com.sequenceiq.common.api.cloudstorage.StorageLocationBase in project cloudbreak by hortonworks.

the class CloudStorageManifesterTest method whenEnvironmentHasLoggingEnabledThenShouldApplyAsLogIdentityForGCS.

@Test
public void whenEnvironmentHasLoggingEnabledThenShouldApplyAsLogIdentityForGCS() {
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    mockFileSystemResponseForCloudbreakClient();
    SdxCluster sdxCluster = new SdxCluster();
    SdxClusterRequest sdxClusterRequest = new SdxClusterRequest();
    sdxCluster.setInitiatorUserCrn(USER_CRN);
    sdxCluster.setClusterName("sdx-cluster");
    SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
    cloudStorageRequest.setBaseLocation("gs://example-path");
    cloudStorageRequest.setFileSystemType(FileSystemType.GCS);
    GcsCloudStorageV1Parameters gcsCloudStorageV1Parameters = new GcsCloudStorageV1Parameters();
    gcsCloudStorageV1Parameters.setServiceAccountEmail(EMAIL);
    cloudStorageRequest.setGcs(gcsCloudStorageV1Parameters);
    sdxClusterRequest.setCloudStorage(cloudStorageRequest);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("GCP");
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    LoggingResponse loggingResponse = new LoggingResponse();
    loggingResponse.setGcs(gcsCloudStorageV1Parameters);
    telemetryResponse.setLogging(loggingResponse);
    GcpEnvironmentParameters gcpEnvironmentParameters = GcpEnvironmentParameters.builder().build();
    environment.setGcp(gcpEnvironmentParameters);
    environment.setTelemetry(telemetryResponse);
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setBlueprintName(exampleBlueprintName);
    CloudStorageRequest cloudStorageConfigReq = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initCloudStorageRequest(environment, clusterV4Request, sdxCluster, sdxClusterRequest));
    StorageLocationBase singleRequest = cloudStorageConfigReq.getLocations().iterator().next();
    assertEquals(2, cloudStorageConfigReq.getIdentities().size());
    assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.ID_BROKER)).collect(Collectors.toSet()).size());
    assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.LOG)).collect(Collectors.toSet()).size());
    assertEquals(2, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getGcs().getServiceAccountEmail().equals(EMAIL)).collect(Collectors.toSet()).size());
    assertEquals(1, cloudStorageConfigReq.getLocations().size());
    assertEquals(CloudStorageCdpService.RANGER_AUDIT, singleRequest.getType());
    assertEquals("ranger/example-path", singleRequest.getValue());
    verify(storageValidationService).validateCloudStorage("GCP", cloudStorageRequest);
}
Also used : SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) GcpEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) Mock(org.mockito.Mock) FileSystemParameterV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) AwsEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters) ArrayList(java.util.ArrayList) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) FileSystemParameterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Response) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) InjectMocks(org.mockito.InjectMocks) RegionAwareInternalCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGenerator) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) FileSystemV4Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Test(org.junit.jupiter.api.Test) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) List(java.util.List) S3GuardRequestParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) GcpEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.jupiter.api.Test)

Example 8 with StorageLocationBase

use of com.sequenceiq.common.api.cloudstorage.StorageLocationBase in project cloudbreak by hortonworks.

the class CloudStorageManifesterTest method whenEnvironmentHasLoggingEnabledThenShouldApplyAsLogIdentity.

@Test
public void whenEnvironmentHasLoggingEnabledThenShouldApplyAsLogIdentity() {
    when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
    when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
    mockFileSystemResponseForCloudbreakClient();
    SdxCluster sdxCluster = new SdxCluster();
    SdxClusterRequest sdxClusterRequest = new SdxClusterRequest();
    sdxCluster.setInitiatorUserCrn(USER_CRN);
    sdxCluster.setClusterName("sdx-cluster");
    SdxCloudStorageRequest cloudStorageRequest = new SdxCloudStorageRequest();
    cloudStorageRequest.setBaseLocation("s3a://example-path");
    cloudStorageRequest.setFileSystemType(FileSystemType.S3);
    S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
    s3Params.setInstanceProfile("instance:profile");
    cloudStorageRequest.setS3(s3Params);
    sdxClusterRequest.setCloudStorage(cloudStorageRequest);
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("AWS");
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    LoggingResponse loggingResponse = new LoggingResponse();
    S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
    s3CloudStorageV1Parameters.setInstanceProfile("logprofile");
    loggingResponse.setS3(s3CloudStorageV1Parameters);
    telemetryResponse.setLogging(loggingResponse);
    AwsEnvironmentParameters awsEnvironmentParameters = new AwsEnvironmentParameters();
    S3GuardRequestParameters s3GuardRequestParameters = new S3GuardRequestParameters();
    s3GuardRequestParameters.setDynamoDbTableName("table");
    awsEnvironmentParameters.setS3guard(s3GuardRequestParameters);
    environment.setAws(awsEnvironmentParameters);
    environment.setTelemetry(telemetryResponse);
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setBlueprintName(exampleBlueprintName);
    CloudStorageRequest cloudStorageConfigReq = ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.initCloudStorageRequest(environment, clusterV4Request, sdxCluster, sdxClusterRequest));
    StorageLocationBase singleRequest = cloudStorageConfigReq.getLocations().iterator().next();
    assertEquals(2, cloudStorageConfigReq.getIdentities().size());
    assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.ID_BROKER)).collect(Collectors.toSet()).size());
    assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.LOG)).collect(Collectors.toSet()).size());
    assertEquals("table", cloudStorageConfigReq.getAws().getS3Guard().getDynamoTableName());
    assertEquals(1, cloudStorageConfigReq.getLocations().size());
    assertEquals(CloudStorageCdpService.RANGER_AUDIT, singleRequest.getType());
    assertEquals("ranger/example-path", singleRequest.getValue());
    verify(storageValidationService).validateCloudStorage("AWS", cloudStorageRequest);
}
Also used : SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) GcpEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) Mock(org.mockito.Mock) FileSystemParameterV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) AwsEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters) ArrayList(java.util.ArrayList) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) FileSystemParameterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Response) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) InjectMocks(org.mockito.InjectMocks) RegionAwareInternalCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGenerator) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) FileSystemV4Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Test(org.junit.jupiter.api.Test) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) List(java.util.List) S3GuardRequestParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) S3GuardRequestParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) AwsEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.jupiter.api.Test)

Example 9 with StorageLocationBase

use of com.sequenceiq.common.api.cloudstorage.StorageLocationBase in project cloudbreak by hortonworks.

the class CloudStorageManifester method setStorageLocations.

private void setStorageLocations(FileSystemParameterV4Responses fileSystemRecommendations, CloudStorageRequest cloudStorageRequest) {
    List<StorageLocationBase> storageLocations = fileSystemRecommendations.getResponses().stream().map(response -> {
        StorageLocationBase storageLocation = new StorageLocationBase();
        storageLocation.setValue(response.getDefaultPath());
        storageLocation.setType(CloudStorageCdpService.valueOf(response.getType()));
        return storageLocation;
    }).collect(Collectors.toList());
    cloudStorageRequest.setLocations(storageLocations);
}
Also used : SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) AwsStorageParameters(com.sequenceiq.common.api.cloudstorage.AwsStorageParameters) FileSystemParameterV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses) LoggerFactory(org.slf4j.LoggerFactory) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) StringUtils(org.apache.commons.lang3.StringUtils) Inject(javax.inject.Inject) Strings(com.google.common.base.Strings) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) Service(org.springframework.stereotype.Service) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) Logger(org.slf4j.Logger) StorageIdentityBase(com.sequenceiq.common.api.cloudstorage.StorageIdentityBase) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) CloudStorageResponse(com.sequenceiq.common.api.cloudstorage.CloudStorageResponse) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Collectors(java.util.stream.Collectors) FileSystemV4Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) List(java.util.List) CollectionUtils(org.springframework.util.CollectionUtils) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) ClusterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response) S3Guard(com.sequenceiq.common.api.cloudstorage.S3Guard) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase)

Example 10 with StorageLocationBase

use of com.sequenceiq.common.api.cloudstorage.StorageLocationBase in project cloudbreak by hortonworks.

the class AwsDataAccessRolePermissionValidatorTest method testGetPolicyJsonReplacementsNoDynamodb.

@Test
@Override
public void testGetPolicyJsonReplacementsNoDynamodb() {
    String storageLocationBaseStr = "bucket/cluster";
    String bucket = "bucket";
    Map<String, String> expectedPolicyJsonReplacements = Map.ofEntries(Map.entry("${ARN_PARTITION}", "aws"), Map.entry("${STORAGE_LOCATION_BASE}", storageLocationBaseStr), Map.entry("${DATALAKE_BUCKET}", bucket), Map.entry("${DYNAMODB_TABLE_NAME}", ""));
    StorageLocationBase storageLocationBase = new StorageLocationBase();
    storageLocationBase.setValue(storageLocationBaseStr);
    CloudS3View cloudFileSystem = new CloudS3View(CloudIdentityType.ID_BROKER);
    cloudFileSystem.setInstanceProfile("arn:aws:iam::11111111111:instance-profile/instanceprofile");
    Map<String, String> policyJsonReplacements = awsDataAccessRolePermissionValidator.getPolicyJsonReplacements(storageLocationBase, cloudFileSystem);
    assertThat(policyJsonReplacements).isEqualTo(expectedPolicyJsonReplacements);
}
Also used : CloudS3View(com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) Test(org.junit.jupiter.api.Test)

Aggregations

StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)34 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)19 Test (org.junit.jupiter.api.Test)19 CloudStorageCdpService (com.sequenceiq.common.model.CloudStorageCdpService)10 StorageIdentityBase (com.sequenceiq.common.api.cloudstorage.StorageIdentityBase)9 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)9 ArrayList (java.util.ArrayList)9 CloudS3View (com.sequenceiq.cloudbreak.cloud.model.filesystem.CloudS3View)7 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)7 FileSystemType (com.sequenceiq.common.model.FileSystemType)7 List (java.util.List)7 ConfigQueryEntry (com.sequenceiq.common.api.cloudstorage.query.ConfigQueryEntry)6 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)6 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)6 LinkedHashSet (java.util.LinkedHashSet)6 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)5 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)5 SdxCloudStorageRequest (com.sequenceiq.sdx.api.model.SdxCloudStorageRequest)5 SdxClusterRequest (com.sequenceiq.sdx.api.model.SdxClusterRequest)5 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)5