@Test public void whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentity() { 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); environment.setTelemetry(telemetryResponse); ClusterV4Request clusterV4Request = new ClusterV4Request(); clusterV4Request.setBlueprintName(exampleBlueprintName); CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest()); assertEquals(1, cloudStorageConfigReq.getIdentities().size()); assertEquals(1, cloudStorageConfigReq.getIdentities() .stream() .filter(r -> r.getType().equals(CloudIdentityType.LOG)) .collect(Collectors.toSet()).size()); assertEquals("logprofile", cloudStorageConfigReq.getIdentities().get(0).getS3().getInstanceProfile()); }
public CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment, ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest) { CloudStorageRequest cloudStorageRequest = null; boolean anyCloudStorageIsConfigured = isCloudStorageConfigured(sdxClusterRequest) || isInternalCloudStorageConfigured(clusterRequest); boolean loggingConfigured = isLoggingConfigured(environment); if (isCloudStorageConfigured(sdxClusterRequest)) { LOGGER.debug("Cloud storage configurations found in SDX cluster request."); cloudStorageRequest = initSdxCloudStorageRequest(environment, clusterRequest.getBlueprintName(), sdxCluster, sdxClusterRequest); } else if (isInternalCloudStorageConfigured(clusterRequest)) { LOGGER.debug("Cloud storage configurations found in internal SDX stack request."); cloudStorageRequest = clusterRequest.getCloudStorage(); } if (loggingConfigured) { LOGGER.debug("Cloud storage logging is enabled."); if (!anyCloudStorageIsConfigured) { LOGGER.debug("Creating cloud storage request only for logging identity."); cloudStorageRequest = new CloudStorageRequest(); } addLogIdentity(cloudStorageRequest, environment); } if (loggingConfigured || anyCloudStorageIsConfigured) { addS3Guard(cloudStorageRequest, environment); } return cloudStorageRequest; }
CloudStorageManifester { public CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment, ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest) { CloudStorageRequest cloudStorageRequest = null; boolean anyCloudStorageIsConfigured = isCloudStorageConfigured(sdxClusterRequest) || isInternalCloudStorageConfigured(clusterRequest); boolean loggingConfigured = isLoggingConfigured(environment); if (isCloudStorageConfigured(sdxClusterRequest)) { LOGGER.debug("Cloud storage configurations found in SDX cluster request."); cloudStorageRequest = initSdxCloudStorageRequest(environment, clusterRequest.getBlueprintName(), sdxCluster, sdxClusterRequest); } else if (isInternalCloudStorageConfigured(clusterRequest)) { LOGGER.debug("Cloud storage configurations found in internal SDX stack request."); cloudStorageRequest = clusterRequest.getCloudStorage(); } if (loggingConfigured) { LOGGER.debug("Cloud storage logging is enabled."); if (!anyCloudStorageIsConfigured) { LOGGER.debug("Creating cloud storage request only for logging identity."); cloudStorageRequest = new CloudStorageRequest(); } addLogIdentity(cloudStorageRequest, environment); } if (loggingConfigured || anyCloudStorageIsConfigured) { addS3Guard(cloudStorageRequest, environment); } return cloudStorageRequest; } }
CloudStorageManifester { public CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment, ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest) { CloudStorageRequest cloudStorageRequest = null; boolean anyCloudStorageIsConfigured = isCloudStorageConfigured(sdxClusterRequest) || isInternalCloudStorageConfigured(clusterRequest); boolean loggingConfigured = isLoggingConfigured(environment); if (isCloudStorageConfigured(sdxClusterRequest)) { LOGGER.debug("Cloud storage configurations found in SDX cluster request."); cloudStorageRequest = initSdxCloudStorageRequest(environment, clusterRequest.getBlueprintName(), sdxCluster, sdxClusterRequest); } else if (isInternalCloudStorageConfigured(clusterRequest)) { LOGGER.debug("Cloud storage configurations found in internal SDX stack request."); cloudStorageRequest = clusterRequest.getCloudStorage(); } if (loggingConfigured) { LOGGER.debug("Cloud storage logging is enabled."); if (!anyCloudStorageIsConfigured) { LOGGER.debug("Creating cloud storage request only for logging identity."); cloudStorageRequest = new CloudStorageRequest(); } addLogIdentity(cloudStorageRequest, environment); } if (loggingConfigured || anyCloudStorageIsConfigured) { addS3Guard(cloudStorageRequest, environment); } return cloudStorageRequest; }  }
CloudStorageManifester { public CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment, ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest) { CloudStorageRequest cloudStorageRequest = null; boolean anyCloudStorageIsConfigured = isCloudStorageConfigured(sdxClusterRequest) || isInternalCloudStorageConfigured(clusterRequest); boolean loggingConfigured = isLoggingConfigured(environment); if (isCloudStorageConfigured(sdxClusterRequest)) { LOGGER.debug("Cloud storage configurations found in SDX cluster request."); cloudStorageRequest = initSdxCloudStorageRequest(environment, clusterRequest.getBlueprintName(), sdxCluster, sdxClusterRequest); } else if (isInternalCloudStorageConfigured(clusterRequest)) { LOGGER.debug("Cloud storage configurations found in internal SDX stack request."); cloudStorageRequest = clusterRequest.getCloudStorage(); } if (loggingConfigured) { LOGGER.debug("Cloud storage logging is enabled."); if (!anyCloudStorageIsConfigured) { LOGGER.debug("Creating cloud storage request only for logging identity."); cloudStorageRequest = new CloudStorageRequest(); } addLogIdentity(cloudStorageRequest, environment); } if (loggingConfigured || anyCloudStorageIsConfigured) { addS3Guard(cloudStorageRequest, environment); } return cloudStorageRequest; }  CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment,
            ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest); }
CloudStorageManifester { public CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment, ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest) { CloudStorageRequest cloudStorageRequest = null; boolean anyCloudStorageIsConfigured = isCloudStorageConfigured(sdxClusterRequest) || isInternalCloudStorageConfigured(clusterRequest); boolean loggingConfigured = isLoggingConfigured(environment); if (isCloudStorageConfigured(sdxClusterRequest)) { LOGGER.debug("Cloud storage configurations found in SDX cluster request."); cloudStorageRequest = initSdxCloudStorageRequest(environment, clusterRequest.getBlueprintName(), sdxCluster, sdxClusterRequest); } else if (isInternalCloudStorageConfigured(clusterRequest)) { LOGGER.debug("Cloud storage configurations found in internal SDX stack request."); cloudStorageRequest = clusterRequest.getCloudStorage(); } if (loggingConfigured) { LOGGER.debug("Cloud storage logging is enabled."); if (!anyCloudStorageIsConfigured) { LOGGER.debug("Creating cloud storage request only for logging identity."); cloudStorageRequest = new CloudStorageRequest(); } addLogIdentity(cloudStorageRequest, environment); } if (loggingConfigured || anyCloudStorageIsConfigured) { addS3Guard(cloudStorageRequest, environment); } return cloudStorageRequest; }  CloudStorageRequest initCloudStorageRequest(DetailedEnvironmentResponse environment,
            ClusterV4Request clusterRequest, SdxCluster sdxCluster, SdxClusterRequest sdxClusterRequest);  }