From 6590dc850ab21df22ee3c23ea97a594828c89f1b Mon Sep 17 00:00:00 2001
From: Angelo
Date: Tue, 2 Dec 2025 14:45:37 +0100
Subject: [PATCH] Ensure it is possible to define livesystem referring to
pre-existing Fractal
---
.../com/yanchware/fractal/sdk/Automaton.java | 171 +++--
.../configuration/EnvVarSdkConfiguration.java | 30 +-
.../InstantiationConfiguration.java | 18 +-
.../InstantiationWaitConfiguration.java | 3 +-
.../fractal/sdk/domain/Component.java | 190 ++---
.../fractal/sdk/domain/ComponentLink.java | 4 +-
.../yanchware/fractal/sdk/domain/Service.java | 51 +-
.../fractal/sdk/domain/Validatable.java | 1 +
.../domain/blueprint/BlueprintAggregate.java | 41 --
.../domain/blueprint/BlueprintComponent.java | 4 -
.../domain/blueprint/BlueprintFactory.java | 33 -
.../CreateBlueprintCommandRequest.java | 12 -
.../UpdateBlueprintCommandRequest.java | 31 -
.../service/dtos/BlueprintComponentDto.java | 71 --
.../domain/environment/BaseEnvironment.java | 51 +-
.../sdk/domain/environment/CiCdProfile.java | 23 +-
.../domain/environment/CloudAgentEntity.java | 298 ++++----
.../sdk/domain/environment/Environment.java | 6 +-
.../environment/EnvironmentAggregate.java | 456 ++++++------
.../environment/EnvironmentIdValue.java | 34 +-
.../domain/environment/EnvironmentType.java | 10 +-
.../environment/EnvironmentsFactory.java | 6 +-
.../environment/ManagementEnvironment.java | 36 +-
.../environment/OperationalEnvironment.java | 13 +-
.../sdk/domain/environment/Secret.java | 7 +-
.../domain/environment/aws/AwsCloudAgent.java | 163 ++--
.../environment/azure/AzureCloudAgent.java | 176 ++---
.../domain/environment/gcp/GcpCloudAgent.java | 163 ++--
.../hetzner/HetznerCloudAgent.java | 145 ++--
.../domain/environment/oci/OciCloudAgent.java | 161 ++--
.../service/EnvironmentService.java | 132 ++--
.../service/RestEnvironmentService.java | 425 ++++++-----
.../AwsAccountInitializationRequest.java | 4 +-
...zureSubscriptionInitializationRequest.java | 11 +-
.../commands/CreateCiCdProfileRequest.java | 29 +-
.../commands/CreateEnvironmentRequest.java | 10 +-
.../service/commands/CreateSecretRequest.java | 5 +-
.../GcpProjectInitializationRequest.java | 6 +-
.../HetznerProjectInitializationRequest.java | 4 +-
.../OciCompartmentInitializationRequest.java | 6 +-
.../commands/UpdateEnvironmentRequest.java | 12 +-
.../service/dtos/CiCdProfileResponse.java | 18 +-
.../service/dtos/EnvironmentResponse.java | 4 +-
.../dtos/InitializationRunResponse.java | 6 +-
.../service/dtos/InitializationRunRoot.java | 3 +-
.../dtos/InitializationStepResponse.java | 6 +-
.../service/dtos/SecretResponse.java | 18 +-
.../ComponentInstantiationException.java | 18 +-
.../exceptions/EnvironmentException.java | 18 +-
.../EnvironmentInitializationException.java | 26 +-
.../EnvironmentNotFoundException.java | 16 +-
.../exceptions/InstantiatorException.java | 16 +-
.../domain/exceptions/ProviderException.java | 26 +-
.../domain/fractal/BlueprintComponent.java | 4 +
.../sdk/domain/fractal/FractalAggregate.java | 84 +++
.../FractalIdValue.java | 12 +-
.../sdk/domain/fractal/FractalsFactory.java | 70 ++
.../caas/CaaSAPIGateway.java | 4 +-
.../caas/CaaSComponent.java | 89 +--
.../caas/CaaSLogging.java | 4 +-
.../caas/CaaSMonitoring.java | 4 +-
.../caas/CaaSSearch.java | 6 +-
.../caas/CaaSServiceMeshSecurity.java | 4 +-
.../caas/CaaSWorkload.java | 4 +-
.../iaas/DnsARecord.java | 22 +-
.../iaas/DnsAaaaRecord.java | 25 +-
.../iaas/DnsCNameRecord.java | 21 +-
.../iaas/DnsCaaRecord.java | 6 +-
.../iaas/DnsCaaRecordData.java | 21 +-
.../iaas/DnsMxRecord.java | 2 +-
.../iaas/DnsMxRecordData.java | 26 +-
.../iaas/DnsNsRecord.java | 10 +-
.../iaas/DnsPtrRecord.java | 22 +-
.../iaas/DnsRecord.java | 45 +-
.../iaas/DnsSrvRecord.java | 26 +-
.../iaas/DnsSrvRecordData.java | 38 +-
.../iaas/DnsTxtRecord.java | 9 +-
.../{blueprint => fractal}/iaas/DnsZone.java | 10 +-
.../paas/PaaSColumnOrientedDbms.java | 4 +-
.../paas/PaaSContainerPlatform.java | 4 +-
.../paas/PaaSDataStorage.java | 4 +-
.../paas/PaaSDocumentDatabase.java | 4 +-
.../paas/PaaSDocumentDbms.java | 4 +-
.../paas/PaaSFileShare.java | 4 +-
.../paas/PaaSGraphDatabase.java | 4 +-
.../paas/PaaSGraphDbms.java | 4 +-
.../paas/PaaSKeyValueDbms.java | 4 +-
.../paas/PaaSKeyValueEntity.java | 4 +-
.../paas/PaaSMessageEntity.java | 4 +-
.../paas/PaaSMessaging.java | 4 +-
.../paas/PaaSNetworkCdnProfile.java | 4 +-
.../paas/PaaSRelationalDatabase.java | 4 +-
.../paas/PaaSRelationalDbms.java | 4 +-
.../paas/PaaSStorageContainer.java | 4 +-
.../paas/PaaSWorkload.java | 4 +-
.../paas/PaaSWorkloadDeploymentSlot.java | 4 +-
.../saas/UnmanagedBrokerComponent.java | 4 +-
.../saas/UnmanagedSecurityComponent.java | 4 +-
.../saas/UnmanagedStorageComponent.java | 4 +-
.../service/BlueprintService.java | 34 +-
.../CreateBlueprintCommandRequest.java | 14 +
.../UpdateBlueprintCommandRequest.java | 34 +
.../service/dtos/BlueprintComponentDto.java | 72 ++
.../service/dtos/BlueprintDto.java | 2 +-
.../service/dtos/BlueprintStatusDto.java | 2 +-
.../sdk/domain/livesystem/CustomWorkload.java | 22 +-
.../livesystem/CustomWorkloadBuilder.java | 17 +-
.../livesystem/EnvironmentReference.java | 3 +-
.../livesystem/LiveSystemAggregate.java | 284 +++----
.../livesystem/LiveSystemComponent.java | 2 +-
.../domain/livesystem/LiveSystemIdValue.java | 2 +-
.../domain/livesystem/LiveSystemsFactory.java | 186 ++---
.../domain/livesystem/SourceControlType.java | 2 +-
.../livesystem/caas/CaaSAPIGatewayImpl.java | 10 +-
.../livesystem/caas/CaaSAmbassador.java | 23 +-
.../livesystem/caas/CaaSElasticDataStore.java | 18 +-
.../livesystem/caas/CaaSElasticLogging.java | 21 +-
.../caas/CaaSKubernetesWorkload.java | 289 ++++----
.../livesystem/caas/CaaSLoggingImpl.java | 40 +-
.../livesystem/caas/CaaSMonitoringImpl.java | 18 +-
.../livesystem/caas/CaaSPrometheus.java | 5 +-
.../livesystem/caas/CaaSSearchImpl.java | 44 +-
.../caas/CaaSServiceMeshSecurityImpl.java | 61 +-
.../domain/livesystem/caas/CaaSTraefik.java | 20 +-
.../livesystem/caas/ContainerResources.java | 35 +-
.../domain/livesystem/caas/JaegerTracing.java | 6 +-
.../domain/livesystem/caas/PriorityClass.java | 5 +-
.../livesystem/caas/ResourceManagement.java | 22 +-
.../domain/livesystem/caas/TaintEffect.java | 4 +-
.../domain/livesystem/caas/Toleration.java | 22 +-
.../livesystem/caas/TolerationOperator.java | 4 +-
.../livesystem/caas/TraefikTracing.java | 2 +-
.../operationalservicewindow/Blackout.java | 9 +-
.../operationalservicewindow/OneOffRule.java | 6 +-
.../OperationalServiceWindow.java | 6 +-
.../operationalservicewindow/Rule.java | 6 +-
.../operationalservicewindow/WeeklyRule.java | 6 +-
.../livesystem/paas/KubernetesCluster.java | 60 +-
.../domain/livesystem/paas/PaaSCassandra.java | 24 +-
.../livesystem/paas/PaaSDataStorage.java | 29 +-
.../paas/PaaSPostgreSqlDatabase.java | 129 ++--
.../livesystem/paas/PaaSPostgreSqlDbms.java | 38 +-
.../livesystem/paas/PodManagedIdentity.java | 15 +-
.../livesystem/paas/ResourceEntity.java | 10 +-
.../aws/AwsElasticKubernetesService.java | 371 +++++-----
.../paas/providers/aws/AwsRegion.java | 100 +--
.../paas/providers/aws/AwsResourceEntity.java | 1 +
.../providers/azure/AzureIdentityType.java | 2 +-
.../providers/azure/AzureMachineType.java | 2 +-
.../paas/providers/azure/AzureOsSku.java | 16 +-
.../paas/providers/azure/AzureOsType.java | 28 +-
.../azure/AzurePostgreSqlDatabase.java | 31 +-
.../providers/azure/AzurePostgreSqlDbms.java | 26 +-
.../paas/providers/azure/AzureRegion.java | 2 +-
.../paas/providers/azure/AzureResource.java | 18 +-
.../providers/azure/AzureResourceEntity.java | 3 +
.../providers/azure/AzureResourceGroup.java | 20 +-
.../paas/providers/azure/AzureTlsVersion.java | 6 +-
.../azure/BackupStorageRedundancy.java | 6 +-
.../aks/AzureActiveDirectoryProfile.java | 19 +-
.../azure/aks/AzureKubernetesAddon.java | 9 +-
.../aks/AzureKubernetesAddonProfile.java | 17 +-
.../azure/aks/AzureKubernetesService.java | 45 +-
.../providers/azure/aks/AzureNodePool.java | 78 +-
.../providers/azure/aks/AzureOutboundIp.java | 15 +-
.../azure/aks/ManagedClusterSkuTier.java | 2 +-
.../azure/appservice/AzureAppServicePlan.java | 69 +-
.../appservice/AzureConnectionStringType.java | 2 +-
.../appservice/AzureKeyVaultCertificate.java | 31 +-
.../appservice/AzureSiteLoadBalancing.java | 4 +-
.../azure/appservice/AzureWebApp.java | 353 ++++-----
.../appservice/AzureWebAppCloningInfo.java | 23 +-
.../appservice/AzureWebAppConfiguration.java | 19 +-
.../appservice/AzureWebAppDeploymentSlot.java | 52 +-
.../AzureWebAppIpSecurityRestriction.java | 11 +-
.../AzureWebAppLinuxRuntimeStack.java | 2 +-
.../appservice/AzureWebAppPushSettings.java | 6 +-
.../appservice/AzureWebAppRuntimeStack.java | 8 +-
.../AzureWebAppWindowsRuntimeStack.java | 1 +
.../AzureAppServiceClientCertMode.java | 30 +-
.../AzureAppServiceRedundancyMode.java | 34 +-
.../valueobjects/AzureFtpsState.java | 26 +-
.../providers/azure/cdn/AzureCdnProfile.java | 55 +-
.../cdn/AzureManagedServiceIdentity.java | 8 +-
.../azure/cosmos/AzureCosmosAccount.java | 6 +-
.../cosmos/AzureCosmosAccountBuilder.java | 3 +-
.../azure/cosmos/AzureCosmosBackupPolicy.java | 38 +-
.../cosmos/AzureCosmosBackupPolicyType.java | 8 +-
.../cosmos/AzureCosmosCassandraCluster.java | 10 +-
.../azure/cosmos/AzureCosmosEntity.java | 14 +-
.../cosmos/AzureCosmosEntityBuilder.java | 10 +-
.../cosmos/AzureCosmosGremlinDatabase.java | 71 +-
.../azure/cosmos/AzureCosmosGremlinDbms.java | 15 +-
.../cosmos/AzureCosmosMongoDatabase.java | 71 +-
.../azure/cosmos/AzureCosmosMongoDbms.java | 15 +-
.../cosmos/AzureCosmosNoSqlDatabase.java | 69 +-
.../azure/cosmos/AzureCosmosNoSqlDbms.java | 15 +-
.../cosmos/AzureCosmosPostgreSqlDbms.java | 32 +-
.../azure/cosmos/AzureCosmosTableDbms.java | 15 +-
.../azure/cosmos/AzureCosmosTableEntity.java | 69 +-
.../azure/servicebus/AzureRelay.java | 6 +-
.../azure/servicebus/AzureServiceBus.java | 16 +-
.../servicebus/AzureServiceBusQueue.java | 22 +-
.../servicebus/AzureServiceBusTopic.java | 12 +-
.../storageaccount/AzureBlobContainer.java | 64 +-
...ntainerImmutableStorageWithVersioning.java | 12 +-
.../AzureBlobContainerPublicAccess.java | 18 +-
.../AzureBlobStorageAccount.java | 7 +-
.../AzureBlockBlobStorageAccount.java | 9 +-
.../azure/storageaccount/AzureBypass.java | 4 +-
.../storageaccount/AzureExpirationAction.java | 2 +-
.../azure/storageaccount/AzureFileShare.java | 9 +-
.../AzureFileShareAccessPolicy.java | 10 +-
.../AzureFileShareAccessTier.java | 4 +-
.../AzureFileShareEnabledProtocols.java | 2 +-
.../AzureFileShareSignedIdentifier.java | 8 +-
.../AzureFileStorageAccount.java | 7 +-
...AzureFilesIdentityBasedAuthentication.java | 9 +-
.../AzureImmutableStorageAccount.java | 10 +-
.../azure/storageaccount/AzureIpRule.java | 4 +-
.../AzureLegacyStorageAccount.java | 2 +-
.../storageaccount/AzureNetworkAction.java | 1 +
.../storageaccount/AzureNetworkRuleSet.java | 6 +-
.../AzureResourceAccessRule.java | 2 +-
.../storageaccount/AzureRoutingChoice.java | 2 +-
.../storageaccount/AzureStorageAccount.java | 2 +-
.../AzureStorageAccountBackup.java | 12 +-
.../AzureStorageAccountCustomDomain.java | 2 +-
.../AzureStorageAccountEncryption.java | 8 +-
...AzureStorageAccountEncryptionIdentity.java | 2 +-
.../AzureStorageAccountEncryptionService.java | 8 +-
.../AzureStorageAccountIdentity.java | 15 +-
...geAccountImmutabilityPolicyProperties.java | 18 +-
...AzureStorageAccountKeyVaultProperties.java | 6 +-
.../AzureStorageAccountRoutingPreference.java | 8 +-
.../AzureStorageAccountSasPolicy.java | 4 +-
.../AzureUserAssignedIdentity.java | 4 +-
.../AzureVirtualNetworkRule.java | 6 +-
.../BaseAzureStorageAccount.java | 37 +-
.../AzureAccountImmutabilityPolicyState.java | 14 +-
.../AzureActiveDirectoryAccountType.java | 2 +-
.../AzureDefaultSharePermission.java | 12 +-
.../valueobjects/AzureDnsEndpointType.java | 4 +-
.../AzureLargeFileSharesState.java | 2 +-
.../AzurePublicNetworkAccess.java | 4 +-
...overyServicesBackupPolicyWorkloadType.java | 46 +-
.../AzureRecoveryServicesSkuName.java | 36 +-
.../valueobjects/AzureState.java | 10 +-
.../AzureStorageAccountAccessTier.java | 4 +-
.../AzureStorageAccountSkuName.java | 2 +-
.../providers/gcp/GcpPostgreSqlDatabase.java | 24 +-
.../paas/providers/gcp/GcpPostgreSqlDbms.java | 15 +-
.../paas/providers/gcp/GcpRegion.java | 118 +--
.../providers/gcp/GoogleKubernetesEngine.java | 10 +-
.../providers/hetzner/HetznerKubernetes.java | 121 +--
.../hetzner/HetznerResourceEntity.java | 1 +
.../paas/providers/oci/Compartment.java | 172 ++---
.../oci/OciContainerEngineForKubernetes.java | 124 ++--
.../paas/providers/oci/OciResourceEntity.java | 3 +
.../saas/UnmanagedBrokerComponent.java | 10 +-
.../saas/UnmanagedSecurityComponent.java | 12 +-
.../saas/UnmanagedStorageComponent.java | 14 +-
.../livesystem/service/LiveSystemService.java | 393 +++++-----
.../InstantiateLiveSystemCommandRequest.java | 13 +-
.../UpdateLiveSystemCommandRequest.java | 17 +-
.../service/dtos/EnvironmentDto.java | 4 +-
.../service/dtos/EnvironmentIdDto.java | 9 +-
.../service/dtos/LiveSystemComponentDto.java | 73 +-
.../dtos/LiveSystemComponentMutationDto.java | 6 +-
.../dtos/LiveSystemComponentStatusDto.java | 12 +-
.../service/dtos/LiveSystemDto.java | 24 +-
.../service/dtos/LiveSystemMutationDto.java | 6 +-
.../livesystem/service/dtos/ProviderType.java | 14 +-
.../services/contracts/ComponentDto.java | 4 +-
.../sdk/domain/values/ComponentId.java | 78 +-
.../sdk/domain/values/ResourceGroupId.java | 5 +-
.../fractal/sdk/utils/CollectionUtils.java | 6 +-
.../fractal/sdk/utils/ExtendableEnum.java | 16 +-
.../fractal/sdk/utils/HttpUtils.java | 102 +--
.../sdk/utils/ReflectionClassUnder.java | 12 +-
.../fractal/sdk/utils/ReflectionUtils.java | 453 ++++++------
.../sdk/utils/RegexValidationUtils.java | 26 +-
.../fractal/sdk/utils/SerializationUtils.java | 6 +-
.../fractal/sdk/utils/StringHelper.java | 16 +-
.../fractal/sdk/utils/ValidationUtils.java | 15 +-
.../yanchware/fractal/sdk/AutomatonTest.java | 13 +-
.../fractal/sdk/TestWithFixture.java | 29 +-
.../sdk/aggregates/LiveSystemTest.java | 3 +-
.../InstantiationWaitConfigurationTest.java | 10 +-
.../fractal/sdk/domain/ComponentLinkTest.java | 150 ++--
.../service/BlueprintServiceTest.java | 78 --
.../CreateBlueprintCommandRequestTest.java | 21 -
.../domain/environment/CiCdProfileTest.java | 244 +++---
.../domain/environment/DnsARecordTest.java | 34 +-
.../domain/environment/DnsAaaaRecordTest.java | 16 +-
.../environment/DnsCaaRecordDataTest.java | 34 +-
.../domain/environment/DnsCaaRecordTest.java | 6 +-
.../environment/DnsMxRecordDataTest.java | 34 +-
.../environment/DnsSrvRecordDataTest.java | 68 +-
.../domain/environment/DnsSrvRecordTest.java | 40 +-
.../sdk/domain/environment/DnsZoneTest.java | 70 +-
.../environment/EnvironmentAggregateTest.java | 30 +-
.../environment/EnvironmentServiceTest.java | 329 +++++----
.../environment/EnvironmentTypeTest.java | 94 +--
.../ManagementEnvironmentTest.java | 435 +++++------
.../OperationalEnvironmentTest.java | 624 ++++++++--------
.../sdk/domain/environment/SecretTest.java | 51 +-
.../fractal/service/BlueprintServiceTest.java | 78 ++
.../CreateBlueprintCommandRequestTest.java | 22 +
.../dtos/BlueprintComponentDtoTest.java | 270 +++----
...stantiateLiveSystemCommandRequestTest.java | 63 +-
.../livesystem/LiveSystemAggregateTest.java | 148 ++--
.../LiveSystemAksComponentDtoTest.java | 84 +--
.../LiveSystemEksComponentDtoTest.java | 66 +-
.../LiveSystemGkeComponentDtoTest.java | 90 +--
.../LiveSystemHetznerKubernetesDtoTest.java | 69 +-
.../LiveSystemOkeComponentDtoTest.java | 66 +-
.../LiveSystemPostgresComponentDtoTest.java | 106 +--
.../livesystem/LiveSystemServiceTest.java | 148 ++--
.../OperationalServiceWindowTest.java | 8 +-
.../livesystem/SourceControlTypeTest.java | 28 +-
.../livesystem/caas/CaaSAmbassadorTest.java | 33 +-
.../caas/CaaSElasticDataStoreTest.java | 186 ++---
.../caas/CaaSElasticLoggingTest.java | 185 ++---
.../livesystem/caas/CaaSKafkaClusterTest.java | 3 +-
.../CaaSKubernetesCustomWorkloadTest.java | 110 +--
.../livesystem/caas/CaaSOcelotTest.java | 87 +--
.../livesystem/caas/CaaSPrometheusTest.java | 9 +-
.../livesystem/caas/CaaSTraefikTest.java | 319 ++++----
.../caas/ContainerResourcesTest.java | 34 +-
.../caas/ResourceManagementTest.java | 16 +-
.../domain/livesystem/caas/RoleTypeTest.java | 8 +-
.../livesystem/caas/TolerationTest.java | 40 +-
.../paas/SupportedTlsVersionsTest.java | 6 +-
.../aws/AwsElasticKubernetesServiceTest.java | 620 ++++++++--------
.../paas/providers/aws/AwsRegionTest.java | 204 +++---
.../paas/providers/azure/AzureActionTest.java | 12 +-
.../AzureActiveDirectoryProfileTest.java | 54 +-
...AzureKubernetesPodManagedIdentityTest.java | 90 +--
.../AzureKubernetesServiceIpRangeTest.java | 64 +-
.../azure/AzureKubernetesServiceTest.java | 140 ++--
.../providers/azure/AzureMachineTypeTest.java | 4 +-
.../providers/azure/AzureNodePoolTest.java | 190 ++---
.../paas/providers/azure/AzureOsSkuTest.java | 2 +-
.../azure/AzurePostgreSQLDBTest.java | 107 +--
.../providers/azure/AzurePostgreSqlTest.java | 84 +--
.../paas/providers/azure/AzureRegionTest.java | 560 +++++++-------
.../azure/AzureResourceGroupTest.java | 30 +-
.../providers/azure/AzureTlsVersionTest.java | 16 +-
.../providers/azure/CosmosAccountTest.java | 229 +++---
.../providers/azure/CosmosCassandraTest.java | 5 +-
.../providers/azure/CosmosEntityTest.java | 50 +-
.../azure/CosmosGremlinAccountTest.java | 1 -
.../azure/CosmosGremlinDatabaseTest.java | 1 -
.../azure/CosmosMongoAccountTest.java | 1 -
.../azure/CosmosMongoDatabaseTest.java | 1 -
.../azure/CosmosNoSqlAccountTest.java | 1 -
.../azure/CosmosNoSqlDatabaseTest.java | 1 -
.../azure/CosmosPostgreSqlAccountTest.java | 7 +-
.../azure/CosmosTableAccountTest.java | 1 -
.../azure/CosmosTableEntityTest.java | 1 -
.../aks/AzureKubernetesAddonProfileTest.java | 30 +-
.../azure/aks/AzureKubernetesAddonTest.java | 22 +-
.../azure/aks/AzureOutboundIpTest.java | 27 +-
.../azure/aks/ManagedClusterSkuTierTest.java | 20 +-
.../appservice/AzureAppServicePlanTest.java | 76 +-
.../azure/appservice/AzureAppServiceTest.java | 407 +++++-----
.../AzureConnectionStringTypeTest.java | 23 +-
.../appservice/AzureDeploymentSlotTest.java | 16 +-
.../appservice/AzureIpFilterTagTest.java | 6 +-
.../AzureKeyVaultCertificateTest.java | 80 +-
.../AzureManagedPipelineModeTest.java | 4 +-
.../AzureSiteLoadBalancingTest.java | 16 +-
.../AzureWebAppLinuxRuntimeStackTest.java | 86 ++-
.../AzureWebAppWindowsRuntimeStackTest.java | 69 +-
.../valueobjects/AzureFtpsStateTest.java | 6 +-
.../providers/azure/cdn/AzureCdnSkuTest.java | 60 +-
.../azure/servicebus/AzureRelayTest.java | 24 +-
.../azure/servicebus/AzureServiceBusTest.java | 129 ++--
.../AzureBlobStorageAccountTest.java | 18 +-
.../AzureBlockBlobStorageAccountTest.java | 18 +-
.../azure/storageaccount/AzureBypassTest.java | 42 +-
.../AzureExpirationActionTest.java | 12 +-
.../AzureFileShareAccessPolicyTest.java | 42 +-
.../AzureFileShareAccessTierTest.java | 32 +-
.../AzureFileShareEnabledProtocolsTest.java | 24 +-
.../AzureFileShareRootSquashTypeTest.java | 32 +-
.../AzureFileShareSignedIdentifierTest.java | 38 +-
.../storageaccount/AzureFileShareTest.java | 98 +--
.../AzureFileStorageAccountTest.java | 72 +-
.../storageaccount/AzureIpRuleActionTest.java | 12 +-
.../AzureLegacyStorageAccountTest.java | 693 +++++++++---------
.../AzureRoutingChoiceTest.java | 22 +-
...orageAccountExtendedLocationTypesTest.java | 12 +-
.../AzureStorageAccountKeySourceTest.java | 22 +-
.../AzureStorageAccountTest.java | 16 +-
...ureAccountImmutabilityPolicyStateTest.java | 34 +-
.../AzureActiveDirectoryAccountTypeTest.java | 22 +-
.../AzureDefaultSharePermissionTest.java | 49 +-
.../AzureDirectoryServiceOptionsTest.java | 44 +-
.../AzureDnsEndpointTypeTest.java | 20 +-
.../valueobjects/AzureIdentityTypeTest.java | 43 +-
.../AzureLargeFileSharesStateTest.java | 24 +-
.../AzurePublicNetworkAccessTest.java | 24 +-
.../valueobjects/AzureStateTest.java | 57 +-
...ureStorageAccountAllowedCopyScopeTest.java | 24 +-
.../valueobjects/AzureStorageKeyTypeTest.java | 22 +-
.../valueobjects/AzureStorageSkuNameTest.java | 86 +--
.../paas/providers/gcp/GcpNodePoolTest.java | 49 +-
.../paas/providers/gcp/GcpProgreSqlTest.java | 224 +++---
.../paas/providers/gcp/GcpRegionTest.java | 256 +++----
.../gcp/GoogleKubernetesEngineTest.java | 97 +--
.../paas/providers/oci/OciRegionTest.java | 248 +++----
.../saas/UnmanagedMessageBrokerTest.java | 23 +-
.../saas/UnmanagedSecurityComponentTest.java | 20 +-
.../saas/UnmanagedStorageAccountTest.java | 29 +-
.../LiveSystemKubernetesComponentDtoTest.java | 253 ++++---
.../values/ComponentIdNegativeTests.java | 35 +-
.../values/ComponentIdPositiveTests.java | 35 +-
.../sdk/utils/CollectionUtilsTest.java | 16 +-
.../sdk/utils/LocalSdkConfiguration.java | 4 +-
.../fractal/sdk/utils/StringHandler.java | 2 +-
.../fractal/sdk/utils/TestUtils.java | 544 +++++++-------
423 files changed, 11362 insertions(+), 10403 deletions(-)
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintAggregate.java
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintComponent.java
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintFactory.java
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/CreateBlueprintCommandRequest.java
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/UpdateBlueprintCommandRequest.java
delete mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintComponentDto.java
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/BlueprintComponent.java
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalAggregate.java
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/FractalIdValue.java (50%)
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalsFactory.java
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSAPIGateway.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSComponent.java (79%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSLogging.java (68%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSMonitoring.java (69%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSSearch.java (53%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSServiceMeshSecurity.java (71%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/caas/CaaSWorkload.java (68%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsARecord.java (81%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsAaaaRecord.java (76%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsCNameRecord.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsCaaRecord.java (91%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsCaaRecordData.java (85%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsMxRecord.java (96%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsMxRecordData.java (74%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsNsRecord.java (82%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsPtrRecord.java (77%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsRecord.java (55%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsSrvRecord.java (76%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsSrvRecordData.java (75%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsTxtRecord.java (90%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/iaas/DnsZone.java (90%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSColumnOrientedDbms.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSContainerPlatform.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSDataStorage.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSDocumentDatabase.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSDocumentDbms.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSFileShare.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSGraphDatabase.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSGraphDbms.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSKeyValueDbms.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSKeyValueEntity.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSMessageEntity.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSMessaging.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSNetworkCdnProfile.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSRelationalDatabase.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSRelationalDbms.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSStorageContainer.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSWorkload.java (72%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/paas/PaaSWorkloadDeploymentSlot.java (74%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/saas/UnmanagedBrokerComponent.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/saas/UnmanagedSecurityComponent.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/saas/UnmanagedStorageComponent.java (73%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/service/BlueprintService.java (74%)
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/CreateBlueprintCommandRequest.java
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/UpdateBlueprintCommandRequest.java
create mode 100644 fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintComponentDto.java
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/service/dtos/BlueprintDto.java (85%)
rename fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/service/dtos/BlueprintStatusDto.java (62%)
delete mode 100644 fractal.sdk/src/test/java/com/yanchware/fractal/sdk/domain/blueprint/service/BlueprintServiceTest.java
delete mode 100644 fractal.sdk/src/test/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/CreateBlueprintCommandRequestTest.java
create mode 100644 fractal.sdk/src/test/java/com/yanchware/fractal/sdk/domain/fractal/service/BlueprintServiceTest.java
create mode 100644 fractal.sdk/src/test/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/CreateBlueprintCommandRequestTest.java
rename fractal.sdk/src/test/java/com/yanchware/fractal/sdk/domain/{blueprint => fractal}/service/dtos/BlueprintComponentDtoTest.java (61%)
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/Automaton.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/Automaton.java
index 6ccf31a2..a9cd6386 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/Automaton.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/Automaton.java
@@ -4,12 +4,12 @@
import com.yanchware.fractal.sdk.configuration.EnvVarSdkConfiguration;
import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
import com.yanchware.fractal.sdk.configuration.instantiation.InstantiationConfiguration;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintFactory;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentAggregate;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentsFactory;
import com.yanchware.fractal.sdk.domain.exceptions.ComponentInstantiationException;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
+import com.yanchware.fractal.sdk.domain.fractal.FractalsFactory;
import com.yanchware.fractal.sdk.domain.livesystem.EnvironmentReference;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemAggregate;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemIdValue;
@@ -37,16 +37,17 @@
@Slf4j
public class Automaton {
private static Automaton instance;
- private static BlueprintFactory blueprintFactory;
+ private static FractalsFactory fractalsFactory;
private static LiveSystemsFactory liveSystemFactory;
private static EnvironmentsFactory environmentsFactory;
private static RetryRegistry serviceRetryRegistry;
private Automaton(HttpClient httpClient, SdkConfiguration sdkConfiguration) {
Automaton.serviceRetryRegistry = getDefaultRetryRegistry();
- Automaton.blueprintFactory = new BlueprintFactory(httpClient, sdkConfiguration, Automaton.serviceRetryRegistry);
+ Automaton.fractalsFactory = new FractalsFactory(httpClient, sdkConfiguration, Automaton.serviceRetryRegistry);
Automaton.liveSystemFactory = new LiveSystemsFactory(httpClient, sdkConfiguration, Automaton.serviceRetryRegistry);
- Automaton.environmentsFactory = new EnvironmentsFactory(httpClient, sdkConfiguration, Automaton.serviceRetryRegistry);
+ Automaton.environmentsFactory = new EnvironmentsFactory(httpClient, sdkConfiguration,
+ Automaton.serviceRetryRegistry);
}
/**
@@ -62,10 +63,19 @@ public static Automaton getInstance() throws InstantiatorException {
return instance;
}
+ /**
+ * Get builder for Blueprint Aggregate
+ *
+ * @return an instance of EnvironmentsFactory.EnvironmentBuilder to configure and build environments
+ */
+ public FractalsFactory.FractalBuilder getFractalBuilder() {
+ return fractalsFactory.builder();
+ }
+
/**
* Get builder for Environment Aggregate
*
- * @return
+ * @return an instance of EnvironmentsFactory.EnvironmentBuilder to configure and build environments
*/
public EnvironmentsFactory.EnvironmentBuilder getEnvironmentBuilder() {
return environmentsFactory.builder();
@@ -74,7 +84,7 @@ public EnvironmentsFactory.EnvironmentBuilder getEnvironmentBuilder() {
/**
* Get builder for LiveSystem Aggregate
*
- * @return
+ * @return an instance of LiveSystemsFactory.LiveSystemBuilder to build and configure live systems.
*/
public LiveSystemsFactory.LiveSystemBuilder getLiveSystemBuilder() {
return liveSystemFactory.builder();
@@ -98,7 +108,7 @@ public void instantiate(EnvironmentAggregate environment) throws InstantiatorExc
*/
public void instantiate(List liveSystems) throws InstantiatorException {
for (var liveSystem : liveSystems) {
- instantiateLiveSystem(liveSystem);
+ instantiateLiveSystem(liveSystem, true);
}
}
@@ -110,19 +120,20 @@ public void instantiate(List liveSystems) throws Instantiat
* @throws InstantiatorException if an error occurs during instantiation
*/
public void instantiate(List liveSystems, InstantiationConfiguration config)
- throws InstantiatorException
+ throws InstantiatorException
{
var liveSystemsMutations = new ArrayList>();
for (var liveSystem : liveSystems) {
- liveSystemsMutations.add(new ImmutablePair<>(liveSystem, instantiateLiveSystem(liveSystem)));
+ liveSystemsMutations.add(new ImmutablePair<>(liveSystem, instantiateLiveSystem(liveSystem,
+ config.createOrUpdateBlueprint)));
}
if (config != null && config.waitConfiguration != null && config.getWaitConfiguration().waitForInstantiation) {
for (var liveSystemMutation : liveSystemsMutations) {
waitForMutationInstantiation(
- liveSystemMutation.getKey(),
- liveSystemMutation.getValue());
+ liveSystemMutation.getKey(),
+ liveSystemMutation.getValue());
}
}
}
@@ -133,14 +144,17 @@ public void instantiate(List liveSystems, InstantiationConf
* @param liveSystemIds the list of ids of the live systems to be deleted
* @throws InstantiatorException if an error occurs during deletion
*/
- public void delete(EnvironmentIdValue environmentId, List liveSystemIds) throws InstantiatorException {
+ public void delete(
+ EnvironmentIdValue environmentId,
+ List liveSystemIds) throws InstantiatorException
+ {
for (var liveSystemId : liveSystemIds) {
var liveSystemAggregate = getLiveSystemBuilder()
- .withId(liveSystemId)
- .withEnvironmentId(environmentId)
- // This is ignored for deletion.
- .withStandardProvider(ProviderType.SAAS)
- .build();
+ .withId(liveSystemId)
+ .withEnvironmentId(environmentId)
+ // This is ignored for deletion.
+ .withStandardProvider(ProviderType.SAAS)
+ .build();
liveSystemAggregate.delete();
}
}
@@ -152,26 +166,34 @@ public void delete(EnvironmentIdValue environmentId, List liv
* This method performs the following steps:
*
*
- * - Parameter Validation: Ensures that all input parameters are valid and not null or empty.
- * - Component Instantiation: Initiates the instantiation of the custom workload component within the live system.
- * - Optional Deployment Wait: If the provided `config` specifies waiting for instantiation, the method will wait until the deployment is complete.
- * - Commit ID Verification: If waiting is enabled, the method verifies that the deployed component's commit ID matches the `commitId` parameter.
+ *
- Parameter Validation: Ensures that all input parameters are valid and not null or empty
+ * .
+ * - Component Instantiation: Initiates the instantiation of the custom workload component
+ * within the live system.
+ * - Optional Deployment Wait: If the provided `config` specifies waiting for instantiation,
+ * the method will wait until the deployment is complete.
+ * - Commit ID Verification: If waiting is enabled, the method verifies that the deployed
+ * component's commit ID matches the `commitId` parameter.
* If there's a mismatch but the component is active, the deployment is re-triggered.
- * - Output Fields Logging: If the deployment is successful, the component's output fields are logged for informational purposes.
+ * - Output Fields Logging: If the deployment is successful, the component's output fields are
+ * logged for informational purposes.
*
*
- * @param liveSystemId The ID of the live system.
- * @param customWorkloadComponentId The ID of the custom workload component to deploy.
- * @param commitId The expected commit ID to be deployed.
- * @param config The instantiation configuration, which can specify whether to wait for deployment completion.
- *
- * @throws ComponentInstantiationException If ny of the required parameters are null or empty, the component is not found, the deployment fails, or an error occurs while waiting for deployment completion.
+ * @param liveSystemId The ID of the live system.
+ * @param customWorkloadComponentId The ID of the custom workload component to deploy.
+ * @param commitId The expected commit ID to be deployed.
+ * @param config The instantiation configuration, which can specify whether to wait for
+ * deployment completion.
+ * @throws ComponentInstantiationException If ny of the required parameters are null or empty, the component is not
+ * found, the deployment fails, or an error occurs while waiting for deployment completion.
*/
- public void deployCustomWorkload(LiveSystemIdValue liveSystemId,
- String customWorkloadComponentId,
- String commitId,
- InstantiationConfiguration config)
- throws ComponentInstantiationException, InstantiatorException {
+ public void deployCustomWorkload(
+ LiveSystemIdValue liveSystemId,
+ String customWorkloadComponentId,
+ String commitId,
+ InstantiationConfiguration config)
+ throws ComponentInstantiationException, InstantiatorException
+ {
if (liveSystemId.resourceGroupId() == null) {
throw new ComponentInstantiationException("Resource group ID cannot be blank.");
}
@@ -189,15 +211,15 @@ public void deployCustomWorkload(LiveSystemIdValue liveSystemId,
}
var liveSystem = liveSystemFactory.builder()
- .withId(liveSystemId)
- .build();
+ .withId(liveSystemId)
+ .build();
var componentMutationDto = liveSystem.instantiateComponent(customWorkloadComponentId);
if (componentMutationDto == null) {
throw new ComponentInstantiationException(
- String.format("Component [id: '%s'] not found in LiveSystem [id: '%s']",
- customWorkloadComponentId, liveSystemId));
+ String.format("Component [id: '%s'] not found in LiveSystem [id: '%s']",
+ customWorkloadComponentId, liveSystemId));
}
// Optional waiting based on configuration
@@ -209,11 +231,13 @@ public void deployCustomWorkload(LiveSystemIdValue liveSystemId,
var componentStatus = component.getStatus();
if (componentStatus == LiveSystemComponentStatusDto.Active &&
- (!component.getOutputFields().containsKey(GIT_COMMIT_ID_KEY) ||
- !component.getOutputFields().get(GIT_COMMIT_ID_KEY).equals(commitId))) {
+ (!component.getOutputFields().containsKey(GIT_COMMIT_ID_KEY) ||
+ !component.getOutputFields().get(GIT_COMMIT_ID_KEY).equals(commitId)))
+ {
- log.info("Component is active but at a different commit ID. Expected: '{}', Current: '{}'. Re-triggering deployment",
- commitId, component.getOutputFields().get(GIT_COMMIT_ID_KEY));
+ log.info("Component is active but at a different commit ID. Expected: '{}', Current: '{}'. Re-triggering " +
+ "deployment",
+ commitId, component.getOutputFields().get(GIT_COMMIT_ID_KEY));
deployCustomWorkload(liveSystemId, customWorkloadComponentId, commitId, config);
} else if (componentStatus != LiveSystemComponentStatusDto.Active) {
@@ -236,19 +260,21 @@ public void deployCustomWorkload(LiveSystemIdValue liveSystemId,
* This method performs the following steps:
*
*
- * - Parameter Validation: Ensures that all input parameters are valid and not null or empty.
- * - Component Instantiation: Initiates the instantiation of the custom workload component within the live system.
+ * - Parameter Validation: Ensures that all input parameters are valid and not null or empty
+ * .
+ * - Component Instantiation: Initiates the instantiation of the custom workload component
+ * within the live system.
*
*
* Note: This method does not wait for deployment completion or verify the commit ID.
*
- * @param liveSystemId The ID of the live system.
- * @param customWorkloadComponentId The ID of the custom workload component to deploy.
- *
- * @throws ComponentInstantiationException If any of the required parameters are null or empty or the component is not found.
+ * @param liveSystemId The ID of the live system.
+ * @param customWorkloadComponentId The ID of the custom workload component to deploy.
+ * @throws ComponentInstantiationException If any of the required parameters are null or empty or the component is
+ * not found.
*/
public void deployCustomWorkload(LiveSystemIdValue liveSystemId, String customWorkloadComponentId)
- throws ComponentInstantiationException, InstantiatorException
+ throws ComponentInstantiationException, InstantiatorException
{
if (liveSystemId.resourceGroupId() == null) {
throw new ComponentInstantiationException("Resource group ID cannot be blank.");
@@ -263,15 +289,15 @@ public void deployCustomWorkload(LiveSystemIdValue liveSystemId, String customWo
}
var liveSystem = liveSystemFactory.builder()
- .withId(liveSystemId)
- .build();
+ .withId(liveSystemId)
+ .build();
var componentMutationDto = liveSystem.instantiateComponent(customWorkloadComponentId);
if (componentMutationDto == null) {
throw new ComponentInstantiationException(
- String.format("Component [id: '%s'] not found in LiveSystem [id: '%s']",
- customWorkloadComponentId, liveSystemId));
+ String.format("Component [id: '%s'] not found in LiveSystem [id: '%s']",
+ customWorkloadComponentId, liveSystemId));
}
}
@@ -292,21 +318,21 @@ protected static void initializeAutomaton(HttpClient httpClient, SdkConfiguratio
*/
protected static void initializeAutomaton(SdkConfiguration sdkConfiguration) {
var builder = HttpClient
- .newBuilder()
- .version(HttpClient.Version.HTTP_2);
+ .newBuilder()
+ .version(HttpClient.Version.HTTP_2);
initializeAutomaton(builder.build(), sdkConfiguration);
}
private static RetryRegistry getDefaultRetryRegistry() {
return RetryRegistry.of(RetryConfig.custom()
- .maxAttempts(5)
- .intervalFunction(IntervalFunction.ofExponentialBackoff(5000L))
- .build());
+ .maxAttempts(5)
+ .intervalFunction(IntervalFunction.ofExponentialBackoff(5000L))
+ .build());
}
private static void waitForMutationInstantiation(LiveSystemAggregate liveSystem, LiveSystemMutationDto mutation)
- throws InstantiatorException
+ throws InstantiatorException
{
liveSystem.checkLiveSystemMutationStatus(mutation.id());
}
@@ -316,31 +342,38 @@ private static String environmentToJsonString(EnvironmentReference environment)
return serialize(environment);
} catch (JsonProcessingException e) {
var errorMessage = String.format("Unable to serialize Instantiate LiveSystem environment. %s",
- e.getLocalizedMessage());
+ e.getLocalizedMessage());
log.error(errorMessage, e);
throw new InstantiatorException(errorMessage, e);
}
}
- private LiveSystemMutationDto instantiateLiveSystem(LiveSystemAggregate liveSystem)
- throws InstantiatorException {
- createOrUpdateBlueprint(liveSystem);
+ private LiveSystemMutationDto instantiateLiveSystem(LiveSystemAggregate liveSystem, boolean createOrUpdateBlueprint)
+ throws InstantiatorException
+ {
+
+ if (createOrUpdateBlueprint) {
+ createOrUpdateFractal(liveSystem);
+ }
return liveSystem.instantiate();
}
- private static void createOrUpdateBlueprint(LiveSystemAggregate liveSystem) throws InstantiatorException {
- var blueprintAggregate = blueprintFactory.getBlueprintAggregate(liveSystem);
- blueprintAggregate.createOrUpdate();
+ private static void createOrUpdateFractal(LiveSystemAggregate liveSystem) throws InstantiatorException {
+ var fractalAggregate = fractalsFactory.builder()
+ .fromLiveSystem(liveSystem)
+ .build();
+ fractalAggregate.createOrUpdate();
}
private static LiveSystemComponentMutationDto waitForCustomWorkloadDeploymentCompletion(
- LiveSystemAggregate liveSystemAggregate,
- LiveSystemComponentMutationDto componentMutationDto) throws InstantiatorException {
+ LiveSystemAggregate liveSystemAggregate,
+ LiveSystemComponentMutationDto componentMutationDto) throws InstantiatorException
+ {
return liveSystemAggregate.getComponentMutationStatus(
- componentMutationDto.component().getId(),
- componentMutationDto.id());
+ componentMutationDto.component().getId(),
+ componentMutationDto.id());
}
private static void instantiateEnvironment(EnvironmentAggregate environment) throws InstantiatorException {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/EnvVarSdkConfiguration.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/EnvVarSdkConfiguration.java
index 85a07fb2..b03d3348 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/EnvVarSdkConfiguration.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/EnvVarSdkConfiguration.java
@@ -42,7 +42,8 @@ public EnvVarSdkConfiguration() throws URISyntaxException {
/**
* Gets the BOT client ID or Cloud Agent Client ID from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#CI_CD_SERVICE_ACCOUNT_NAME_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#CI_CD_SERVICE_ACCOUNT_NAME_KEY}.
*
* @return the BOT client ID or Cloud Agent Client ID
* @throws IllegalArgumentException if the client ID environment variable is not set
@@ -52,14 +53,16 @@ public String getClientId() {
var clientId = System.getenv(CI_CD_SERVICE_ACCOUNT_NAME_KEY);
if (isBlank(clientId)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", CI_CD_SERVICE_ACCOUNT_NAME_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ CI_CD_SERVICE_ACCOUNT_NAME_KEY));
}
return clientId;
}
/**
* Gets the BOT client secret or Cloud Agent Client secret from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#CI_CD_SERVICE_ACCOUNT_SECRET_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#CI_CD_SERVICE_ACCOUNT_SECRET_KEY}.
*
* @return the BOT client secret or Cloud Agent Client secret
* @throws IllegalArgumentException if the client secret environment variable is not set
@@ -69,7 +72,8 @@ public String getClientSecret() {
var clientSecret = System.getenv(CI_CD_SERVICE_ACCOUNT_SECRET_KEY);
if (isBlank(clientSecret)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", CI_CD_SERVICE_ACCOUNT_SECRET_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ CI_CD_SERVICE_ACCOUNT_SECRET_KEY));
}
return clientSecret;
}
@@ -87,7 +91,8 @@ public String getAzureSpClientId() {
/**
* Gets the Azure service principal client secret from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#AZURE_SP_CLIENT_SECRET_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#AZURE_SP_CLIENT_SECRET_KEY}.
*
* @return the Azure service principal client secret
*/
@@ -120,7 +125,8 @@ public URI getLiveSystemEndpoint() {
/**
* Gets the URI of the environments endpoint from environment variables or default.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#ENVIRONMENTS_ENDPOINT_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#ENVIRONMENTS_ENDPOINT_KEY}.
*
* @return the URI of the environments endpoint
*/
@@ -164,7 +170,8 @@ public String getAwsSessionToken() {
/**
* Gets the GCP service account email from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#GCP_SERVICE_ACCOUNT_EMAIL_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#GCP_SERVICE_ACCOUNT_EMAIL_KEY}.
*
* @return the GCP service account email
*/
@@ -175,7 +182,8 @@ public String getGcpServiceAccountEMail() {
/**
* Gets the GCP service account credentials from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#GCP_SERVICE_ACCOUNT_CREDENTIALS_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#GCP_SERVICE_ACCOUNT_CREDENTIALS_KEY}.
*
* @return the GCP service account credentials
*/
@@ -186,7 +194,8 @@ public String getGcpServiceAccountCredentials() {
/**
* Gets the OCI service account ID from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#OCI_SERVICE_ACCOUNT_ID_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#OCI_SERVICE_ACCOUNT_ID_KEY}.
*
* @return the OCI service account ID
*/
@@ -197,7 +206,8 @@ public String getOciServiceAccountId() {
/**
* Gets the OCI service account credentials from environment variables.
- * The environment variable key is {@value com.yanchware.fractal.sdk.configuration.Constants#OCI_SERVICE_ACCOUNT_CREDENTIALS_KEY}.
+ * The environment variable key is
+ * {@value com.yanchware.fractal.sdk.configuration.Constants#OCI_SERVICE_ACCOUNT_CREDENTIALS_KEY}.
*
* @return the OCI service account credentials
*/
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationConfiguration.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationConfiguration.java
index 4466636c..9cc87b82 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationConfiguration.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationConfiguration.java
@@ -7,9 +7,17 @@
@Builder(setterPrefix = "with")
public class InstantiationConfiguration {
- /**
- * Defines the wait configuration for the instantiation process.
- * By default the instantiation terminates without waiting.
- */
- public InstantiationWaitConfiguration waitConfiguration;
+ /**
+ * Defines the wait configuration for the instantiation process.
+ * By default, the instantiation terminates without waiting.
+ */
+ public InstantiationWaitConfiguration waitConfiguration;
+
+ /**
+ * Indicates whether to create or update a blueprint during the instantiation process.
+ * This variable is used to control the behavior of blueprint management.
+ * If set to true, an existing blueprint will be updated or a new blueprint will
+ * be created as part of the Live System instantiation.
+ */
+ public boolean createOrUpdateBlueprint;
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationWaitConfiguration.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationWaitConfiguration.java
index 06217a27..6a528b2d 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationWaitConfiguration.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/configuration/instantiation/InstantiationWaitConfiguration.java
@@ -50,7 +50,8 @@ public InstantiationWaitConfigurationBuilder withTimeoutMinutes(int timeoutMinut
public InstantiationWaitConfiguration build() {
if (configuration.waitForInstantiation
- && configuration.timeoutMinutes == null) {
+ && configuration.timeoutMinutes == null)
+ {
configuration.setTimeoutMinutes(DEFAULT_LIVE_SYSTEM_INSTANTIATION_WAIT_TIMEOUT_MINUTES);
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Component.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Component.java
index d566d001..9c49f9eb 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Component.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Component.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSAPIGateway;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSAPIGateway;
import com.yanchware.fractal.sdk.domain.livesystem.caas.CaaSKubernetesWorkload;
import com.yanchware.fractal.sdk.domain.values.ComponentId;
import com.yanchware.fractal.sdk.domain.values.ComponentType;
@@ -66,19 +66,20 @@ public Builder() {
}
protected abstract T createComponent();
+
protected abstract B getBuilder();
/**
*
* Sets the display name for the current {@link Component} instance.
- *
- * This method allows setting a human-readable name for a component,
- * which can be useful for identification and management purposes within
- * the Fractal Cloud infrastructure. The display name is used across the
- * Fractal Cloud interface and other areas where a more descriptive,
+ *
+ * This method allows setting a human-readable name for a component,
+ * which can be useful for identification and management purposes within
+ * the Fractal Cloud infrastructure. The display name is used across the
+ * Fractal Cloud interface and other areas where a more descriptive,
* human-friendly name for a component is preferable over its technical identifier.
*
- * @param displayName A String representing the new display name for the component.
+ * @param displayName A String representing the new display name for the component.
* This cannot be null or empty.
* @see Component
*/
@@ -90,17 +91,17 @@ public B withDisplayName(String displayName) {
/**
*
* Sets the unique identifier for the current {@link Component} instance using a {@link ComponentId}.
- *
- * The method validates the provided ComponentId against a series of rules defined in the
- * {@link ComponentId} class. These rules ensure that the ID is not null, not empty, starts with a
- * lowercase letter, contains only lowercase letters, digits, and hyphens, and adheres to length
+ *
+ * The method validates the provided ComponentId against a series of rules defined in the
+ * {@link ComponentId} class. These rules ensure that the ID is not null, not empty, starts with a
+ * lowercase letter, contains only lowercase letters, digits, and hyphens, and adheres to length
* constraints (between 3 and 63 characters).
*
* If the ComponentId fails validation, an {@link IllegalArgumentException} is thrown,
* detailing the reason for failure based on the specific validation rule(s) the provided ID violated.
*
* @param id The {@link ComponentId} to set as the identifier for the component. Must not be null.
- * @throws IllegalArgumentException if the id is null or doesn't meet the validation
+ * @throws IllegalArgumentException if the id is null or doesn't meet the validation
* criteria set by {@link ComponentId#validate(String)}.
*/
public B withId(ComponentId id) {
@@ -112,20 +113,20 @@ public B withId(ComponentId id) {
*
* Sets the unique identifier for the current {@link Component} instance by converting a String
* to a {@link ComponentId}.
- *
- * This convenience method facilitates the direct assignment of a component's ID using a string value.
- * It internally converts the string to a {@link ComponentId} instance, leveraging the validation rules
- * defined within the {@link ComponentId} class. These rules ensure the ID is properly formatted—starting
- * with a lowercase letter, containing only lowercase letters, digits, and hyphens, and conforming to
+ *
+ * This convenience method facilitates the direct assignment of a component's ID using a string value.
+ * It internally converts the string to a {@link ComponentId} instance, leveraging the validation rules
+ * defined within the {@link ComponentId} class. These rules ensure the ID is properly formatted—starting
+ * with a lowercase letter, containing only lowercase letters, digits, and hyphens, and conforming to
* length constraints (between 3 and 63 characters).
- *
+ *
* If the provided string fails to meet these validation criteria, an {@link IllegalArgumentException}
- * is thrown, indicating the specific validation failure(s). This ensures that only valid identifiers
+ * is thrown, indicating the specific validation failure(s). This ensures that only valid identifiers
* are set for components, maintaining integrity within the Fractal Cloud infrastructure.
*
- * @param id A String representing the desired identifier for the component. This string is
+ * @param id A String representing the desired identifier for the component. This string is
* converted to a {@link ComponentId}, and must adhere to the {@link ComponentId} validation rules.
- * @throws IllegalArgumentException if the id string is null, empty, or violates the
+ * @throws IllegalArgumentException if the id string is null, empty, or violates the
* validation rules defined by {@link ComponentId#validate(String)}.
*/
public B withId(String id) {
@@ -136,19 +137,19 @@ public B withId(String id) {
/**
*
* Assigns the version to the current {@link Component} instance.
- *
- * This method sets the version string for a component, intended for future use to distinguish
+ *
+ * This method sets the version string for a component, intended for future use to distinguish
* between different stages or configurations of a component's lifecycle. Currently, if a null
- * version is provided, the version is set to a default value of "1.0". This defaulting behavior
- * ensures backward compatibility and facilitates the future introduction of version management
+ * version is provided, the version is set to a default value of "1.0". This defaulting behavior
+ * ensures backward compatibility and facilitates the future introduction of version management
* without affecting existing components.
*
- * The versioning feature, once in use, will allow for precise management and differentiation
- * between component iterations within the Fractal Cloud infrastructure, ensuring that operations
+ * The versioning feature, once in use, will allow for precise management and differentiation
+ * between component iterations within the Fractal Cloud infrastructure, ensuring that operations
* utilize the correct component version.
*
- * @param version A String representing the new version for the component. If null,
- * the version is set to the default value of "1.0". Future implementations will enforce
+ * @param version A String representing the new version for the component. If null,
+ * the version is set to the default value of "1.0". Future implementations will enforce
* specific format compliance with the application's versioning scheme.
*/
public B withVersion(String version) {
@@ -158,21 +159,21 @@ public B withVersion(String version) {
/**
*
- * Locks the current {@link Component}, setting it to prevent hard deletions and enabling its removal
- * from the Fractal Cloud list of components by the customer without deleting the actual resource from
+ * Locks the current {@link Component}, setting it to prevent hard deletions and enabling its removal
+ * from the Fractal Cloud list of components by the customer without deleting the actual resource from
* the cloud provider.
- *
- * When a component is locked, it is marked as immutable within Fractal Cloud, meaning that no operations
- * can lead to its hard deletion from the underlying cloud provider. This status allows the component to be
- * manually removed from the Fractal Cloud list of components by the customer as needed, without affecting
- * the component's actual resources on the cloud provider. The locked state is especially critical for
- * ensuring the component's persistence and availability in the cloud, even as it gets unlisted from
+ *
+ * When a component is locked, it is marked as immutable within Fractal Cloud, meaning that no operations
+ * can lead to its hard deletion from the underlying cloud provider. This status allows the component to be
+ * manually removed from the Fractal Cloud list of components by the customer as needed, without affecting
+ * the component's actual resources on the cloud provider. The locked state is especially critical for
+ * ensuring the component's persistence and availability in the cloud, even as it gets unlisted from
* Fractal Cloud UI.
*
- * This approach is ideal for components that need to be preserved outside the active management scope of
- * Fractal Cloud, such as for archival purposes or during periods of maintenance or transition. It is
- * important to note that while the component will no longer appear within Fractal Cloud's active component
- * list following its deletion by the customer, its resources remain intact and unmodified on the cloud
+ * This approach is ideal for components that need to be preserved outside the active management scope of
+ * Fractal Cloud, such as for archival purposes or during periods of maintenance or transition. It is
+ * important to note that while the component will no longer appear within Fractal Cloud's active component
+ * list following its deletion by the customer, its resources remain intact and unmodified on the cloud
* provider's platform.
*/
public B lock() {
@@ -182,15 +183,15 @@ public B lock() {
/**
*
- * Unlocks the current {@link Component}, enabling it for standard management procedures within Fractal Cloud,
- * including the potential for hard deletion. This method reinstates the component as fully managed by Fractal Cloud,
+ * Unlocks the current {@link Component}, enabling it for standard management procedures within Fractal Cloud,
+ * including the potential for hard deletion. This method reinstates the component as fully managed by Fractal Cloud,
* preparing it for any operational workflows that include its management and potential deletion.
*
- * Warning: Unlocking can only be applied to components that have not been permanently deleted.
+ * Warning: Unlocking can only be applied to components that have not been permanently deleted.
* It is crucial to ensure that the component is still present and has not undergone a hard deletion process.
*
- * Use this method with caution to avoid unintended consequences, particularly with components critical to
- * operational stability. Ensure that the component is in a state that should be managed and potentially
+ * Use this method with caution to avoid unintended consequences, particularly with components critical to
+ * operational stability. Ensure that the component is in a state that should be managed and potentially
* deleted by Fractal Cloud before proceeding with unlocking.
*/
public B unlock() {
@@ -201,19 +202,19 @@ public B unlock() {
/**
*
* Adds a collection of dependencies to the current {@link Component}.
- *
- * This method allows for the specification of dependencies that must be instantiated before
- * the current component, ensuring all necessary resources are ready and available for the
- * component's instantiation. Dependencies are managed as a set, avoiding duplicate entries
+ *
+ * This method allows for the specification of dependencies that must be instantiated before
+ * the current component, ensuring all necessary resources are ready and available for the
+ * component's instantiation. Dependencies are managed as a set, avoiding duplicate entries
* and ensuring each dependency is only considered once.
*
- * @param dependencies A collection of {@link ComponentId} representing the dependencies to be
- * added to the component. This collection must not be null, and each
- * ComponentId within it represents a unique component dependency
+ * @param dependencies A collection of {@link ComponentId} representing the dependencies to be
+ * added to the component. This collection must not be null, and each
+ * ComponentId within it represents a unique component dependency
* that must be available prior to the instantiation of the current component.
*/
public B withDependencies(Collection extends ComponentId> dependencies) {
- if(component.getDependencies() == null) {
+ if (component.getDependencies() == null) {
component.setDependencies(new HashSet<>());
}
@@ -225,7 +226,7 @@ public B withDependencies(Collection extends ComponentId> dependencies) {
/**
*
* Adds a single dependency to the current {@link Component}.
- *
+ *
* This method provides a convenient way to add a single dependency to the component, ensuring that
* this dependency is instantiated before the component itself. It leverages the {@link #withDependencies(Collection)}
* method, wrapping the single dependency in a set and passing it on for addition. This approach
@@ -248,22 +249,23 @@ public B withDependency(ComponentId dependency) {
/**
*
* Adds a collection of links to the current {@link Component}.
- *
- * Utilizes {@link ComponentLink} objects to define connections or relationships between this component
- * and others within the system. Each link specifies a target component through its ID and includes
- * an optional map of settings to configure the relationship's properties. The method ensures all links
+ *
+ * Utilizes {@link ComponentLink} objects to define connections or relationships between this component
+ * and others within the system. Each link specifies a target component through its ID and includes
+ * an optional map of settings to configure the relationship's properties. The method ensures all links
* are valid and adhere to the constraints defined in {@link ComponentLink#validate()} before adding them
* to the component.
*
- * @param links A collection of {@link ComponentLink} objects representing the links to be added.
- * Each link must pass validation checks as defined in {@link ComponentLink#validate()},
- * ensuring that all specified component IDs are valid and that the settings map adheres
+ * @param links A collection of {@link ComponentLink} objects representing the links to be added.
+ * Each link must pass validation checks as defined in {@link ComponentLink#validate()},
+ * ensuring that all specified component IDs are valid and that the settings map adheres
* to expected formats and values.
- * @throws IllegalArgumentException If any {@link ComponentLink} in the collection fails validation,
- * indicating problems with the component ID validity or settings map configuration.
+ * @throws IllegalArgumentException If any {@link ComponentLink} in the collection fails validation,
+ * indicating problems with the component ID validity or settings map
+ * configuration.
*/
public B withLinks(Collection extends ComponentLink> links) {
- if(component.getLinks() == null) {
+ if (component.getLinks() == null) {
component.setLinks(new HashSet<>());
}
@@ -283,10 +285,10 @@ public B withLinks(Collection extends ComponentLink> links) {
* it adheres to the necessary standards before being added to the component.
*
*
- * @param link A {@link ComponentLink} object representing the link to be added. The link must pass
- * validation checks as outlined in {@link ComponentLink#validate()}, confirming the validity
+ * @param link A {@link ComponentLink} object representing the link to be added. The link must pass
+ * validation checks as outlined in {@link ComponentLink#validate()}, confirming the validity
* of the specified component ID and the appropriateness of any settings.
- * @throws IllegalArgumentException If the {@link ComponentLink} fails validation, indicating issues
+ * @throws IllegalArgumentException If the {@link ComponentLink} fails validation, indicating issues
* with the component ID's validity or the configuration of the settings map.
*/
public B withLink(ComponentLink link) {
@@ -300,11 +302,11 @@ public B withLink(ComponentLink link) {
* a default description is generated based on the component's type, ensuring the component always has
* a meaningful description.
*
- * This method facilitates the provision of detailed information about the component's purpose, usage, or
+ * This method facilitates the provision of detailed information about the component's purpose, usage, or
* any other relevant details. In cases where the description is not explicitly provided or is deemed invalid
- * (e.g., empty or null), the component is assigned a default description formatted as
+ * (e.g., empty or null), the component is assigned a default description formatted as
* "[ComponentType] generated via SDK", where [ComponentType] is the identifier of the component's type.
- * This ensures that every component managed by the SDK has a descriptive text, enhancing clarity and
+ * This ensures that every component managed by the SDK has a descriptive text, enhancing clarity and
* manageability within the system.
*
* @param description A String representing the description to set for the component. If this parameter
@@ -318,24 +320,24 @@ public B withDescription(String description) {
/**
*
* Configures the current {@link Component} to be either recreated or not in the event of a failure.
- *
- * This method sets a flag determining whether the component should be automatically recreated
- * upon encountering a failure during its lifecycle. This feature is crucial for maintaining
- * high availability and resilience, particularly for critical components where automatic recovery
- * is preferred to manual intervention. By default, components do not automatically recreate on failure
- * (recreateOnFailure = false). However, this behavior is overridden to true in specific
- * subclasses, such as {@link CaaSAPIGateway} and {@link CaaSKubernetesWorkload}, to enhance their
+ *
+ * This method sets a flag determining whether the component should be automatically recreated
+ * upon encountering a failure during its lifecycle. This feature is crucial for maintaining
+ * high availability and resilience, particularly for critical components where automatic recovery
+ * is preferred to manual intervention. By default, components do not automatically recreate on failure
+ * (recreateOnFailure = false). However, this behavior is overridden to true in specific
+ * subclasses, such as {@link CaaSAPIGateway} and {@link CaaSKubernetesWorkload}, to enhance their
* reliability and self-healing capabilities.
*
- * Setting this flag to true enables the component for automatic recreation following a failure,
- * while false disables this behavior, necessitating manual remediation to resolve
- * failures. This setting permits tailored lifecycle and resilience strategies for different
- * component types within the system, accommodating both automated recovery needs and scenarios
+ * Setting this flag to true enables the component for automatic recreation following a failure,
+ * while false disables this behavior, necessitating manual remediation to resolve
+ * failures. This setting permits tailored lifecycle and resilience strategies for different
+ * component types within the system, accommodating both automated recovery needs and scenarios
* where manual intervention is preferred.
*
- * @param recreateOnFailure A boolean value indicating whether the component should be
- * recreated on failure (true) or not (false). The default
- * behavior may vary based on the component's type or subclass, with certain
+ * @param recreateOnFailure A boolean value indicating whether the component should be
+ * recreated on failure (true) or not (false). The default
+ * behavior may vary based on the component's type or subclass, with certain
* types defaulting to automatic recreation to ensure continuity and resilience.
*/
public B withRecreateOnFailure(boolean recreateOnFailure) {
@@ -345,21 +347,21 @@ public B withRecreateOnFailure(boolean recreateOnFailure) {
/**
*
- * Finalizes the building process of the {@link Component}, ensuring it meets all necessary validation
+ * Finalizes the building process of the {@link Component}, ensuring it meets all necessary validation
* criteria before instantiation.
- *
- * This method performs a final validation check on the component to ensure that all required fields
- * and configurations meet the system's specifications. If any validation errors are found, an
- * {@link IllegalArgumentException} is thrown, detailing the reasons for failure. This approach guarantees
+ *
+ * This method performs a final validation check on the component to ensure that all required fields
+ * and configurations meet the system's specifications. If any validation errors are found, an
+ * {@link IllegalArgumentException} is thrown, detailing the reasons for failure. This approach guarantees
* that only fully compliant and correctly configured components are created.
*
- * If the component's description is not explicitly set, a default description is generated based on
- * the component's type to ensure every component is accompanied by descriptive text. Additionally, if
- * the version is not specified, it defaults to DEFAULT_VERSION, which is currently "1.0". This
+ * If the component's description is not explicitly set, a default description is generated based on
+ * the component's type to ensure every component is accompanied by descriptive text. Additionally, if
+ * the version is not specified, it defaults to DEFAULT_VERSION, which is currently "1.0". This
* standardizes the component versioning, simplifying management and integration within the system.
*
* @return The fully constructed and validated {@link Component} instance, ready for use within the system.
- * @throws IllegalArgumentException if the component fails any validation checks, with a detailed
+ * @throws IllegalArgumentException if the component fails any validation checks, with a detailed
* message of the validation errors encountered.
*/
public T build() {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/ComponentLink.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/ComponentLink.java
index 3b73455b..eb572e2b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/ComponentLink.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/ComponentLink.java
@@ -76,8 +76,8 @@ public ComponentLink build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "ComponentLink validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "ComponentLink validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
return componentLink;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Service.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Service.java
index c8f8fe55..5be9a2d6 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Service.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Service.java
@@ -2,7 +2,6 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
-import com.yanchware.fractal.sdk.domain.exceptions.EnvironmentException;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
import com.yanchware.fractal.sdk.utils.StringHelper;
import io.github.resilience4j.retry.Retry;
@@ -33,11 +32,12 @@ protected Service(HttpClient client, SdkConfiguration sdkConfiguration, RetryReg
}
protected static void executeRequestWithRetries(
- String requestName,
- HttpClient client,
- RetryRegistry retryRegistry,
- HttpRequest request,
- int[] acceptedResponses) throws InstantiatorException {
+ String requestName,
+ HttpClient client,
+ RetryRegistry retryRegistry,
+ HttpRequest request,
+ int[] acceptedResponses) throws InstantiatorException
+ {
Retry retry = retryRegistry.retry(requestName);
@@ -50,19 +50,20 @@ protected static void executeRequestWithRetries(
}).get();
} catch (Throwable ex) {
throw new InstantiatorException(
- String.format("All attempts to %s failed", StringHelper.toWords(requestName)),
- ex);
+ String.format("All attempts to %s failed", StringHelper.toWords(requestName)),
+ ex);
}
}
protected static T executeRequestWithRetries(
- String requestName,
- String entityId,
- HttpClient client,
- RetryRegistry retryRegistry,
- HttpRequest request,
- int[] acceptedResponses,
- Class classRef) throws InstantiatorException {
+ String requestName,
+ String entityId,
+ HttpClient client,
+ RetryRegistry retryRegistry,
+ HttpRequest request,
+ int[] acceptedResponses,
+ Class classRef) throws InstantiatorException
+ {
Retry retry = retryRegistry.retry(requestName);
@@ -73,9 +74,11 @@ protected static T executeRequestWithRetries(
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 401) {
- var message = String.format("Invalid credentials provided. Please ensure the '%s' and '%s' environment variables are correctly set. Contact Fractal Cloud support if you need assistance with these credentials.",
- CI_CD_SERVICE_ACCOUNT_NAME_KEY, CI_CD_SERVICE_ACCOUNT_SECRET_KEY);
-
+ var message = String.format("Invalid credentials provided. Please ensure the '%s' and '%s' environment " +
+ "variables are correctly set. Contact Fractal Cloud support if you need assistance with these " +
+ "credentials.",
+ CI_CD_SERVICE_ACCOUNT_NAME_KEY, CI_CD_SERVICE_ACCOUNT_SECRET_KEY);
+
String errorMessage = formatErrorMessage(requestName, message, entityId);
log.error(errorMessage);
@@ -94,13 +97,13 @@ protected static T executeRequestWithRetries(
log.error("Attempted {} has come up with empty or null body contents", requestNameLog);
return null;
}
-
- if(requestName.equals("fetchEnvironmentById")) {
- if(bodyContents.contains("Guid should contain 32 digits")) {
+
+ if (requestName.equals("fetchEnvironmentById")) {
+ if (bodyContents.contains("Guid should contain 32 digits")) {
return null;
}
}
-
+
try {
return deserialize(bodyContents, classRef);
} catch (JsonProcessingException e) {
@@ -112,8 +115,8 @@ protected static T executeRequestWithRetries(
} catch (Throwable ex) {
log.error("All attempts failed. {}", ex.getMessage()); // Improved log message
throw new InstantiatorException(
- String.format("%s. Please try again later or contact Fractal Cloud support if the issue persists.",
- ex.getMessage())); // Improved exception message
+ String.format("%s. Please try again later or contact Fractal Cloud support if the issue persists.",
+ ex.getMessage())); // Improved exception message
}
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Validatable.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Validatable.java
index 068d8534..d785cb91 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Validatable.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/Validatable.java
@@ -7,6 +7,7 @@ public interface Validatable {
/**
* Perform a validation on the current instance of the class.
* Returns a list of validation errors or an empty list if validation is successful.
+ *
* @return Error list or empty list in case of successful validation.
*/
Collection validate();
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintAggregate.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintAggregate.java
deleted file mode 100644
index b8b98b76..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintAggregate.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint;
-
-import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
-import com.yanchware.fractal.sdk.domain.blueprint.service.BlueprintService;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintComponentDto;
-import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
-import io.github.resilience4j.retry.RetryRegistry;
-import lombok.Getter;
-
-import java.net.http.HttpClient;
-import java.util.Collection;
-
-@Getter
-public class BlueprintAggregate {
- private final BlueprintService service;
- private final FractalIdValue fractalId;
- private final String description;
- private final boolean isPrivate;
- private final Collection components;
-
- public BlueprintAggregate(
- HttpClient client,
- SdkConfiguration sdkConfiguration,
- RetryRegistry retryRegistry,
- FractalIdValue fractalId,
- String description,
- boolean isPrivate,
- // TODO FRA-1870: We should find a way to fix this instead to have DTOs in the Aggregate 🤮
- Collection components)
- {
- this.fractalId = fractalId;
- this.description = description;
- this.isPrivate = isPrivate;
- this.components = components;
- this.service = new BlueprintService(client, sdkConfiguration, retryRegistry);
- }
-
- public void createOrUpdate() throws InstantiatorException {
- service.createOrUpdate(fractalId, description, isPrivate, components);
- }
-}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintComponent.java
deleted file mode 100644
index e546491b..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintComponent.java
+++ /dev/null
@@ -1,4 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint;
-
-public interface BlueprintComponent {
-}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintFactory.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintFactory.java
deleted file mode 100644
index bd14e9ed..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/BlueprintFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint;
-
-import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintComponentDto;
-import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemAggregate;
-import io.github.resilience4j.retry.RetryRegistry;
-
-import java.net.http.HttpClient;
-
-public class BlueprintFactory {
- private final HttpClient client;
- private final SdkConfiguration sdkConfiguration;
- private final RetryRegistry retryRegistry;
-
- public BlueprintFactory(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
-
- this.client = client;
- this.sdkConfiguration = sdkConfiguration;
- this.retryRegistry = retryRegistry;
- }
-
- public BlueprintAggregate getBlueprintAggregate(LiveSystemAggregate liveSystem) {
- var fractalId = liveSystem.getFractalId();
- return new BlueprintAggregate(
- client,
- sdkConfiguration,
- retryRegistry,
- fractalId,
- String.format("Blueprint created via SDK from LiveSystem with Fractal ID: %s", fractalId),
- true,
- BlueprintComponentDto.fromLiveSystemComponents(liveSystem.getComponents()));
- }
-}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/CreateBlueprintCommandRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/CreateBlueprintCommandRequest.java
deleted file mode 100644
index 93be5ebf..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/CreateBlueprintCommandRequest.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service.commands;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintComponentDto;
-
-import java.util.Collection;
-
-public record CreateBlueprintCommandRequest (
- String description,
- @JsonProperty("private")
- boolean isPrivate,
- Collection components) { }
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/UpdateBlueprintCommandRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/UpdateBlueprintCommandRequest.java
deleted file mode 100644
index 14522121..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/commands/UpdateBlueprintCommandRequest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service.commands;
-
-import com.yanchware.fractal.sdk.domain.blueprint.FractalIdValue;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintComponentDto;
-import lombok.Builder;
-import lombok.Data;
-
-import java.util.Collection;
-
-@Data
-@Builder
-public class UpdateBlueprintCommandRequest {
- private String resourceGroupId;
- private String fractalName;
- private String fractalVersion;
- private String description;
- private boolean isPrivate;
- Collection components;
-
- public static UpdateBlueprintCommandRequest fromCreateCommand(CreateBlueprintCommandRequest command, FractalIdValue fractalId) {
- String[] splitId = fractalId.toString().split("[/:]");
- return UpdateBlueprintCommandRequest.builder()
- .resourceGroupId(String.format("%s/%s/%s", splitId[0], splitId[1], splitId[2]))
- .fractalName(splitId[3])
- .fractalVersion(splitId[4])
- .description(command.description())
- .isPrivate(command.isPrivate())
- .components(command.components())
- .build();
- }
-}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintComponentDto.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintComponentDto.java
deleted file mode 100644
index 7e80d122..00000000
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintComponentDto.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service.dtos;
-
-import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
-import com.yanchware.fractal.sdk.domain.services.contracts.ComponentDto;
-import com.yanchware.fractal.sdk.utils.ReflectionUtils;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.*;
-
-import static com.yanchware.fractal.sdk.configuration.Constants.BLUEPRINT_TYPE;
-import static java.util.Collections.emptySet;
-
-@Data
-@EqualsAndHashCode(callSuper = true)
-@ToString(callSuper = true)
-@NoArgsConstructor
-@Slf4j
-public class BlueprintComponentDto extends ComponentDto {
- private Set outputFields;
-
- public static BlueprintComponentDtoBuilder builder() {
- return new BlueprintComponentDtoBuilder();
- }
-
- public static class BlueprintComponentDtoBuilder extends Builder {
-
- @Override
- protected BlueprintComponentDto createComponent() {
- return new BlueprintComponentDto();
- }
-
- @Override
- protected BlueprintComponentDtoBuilder getBuilder() {
- return this;
- }
-
- public BlueprintComponentDtoBuilder withOutputFields(Collection extends String> outputFields) {
- if (componentDto.getOutputFields() == null) {
- componentDto.setOutputFields(new HashSet<>());
- }
-
- componentDto.getOutputFields().addAll(outputFields);
-
- return builder;
- }
- }
-
- public static List fromLiveSystemComponents(Collection components) {
- List blueprintComponentDtoList = new ArrayList<>();
- for (LiveSystemComponent component : components) {
- List
*
* @param shortName The short name of the CI/CD profile, which must adhere to the following constraints:
*
@@ -56,8 +62,8 @@ public CiCdProfile(String shortName, String displayName, String sshPrivateKeyDat
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "CI/CD Profile validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "CI/CD Profile validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
}
@@ -79,8 +85,7 @@ private Collection validate(String shortName, String displayName, String
errors.add(SHORT_NAME_NOT_VALID);
}
}
-
-
+
if (StringUtils.isBlank(displayName)) {
errors.add(DISPLAY_NAME_NOT_VALID);
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/CloudAgentEntity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/CloudAgentEntity.java
index c080862e..81335897 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/CloudAgentEntity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/CloudAgentEntity.java
@@ -21,154 +21,162 @@
@Slf4j
public abstract class CloudAgentEntity {
- public static final String PROVIDER_PARAM_KEY = "provider";
- protected static final Duration RETRIES_DELAY = Duration.ofSeconds(30);
- protected static final Duration TOTAL_ALLOWED_DURATION = Duration.ofMinutes(55);
- protected final EnvironmentIdValue environmentId;
- protected final Map tags;
-
- public abstract ProviderType getProvider();
- public abstract void initialize(EnvironmentService environmentService) throws InstantiatorException;
- public abstract void initialize(EnvironmentService environmentService, EnvironmentIdValue managedEnvironmentId) throws InstantiatorException;
- protected abstract Map getConfigurationForEnvironmentParameters();
-
- protected CloudAgentEntity(
- EnvironmentIdValue environmentId,
- Map tags) {
- this.tags = tags;
- this.environmentId = environmentId;
+ public static final String PROVIDER_PARAM_KEY = "provider";
+ protected static final Duration RETRIES_DELAY = Duration.ofSeconds(30);
+ protected static final Duration TOTAL_ALLOWED_DURATION = Duration.ofMinutes(55);
+ protected final EnvironmentIdValue environmentId;
+ protected final Map tags;
+
+ public abstract ProviderType getProvider();
+
+ public abstract void initialize(EnvironmentService environmentService) throws InstantiatorException;
+
+ public abstract void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managedEnvironmentId) throws InstantiatorException;
+
+ protected abstract Map getConfigurationForEnvironmentParameters();
+
+ protected CloudAgentEntity(
+ EnvironmentIdValue environmentId,
+ Map tags)
+ {
+ this.tags = tags;
+ this.environmentId = environmentId;
+ }
+
+ protected void checkInitializationStatus(Supplier fetchCurrentInitialization) throws InstantiatorException {
+ int maxAttempts = (int) (TOTAL_ALLOWED_DURATION.toMillis() / RETRIES_DELAY.toMillis());
+
+ var retryConfig = RetryConfig.custom()
+ .retryExceptions(InstantiatorException.class)
+ .maxAttempts(maxAttempts)
+ .waitDuration(RETRIES_DELAY)
+ .build();
+
+ var retry = RetryRegistry.of(retryConfig).retry("checkInitializationStatus");
+
+ try {
+ Retry.decorateCheckedSupplier(retry, () -> {
+ InitializationRunResponse currentInitialization = fetchCurrentInitialization.get();
+ printInitializationStatus(currentInitialization);
+ validateInitializationStatus(currentInitialization);
+
+ return currentInitialization;
+ }).get();
+ } catch (Throwable ex) {
+ throw new InstantiatorException(ex.getLocalizedMessage());
}
-
- protected void checkInitializationStatus(Supplier fetchCurrentInitialization) throws InstantiatorException {
- int maxAttempts = (int) (TOTAL_ALLOWED_DURATION.toMillis() / RETRIES_DELAY.toMillis());
-
- var retryConfig = RetryConfig.custom()
- .retryExceptions(InstantiatorException.class)
- .maxAttempts(maxAttempts)
- .waitDuration(RETRIES_DELAY)
- .build();
-
- var retry = RetryRegistry.of(retryConfig).retry("checkInitializationStatus");
-
- try {
- Retry.decorateCheckedSupplier(retry, () -> {
- InitializationRunResponse currentInitialization = fetchCurrentInitialization.get();
- printInitializationStatus(currentInitialization);
- validateInitializationStatus(currentInitialization);
-
- return currentInitialization;
- }).get();
- } catch (Throwable ex) {
- throw new InstantiatorException(ex.getLocalizedMessage());
- }
- }
-
- private void validateInitializationStatus(InitializationRunResponse initializationRun) throws InstantiatorException, EnvironmentInitializationException {
- var environmentId = initializationRun.environmentId().toString();
- var providerType = StringHelper.convertToTitleCase(getProvider().toString());
-
- switch (initializationRun.status()) {
- case "Completed" -> log.info("{} Cloud Agent initialization completed successfully [EnvironmentId: '{}']",
- providerType,
- environmentId);
- case "Failed" -> {
- var messageToThrow = getFailedStepsMessageToThrow(providerType, environmentId, initializationRun);
- if (isBlank(messageToThrow)) {
- logCloudAgentInitializationInProgress(providerType, environmentId);
- throw new InstantiatorException("Initialization is in progress, retrying...");
- } else {
- throw new EnvironmentInitializationException(messageToThrow);
- }
- }
- case "Cancelled" -> {
- log.warn("{} cloud agent initialization cancelled [EnvironmentId: '{}']", providerType, environmentId);
- throw new EnvironmentInitializationException("Initialization was cancelled.");
- }
- case "InProgress" -> {
- logCloudAgentInitializationInProgress(providerType, environmentId);
- throw new InstantiatorException("Initialization is in progress, retrying...");
- }
- default -> {
- log.warn("{} cloud agent initialization in an unknown state [EnvironmentId: '{}']", providerType,
- environmentId);
- throw new EnvironmentInitializationException(
- String.format("Unknown initialization status: [%s]", initializationRun.status()));
- }
- }
- }
-
- private void logCloudAgentInitializationInProgress(String providerType, String environmentId) {
- log.info("{} Cloud Agent initialization [status: 'InProgress', EnvironmentId: '{}']. Next check in {} seconds...",
- providerType, environmentId, RETRIES_DELAY.toSeconds());
- }
-
- private String getFailedStepsMessageToThrow(
- String providerType,
- String environmentId,
- InitializationRunResponse initializationRun) {
- var failedSteps = initializationRun.steps()
- .stream()
- .filter(step -> "Failed".equals(step.status()))
- .toList();
-
- if (failedSteps.isEmpty()) {
- return "";
+ }
+
+ private void validateInitializationStatus(InitializationRunResponse initializationRun) throws InstantiatorException
+ , EnvironmentInitializationException {
+ var environmentId = initializationRun.environmentId().toString();
+ var providerType = StringHelper.convertToTitleCase(getProvider().toString());
+
+ switch (initializationRun.status()) {
+ case "Completed" -> log.info("{} Cloud Agent initialization completed successfully [EnvironmentId: '{}']",
+ providerType,
+ environmentId);
+ case "Failed" -> {
+ var messageToThrow = getFailedStepsMessageToThrow(providerType, environmentId, initializationRun);
+ if (isBlank(messageToThrow)) {
+ logCloudAgentInitializationInProgress(providerType, environmentId);
+ throw new InstantiatorException("Initialization is in progress, retrying...");
} else {
- var messageToThrow = new StringBuilder();
- messageToThrow.append(
- String.format("%s cloud agent initialization failed [EnvironmentId: '%s'].\n Failed steps:\n",
- providerType,
- environmentId));
-
- for (var step : failedSteps) {
- var errorMessage = step.lastOperationStatusMessage();
-
- messageToThrow.append(String.format(" - Name: '%s', Status: '%s', ErrorMessage: '%s'\n",
- step.resourceName(),
- step.status(),
- errorMessage));
- }
-
- messageToThrow.deleteCharAt(messageToThrow.length() - 1);
- return messageToThrow.toString();
+ throw new EnvironmentInitializationException(messageToThrow);
}
+ }
+ case "Cancelled" -> {
+ log.warn("{} cloud agent initialization cancelled [EnvironmentId: '{}']", providerType, environmentId);
+ throw new EnvironmentInitializationException("Initialization was cancelled.");
+ }
+ case "InProgress" -> {
+ logCloudAgentInitializationInProgress(providerType, environmentId);
+ throw new InstantiatorException("Initialization is in progress, retrying...");
+ }
+ default -> {
+ log.warn("{} cloud agent initialization in an unknown state [EnvironmentId: '{}']", providerType,
+ environmentId);
+ throw new EnvironmentInitializationException(
+ String.format("Unknown initialization status: [%s]", initializationRun.status()));
+ }
}
-
- private void printInitializationStatus(InitializationRunResponse initializationRun) {
-
- initializationRun.steps().sort(Comparator.comparingInt(InitializationStepResponse::order));
-
- var logMessage = new StringBuilder();
- initializationRun.steps()
- .forEach(step -> {
- String status = step.status();
- String resourceName = step.resourceName();
- String resourceType = step.resourceType();
-
- String statusSymbol = switch (status) {
- case "Completed" -> "âś…";
- case "InProgress" -> "đźš§";
- case "Failed" -> "❌";
- case "NotStarted" -> "⏳";
- default -> ""; // For "NotStarted" or other unknown statuses
- };
-
- // Append each step's information to the log message
- logMessage.append(String.format(" %s Name: '%s', Type: '%s'\n",
- statusSymbol,
- resourceName,
- resourceType));
- });
-
- if (!logMessage.isEmpty()) {
- logMessage.deleteCharAt(logMessage.length() - 1);
-
- var status = String.format("%s Cloud Agent initialization [status: '%s', EnvironmentId: '%s'], steps:\n",
- initializationRun.cloudProvider(),
- initializationRun.status(),
- initializationRun.environmentId());
-
- log.info("{}{}", status, logMessage);
- }
+ }
+
+ private void logCloudAgentInitializationInProgress(String providerType, String environmentId) {
+ log.info("{} Cloud Agent initialization [status: 'InProgress', EnvironmentId: '{}']. Next check in {} seconds...",
+ providerType, environmentId, RETRIES_DELAY.toSeconds());
+ }
+
+ private String getFailedStepsMessageToThrow(
+ String providerType,
+ String environmentId,
+ InitializationRunResponse initializationRun)
+ {
+ var failedSteps = initializationRun.steps()
+ .stream()
+ .filter(step -> "Failed".equals(step.status()))
+ .toList();
+
+ if (failedSteps.isEmpty()) {
+ return "";
+ } else {
+ var messageToThrow = new StringBuilder();
+ messageToThrow.append(
+ String.format("%s cloud agent initialization failed [EnvironmentId: '%s'].\n Failed steps:\n",
+ providerType,
+ environmentId));
+
+ for (var step : failedSteps) {
+ var errorMessage = step.lastOperationStatusMessage();
+
+ messageToThrow.append(String.format(" - Name: '%s', Status: '%s', ErrorMessage: '%s'\n",
+ step.resourceName(),
+ step.status(),
+ errorMessage));
+ }
+
+ messageToThrow.deleteCharAt(messageToThrow.length() - 1);
+ return messageToThrow.toString();
+ }
+ }
+
+ private void printInitializationStatus(InitializationRunResponse initializationRun) {
+
+ initializationRun.steps().sort(Comparator.comparingInt(InitializationStepResponse::order));
+
+ var logMessage = new StringBuilder();
+ initializationRun.steps()
+ .forEach(step -> {
+ String status = step.status();
+ String resourceName = step.resourceName();
+ String resourceType = step.resourceType();
+
+ String statusSymbol = switch (status) {
+ case "Completed" -> "âś…";
+ case "InProgress" -> "đźš§";
+ case "Failed" -> "❌";
+ case "NotStarted" -> "⏳";
+ default -> ""; // For "NotStarted" or other unknown statuses
+ };
+
+ // Append each step's information to the log message
+ logMessage.append(String.format(" %s Name: '%s', Type: '%s'\n",
+ statusSymbol,
+ resourceName,
+ resourceType));
+ });
+
+ if (!logMessage.isEmpty()) {
+ logMessage.deleteCharAt(logMessage.length() - 1);
+
+ var status = String.format("%s Cloud Agent initialization [status: '%s', EnvironmentId: '%s'], steps:\n",
+ initializationRun.cloudProvider(),
+ initializationRun.status(),
+ initializationRun.environmentId());
+
+ log.info("{}{}", status, logMessage);
}
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Environment.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Environment.java
index b68f2b73..b24cbe81 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Environment.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Environment.java
@@ -5,13 +5,17 @@
import java.util.Collection;
import java.util.Map;
-import java.util.UUID;
public interface Environment {
EnvironmentIdValue getId();
+
String getName();
+
Collection getResourceGroups();
+
Map getTags();
+
Map getParameters();
+
EnvironmentDto toDto();
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentAggregate.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentAggregate.java
index 1fd65b85..7252fbde 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentAggregate.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentAggregate.java
@@ -21,270 +21,280 @@
@Slf4j
@Setter(AccessLevel.PROTECTED)
public class EnvironmentAggregate {
- public static final String REGION_PARAM_KEY = "region";
-
- private final EnvironmentService service;
-
- @Getter
- private ManagementEnvironment managementEnvironment;
-
- public EnvironmentAggregate(EnvironmentService environmentService) {
- this.service = environmentService;
+ public static final String REGION_PARAM_KEY = "region";
+
+ private final EnvironmentService service;
+
+ @Getter
+ private ManagementEnvironment managementEnvironment;
+
+ public EnvironmentAggregate(EnvironmentService environmentService) {
+ this.service = environmentService;
+ }
+
+ public void createOrUpdate() throws InstantiatorException {
+ var managementEnvironmentId = managementEnvironment.getId();
+
+ var existingEnvironment = service.fetch(managementEnvironmentId);
+ if (shouldCreateEnvironment(existingEnvironment)) {
+ log.info("Creating new Management Environment [id: '{}']", managementEnvironmentId);
+ service.create(
+ null,
+ managementEnvironmentId,
+ managementEnvironment.getName(),
+ managementEnvironment.getResourceGroups(),
+ managementEnvironment.getParameters());
+ } else {
+ if (doesNotNeedUpdate(managementEnvironment, existingEnvironment)) {
+ log.info("Management Environment [id: '{}'] already exists and is up-to-date.", managementEnvironmentId);
+ } else {
+ log.info("Updating existing Management Environment [id: '{}']", managementEnvironmentId);
+ service.update(
+ managementEnvironmentId,
+ managementEnvironmentId,
+ managementEnvironment.getName(),
+ managementEnvironment.getResourceGroups(),
+ managementEnvironment.getParameters(),
+ existingEnvironment.defaultCiCdProfileShortName());
+ }
}
- public void createOrUpdate() throws InstantiatorException {
- var managementEnvironmentId = managementEnvironment.getId();
-
- var existingEnvironment = service.fetch(managementEnvironmentId);
- if (shouldCreateEnvironment(existingEnvironment)) {
- log.info("Creating new Management Environment [id: '{}']", managementEnvironmentId);
- service.create(
- null,
- managementEnvironmentId,
- managementEnvironment.getName(),
- managementEnvironment.getResourceGroups(),
- managementEnvironment.getParameters());
- } else {
- if (doesNotNeedUpdate(managementEnvironment, existingEnvironment)) {
- log.info("Management Environment [id: '{}'] already exists and is up-to-date.", managementEnvironmentId);
- } else {
- log.info("Updating existing Management Environment [id: '{}']", managementEnvironmentId);
- service.update(
- managementEnvironmentId,
- managementEnvironmentId,
- managementEnvironment.getName(),
- managementEnvironment.getResourceGroups(),
- managementEnvironment.getParameters(),
- existingEnvironment.defaultCiCdProfileShortName());
- }
- }
-
- for (var operationalEnvironment : managementEnvironment.getOperationalEnvironments()) {
- initializeOperationalEnvironment(operationalEnvironment);
- }
+ for (var operationalEnvironment : managementEnvironment.getOperationalEnvironments()) {
+ initializeOperationalEnvironment(operationalEnvironment);
}
+ }
- private boolean shouldCreateEnvironment(EnvironmentResponse existingEnvironment) {
- if (existingEnvironment == null) {
- return true;
- }
-
- return existingEnvironment.status().equalsIgnoreCase("deleted");
+ private boolean shouldCreateEnvironment(EnvironmentResponse existingEnvironment) {
+ if (existingEnvironment == null) {
+ return true;
}
- public void manageCiCdProfiles() throws InstantiatorException {
- manageProfilesForEnvironment(managementEnvironment); // Manage profiles for management environment
+ return existingEnvironment.status().equalsIgnoreCase("deleted");
+ }
+
+ public void manageCiCdProfiles() throws InstantiatorException {
+ manageProfilesForEnvironment(managementEnvironment); // Manage profiles for management environment
- for (var environment: managementEnvironment.getOperationalEnvironments()) {
- manageProfilesForEnvironment(environment); // Manage profiles for each operational environment
- }
+ for (var environment : managementEnvironment.getOperationalEnvironments()) {
+ manageProfilesForEnvironment(environment); // Manage profiles for each operational environment
}
+ }
- void manageProfilesForEnvironment(BaseEnvironment environment) throws InstantiatorException {
- var environmentId = environment.getId();
- var defaultProfile = environment.getDefaultCiCdProfile();
+ void manageProfilesForEnvironment(BaseEnvironment environment) throws InstantiatorException {
+ var environmentId = environment.getId();
+ var defaultProfile = environment.getDefaultCiCdProfile();
- var existingEnvironment = service.fetch(environmentId);
- var currentDefaultProfileShortName = existingEnvironment.defaultCiCdProfileShortName();
+ var existingEnvironment = service.fetch(environmentId);
+ var currentDefaultProfileShortName = existingEnvironment.defaultCiCdProfileShortName();
- var environmentTier = environment instanceof ManagementEnvironment ? "Management" : "Operational";
+ var environmentTier = environment instanceof ManagementEnvironment ? "Management" : "Operational";
- if (defaultProfile != null) {
- handleDefaultProfile(environmentTier, environment, environmentId, defaultProfile, currentDefaultProfileShortName);
- } else {
- handleRemovedDefaultProfile(environmentTier, environment, environmentId, currentDefaultProfileShortName);
- }
+ if (defaultProfile != null) {
+ handleDefaultProfile(environmentTier, environment, environmentId, defaultProfile, currentDefaultProfileShortName);
+ } else {
+ handleRemovedDefaultProfile(environmentTier, environment, environmentId, currentDefaultProfileShortName);
}
-
- private void handleDefaultProfile(String environmentTier,
- BaseEnvironment environment,
- EnvironmentIdValue environmentId,
- CiCdProfile defaultProfile,
- String currentDefaultProfileShortName) throws InstantiatorException {
- var requests = new ArrayList();
- requests.add(CreateCiCdProfileRequest.fromProfile(defaultProfile));
-
- for (var profile: environment.getCiCdProfiles()) {
- requests.add(CreateCiCdProfileRequest.fromProfile(profile));
- }
-
- log.info("Managing CI/CD profiles for {} environment [id: {}]",
- environmentTier, environmentId);
-
- var profilesResponse = service.manageCiCdProfiles(environmentId, requests);
-
- log.info("Managed {} CI/CD profiles for {} environment [id: {}]", profilesResponse.length,
- environmentTier, environmentId);
-
- if (!defaultProfile.shortName().equals(currentDefaultProfileShortName)) {
- updateEnvironmentWithDefaultProfile(environmentTier, environment, environmentId, defaultProfile.shortName());
- }
+ }
+
+ private void handleDefaultProfile(
+ String environmentTier,
+ BaseEnvironment environment,
+ EnvironmentIdValue environmentId,
+ CiCdProfile defaultProfile,
+ String currentDefaultProfileShortName) throws InstantiatorException
+ {
+ var requests = new ArrayList();
+ requests.add(CreateCiCdProfileRequest.fromProfile(defaultProfile));
+
+ for (var profile : environment.getCiCdProfiles()) {
+ requests.add(CreateCiCdProfileRequest.fromProfile(profile));
}
- private void updateEnvironmentWithDefaultProfile(String environmentTier,
- BaseEnvironment environment,
- EnvironmentIdValue environmentId,
- String shortName) throws InstantiatorException {
- var managementEnvironmentId = environmentId;
+ log.info("Managing CI/CD profiles for {} environment [id: {}]",
+ environmentTier, environmentId);
- if (environment instanceof OperationalEnvironment operationalEnvironment) {
- managementEnvironmentId = operationalEnvironment.getManagementEnvironmentId();
- }
+ var profilesResponse = service.manageCiCdProfiles(environmentId, requests);
- log.info("Updating {} Environment [id: '{}'] with new default CI/CD profile short name",
- environmentTier,
- environmentId);
+ log.info("Managed {} CI/CD profiles for {} environment [id: {}]", profilesResponse.length,
+ environmentTier, environmentId);
- service.update(
- managementEnvironmentId,
- environmentId,
- environment.getName(),
- environment.getResourceGroups(),
- environment.getParameters(),
- shortName);
+ if (!defaultProfile.shortName().equals(currentDefaultProfileShortName)) {
+ updateEnvironmentWithDefaultProfile(environmentTier, environment, environmentId, defaultProfile.shortName());
+ }
+ }
+
+ private void updateEnvironmentWithDefaultProfile(
+ String environmentTier,
+ BaseEnvironment environment,
+ EnvironmentIdValue environmentId,
+ String shortName) throws InstantiatorException
+ {
+ var managementEnvironmentId = environmentId;
+
+ if (environment instanceof OperationalEnvironment operationalEnvironment) {
+ managementEnvironmentId = operationalEnvironment.getManagementEnvironmentId();
}
- private void handleRemovedDefaultProfile(String environmentTier,
- BaseEnvironment environment,
- EnvironmentIdValue environmentId,
- String currentDefaultProfileShortName) throws InstantiatorException {
- if (StringUtils.isNotBlank(currentDefaultProfileShortName)) {
- var managementEnvironmentId = environmentId;
-
- if (environment instanceof OperationalEnvironment operationalEnvironment) {
- managementEnvironmentId = operationalEnvironment.getManagementEnvironmentId();
- environmentTier = "Operational";
- }
-
- log.info("Updating {} Environment [id: '{}'] to remove default CI/CD profile", environmentTier, environmentId);
-
- service.update(
- managementEnvironmentId,
- environmentId,
- environment.getName(),
- environment.getResourceGroups(),
- environment.getParameters(),
- null);
- }
+ log.info("Updating {} Environment [id: '{}'] with new default CI/CD profile short name",
+ environmentTier,
+ environmentId);
+
+ service.update(
+ managementEnvironmentId,
+ environmentId,
+ environment.getName(),
+ environment.getResourceGroups(),
+ environment.getParameters(),
+ shortName);
+ }
+
+ private void handleRemovedDefaultProfile(
+ String environmentTier,
+ BaseEnvironment environment,
+ EnvironmentIdValue environmentId,
+ String currentDefaultProfileShortName) throws InstantiatorException
+ {
+ if (StringUtils.isNotBlank(currentDefaultProfileShortName)) {
+ var managementEnvironmentId = environmentId;
+
+ if (environment instanceof OperationalEnvironment operationalEnvironment) {
+ managementEnvironmentId = operationalEnvironment.getManagementEnvironmentId();
+ environmentTier = "Operational";
+ }
+
+ log.info("Updating {} Environment [id: '{}'] to remove default CI/CD profile", environmentTier, environmentId);
+
+ service.update(
+ managementEnvironmentId,
+ environmentId,
+ environment.getName(),
+ environment.getResourceGroups(),
+ environment.getParameters(),
+ null);
}
+ }
- public void manageSecrets() throws InstantiatorException {
- var managementEnvironmentId = managementEnvironment.getId();
+ public void manageSecrets() throws InstantiatorException {
+ var managementEnvironmentId = managementEnvironment.getId();
- log.info("Managing Secrets for Management environment [id: {}]", managementEnvironmentId);
+ log.info("Managing Secrets for Management environment [id: {}]", managementEnvironmentId);
- var secretsResponse = service.manageSecrets(managementEnvironmentId, managementEnvironment.getSecrets());
+ var secretsResponse = service.manageSecrets(managementEnvironmentId, managementEnvironment.getSecrets());
- log.info("Managed {} Secrets for Management environment [id: {}]", secretsResponse.length, managementEnvironmentId);
+ log.info("Managed {} Secrets for Management environment [id: {}]", secretsResponse.length, managementEnvironmentId);
- for (var environment : managementEnvironment.getOperationalEnvironments()) {
- var environmentId = environment.getId();
- log.info("Managing Secrets for Operational environment [id: {}]", environmentId);
+ for (var environment : managementEnvironment.getOperationalEnvironments()) {
+ var environmentId = environment.getId();
+ log.info("Managing Secrets for Operational environment [id: {}]", environmentId);
- secretsResponse = service.manageSecrets(environmentId, environment.getSecrets());
+ secretsResponse = service.manageSecrets(environmentId, environment.getSecrets());
- log.info("Managed {} Secrets for Operational environment [id: {}]", secretsResponse.length, environmentId);
- }
+ log.info("Managed {} Secrets for Operational environment [id: {}]", secretsResponse.length, environmentId);
}
-
- private void initializeOperationalEnvironment(OperationalEnvironment operationalEnvironment) throws InstantiatorException {
- var environmentId = operationalEnvironment.getId();
-
- var existingEnvironment = service.fetch(environmentId);
-
- if (shouldCreateEnvironment(existingEnvironment)) {
- log.info("Creating new Operational Environment [id: '{}']", environmentId);
- service.create(
- managementEnvironment.getId(),
- environmentId,
- operationalEnvironment.getName(),
- operationalEnvironment.getResourceGroups(),
- operationalEnvironment.getParameters());
- } else {
- if (doesNotNeedUpdate(operationalEnvironment, existingEnvironment)) {
- log.info("Operational Environment [id: '{}'] already exists and is up-to-date.", environmentId);
- } else {
- log.info("Updating existing Operational Environment [id: '{}']", environmentId);
- service.update(
- managementEnvironment.getId(),
- environmentId,
- operationalEnvironment.getName(),
- operationalEnvironment.getResourceGroups(),
- operationalEnvironment.getParameters(),
- existingEnvironment.defaultCiCdProfileShortName());
- }
- }
+ }
+
+ private void initializeOperationalEnvironment(OperationalEnvironment operationalEnvironment) throws InstantiatorException {
+ var environmentId = operationalEnvironment.getId();
+
+ var existingEnvironment = service.fetch(environmentId);
+
+ if (shouldCreateEnvironment(existingEnvironment)) {
+ log.info("Creating new Operational Environment [id: '{}']", environmentId);
+ service.create(
+ managementEnvironment.getId(),
+ environmentId,
+ operationalEnvironment.getName(),
+ operationalEnvironment.getResourceGroups(),
+ operationalEnvironment.getParameters());
+ } else {
+ if (doesNotNeedUpdate(operationalEnvironment, existingEnvironment)) {
+ log.info("Operational Environment [id: '{}'] already exists and is up-to-date.", environmentId);
+ } else {
+ log.info("Updating existing Operational Environment [id: '{}']", environmentId);
+ service.update(
+ managementEnvironment.getId(),
+ environmentId,
+ operationalEnvironment.getName(),
+ operationalEnvironment.getResourceGroups(),
+ operationalEnvironment.getParameters(),
+ existingEnvironment.defaultCiCdProfileShortName());
+ }
}
-
- /**
- * Compares this environment response with another environment object.
- *
- * @param existingEnvironmentResponse the environment response to compare with current entity
- * @return true if the environments are equal, false otherwise
- */
- private boolean doesNotNeedUpdate(Environment environment,
- EnvironmentResponse existingEnvironmentResponse) {
- if (existingEnvironmentResponse == null) return false;
-
- var environmentIdInResponse = existingEnvironmentResponse.id();
-
-
- return Objects.equals(environmentIdInResponse.type().toString(), environment.getId().type().toString()) &&
- Objects.equals(environmentIdInResponse.ownerId(), environment.getId().ownerId()) &&
- Objects.equals(environmentIdInResponse.shortName(), environment.getId().shortName()) &&
- Objects.equals(existingEnvironmentResponse.name(), environment.getName()) &&
- Objects.equals(existingEnvironmentResponse.resourceGroups(), environment.getResourceGroups()) &&
- mapsEqual(existingEnvironmentResponse.parameters(), environment.getParameters());
+ }
+
+ /**
+ * Compares this environment response with another environment object.
+ *
+ * @param existingEnvironmentResponse the environment response to compare with current entity
+ * @return true if the environments are equal, false otherwise
+ */
+ private boolean doesNotNeedUpdate(
+ Environment environment,
+ EnvironmentResponse existingEnvironmentResponse)
+ {
+ if (existingEnvironmentResponse == null) {
+ return false;
}
- /**
- * Compares two maps for equality using JSON serialization.
- *
- * @param map1 the first map to compare
- * @param map2 the second map to compare
- * @return true if the maps are equal, false otherwise
- */
- private boolean mapsEqual(Map map1, Map map2) {
- try {
- String json1 = SerializationUtils.serializeSortedJson(map1);
- String json2 = SerializationUtils.serializeSortedJson(map2);
- return json1.equals(json2);
- } catch (JsonProcessingException e) {
- return false;
- }
+ var environmentIdInResponse = existingEnvironmentResponse.id();
+
+
+ return Objects.equals(environmentIdInResponse.type().toString(), environment.getId().type().toString()) &&
+ Objects.equals(environmentIdInResponse.ownerId(), environment.getId().ownerId()) &&
+ Objects.equals(environmentIdInResponse.shortName(), environment.getId().shortName()) &&
+ Objects.equals(existingEnvironmentResponse.name(), environment.getName()) &&
+ Objects.equals(existingEnvironmentResponse.resourceGroups(), environment.getResourceGroups()) &&
+ mapsEqual(existingEnvironmentResponse.parameters(), environment.getParameters());
+ }
+
+ /**
+ * Compares two maps for equality using JSON serialization.
+ *
+ * @param map1 the first map to compare
+ * @param map2 the second map to compare
+ * @return true if the maps are equal, false otherwise
+ */
+ private boolean mapsEqual(Map map1, Map map2) {
+ try {
+ String json1 = SerializationUtils.serializeSortedJson(map1);
+ String json2 = SerializationUtils.serializeSortedJson(map2);
+ return json1.equals(json2);
+ } catch (JsonProcessingException e) {
+ return false;
}
+ }
- public void initializeAgents() {
- var managementAgents = managementEnvironment.getCloudAgentByProviderType().values();
+ public void initializeAgents() {
+ var managementAgents = managementEnvironment.getCloudAgentByProviderType().values();
- // 1. Initialize Management Environment Agents
- try (ExecutorService executor = Executors.newFixedThreadPool(managementAgents.size())) {
- for (var managementAgent : managementAgents) {
- executor.execute(() -> {
- try {
+ // 1. Initialize Management Environment Agents
+ try (ExecutorService executor = Executors.newFixedThreadPool(managementAgents.size())) {
+ for (var managementAgent : managementAgents) {
+ executor.execute(() -> {
+ try {
- var providerType = managementAgent.getProvider();
+ var providerType = managementAgent.getProvider();
- managementAgent.initialize(service);
+ managementAgent.initialize(service);
- for (var operationalEnvironment : managementEnvironment.getOperationalEnvironments()) {
+ for (var operationalEnvironment : managementEnvironment.getOperationalEnvironments()) {
- var operationalAgent = operationalEnvironment.getCloudAgentByProviderType()
- .values()
- .stream().filter(a -> a.getProvider() == providerType)
- .findFirst();
+ var operationalAgent = operationalEnvironment.getCloudAgentByProviderType()
+ .values()
+ .stream().filter(a -> a.getProvider() == providerType)
+ .findFirst();
- if (operationalAgent.isPresent()) {
- operationalAgent.get().initialize(service, managementEnvironment.getId());
- }
- }
- } catch (InstantiatorException e) {
- log.error(e.getMessage());
- System.exit(1);
- }
- });
+ if (operationalAgent.isPresent()) {
+ operationalAgent.get().initialize(service, managementEnvironment.getId());
+ }
}
- }
+ } catch (InstantiatorException e) {
+ log.error(e.getMessage());
+ System.exit(1);
+ }
+ });
+ }
}
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentIdValue.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentIdValue.java
index f9298d66..ae3e0812 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentIdValue.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentIdValue.java
@@ -9,23 +9,23 @@
public record EnvironmentIdValue(EnvironmentType type, UUID ownerId, String shortName) {
- @NotNull
- @Override
- public String toString(){
- return String.format("%s/%s/%s", StringHelper.convertToTitleCase(type.name()), ownerId, shortName);
- }
+ @NotNull
+ @Override
+ public String toString() {
+ return String.format("%s/%s/%s", StringHelper.convertToTitleCase(type.name()), ownerId, shortName);
+ }
- public EnvironmentIdDto toDto() {
- return new EnvironmentIdDto(
- EnvironmentTypeDto.fromString(type.toString()),
- ownerId(),
- shortName());
- }
+ public EnvironmentIdDto toDto() {
+ return new EnvironmentIdDto(
+ EnvironmentTypeDto.fromString(type.toString()),
+ ownerId(),
+ shortName());
+ }
- public static EnvironmentIdValue fromDto(EnvironmentIdDto dto) {
- return new EnvironmentIdValue(
- EnvironmentType.fromString(dto.type().toString()),
- dto.ownerId(),
- dto.shortName());
- }
+ public static EnvironmentIdValue fromDto(EnvironmentIdDto dto) {
+ return new EnvironmentIdValue(
+ EnvironmentType.fromString(dto.type().toString()),
+ dto.ownerId(),
+ dto.shortName());
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentType.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentType.java
index c5fdd02a..5e2aeddd 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentType.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentType.java
@@ -22,10 +22,10 @@ public String getEnvironmentType() {
}
public static EnvironmentType fromString(String text) {
- if(isBlank(text)) {
+ if (isBlank(text)) {
throw new IllegalArgumentException(
- String.format("Environment type cannot be null or blank. Allowed values: %s",
- Arrays.toString(EnvironmentType.values())));
+ String.format("Environment type cannot be null or blank. Allowed values: %s",
+ Arrays.toString(EnvironmentType.values())));
}
for (var item : EnvironmentType.values()) {
@@ -35,8 +35,8 @@ public static EnvironmentType fromString(String text) {
}
throw new IllegalArgumentException(
- String.format("Invalid environment type: '%s'. Allowed values: %s",
- text, Arrays.toString(EnvironmentType.values())));
+ String.format("Invalid environment type: '%s'. Allowed values: %s",
+ text, Arrays.toString(EnvironmentType.values())));
}
@Override
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentsFactory.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentsFactory.java
index 462add28..5c2ec4a0 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentsFactory.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/EnvironmentsFactory.java
@@ -29,7 +29,11 @@ public EnvironmentBuilder(HttpClient client, SdkConfiguration sdkConfiguration,
builder = getBuilder();
}
- protected EnvironmentAggregate create(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
+ protected EnvironmentAggregate create(
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
+ {
return new EnvironmentAggregate(new RestEnvironmentService(client, sdkConfiguration, retryRegistry));
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/ManagementEnvironment.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/ManagementEnvironment.java
index d913a7ac..c991a46e 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/ManagementEnvironment.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/ManagementEnvironment.java
@@ -62,7 +62,8 @@ public Collection validate() {
}
@SuppressWarnings("unchecked")
- public static class ManagementEnvironmentBuilder extends EnvironmentBuilder { // Specify Builder type
+ public static class ManagementEnvironmentBuilder extends EnvironmentBuilder { // Specify Builder type
public ManagementEnvironmentBuilder withId(EnvironmentIdValue environmentId) {
environment.setId(environmentId);
@@ -137,35 +138,35 @@ private void configureOperationalEnvironment(OperationalEnvironment operationalE
Map config = entry.getValue();
CloudAgentEntity managementAgent = environment.getCloudAgentByProviderType().get(provider);
-
- if(managementAgent == null) {
+
+ if (managementAgent == null) {
continue;
}
switch (provider) {
case AWS:
operationalEnvironment.registerAwsCloudAgent(
- (AwsRegion) config.get("region"),
- getPropertyFromManagementAgent(provider, "organizationId"),
- (String) config.get("accountId"));
+ (AwsRegion) config.get("region"),
+ getPropertyFromManagementAgent(provider, "organizationId"),
+ (String) config.get("accountId"));
break;
case AZURE:
operationalEnvironment.registerAzureCloudAgent(
- (AzureRegion) config.get("region"),
- getPropertyFromManagementAgent(provider, "tenantId"),
- (UUID) config.get("subscriptionId"));
+ (AzureRegion) config.get("region"),
+ getPropertyFromManagementAgent(provider, "tenantId"),
+ (UUID) config.get("subscriptionId"));
break;
case GCP:
operationalEnvironment.registerGcpCloudAgent(
- (GcpRegion) config.get("region"),
- getPropertyFromManagementAgent(provider, "organizationId"),
- (String) config.get("projectId"));
+ (GcpRegion) config.get("region"),
+ getPropertyFromManagementAgent(provider, "organizationId"),
+ (String) config.get("projectId"));
break;
case OCI:
operationalEnvironment.registerOciCloudAgent(
- (OciRegion) config.get("region"),
- getPropertyFromManagementAgent(provider, "tenancyId"),
- (String) config.get("compartmentId"));
+ (OciRegion) config.get("region"),
+ getPropertyFromManagementAgent(provider, "tenancyId"),
+ (String) config.get("compartmentId"));
break;
case HETZNER:
operationalEnvironment.registerHetznerCloudAgent(
@@ -188,10 +189,11 @@ private T getPropertyFromManagementAgent(ProviderType providerType, String p
try {
var field = cloudAgent.getClass().getDeclaredField(propertyName);
field.setAccessible(true);
-
+
return (T) field.get(cloudAgent);
} catch (NoSuchFieldException | IllegalAccessException e) {
- throw new RuntimeException("Error getting property " + propertyName + " from " + providerType + " Cloud Agent", e);
+ throw new RuntimeException("Error getting property " + propertyName + " from " + providerType + " Cloud " +
+ "Agent", e);
}
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/OperationalEnvironment.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/OperationalEnvironment.java
index 1bdd767e..ab44b4c5 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/OperationalEnvironment.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/OperationalEnvironment.java
@@ -23,7 +23,7 @@
public class OperationalEnvironment extends BaseEnvironment {
@JsonIgnore
private final Map> cloudProviders = new HashMap<>();
-
+
@Setter(AccessLevel.PROTECTED)
private EnvironmentIdValue managementEnvironmentId;
@@ -32,13 +32,13 @@ public class OperationalEnvironment extends BaseEnvironment {
@Override
public EnvironmentIdValue getId() {
- if(this.managementEnvironmentId == null) {
+ if (this.managementEnvironmentId == null) {
return null;
}
-
+
return new EnvironmentIdValue(managementEnvironmentId.type(),
- managementEnvironmentId.ownerId(),
- shortName);
+ managementEnvironmentId.ownerId(),
+ shortName);
}
@Override
@@ -68,7 +68,8 @@ public static OperationalEnvironmentBuilder builder() {
return new OperationalEnvironmentBuilder();
}
- public static class OperationalEnvironmentBuilder extends EnvironmentBuilder {
+ public static class OperationalEnvironmentBuilder extends EnvironmentBuilder {
public OperationalEnvironmentBuilder withShortName(String shortName) {
environment.setShortName(shortName);
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Secret.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Secret.java
index ee4c1fff..7cafd091 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Secret.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/Secret.java
@@ -18,7 +18,8 @@
* Secret values cannot be empty or null.
*/
public record Secret(String shortName, String displayName, String description, String value) {
- private final static String SHORT_NAME_NOT_VALID = "[Secret Validation] The Short Name only allow alphanumeric characters and hyphens, cannot start or end in a hyphen";
+ private final static String SHORT_NAME_NOT_VALID = "[Secret Validation] The Short Name only allow alphanumeric " +
+ "characters and hyphens, cannot start or end in a hyphen";
private final static String DISPLAY_NAME_NOT_VALID = "[Secret Validation] The Display Name cannot be empty or null";
private final static String VALUE_NOT_VALID = "[Secret Validation] The value cannot be empty or null";
@@ -62,8 +63,8 @@ public Secret(String shortName, String displayName, String value) {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "Secret validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "Secret validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/aws/AwsCloudAgent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/aws/AwsCloudAgent.java
index 63b756cd..01d6a2f5 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/aws/AwsCloudAgent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/aws/AwsCloudAgent.java
@@ -2,7 +2,6 @@
import com.yanchware.fractal.sdk.domain.environment.CloudAgentEntity;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
-import com.yanchware.fractal.sdk.domain.environment.oci.OciCloudAgent;
import com.yanchware.fractal.sdk.domain.environment.service.EnvironmentService;
import com.yanchware.fractal.sdk.domain.environment.service.dtos.InitializationRunResponse;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
@@ -19,91 +18,99 @@
@Slf4j
@Getter
public class AwsCloudAgent extends CloudAgentEntity {
- public static final String ORGANIZATION_ID_PARAM_KEY = "organizationId";
- public static final String ACCOUNT_ID_PARAM_KEY = "accountId";
-
- private final AwsRegion region;
- private final String organizationId;
- private final String accountId;
-
- public AwsCloudAgent(
- EnvironmentIdValue environmentId,
- AwsRegion region,
- String organizationId,
- String accountId,
- Map tags)
+ public static final String ORGANIZATION_ID_PARAM_KEY = "organizationId";
+ public static final String ACCOUNT_ID_PARAM_KEY = "accountId";
+
+ private final AwsRegion region;
+ private final String organizationId;
+ private final String accountId;
+
+ public AwsCloudAgent(
+ EnvironmentIdValue environmentId,
+ AwsRegion region,
+ String organizationId,
+ String accountId,
+ Map tags)
+ {
+ super(environmentId, tags);
+ this.region = region;
+ this.organizationId = organizationId;
+ this.accountId = accountId;
+ }
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.AWS;
+ }
+
+ @Override
+ public void initialize(EnvironmentService environmentService) throws InstantiatorException {
+ initialize(environmentService, null);
+ }
+
+ @Override
+ public void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managementEnvironmentId) throws InstantiatorException
+ {
+ var currentInitialization = environmentService.fetchCurrentAwsInitialization(environmentId);
+
+ if (currentInitialization == null ||
+ "Failed".equals(currentInitialization.status()) ||
+ "Cancelled".equals(currentInitialization.status()))
{
- super(environmentId, tags);
- this.region = region;
- this.organizationId = organizationId;
- this.accountId = accountId;
- }
-
- @Override
- public ProviderType getProvider() {
- return ProviderType.AWS;
- }
- @Override
- public void initialize(EnvironmentService environmentService) throws InstantiatorException {
- initialize(environmentService, null);
+ environmentService.startAwsCloudAgentInitialization(
+ environmentId,
+ organizationId,
+ accountId,
+ region,
+ tags);
+
+ log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
+ checkInitializationStatus(() -> fetchCurrentAwsInitialization(environmentService));
+ } else {
+ checkInitializationStatus(() -> fetchCurrentAwsInitialization(environmentService));
}
-
- @Override
- public void initialize(EnvironmentService environmentService, EnvironmentIdValue managementEnvironmentId) throws InstantiatorException {
- var currentInitialization = environmentService.fetchCurrentAwsInitialization(environmentId);
-
- if (currentInitialization == null ||
- "Failed".equals(currentInitialization.status()) ||
- "Cancelled".equals(currentInitialization.status())) {
-
- environmentService.startAwsCloudAgentInitialization(
- environmentId,
- organizationId,
- accountId,
- region,
- tags);
-
- log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
- checkInitializationStatus(() -> fetchCurrentAwsInitialization(environmentService));
- } else {
- checkInitializationStatus(() -> fetchCurrentAwsInitialization(environmentService));
- }
+ }
+
+ @Override
+ protected Map getConfigurationForEnvironmentParameters() {
+ return Map.of(
+ PROVIDER_PARAM_KEY, getProvider(),
+ REGION_PARAM_KEY, region,
+ ORGANIZATION_ID_PARAM_KEY, organizationId,
+ ACCOUNT_ID_PARAM_KEY, accountId
+ );
+ }
+
+ private InitializationRunResponse fetchCurrentAwsInitialization(EnvironmentService environmentService) {
+ try {
+ return environmentService.fetchCurrentAwsInitialization(environmentId);
+ } catch (InstantiatorException e) {
+ throw new RuntimeException(e);
}
+ }
- @Override
- protected Map getConfigurationForEnvironmentParameters() {
- return Map.of(
- PROVIDER_PARAM_KEY, getProvider(),
- REGION_PARAM_KEY, region,
- ORGANIZATION_ID_PARAM_KEY, organizationId,
- ACCOUNT_ID_PARAM_KEY, accountId
- );
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
}
-
- private InitializationRunResponse fetchCurrentAwsInitialization(EnvironmentService environmentService) {
- try {
- return environmentService.fetchCurrentAwsInitialization(environmentId);
- } catch (InstantiatorException e) {
- throw new RuntimeException(e);
- }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- AwsCloudAgent member = (AwsCloudAgent) o;
+ AwsCloudAgent member = (AwsCloudAgent) o;
- return region.equals(member.region)
- && organizationId.equals(member.organizationId)
- && accountId.equals(member.accountId)
- && environmentId.equals(member.environmentId);
- }
+ return region.equals(member.region)
+ && organizationId.equals(member.organizationId)
+ && accountId.equals(member.accountId)
+ && environmentId.equals(member.environmentId);
+ }
- @Override
- public int hashCode() {
- return Objects.hash(region, organizationId, accountId, environmentId);
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(region, organizationId, accountId, environmentId);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/azure/AzureCloudAgent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/azure/AzureCloudAgent.java
index 3b70ddcf..6ad324f2 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/azure/AzureCloudAgent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/azure/AzureCloudAgent.java
@@ -2,7 +2,6 @@
import com.yanchware.fractal.sdk.domain.environment.CloudAgentEntity;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
-import com.yanchware.fractal.sdk.domain.environment.oci.OciCloudAgent;
import com.yanchware.fractal.sdk.domain.environment.service.EnvironmentService;
import com.yanchware.fractal.sdk.domain.environment.service.dtos.InitializationRunResponse;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
@@ -20,97 +19,106 @@
@Slf4j
@Getter
public class AzureCloudAgent extends CloudAgentEntity {
- public static final String TENANT_ID_PARAM_KEY = "tenantId";
- public static final String SUBSCRIPTION_ID_PARAM_KEY = "subscriptionId";
- public static final UUID EMPTY_UUID = new UUID(0L, 0L);
-
- private final AzureRegion region;
- private final UUID tenantId;
- private final UUID subscriptionId;
-
- public AzureCloudAgent(
- EnvironmentIdValue environmentId,
- AzureRegion region,
- UUID tenantId,
- UUID subscriptionId,
- Map tags) {
- super(environmentId, tags);
- this.region = region;
- this.tenantId = tenantId;
- this.subscriptionId = subscriptionId;
+ public static final String TENANT_ID_PARAM_KEY = "tenantId";
+ public static final String SUBSCRIPTION_ID_PARAM_KEY = "subscriptionId";
+ public static final UUID EMPTY_UUID = new UUID(0L, 0L);
+
+ private final AzureRegion region;
+ private final UUID tenantId;
+ private final UUID subscriptionId;
+
+ public AzureCloudAgent(
+ EnvironmentIdValue environmentId,
+ AzureRegion region,
+ UUID tenantId,
+ UUID subscriptionId,
+ Map tags)
+ {
+ super(environmentId, tags);
+ this.region = region;
+ this.tenantId = tenantId;
+ this.subscriptionId = subscriptionId;
+ }
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.AZURE;
+ }
+
+ @Override
+ public void initialize(EnvironmentService environmentService) throws InstantiatorException {
+ initialize(environmentService, null);
+ }
+
+ @Override
+ public void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managementEnvironmentId) throws InstantiatorException
+ {
+ var currentInitialization = environmentService.fetchCurrentAzureInitialization(environmentId);
+
+ if (currentInitialization != null && currentInitialization.status().equals("Completed")) {
+ log.info("{} Cloud Agent initialization for environment '{}' completed successfully.",
+ currentInitialization.cloudProvider(), currentInitialization.environmentId());
+ return;
}
- @Override
- public ProviderType getProvider() {
- return ProviderType.AZURE;
+ if (currentInitialization == null ||
+ currentInitialization.id().equals(EMPTY_UUID) ||
+ "Failed".equals(currentInitialization.status()) ||
+ "Cancelled".equals(currentInitialization.status()))
+ {
+
+ environmentService.startAzureCloudAgentInitialization(
+ managementEnvironmentId,
+ environmentId,
+ tenantId,
+ subscriptionId,
+ region,
+ tags);
+
+ checkInitializationStatus(() -> fetchCurrentAzureInitialization(environmentService));
+ } else {
+ checkInitializationStatus(() -> fetchCurrentAzureInitialization(environmentService));
}
-
- @Override
- public void initialize(EnvironmentService environmentService) throws InstantiatorException {
- initialize(environmentService, null);
- }
-
- @Override
- public void initialize(EnvironmentService environmentService, EnvironmentIdValue managementEnvironmentId) throws InstantiatorException {
- var currentInitialization = environmentService.fetchCurrentAzureInitialization(environmentId);
-
- if (currentInitialization != null && currentInitialization.status().equals("Completed")) {
- log.info("{} Cloud Agent initialization for environment '{}' completed successfully.",
- currentInitialization.cloudProvider(), currentInitialization.environmentId());
- return;
- }
-
- if (currentInitialization == null ||
- currentInitialization.id().equals(EMPTY_UUID) ||
- "Failed".equals(currentInitialization.status()) ||
- "Cancelled".equals(currentInitialization.status())) {
-
- environmentService.startAzureCloudAgentInitialization(
- managementEnvironmentId,
- environmentId,
- tenantId,
- subscriptionId,
- region,
- tags);
-
- checkInitializationStatus(() -> fetchCurrentAzureInitialization(environmentService));
- } else {
- checkInitializationStatus(() -> fetchCurrentAzureInitialization(environmentService));
- }
+ }
+
+ @Override
+ public Map getConfigurationForEnvironmentParameters() {
+ return Map.of(
+ PROVIDER_PARAM_KEY, getProvider(),
+ REGION_PARAM_KEY, region,
+ TENANT_ID_PARAM_KEY, tenantId,
+ SUBSCRIPTION_ID_PARAM_KEY, subscriptionId);
+ }
+
+ private InitializationRunResponse fetchCurrentAzureInitialization(EnvironmentService environmentService) {
+ try {
+ return environmentService.fetchCurrentAzureInitialization(environmentId);
+ } catch (InstantiatorException e) {
+ throw new RuntimeException(e);
}
+ }
- @Override
- public Map getConfigurationForEnvironmentParameters() {
- return Map.of(
- PROVIDER_PARAM_KEY, getProvider(),
- REGION_PARAM_KEY, region,
- TENANT_ID_PARAM_KEY, tenantId,
- SUBSCRIPTION_ID_PARAM_KEY, subscriptionId);
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
}
-
- private InitializationRunResponse fetchCurrentAzureInitialization(EnvironmentService environmentService) {
- try {
- return environmentService.fetchCurrentAzureInitialization(environmentId);
- } catch (InstantiatorException e) {
- throw new RuntimeException(e);
- }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ AzureCloudAgent member = (AzureCloudAgent) o;
- AzureCloudAgent member = (AzureCloudAgent) o;
+ return region.equals(member.region)
+ && tenantId.equals(member.tenantId)
+ && subscriptionId.equals(member.subscriptionId)
+ && environmentId.equals(member.environmentId);
+ }
- return region.equals(member.region)
- && tenantId.equals(member.tenantId)
- && subscriptionId.equals(member.subscriptionId)
- && environmentId.equals(member.environmentId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(region, tenantId, subscriptionId, environmentId);
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(region, tenantId, subscriptionId, environmentId);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/gcp/GcpCloudAgent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/gcp/GcpCloudAgent.java
index 8afcc87a..87b7281a 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/gcp/GcpCloudAgent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/gcp/GcpCloudAgent.java
@@ -2,7 +2,6 @@
import com.yanchware.fractal.sdk.domain.environment.CloudAgentEntity;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
-import com.yanchware.fractal.sdk.domain.environment.oci.OciCloudAgent;
import com.yanchware.fractal.sdk.domain.environment.service.EnvironmentService;
import com.yanchware.fractal.sdk.domain.environment.service.dtos.InitializationRunResponse;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
@@ -19,91 +18,99 @@
@Slf4j
@Getter
public class GcpCloudAgent extends CloudAgentEntity {
- public static final String ORGANIZATION_ID_PARAM_KEY = "organizationId";
- public static final String PROJECT_ID_PARAM_KEY = "projectId";
-
- private final GcpRegion region;
- private final String organizationId;
- private final String projectId;
-
- public GcpCloudAgent(
- EnvironmentIdValue environmentId,
- GcpRegion region,
- String organizationId,
- String projectId,
- Map tags)
+ public static final String ORGANIZATION_ID_PARAM_KEY = "organizationId";
+ public static final String PROJECT_ID_PARAM_KEY = "projectId";
+
+ private final GcpRegion region;
+ private final String organizationId;
+ private final String projectId;
+
+ public GcpCloudAgent(
+ EnvironmentIdValue environmentId,
+ GcpRegion region,
+ String organizationId,
+ String projectId,
+ Map tags)
+ {
+ super(environmentId, tags);
+ this.region = region;
+ this.organizationId = organizationId;
+ this.projectId = projectId;
+ }
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.GCP;
+ }
+
+ @Override
+ public void initialize(EnvironmentService environmentService) throws InstantiatorException {
+ initialize(environmentService, null);
+ }
+
+ @Override
+ public void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managementEnvironmentId) throws InstantiatorException
+ {
+ var currentInitialization = environmentService.fetchCurrentGcpInitialization(environmentId);
+
+ if (currentInitialization == null ||
+ "Failed".equals(currentInitialization.status()) ||
+ "Cancelled".equals(currentInitialization.status()))
{
- super(environmentId, tags);
- this.region = region;
- this.organizationId = organizationId;
- this.projectId = projectId;
- }
-
- @Override
- public ProviderType getProvider() {
- return ProviderType.GCP;
- }
- @Override
- public void initialize(EnvironmentService environmentService) throws InstantiatorException {
- initialize(environmentService, null);
+ environmentService.startGcpCloudAgentInitialization(
+ environmentId,
+ organizationId,
+ projectId,
+ region,
+ tags);
+
+ log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
+ checkInitializationStatus(() -> fetchCurrentGcpInitialization(environmentService));
+ } else {
+ checkInitializationStatus(() -> fetchCurrentGcpInitialization(environmentService));
}
-
- @Override
- public void initialize(EnvironmentService environmentService, EnvironmentIdValue managementEnvironmentId) throws InstantiatorException {
- var currentInitialization = environmentService.fetchCurrentGcpInitialization(environmentId);
-
- if (currentInitialization == null ||
- "Failed".equals(currentInitialization.status()) ||
- "Cancelled".equals(currentInitialization.status())) {
-
- environmentService.startGcpCloudAgentInitialization(
- environmentId,
- organizationId,
- projectId,
- region,
- tags);
-
- log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
- checkInitializationStatus(() -> fetchCurrentGcpInitialization(environmentService));
- } else {
- checkInitializationStatus(() -> fetchCurrentGcpInitialization(environmentService));
- }
+ }
+
+ @Override
+ protected Map getConfigurationForEnvironmentParameters() {
+ return Map.of(
+ PROVIDER_PARAM_KEY, getProvider(),
+ REGION_PARAM_KEY, region,
+ ORGANIZATION_ID_PARAM_KEY, organizationId,
+ PROJECT_ID_PARAM_KEY, projectId
+ );
+ }
+
+ private InitializationRunResponse fetchCurrentGcpInitialization(EnvironmentService environmentService) {
+ try {
+ return environmentService.fetchCurrentGcpInitialization(environmentId);
+ } catch (InstantiatorException e) {
+ throw new RuntimeException(e);
}
+ }
- @Override
- protected Map getConfigurationForEnvironmentParameters() {
- return Map.of(
- PROVIDER_PARAM_KEY, getProvider(),
- REGION_PARAM_KEY, region,
- ORGANIZATION_ID_PARAM_KEY, organizationId,
- PROJECT_ID_PARAM_KEY, projectId
- );
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
}
-
- private InitializationRunResponse fetchCurrentGcpInitialization(EnvironmentService environmentService) {
- try {
- return environmentService.fetchCurrentGcpInitialization(environmentId);
- } catch (InstantiatorException e) {
- throw new RuntimeException(e);
- }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- GcpCloudAgent member = (GcpCloudAgent) o;
+ GcpCloudAgent member = (GcpCloudAgent) o;
- return region.equals(member.region)
- && organizationId.equals(member.organizationId)
- && projectId.equals(member.projectId)
- && environmentId.equals(member.environmentId);
- }
+ return region.equals(member.region)
+ && organizationId.equals(member.organizationId)
+ && projectId.equals(member.projectId)
+ && environmentId.equals(member.environmentId);
+ }
- @Override
- public int hashCode() {
- return Objects.hash(region, organizationId, projectId, environmentId);
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(region, organizationId, projectId, environmentId);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/hetzner/HetznerCloudAgent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/hetzner/HetznerCloudAgent.java
index 7d56a1e9..d1450246 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/hetzner/HetznerCloudAgent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/hetzner/HetznerCloudAgent.java
@@ -18,82 +18,91 @@
@Slf4j
@Getter
public class HetznerCloudAgent extends CloudAgentEntity {
- public static final String PROJECT_ID_PARAM_KEY = "projectId";
-
- private final HetznerRegion region;
- private final String projectId;
-
- public HetznerCloudAgent(
- EnvironmentIdValue environmentId,
- HetznerRegion region,
- String projectId,
- Map tags)
+ public static final String PROJECT_ID_PARAM_KEY = "projectId";
+
+ private final HetznerRegion region;
+ private final String projectId;
+
+ public HetznerCloudAgent(
+ EnvironmentIdValue environmentId,
+ HetznerRegion region,
+ String projectId,
+ Map tags)
+ {
+ super(environmentId, tags);
+ this.region = region;
+ this.projectId = projectId;
+ }
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.HETZNER;
+ }
+
+ @Override
+ public void initialize(EnvironmentService environmentService) throws InstantiatorException {
+ initialize(environmentService, null);
+ }
+
+ @Override
+ public void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managementEnvironmentId) throws InstantiatorException
+ {
+ var currentInitialization = environmentService.fetchCurrentHetznerInitialization(environmentId);
+
+ if (currentInitialization == null ||
+ "Failed".equals(currentInitialization.status()) ||
+ "Cancelled".equals(currentInitialization.status()))
{
- super(environmentId, tags);
- this.region = region;
- this.projectId = projectId;
- }
-
- @Override
- public ProviderType getProvider() {
- return ProviderType.HETZNER;
- }
- @Override
- public void initialize(EnvironmentService environmentService) throws InstantiatorException {
- initialize(environmentService, null);
- }
+ environmentService.startHetznerCloudAgentInitialization(
+ environmentId,
+ projectId,
+ region,
+ tags);
- @Override
- public void initialize(EnvironmentService environmentService, EnvironmentIdValue managementEnvironmentId) throws InstantiatorException {
- var currentInitialization = environmentService.fetchCurrentHetznerInitialization(environmentId);
-
- if (currentInitialization == null ||
- "Failed".equals(currentInitialization.status()) ||
- "Cancelled".equals(currentInitialization.status())) {
-
- environmentService.startHetznerCloudAgentInitialization(
- environmentId,
- projectId,
- region,
- tags);
-
- log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
- checkInitializationStatus(() -> fetchCurrentHetznerInitialization(environmentService));
- } else {
- checkInitializationStatus(() -> fetchCurrentHetznerInitialization(environmentService));
- }
+ log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
+ checkInitializationStatus(() -> fetchCurrentHetznerInitialization(environmentService));
+ } else {
+ checkInitializationStatus(() -> fetchCurrentHetznerInitialization(environmentService));
}
- @Override
- protected Map getConfigurationForEnvironmentParameters() {
- return Map.of(
- PROVIDER_PARAM_KEY, getProvider(),
- REGION_PARAM_KEY, region,
- PROJECT_ID_PARAM_KEY, projectId);
+ }
+
+ @Override
+ protected Map getConfigurationForEnvironmentParameters() {
+ return Map.of(
+ PROVIDER_PARAM_KEY, getProvider(),
+ REGION_PARAM_KEY, region,
+ PROJECT_ID_PARAM_KEY, projectId);
+ }
+
+ private InitializationRunResponse fetchCurrentHetznerInitialization(EnvironmentService environmentService) {
+ try {
+ return environmentService.fetchCurrentHetznerInitialization(environmentId);
+ } catch (InstantiatorException e) {
+ throw new RuntimeException(e);
}
+ }
- private InitializationRunResponse fetchCurrentHetznerInitialization(EnvironmentService environmentService) {
- try {
- return environmentService.fetchCurrentHetznerInitialization(environmentId);
- } catch (InstantiatorException e) {
- throw new RuntimeException(e);
- }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ HetznerCloudAgent member = (HetznerCloudAgent) o;
- HetznerCloudAgent member = (HetznerCloudAgent) o;
+ return region.equals(member.region)
+ && projectId.equals(member.projectId)
+ && environmentId.equals(member.environmentId);
+ }
- return region.equals(member.region)
- && projectId.equals(member.projectId)
- && environmentId.equals(member.environmentId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(region, projectId, environmentId);
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(region, projectId, environmentId);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/oci/OciCloudAgent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/oci/OciCloudAgent.java
index 735af30b..db5a76b5 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/oci/OciCloudAgent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/oci/OciCloudAgent.java
@@ -18,90 +18,99 @@
@Slf4j
@Getter
public class OciCloudAgent extends CloudAgentEntity {
- public static final String TENANCY_ID_PARAM_KEY = "tenancyId";
- public static final String COMPARTMENT_ID_PARAM_KEY = "compartmentId";
-
- private final OciRegion region;
- private final String tenancyId;
- private final String compartmentId;
-
- public OciCloudAgent(
- EnvironmentIdValue environmentId,
- OciRegion region,
- String tenancyId,
- String compartmentId,
- Map tags)
+ public static final String TENANCY_ID_PARAM_KEY = "tenancyId";
+ public static final String COMPARTMENT_ID_PARAM_KEY = "compartmentId";
+
+ private final OciRegion region;
+ private final String tenancyId;
+ private final String compartmentId;
+
+ public OciCloudAgent(
+ EnvironmentIdValue environmentId,
+ OciRegion region,
+ String tenancyId,
+ String compartmentId,
+ Map tags)
+ {
+ super(environmentId, tags);
+ this.region = region;
+ this.tenancyId = tenancyId;
+ this.compartmentId = compartmentId;
+ }
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.OCI;
+ }
+
+ @Override
+ public void initialize(EnvironmentService environmentService) throws InstantiatorException {
+ initialize(environmentService, null);
+ }
+
+ @Override
+ public void initialize(
+ EnvironmentService environmentService,
+ EnvironmentIdValue managementEnvironmentId) throws InstantiatorException
+ {
+ var currentInitialization = environmentService.fetchCurrentOciInitialization(environmentId);
+
+ if (currentInitialization == null ||
+ "Failed".equals(currentInitialization.status()) ||
+ "Cancelled".equals(currentInitialization.status()))
{
- super(environmentId, tags);
- this.region = region;
- this.tenancyId = tenancyId;
- this.compartmentId = compartmentId;
- }
- @Override
- public ProviderType getProvider() {
- return ProviderType.OCI;
+ environmentService.startOciCloudAgentInitialization(
+ environmentId,
+ tenancyId,
+ compartmentId,
+ region,
+ tags);
+
+ log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
+ checkInitializationStatus(() -> fetchCurrentOciInitialization(environmentService));
+ } else {
+ checkInitializationStatus(() -> fetchCurrentOciInitialization(environmentService));
}
-
- @Override
- public void initialize(EnvironmentService environmentService) throws InstantiatorException {
- initialize(environmentService, null);
+ }
+
+ @Override
+ protected Map getConfigurationForEnvironmentParameters() {
+ return Map.of(
+ PROVIDER_PARAM_KEY, getProvider(),
+ REGION_PARAM_KEY, region,
+ TENANCY_ID_PARAM_KEY, tenancyId,
+ COMPARTMENT_ID_PARAM_KEY, compartmentId
+ );
+ }
+
+ private InitializationRunResponse fetchCurrentOciInitialization(EnvironmentService environmentService) {
+ try {
+ return environmentService.fetchCurrentOciInitialization(environmentId);
+ } catch (InstantiatorException e) {
+ throw new RuntimeException(e);
}
+ }
- @Override
- public void initialize(EnvironmentService environmentService, EnvironmentIdValue managementEnvironmentId) throws InstantiatorException {
- var currentInitialization = environmentService.fetchCurrentOciInitialization(environmentId);
-
- if (currentInitialization == null ||
- "Failed".equals(currentInitialization.status()) ||
- "Cancelled".equals(currentInitialization.status())) {
-
- environmentService.startOciCloudAgentInitialization(
- environmentId,
- tenancyId,
- compartmentId,
- region,
- tags);
-
- log.info("New initialization started, checking initialization status for environment [id: '{}']", environmentId);
- checkInitializationStatus(() -> fetchCurrentOciInitialization(environmentService));
- } else {
- checkInitializationStatus(() -> fetchCurrentOciInitialization(environmentService));
- }
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
}
- @Override
- protected Map getConfigurationForEnvironmentParameters() {
- return Map.of(
- PROVIDER_PARAM_KEY, getProvider(),
- REGION_PARAM_KEY, region,
- TENANCY_ID_PARAM_KEY, tenancyId,
- COMPARTMENT_ID_PARAM_KEY, compartmentId
- );
- }
-
- private InitializationRunResponse fetchCurrentOciInitialization(EnvironmentService environmentService) {
- try {
- return environmentService.fetchCurrentOciInitialization(environmentId);
- } catch (InstantiatorException e) {
- throw new RuntimeException(e);
- }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
}
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ OciCloudAgent member = (OciCloudAgent) o;
- OciCloudAgent member = (OciCloudAgent) o;
+ return region.equals(member.region)
+ && tenancyId.equals(member.tenancyId)
+ && compartmentId.equals(member.compartmentId)
+ && environmentId.equals(member.environmentId);
+ }
- return region.equals(member.region)
- && tenancyId.equals(member.tenancyId)
- && compartmentId.equals(member.compartmentId)
- && environmentId.equals(member.environmentId);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(region, tenancyId, compartmentId, environmentId);
- }
+ @Override
+ public int hashCode() {
+ return Objects.hash(region, tenancyId, compartmentId, environmentId);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/EnvironmentService.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/EnvironmentService.java
index efcc174b..3b80bd69 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/EnvironmentService.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/EnvironmentService.java
@@ -20,65 +20,75 @@
import java.util.UUID;
public interface EnvironmentService {
- EnvironmentResponse create(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- String name,
- Collection resourceGroups,
- Map parameters) throws InstantiatorException;
-
- EnvironmentResponse update(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- String name,
- Collection resourceGroups,
- Map parameters,
- String defaultCiCdProfileShortName) throws InstantiatorException;
-
- EnvironmentResponse fetch(EnvironmentIdValue environmentId) throws InstantiatorException;
-
- EnvironmentResponse tryGetById(EnvironmentIdValue environmentId);
-
- void startAzureCloudAgentInitialization(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- UUID tenantId,
- UUID subscriptionId,
- AzureRegion region,
- Map tags) throws InstantiatorException;
-
- void startAwsCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String organizationId,
- String accountId,
- AwsRegion region,
- Map tags) throws InstantiatorException;
-
- void startGcpCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String organizationId,
- String projectId,
- GcpRegion region,
- Map tags) throws InstantiatorException;
-
- void startOciCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String tenancyId,
- String compartmentId,
- OciRegion region,
- Map tags) throws InstantiatorException;
-
- void startHetznerCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String projectId,
- HetznerRegion region,
- Map tags) throws InstantiatorException;
-
- InitializationRunResponse fetchCurrentAwsInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
- InitializationRunResponse fetchCurrentAzureInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
- InitializationRunResponse fetchCurrentGcpInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
- InitializationRunResponse fetchCurrentOciInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
- InitializationRunResponse fetchCurrentHetznerInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
- CiCdProfileResponse[] manageCiCdProfiles(EnvironmentIdValue environmentId, Collection ciCdProfiles) throws InstantiatorException;
- SecretResponse[] manageSecrets(EnvironmentIdValue environmentId, Collection secrets) throws InstantiatorException;
+ EnvironmentResponse create(
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters) throws InstantiatorException;
+
+ EnvironmentResponse update(
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters,
+ String defaultCiCdProfileShortName) throws InstantiatorException;
+
+ EnvironmentResponse fetch(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ EnvironmentResponse tryGetById(EnvironmentIdValue environmentId);
+
+ void startAzureCloudAgentInitialization(
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ UUID tenantId,
+ UUID subscriptionId,
+ AzureRegion region,
+ Map tags) throws InstantiatorException;
+
+ void startAwsCloudAgentInitialization(
+ EnvironmentIdValue environmentId,
+ String organizationId,
+ String accountId,
+ AwsRegion region,
+ Map tags) throws InstantiatorException;
+
+ void startGcpCloudAgentInitialization(
+ EnvironmentIdValue environmentId,
+ String organizationId,
+ String projectId,
+ GcpRegion region,
+ Map tags) throws InstantiatorException;
+
+ void startOciCloudAgentInitialization(
+ EnvironmentIdValue environmentId,
+ String tenancyId,
+ String compartmentId,
+ OciRegion region,
+ Map tags) throws InstantiatorException;
+
+ void startHetznerCloudAgentInitialization(
+ EnvironmentIdValue environmentId,
+ String projectId,
+ HetznerRegion region,
+ Map tags) throws InstantiatorException;
+
+ InitializationRunResponse fetchCurrentAwsInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ InitializationRunResponse fetchCurrentAzureInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ InitializationRunResponse fetchCurrentGcpInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ InitializationRunResponse fetchCurrentOciInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ InitializationRunResponse fetchCurrentHetznerInitialization(EnvironmentIdValue environmentId) throws InstantiatorException;
+
+ CiCdProfileResponse[] manageCiCdProfiles(
+ EnvironmentIdValue environmentId,
+ Collection ciCdProfiles) throws InstantiatorException;
+
+ SecretResponse[] manageSecrets(
+ EnvironmentIdValue environmentId,
+ Collection secrets) throws InstantiatorException;
}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/RestEnvironmentService.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/RestEnvironmentService.java
index 21ef83ac..b47b0edd 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/RestEnvironmentService.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/RestEnvironmentService.java
@@ -34,55 +34,59 @@
@Slf4j
public class RestEnvironmentService extends Service implements EnvironmentService {
public RestEnvironmentService(
- HttpClient client,
- SdkConfiguration sdkConfiguration,
- RetryRegistry retryRegistry) {
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
+ {
super(client, sdkConfiguration, retryRegistry);
}
@Override
public EnvironmentResponse create(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- String name,
- Collection resourceGroups,
- Map parameters) throws InstantiatorException {
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters) throws InstantiatorException
+ {
return executeRequestWithRetries(
- "createEnvironment",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getEnvironmentsUri(environmentId),
- sdkConfiguration,
- serializeSafely(new CreateEnvironmentRequest(
- managementEnvironmentId,
- name,
- resourceGroups.stream().map(ResourceGroupId::toString).toList(),
- parameters))),
- new int[]{201},
- EnvironmentResponse.class);
+ "createEnvironment",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getEnvironmentsUri(environmentId),
+ sdkConfiguration,
+ serializeSafely(new CreateEnvironmentRequest(
+ managementEnvironmentId,
+ name,
+ resourceGroups.stream().map(ResourceGroupId::toString).toList(),
+ parameters))),
+ new int[]{201},
+ EnvironmentResponse.class);
}
@Override
public EnvironmentResponse update(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- String name,
- Collection resourceGroups,
- Map parameters,
- String defaultCiCdProfileShortName) throws InstantiatorException {
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters,
+ String defaultCiCdProfileShortName) throws InstantiatorException
+ {
return executeRequestWithRetries(
- "updateEnvironment",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPutRequest(
- getEnvironmentsUri(environmentId),
- sdkConfiguration,
- serializeSafely(new UpdateEnvironmentRequest(managementEnvironmentId, name, resourceGroups.stream().map(ResourceGroupId::toString).toList(), parameters, defaultCiCdProfileShortName))),
- new int[]{200},
- EnvironmentResponse.class);
+ "updateEnvironment",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPutRequest(
+ getEnvironmentsUri(environmentId),
+ sdkConfiguration,
+ serializeSafely(new UpdateEnvironmentRequest(managementEnvironmentId, name,
+ resourceGroups.stream().map(ResourceGroupId::toString).toList(), parameters, defaultCiCdProfileShortName))),
+ new int[]{200},
+ EnvironmentResponse.class);
}
@Override
@@ -90,63 +94,65 @@ public EnvironmentResponse fetch(EnvironmentIdValue environmentId) {
try {
return executeRequestWithRetries(
- "fetchEnvironment",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildGetRequest(
- getEnvironmentsUri(environmentId),
- sdkConfiguration),
- new int[]{200, 404},
- EnvironmentResponse.class);
+ "fetchEnvironment",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildGetRequest(
+ getEnvironmentsUri(environmentId),
+ sdkConfiguration),
+ new int[]{200, 404},
+ EnvironmentResponse.class);
} catch (Exception e) {
log.error("An unexpected error occurred while fetching the environment [id: '{}']. " +
- "Please try again later or contact Fractal Cloud support if the issue persists.",
- environmentId);
-
+ "Please try again later or contact Fractal Cloud support if the issue persists.",
+ environmentId);
+
System.exit(1);
-
+
return null;
-
+
}
}
@Override
public EnvironmentResponse tryGetById(EnvironmentIdValue environmentId) {
- try {
- return executeRequestWithRetries(
- "fetchEnvironmentById",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildGetRequest(
- getEnvironmentsUri(environmentId),
- sdkConfiguration),
- new int[]{200, 400, 404},
- EnvironmentResponse.class);
- } catch (InstantiatorException e) {
- return null;
- }
+ try {
+ return executeRequestWithRetries(
+ "fetchEnvironmentById",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildGetRequest(
+ getEnvironmentsUri(environmentId),
+ sdkConfiguration),
+ new int[]{200, 400, 404},
+ EnvironmentResponse.class);
+ } catch (InstantiatorException e) {
+ return null;
+ }
}
@Override
public void startAzureCloudAgentInitialization(
- EnvironmentIdValue managementEnvironmentId,
- EnvironmentIdValue environmentId,
- UUID tenantId,
- UUID subscriptionId,
- AzureRegion region,
- Map tags) throws InstantiatorException {
+ EnvironmentIdValue managementEnvironmentId,
+ EnvironmentIdValue environmentId,
+ UUID tenantId,
+ UUID subscriptionId,
+ AzureRegion region,
+ Map tags) throws InstantiatorException
+ {
var azureSpClientId = sdkConfiguration.getAzureSpClientId();
if (isBlank(azureSpClientId)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", AZURE_SP_CLIENT_ID_KEY));
+ String.format("The environment variable %s is required and it has not been defined", AZURE_SP_CLIENT_ID_KEY));
}
var azureSpClientSecret = sdkConfiguration.getAzureSpClientSecret();
if (isBlank(azureSpClientSecret)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", AZURE_SP_CLIENT_SECRET_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ AZURE_SP_CLIENT_SECRET_KEY));
}
Map additionalHeaders = new HashMap<>();
@@ -154,86 +160,90 @@ public void startAzureCloudAgentInitialization(
additionalHeaders.put(X_AZURE_SP_CLIENT_SECRET_HEADER, azureSpClientSecret);
executeRequestWithRetries(
- "InitializeAzureSubscription",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getEnvironmentsUri(environmentId, "initializer/azure/initialize"),
- sdkConfiguration,
- serializeSafely(new AzureSubscriptionInitializationRequest(
- managementEnvironmentId,
- tenantId,
- subscriptionId,
- region.toString(),
- tags)),
- additionalHeaders),
- new int[]{202},
- EnvironmentResponse.class);
+ "InitializeAzureSubscription",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getEnvironmentsUri(environmentId, "initializer/azure/initialize"),
+ sdkConfiguration,
+ serializeSafely(new AzureSubscriptionInitializationRequest(
+ managementEnvironmentId,
+ tenantId,
+ subscriptionId,
+ region.toString(),
+ tags)),
+ additionalHeaders),
+ new int[]{202},
+ EnvironmentResponse.class);
}
@Override
public void startAwsCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String organizationId,
- String accountId,
- AwsRegion region,
- Map tags) throws InstantiatorException {
+ EnvironmentIdValue environmentId,
+ String organizationId,
+ String accountId,
+ AwsRegion region,
+ Map tags) throws InstantiatorException
+ {
var awsAccessKeyId = sdkConfiguration.getAwsAccessKeyId();
if (isBlank(awsAccessKeyId)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", AWS_ACCESS_KEY_ID_KEY));
+ String.format("The environment variable %s is required and it has not been defined", AWS_ACCESS_KEY_ID_KEY));
}
var awsSecretAccessKey = sdkConfiguration.getAwsSecretAccessKey();
if (isBlank(awsSecretAccessKey)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", AWS_SECRET_ACCESS_KEY));
+ String.format("The environment variable %s is required and it has not been defined", AWS_SECRET_ACCESS_KEY));
}
var awsSessionToken = sdkConfiguration.getAwsSessionToken();
Map additionalHeaders = new HashMap<>();
additionalHeaders.put(X_AWS_ACCESS_KEY_ID_HEADER, awsAccessKeyId);
additionalHeaders.put(X_AWS_SECRET_ACCESS_KEY_HEADER, awsSecretAccessKey);
- if(!isBlank(awsSessionToken)) {
+ if (!isBlank(awsSessionToken)) {
additionalHeaders.put(X_AWS_SESSION_TOKEN_HEADER, awsSessionToken);
}
executeRequestWithRetries(
- "InitializeAwsAccount",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getEnvironmentsUri(environmentId, "initializer/aws/initialize"),
- sdkConfiguration,
- serializeSafely(new AwsAccountInitializationRequest(
- organizationId,
- accountId,
- region.toString(),
- tags)),
- additionalHeaders),
- new int[]{202},
- EnvironmentResponse.class);
+ "InitializeAwsAccount",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getEnvironmentsUri(environmentId, "initializer/aws/initialize"),
+ sdkConfiguration,
+ serializeSafely(new AwsAccountInitializationRequest(
+ organizationId,
+ accountId,
+ region.toString(),
+ tags)),
+ additionalHeaders),
+ new int[]{202},
+ EnvironmentResponse.class);
}
@Override
public void startGcpCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String organizationId,
- String projectId,
- GcpRegion region,
- Map tags) throws InstantiatorException {
+ EnvironmentIdValue environmentId,
+ String organizationId,
+ String projectId,
+ GcpRegion region,
+ Map tags) throws InstantiatorException
+ {
var gcpServiceAccountEMail = sdkConfiguration.getGcpServiceAccountEMail();
if (isBlank(gcpServiceAccountEMail)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", GCP_SERVICE_ACCOUNT_EMAIL_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ GCP_SERVICE_ACCOUNT_EMAIL_KEY));
}
var gcpServiceAccountCredentials = sdkConfiguration.getGcpServiceAccountCredentials();
if (isBlank(gcpServiceAccountCredentials)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", GCP_SERVICE_ACCOUNT_CREDENTIALS_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ GCP_SERVICE_ACCOUNT_CREDENTIALS_KEY));
}
Map additionalHeaders = new HashMap<>();
@@ -241,40 +251,43 @@ public void startGcpCloudAgentInitialization(
additionalHeaders.put(X_GCP_SERVICE_ACCOUNT_CREDENTIALS_HEADER, gcpServiceAccountCredentials);
executeRequestWithRetries(
- "InitializeGcpProject",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getEnvironmentsUri(environmentId, "initializer/gcp/initialize"),
- sdkConfiguration,
- serializeSafely(new GcpProjectInitializationRequest(
- organizationId,
- projectId,
- region.toString(),
- tags)),
- additionalHeaders),
- new int[]{202},
- EnvironmentResponse.class);
+ "InitializeGcpProject",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getEnvironmentsUri(environmentId, "initializer/gcp/initialize"),
+ sdkConfiguration,
+ serializeSafely(new GcpProjectInitializationRequest(
+ organizationId,
+ projectId,
+ region.toString(),
+ tags)),
+ additionalHeaders),
+ new int[]{202},
+ EnvironmentResponse.class);
}
@Override
public void startOciCloudAgentInitialization(
- EnvironmentIdValue environmentId,
- String tenancyId,
- String compartmentId,
- OciRegion region,
- Map tags) throws InstantiatorException {
+ EnvironmentIdValue environmentId,
+ String tenancyId,
+ String compartmentId,
+ OciRegion region,
+ Map tags) throws InstantiatorException
+ {
var ociServiceAccountId = sdkConfiguration.getOciServiceAccountId();
if (isBlank(ociServiceAccountId)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", OCI_SERVICE_ACCOUNT_ID_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ OCI_SERVICE_ACCOUNT_ID_KEY));
}
var ociServiceAccountCredentials = sdkConfiguration.getOciServiceAccountCredentials();
if (isBlank(ociServiceAccountCredentials)) {
throw new IllegalArgumentException(
- String.format("The environment variable %s is required and it has not been defined", OCI_SERVICE_ACCOUNT_CREDENTIALS_KEY));
+ String.format("The environment variable %s is required and it has not been defined",
+ OCI_SERVICE_ACCOUNT_CREDENTIALS_KEY));
}
Map additionalHeaders = new HashMap<>();
@@ -282,21 +295,21 @@ public void startOciCloudAgentInitialization(
additionalHeaders.put(X_OCI_SERVICE_ACCOUNT_CREDENTIALS_HEADER, ociServiceAccountCredentials);
executeRequestWithRetries(
- "InitializeOciProject",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getEnvironmentsUri(environmentId, "initializer/oci/initialize"),
- sdkConfiguration,
- serializeSafely(new OciCompartmentInitializationRequest(
- tenancyId,
- compartmentId,
- region.toString(),
- tags)),
- additionalHeaders),
- new int[]{202},
- EnvironmentResponse.class);
+ "InitializeOciProject",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getEnvironmentsUri(environmentId, "initializer/oci/initialize"),
+ sdkConfiguration,
+ serializeSafely(new OciCompartmentInitializationRequest(
+ tenancyId,
+ compartmentId,
+ region.toString(),
+ tags)),
+ additionalHeaders),
+ new int[]{202},
+ EnvironmentResponse.class);
}
@Override
@@ -358,49 +371,56 @@ public InitializationRunResponse fetchCurrentHetznerInitialization(EnvironmentId
}
@Override
- public CiCdProfileResponse[] manageCiCdProfiles(EnvironmentIdValue environmentId, Collection ciCdProfiles) throws InstantiatorException {
+ public CiCdProfileResponse[] manageCiCdProfiles(
+ EnvironmentIdValue environmentId,
+ Collection ciCdProfiles) throws InstantiatorException
+ {
return executeRequestWithRetries(
- "manageCiCdProfiles",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getCiCdProfilesBulkUri(environmentId),
- sdkConfiguration,
- serializeSafely(ciCdProfiles)),
- new int[]{201, 404},
- CiCdProfileResponse[].class);
+ "manageCiCdProfiles",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getCiCdProfilesBulkUri(environmentId),
+ sdkConfiguration,
+ serializeSafely(ciCdProfiles)),
+ new int[]{201, 404},
+ CiCdProfileResponse[].class);
}
@Override
- public SecretResponse[] manageSecrets(EnvironmentIdValue environmentId, Collection secrets) throws InstantiatorException {
+ public SecretResponse[] manageSecrets(
+ EnvironmentIdValue environmentId,
+ Collection secrets) throws InstantiatorException
+ {
return executeRequestWithRetries(
- "manageSecrets",
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildPostRequest(
- getSecretsBulkUri(environmentId),
- sdkConfiguration,
- serializeSafely(secrets)),
- new int[]{201, 404},
- SecretResponse[].class);
+ "manageSecrets",
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildPostRequest(
+ getSecretsBulkUri(environmentId),
+ sdkConfiguration,
+ serializeSafely(secrets)),
+ new int[]{201, 404},
+ SecretResponse[].class);
}
private InitializationRunResponse fetchCurrentInitialization(
- EnvironmentIdValue environmentId,
- ProviderType provider) throws InstantiatorException {
+ EnvironmentIdValue environmentId,
+ ProviderType provider) throws InstantiatorException
+ {
var providerStr = StringHelper.convertToTitleCase(provider.toString());
var runRoot = executeRequestWithRetries(
- String.format("fetchCurrent%sInitialization", providerStr),
- environmentId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildGetRequest(
- getEnvironmentsUri(environmentId, String.format("initializer/%s/status", providerStr.toLowerCase())),
- sdkConfiguration),
- new int[]{200, 404},
- InitializationRunRoot.class);
+ String.format("fetchCurrent%sInitialization", providerStr),
+ environmentId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildGetRequest(
+ getEnvironmentsUri(environmentId, String.format("initializer/%s/status", providerStr.toLowerCase())),
+ sdkConfiguration),
+ new int[]{200, 404},
+ InitializationRunRoot.class);
return runRoot == null ? null : runRoot.initializationRun();
}
@@ -424,10 +444,10 @@ private URI getUriWithOptionalPath(String basePath, String path) {
private URI getEnvironmentsUri(EnvironmentIdValue environmentId, String path) {
var basePath = String.format("%s/%s/%s/%s",
- sdkConfiguration.getEnvironmentsEndpoint(),
- environmentId.type(),
- environmentId.ownerId(),
- environmentId.shortName());
+ sdkConfiguration.getEnvironmentsEndpoint(),
+ environmentId.type(),
+ environmentId.ownerId(),
+ environmentId.shortName());
return getUriWithOptionalPath(basePath, path);
}
@@ -437,23 +457,22 @@ private URI getEnvironmentsUri(EnvironmentIdValue environmentId) {
}
-
private URI getSecretsBulkUri(EnvironmentIdValue environmentId) {
var basePath = String.format("%s/%s/%s/%s/secrets",
- sdkConfiguration.getEnvironmentsEndpoint(),
- environmentId.type(),
- environmentId.ownerId(),
- environmentId.shortName());
+ sdkConfiguration.getEnvironmentsEndpoint(),
+ environmentId.type(),
+ environmentId.ownerId(),
+ environmentId.shortName());
return getUriWithOptionalPath(basePath, "bulk");
}
private URI getCiCdProfilesBulkUri(EnvironmentIdValue environmentId) {
var ciCdProfileEndpoint = String.format("%s/%s/%s/%s/ci-cd-profiles",
- sdkConfiguration.getEnvironmentsEndpoint(),
- environmentId.type(),
- environmentId.ownerId(),
- environmentId.shortName());
+ sdkConfiguration.getEnvironmentsEndpoint(),
+ environmentId.type(),
+ environmentId.ownerId(),
+ environmentId.shortName());
return getUriWithOptionalPath(ciCdProfileEndpoint, "bulk");
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AwsAccountInitializationRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AwsAccountInitializationRequest.java
index e88ab84b..2243211f 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AwsAccountInitializationRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AwsAccountInitializationRequest.java
@@ -6,4 +6,6 @@ public record AwsAccountInitializationRequest(
String organizationId,
String accountId,
String region,
- Map tags){}
\ No newline at end of file
+ Map tags)
+{
+}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AzureSubscriptionInitializationRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AzureSubscriptionInitializationRequest.java
index 82f78392..7d225702 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AzureSubscriptionInitializationRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/AzureSubscriptionInitializationRequest.java
@@ -6,9 +6,10 @@
import java.util.UUID;
public record AzureSubscriptionInitializationRequest(
- EnvironmentIdValue ManagementEnvironmentId,
- UUID tenantId,
- UUID subscriptionId,
- String region,
- Map tags) {
+ EnvironmentIdValue ManagementEnvironmentId,
+ UUID tenantId,
+ UUID subscriptionId,
+ String region,
+ Map tags)
+{
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateCiCdProfileRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateCiCdProfileRequest.java
index c82a02a8..c3189d8c 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateCiCdProfileRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateCiCdProfileRequest.java
@@ -3,19 +3,20 @@
import com.yanchware.fractal.sdk.domain.environment.CiCdProfile;
public record CreateCiCdProfileRequest(
- String shortName,
- String displayName,
- String description,
- String sshPrivateKeyData,
- String sshPrivateKeyPassphrase){
+ String shortName,
+ String displayName,
+ String description,
+ String sshPrivateKeyData,
+ String sshPrivateKeyPassphrase)
+{
- public static CreateCiCdProfileRequest fromProfile(CiCdProfile profile)
- {
- return new CreateCiCdProfileRequest(
- profile.shortName(),
- profile.displayName(),
- profile.description(),
- profile.sshPrivateKeyData(),
- profile.sshPrivateKeyPassphrase());
- }
+ public static CreateCiCdProfileRequest fromProfile(CiCdProfile profile)
+ {
+ return new CreateCiCdProfileRequest(
+ profile.shortName(),
+ profile.displayName(),
+ profile.description(),
+ profile.sshPrivateKeyData(),
+ profile.sshPrivateKeyPassphrase());
+ }
}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateEnvironmentRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateEnvironmentRequest.java
index 66386b43..68b28b74 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateEnvironmentRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateEnvironmentRequest.java
@@ -4,11 +4,11 @@
import java.util.Collection;
import java.util.Map;
-import java.util.UUID;
public record CreateEnvironmentRequest(
- EnvironmentIdValue managementEnvironmentId,
- String name,
- Collection resourceGroups,
- Map parameters) {
+ EnvironmentIdValue managementEnvironmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters)
+{
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateSecretRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateSecretRequest.java
index c0865a29..3591cb2a 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateSecretRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/CreateSecretRequest.java
@@ -1,8 +1,9 @@
package com.yanchware.fractal.sdk.domain.environment.service.commands;
public record CreateSecretRequest(
- String name,
- String value) {
+ String name,
+ String value)
+{
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/GcpProjectInitializationRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/GcpProjectInitializationRequest.java
index 52e2dc92..8cb56c04 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/GcpProjectInitializationRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/GcpProjectInitializationRequest.java
@@ -2,10 +2,12 @@
import java.util.Map;
-public record GcpProjectInitializationRequest (
+public record GcpProjectInitializationRequest(
String organizationId,
String projectId,
String region,
- Map tags){}
+ Map tags)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/HetznerProjectInitializationRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/HetznerProjectInitializationRequest.java
index 6f976a7e..0bcec254 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/HetznerProjectInitializationRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/HetznerProjectInitializationRequest.java
@@ -5,4 +5,6 @@
public record HetznerProjectInitializationRequest(
String projectId,
String region,
- Map tags){}
\ No newline at end of file
+ Map tags)
+{
+}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/OciCompartmentInitializationRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/OciCompartmentInitializationRequest.java
index 03f77154..94797bf7 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/OciCompartmentInitializationRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/OciCompartmentInitializationRequest.java
@@ -2,8 +2,10 @@
import java.util.Map;
-public record OciCompartmentInitializationRequest (
+public record OciCompartmentInitializationRequest(
String tenancyId,
String compartmentId,
String region,
- Map tags){}
\ No newline at end of file
+ Map tags)
+{
+}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/UpdateEnvironmentRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/UpdateEnvironmentRequest.java
index 33736280..1577a5b6 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/UpdateEnvironmentRequest.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/commands/UpdateEnvironmentRequest.java
@@ -4,12 +4,12 @@
import java.util.Collection;
import java.util.Map;
-import java.util.UUID;
public record UpdateEnvironmentRequest(
- EnvironmentIdValue managementEnvironmentId,
- String name,
- Collection resourceGroups,
- Map parameters,
- String defaultCiCdProfileShortName) {
+ EnvironmentIdValue managementEnvironmentId,
+ String name,
+ Collection resourceGroups,
+ Map parameters,
+ String defaultCiCdProfileShortName)
+{
}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/CiCdProfileResponse.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/CiCdProfileResponse.java
index 2df3c4de..08a34098 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/CiCdProfileResponse.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/CiCdProfileResponse.java
@@ -6,11 +6,13 @@
import java.util.UUID;
public record CiCdProfileResponse(
- UUID id,
- EnvironmentIdDto environmentId,
- String shortName,
- String displayName,
- Date createdAt,
- String createdBy,
- Date updatedAt,
- String updatedBy){ }
+ UUID id,
+ EnvironmentIdDto environmentId,
+ String shortName,
+ String displayName,
+ Date createdAt,
+ String createdBy,
+ Date updatedAt,
+ String updatedBy)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/EnvironmentResponse.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/EnvironmentResponse.java
index 265930b0..03ff8a63 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/EnvironmentResponse.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/EnvironmentResponse.java
@@ -17,6 +17,8 @@ public record EnvironmentResponse(
Date createdAt,
String createdBy,
Date updatedAt,
- String updatedBy){ }
+ String updatedBy)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunResponse.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunResponse.java
index 63030b89..db717726 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunResponse.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunResponse.java
@@ -6,12 +6,14 @@
import java.util.List;
import java.util.UUID;
-public record InitializationRunResponse (
+public record InitializationRunResponse(
UUID id,
EnvironmentIdDto environmentId,
String cloudProvider,
List steps,
String status,
String requester,
- Date createdAt){ }
+ Date createdAt)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunRoot.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunRoot.java
index 9f7aca07..2e6a0607 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunRoot.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationRunRoot.java
@@ -1,3 +1,4 @@
package com.yanchware.fractal.sdk.domain.environment.service.dtos;
-public record InitializationRunRoot(InitializationRunResponse initializationRun) { }
+public record InitializationRunRoot(InitializationRunResponse initializationRun) {
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationStepResponse.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationStepResponse.java
index 2a112301..6e4cb8f2 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationStepResponse.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/InitializationStepResponse.java
@@ -4,7 +4,7 @@
import java.util.Map;
import java.util.UUID;
-public record InitializationStepResponse (
+public record InitializationStepResponse(
UUID id,
String name,
String description,
@@ -16,4 +16,6 @@ public record InitializationStepResponse (
String status,
Integer retryCount,
Date createdAt,
- Date updatedAt){ }
+ Date updatedAt)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/SecretResponse.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/SecretResponse.java
index 135ebd5a..60c2f623 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/SecretResponse.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/environment/service/dtos/SecretResponse.java
@@ -6,13 +6,15 @@
import java.util.UUID;
public record SecretResponse(
- UUID id,
- EnvironmentIdDto environmentId,
- String name,
- String value,
- Date createdAt,
- String createdBy,
- Date updatedAt,
- String updatedBy){ }
+ UUID id,
+ EnvironmentIdDto environmentId,
+ String name,
+ String value,
+ Date createdAt,
+ String createdBy,
+ Date updatedAt,
+ String updatedBy)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ComponentInstantiationException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ComponentInstantiationException.java
index 075d4b16..b5da9cf9 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ComponentInstantiationException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ComponentInstantiationException.java
@@ -3,15 +3,15 @@
import java.io.Serial;
public class ComponentInstantiationException extends Exception {
- @Serial
- private static final long serialVersionUID = 1L;
-
+ @Serial
+ private static final long serialVersionUID = 1L;
- public ComponentInstantiationException(String message) {
- super(message);
- }
- public ComponentInstantiationException(String message, Throwable cause) {
- super(message, cause);
- }
+ public ComponentInstantiationException(String message) {
+ super(message);
+ }
+
+ public ComponentInstantiationException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentException.java
index e255d842..369bde80 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentException.java
@@ -3,14 +3,14 @@
import java.io.Serial;
public class EnvironmentException extends InstantiatorException {
- @Serial
- private static final long serialVersionUID = 1L;
-
- public EnvironmentException(String message) {
- super(message);
- }
+ @Serial
+ private static final long serialVersionUID = 1L;
- public EnvironmentException(String message, Throwable cause) {
- super(message, cause);
- }
+ public EnvironmentException(String message) {
+ super(message);
+ }
+
+ public EnvironmentException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentInitializationException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentInitializationException.java
index f935bcd9..45a37649 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentInitializationException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentInitializationException.java
@@ -5,22 +5,22 @@
import java.util.Collection;
public class EnvironmentInitializationException extends Exception {
- @Serial
- private static final long serialVersionUID = 1L;
+ @Serial
+ private static final long serialVersionUID = 1L;
- private Collection failedSteps = new ArrayList<>();
+ private Collection failedSteps = new ArrayList<>();
- public EnvironmentInitializationException(String message) {
- super(message);
- }
+ public EnvironmentInitializationException(String message) {
+ super(message);
+ }
- public EnvironmentInitializationException(String message, Throwable cause) {
- super(message, cause);
- }
+ public EnvironmentInitializationException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public EnvironmentInitializationException(Collection failedSteps, String message) {
- super(message);
- this.failedSteps = failedSteps;
- }
+ public EnvironmentInitializationException(Collection failedSteps, String message) {
+ super(message);
+ this.failedSteps = failedSteps;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentNotFoundException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentNotFoundException.java
index b4a270f4..dafc199b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentNotFoundException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/EnvironmentNotFoundException.java
@@ -3,14 +3,14 @@
import java.io.Serial;
public class EnvironmentNotFoundException extends InstantiatorException {
- @Serial
- private static final long serialVersionUID = 1L;
+ @Serial
+ private static final long serialVersionUID = 1L;
- public EnvironmentNotFoundException(String message) {
- super(message);
- }
+ public EnvironmentNotFoundException(String message) {
+ super(message);
+ }
- public EnvironmentNotFoundException(String message, Throwable cause) {
- super(message, cause);
- }
+ public EnvironmentNotFoundException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/InstantiatorException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/InstantiatorException.java
index 82776b31..5b7fb4cd 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/InstantiatorException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/InstantiatorException.java
@@ -3,15 +3,15 @@
import java.io.Serial;
public class InstantiatorException extends Exception {
- @Serial
- private static final long serialVersionUID = 1L;
+ @Serial
+ private static final long serialVersionUID = 1L;
- public InstantiatorException(String message) {
- super(message);
- }
+ public InstantiatorException(String message) {
+ super(message);
+ }
- public InstantiatorException(String message, Throwable cause) {
- super(message, cause);
- }
+ public InstantiatorException(String message, Throwable cause) {
+ super(message, cause);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ProviderException.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ProviderException.java
index 5175898e..21a456c9 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ProviderException.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/exceptions/ProviderException.java
@@ -5,22 +5,22 @@
import java.util.Collection;
public class ProviderException extends Exception {
- @Serial
- private static final long serialVersionUID = 1L;
+ @Serial
+ private static final long serialVersionUID = 1L;
- private Collection failedComponents = new ArrayList<>();
+ private Collection failedComponents = new ArrayList<>();
- public ProviderException(String message) {
- super(message);
- }
+ public ProviderException(String message) {
+ super(message);
+ }
- public ProviderException(String message, Throwable cause) {
- super(message, cause);
- }
+ public ProviderException(String message, Throwable cause) {
+ super(message, cause);
+ }
- public ProviderException(Collection failedComponentsIds, String message) {
- super(message);
- this.failedComponents = failedComponentsIds;
- }
+ public ProviderException(Collection failedComponentsIds, String message) {
+ super(message);
+ this.failedComponents = failedComponentsIds;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/BlueprintComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/BlueprintComponent.java
new file mode 100644
index 00000000..59042b6c
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/BlueprintComponent.java
@@ -0,0 +1,4 @@
+package com.yanchware.fractal.sdk.domain.fractal;
+
+public interface BlueprintComponent {
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalAggregate.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalAggregate.java
new file mode 100644
index 00000000..5aabc5d9
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalAggregate.java
@@ -0,0 +1,84 @@
+package com.yanchware.fractal.sdk.domain.fractal;
+
+import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
+import com.yanchware.fractal.sdk.domain.Validatable;
+import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
+import com.yanchware.fractal.sdk.domain.fractal.service.BlueprintService;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintComponentDto;
+import io.github.resilience4j.retry.RetryRegistry;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.extern.slf4j.Slf4j;
+
+import java.net.http.HttpClient;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import static org.apache.commons.lang3.StringUtils.isBlank;
+
+@Slf4j
+@Setter(AccessLevel.PROTECTED)
+public class FractalAggregate implements Validatable {
+ private final static String ID_IS_NULL = "[Fractal Validation] Id has not been defined and it is required";
+ private final static String NAME_IS_NULL = "[Fractal Validation] Name has not been defined and it is required";
+ private final static String VERSION_IS_NULL = "[Fractal Validation] Version has not been defined and it is required";
+ private final static String RESOURCE_GROUP_ID_IS_NULL = "[Fractal Validation] ResourceGroupId has not been " +
+ "defined and it is required'";
+ private final static String EMPTY_COMPONENT_LIST = "[Fractal Validation] Components list is null or empty and at" +
+ " least one component is required";
+
+ private final BlueprintService service;
+
+ @Getter
+ private FractalIdValue id;
+ @Getter
+ private String description;
+ @Getter
+ private boolean isPrivate;
+ @Getter
+ // TODO FRA-1870: We should find a way to fix this instead to have DTOs in the Aggregate 🤮
+ private Collection components;
+
+ public FractalAggregate(
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
+ {
+ this.service = new BlueprintService(client, sdkConfiguration, retryRegistry);
+ components = new ArrayList<>();
+ }
+
+ public void createOrUpdate() throws InstantiatorException {
+ if (components == null || components.isEmpty()) {
+ throw new InstantiatorException(EMPTY_COMPONENT_LIST);
+ }
+
+ service.createOrUpdate(id, description, isPrivate, components);
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = new ArrayList<>();
+
+ if (id == null) {
+ errors.add(ID_IS_NULL);
+ return errors;
+ }
+
+ if (isBlank(id.name())) {
+ errors.add(NAME_IS_NULL);
+ }
+
+ if (isBlank(id.version())) {
+ errors.add(VERSION_IS_NULL);
+ }
+
+ if (id.resourceGroupId() == null) {
+ errors.add(RESOURCE_GROUP_ID_IS_NULL);
+ }
+
+ return errors;
+ }
+
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/FractalIdValue.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalIdValue.java
similarity index 50%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/FractalIdValue.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalIdValue.java
index 88a72489..9e76383c 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/FractalIdValue.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalIdValue.java
@@ -1,12 +1,12 @@
-package com.yanchware.fractal.sdk.domain.blueprint;
+package com.yanchware.fractal.sdk.domain.fractal;
import com.yanchware.fractal.sdk.domain.values.ResourceGroupId;
import org.jetbrains.annotations.NotNull;
public record FractalIdValue(ResourceGroupId resourceGroupId, String name, String version) {
- @NotNull
- @Override
- public String toString(){
- return String.format("%s/%s:%s", resourceGroupId.toString(), name, version);
- }
+ @NotNull
+ @Override
+ public String toString() {
+ return String.format("%s/%s:%s", resourceGroupId.toString(), name, version);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalsFactory.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalsFactory.java
new file mode 100644
index 00000000..272c0ecd
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/FractalsFactory.java
@@ -0,0 +1,70 @@
+package com.yanchware.fractal.sdk.domain.fractal;
+
+import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintComponentDto;
+import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemAggregate;
+import io.github.resilience4j.retry.RetryRegistry;
+
+import java.net.http.HttpClient;
+import java.util.Arrays;
+import java.util.Collection;
+
+public class FractalsFactory {
+ private final HttpClient client;
+ private final SdkConfiguration sdkConfiguration;
+ private final RetryRegistry retryRegistry;
+
+ public FractalsFactory(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
+
+ this.client = client;
+ this.sdkConfiguration = sdkConfiguration;
+ this.retryRegistry = retryRegistry;
+ }
+
+ public FractalBuilder builder() {
+ return new FractalBuilder(client, sdkConfiguration, retryRegistry);
+ }
+
+ public static class FractalBuilder {
+ private final FractalAggregate fractal;
+ private final FractalBuilder builder;
+
+ public FractalBuilder(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
+ fractal = createFractal(client, sdkConfiguration, retryRegistry);
+ builder = getBuilder();
+ }
+
+ public FractalBuilder fromLiveSystem(LiveSystemAggregate liveSystem) {
+ fractal.setId(liveSystem.getFractalId());
+ fractal.setDescription(String.format("Blueprint created via SDK from LiveSystem with Fractal ID: %s", liveSystem.getFractalId()));
+ fractal.setPrivate(true);
+ fractal.setComponents(BlueprintComponentDto.fromLiveSystemComponents(liveSystem.getComponents()));
+ return builder;
+ }
+
+ public FractalAggregate build() {
+ Collection errors = fractal.validate();
+
+ if (!errors.isEmpty()) {
+ throw new IllegalArgumentException(String.format(
+ "Fractal validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
+ }
+
+ return fractal;
+ }
+
+ protected FractalBuilder getBuilder() {
+ return this;
+ }
+
+ protected FractalAggregate createFractal(
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
+ {
+ return new FractalAggregate(client, sdkConfiguration, retryRegistry);
+ }
+ }
+
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSAPIGateway.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSAPIGateway.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSAPIGateway.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSAPIGateway.java
index 7d05cfcb..6a7bdf85 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSAPIGateway.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSAPIGateway.java
@@ -1,6 +1,6 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_API_GATEWAY;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSComponent.java
similarity index 79%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSComponent.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSComponent.java
index 692cfcd5..d89ea350 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSComponent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSComponent.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
import com.yanchware.fractal.sdk.domain.Component;
import com.yanchware.fractal.sdk.domain.livesystem.caas.ResourceManagement;
@@ -18,7 +18,10 @@
@Setter(AccessLevel.PUBLIC)
@ToString(callSuper = true)
public abstract class CaaSComponent extends Component {
- private final static String DNS_ZONE_NAME_NOT_VALID = "[DnsRecords Validation] The dnsZoneName must contain no more than 253 characters, excluding a trailing period and must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period";
+ private final static String DNS_ZONE_NAME_NOT_VALID = "[DnsRecords Validation] The dnsZoneName must contain no more" +
+ " than 253 characters, excluding a trailing period and must be between 2 and 34 labels. Each label must only " +
+ "contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a " +
+ "period";
private String containerPlatform;
private String namespace;
@@ -29,24 +32,27 @@ public abstract class CaaSComponent extends Component {
private String priorityClassName;
private String getNamespaceIsNullOrEmptyErrorMessage() {
- return String.format("[%s Validation] Namespace has not been defined and it is required", this.getClass().getSimpleName());
+ return String.format("[%s Validation] Namespace has not been defined and it is required",
+ this.getClass().getSimpleName());
}
private String getContainerPlatformIsNullOrEmptyErrorMessage() {
- return String.format("[%s Validation] ContainerPlatform defined was either empty or blank and it is required", this.getClass().getSimpleName());
+ return String.format("[%s Validation] ContainerPlatform defined was either empty or blank and it is required",
+ this.getClass().getSimpleName());
}
- public static abstract class Builder> extends Component.Builder {
+ public static abstract class Builder> extends Component.Builder {
/**
*
* Configures resource management settings for the component, specifying CPU and memory requests and limits.
* This ensures the component is allocated the necessary resources for optimal performance and does not exceed
* specified usage thresholds.
- *
+ *
* @param resourceManagement The ResourceManagement settings for the component.
- *
- * @important.note Customizing resource management values offers flexibility, but you need to carefully consider
+ * @important.note Customizing resource management values offers flexibility, but you need to carefully
+ * consider
* the implications. Fractal Cloud cannot guarantee the functionality of the deployment if these customizations
* lead to resource constraints or conflicts. You are responsible for ensuring that your configurations are
* appropriate for your application's needs and compatible with your cluster's capabilities.
@@ -55,16 +61,17 @@ public B withResourceManagement(ResourceManagement resourceManagement) {
component.setResourceManagement(resourceManagement);
return builder;
}
-
- /**
+
+ /**
*
- * Sets multiple node selectors at once.
+ * Sets multiple node selectors at once.
* Each entry in the map represents a label and its desired value.
*
* @param selectors A map of label keys to label values defining the node selection criteria.
- *
- * @important.note Node selectors provide powerful control over pod scheduling, but incorrect or overly restrictive
- * configurations may limit your deployment options. Fractal Cloud cannot guarantee the functionality of the deployment
+ * @important.note Node selectors provide powerful control over pod scheduling, but incorrect or overly
+ * restrictive
+ * configurations may limit your deployment options. Fractal Cloud cannot guarantee the functionality of the
+ * deployment
* if node selector configurations prevent scheduling. You need to verify the accuracy and applicability of your
* node label selections.
*/
@@ -72,22 +79,23 @@ public B withNodeSelectors(Map selectors) {
if (component.getNodeSelectors() == null) {
component.setNodeSelectors(new HashMap<>());
}
-
+
component.getNodeSelectors().putAll(selectors);
return builder;
}
/**
*
- * Adds a single node selector.
+ * Adds a single node selector.
* This method allows you to specify one label and its desired value at a time.
* Can be called multiple times to add multiple selectors.
*
* @param label The label key representing a specific characteristic of nodes.
* @param value The label value that nodes must have to match the selector.
- *
- * @important.note Node selectors provide powerful control over pod scheduling, but incorrect or overly restrictive
- * configurations may limit your deployment options. Fractal Cloud cannot guarantee the functionality of the deployment
+ * @important.note Node selectors provide powerful control over pod scheduling, but incorrect or overly
+ * restrictive
+ * configurations may limit your deployment options. Fractal Cloud cannot guarantee the functionality of the
+ * deployment
* if node selector configurations prevent scheduling. You need to verify the accuracy and applicability of your
* node label selections.
*/
@@ -95,20 +103,20 @@ public B withNodeSelector(String label, String value) {
if (component.getNodeSelectors() == null) {
component.setNodeSelectors(new HashMap<>());
}
-
+
component.getNodeSelectors().put(label, value);
return builder;
}
-
+
/**
*
* Adds a list of tolerations for the component, enabling it to be scheduled on nodes with specific taints.
* Tolerations are essential for running applications in environments with strict security or operational requirements.
- *
+ *
* @param tolerations A list of Toleration objects for the component.
- *
- * @important.note Toleration configurations must be carefully crafted to ensure compatibility with cluster taints.
+ * @important.note Toleration configurations must be carefully crafted to ensure compatibility with
+ * cluster taints.
* Fractal Cloud cannot guarantee the functionality of the deployment if tolerations cause the component to be
* unscheduled or scheduled on unsuitable nodes. You need to carefully review and test your toleration settings
* to ensure they align with your deployment strategy and security requirements.
@@ -124,12 +132,12 @@ public B withTolerations(List tolerations) {
/**
*
* Adds a single toleration to the component, providing granular control over scheduling on nodes with certain taints.
- *
+ *
* @param toleration A Toleration object to add to the component.
- *
* @important.note Adding individual tolerations requires precision to avoid unintended scheduling outcomes.
* Fractal Cloud cannot guarantee the functionality of the deployment if improper tolerations lead to deployment
- * challenges. You need to ensure that tolerations are correctly configured for your operational environment.
+ * challenges. You need to ensure that tolerations are correctly configured for your operational environment
+ * .
*/
public B withToleration(Toleration toleration) {
if (component.getTolerations() == null) {
@@ -142,9 +150,8 @@ public B withToleration(Toleration toleration) {
/**
*
* Specifies the priority class name for the component, affecting the scheduling and preemption of pods.
- *
+ *
* @param priorityClassName The name of the PriorityClass for the component.
- *
* @important.note Priority class names influence the scheduling and lifecycle of pods significantly.
* Fractal Cloud cannot guarantee the functionality of the deployment if priority class names conflict with
* cluster policies or other deployed applications. You need to ensure that priority class names are chosen
@@ -155,7 +162,7 @@ public B withPriorityClassName(String priorityClassName) {
return builder;
}
}
-
+
@Override
public Collection validate() {
Collection errors = super.validate();
@@ -170,20 +177,20 @@ public Collection validate() {
if (dnsZoneConfig != null) {
dnsZoneConfig.keySet()
- .forEach(dnsZoneName -> {
- if (isBlank(dnsZoneName)) {
- errors.add(DNS_ZONE_NAME_NOT_VALID);
- }
- if (StringUtils.isNotBlank(dnsZoneName)) {
- var nameWithoutTrailingPeriod = StringUtils.stripEnd(dnsZoneName, ".");
+ .forEach(dnsZoneName -> {
+ if (isBlank(dnsZoneName)) {
+ errors.add(DNS_ZONE_NAME_NOT_VALID);
+ }
+ if (StringUtils.isNotBlank(dnsZoneName)) {
+ var nameWithoutTrailingPeriod = StringUtils.stripEnd(dnsZoneName, ".");
- var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriods(dnsZoneName);
+ var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriods(dnsZoneName);
- if (!hasValidCharacters || nameWithoutTrailingPeriod.length() > 253) {
- errors.add(DNS_ZONE_NAME_NOT_VALID);
- }
+ if (!hasValidCharacters || nameWithoutTrailingPeriod.length() > 253) {
+ errors.add(DNS_ZONE_NAME_NOT_VALID);
}
- });
+ }
+ });
}
return errors;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSLogging.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSLogging.java
similarity index 68%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSLogging.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSLogging.java
index 3efca947..b31ca7e0 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSLogging.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSLogging.java
@@ -1,6 +1,6 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_LOGGING;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSMonitoring.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSMonitoring.java
similarity index 69%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSMonitoring.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSMonitoring.java
index cb8f516d..9a5b85c3 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSMonitoring.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSMonitoring.java
@@ -1,6 +1,6 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_MONITORING;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSSearch.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSSearch.java
similarity index 53%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSSearch.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSSearch.java
index edcf3df8..19d10632 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSSearch.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSSearch.java
@@ -1,11 +1,11 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_SEARCH;
@ToString(callSuper = true)
public class CaaSSearch extends CaaSComponent implements BlueprintComponent {
- public static final String TYPE = CAAS_SEARCH.getId();
+ public static final String TYPE = CAAS_SEARCH.getId();
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSServiceMeshSecurity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSServiceMeshSecurity.java
similarity index 71%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSServiceMeshSecurity.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSServiceMeshSecurity.java
index ecad2057..3e3f4d3f 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSServiceMeshSecurity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSServiceMeshSecurity.java
@@ -1,6 +1,6 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_SERVICE_MESH_SECURITY;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSWorkload.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSWorkload.java
similarity index 68%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSWorkload.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSWorkload.java
index 92a7b9d7..0d148189 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/caas/CaaSWorkload.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/caas/CaaSWorkload.java
@@ -1,6 +1,6 @@
-package com.yanchware.fractal.sdk.domain.blueprint.caas;
+package com.yanchware.fractal.sdk.domain.fractal.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.CAAS_WORKLOAD;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsARecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsARecord.java
similarity index 81%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsARecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsARecord.java
index 1af57c7e..ba9fadc6 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsARecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsARecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -69,17 +69,17 @@ public Collection validate() {
if (!isBlank(ipV4Addresses)) {
ipV4Addresses.stream()
- .filter(StringUtils::isNotBlank)
- .forEach(ipV4Address -> {
- var hasValidCharacters = isValidIpV4Address(ipV4Address);
- if (!hasValidCharacters) {
- errors.add(IP_V4_ADDRESS_NOT_VALID);
- }
- });
+ .filter(StringUtils::isNotBlank)
+ .forEach(ipV4Address -> {
+ var hasValidCharacters = isValidIpV4Address(ipV4Address);
+ if (!hasValidCharacters) {
+ errors.add(IP_V4_ADDRESS_NOT_VALID);
+ }
+ });
}
-
+
return errors.stream()
- .map(error -> "[DnsARecord Validation] " + error)
- .collect(Collectors.toList());
+ .map(error -> "[DnsARecord Validation] " + error)
+ .collect(Collectors.toList());
}
}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsAaaaRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsAaaaRecord.java
similarity index 76%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsAaaaRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsAaaaRecord.java
index 412c2994..938927b9 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsAaaaRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsAaaaRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.fasterxml.jackson.annotation.JsonTypeName;
import lombok.AccessLevel;
@@ -13,7 +13,7 @@
import java.util.Set;
import java.util.stream.Collectors;
-import static com.yanchware.fractal.sdk.domain.blueprint.iaas.DnsAaaaRecord.AAAA_DNS_RECORD_TYPE;
+import static com.yanchware.fractal.sdk.domain.fractal.iaas.DnsAaaaRecord.AAAA_DNS_RECORD_TYPE;
import static com.yanchware.fractal.sdk.utils.CollectionUtils.isBlank;
import static com.yanchware.fractal.sdk.utils.RegexValidationUtils.isValidIpV6Address;
@@ -24,7 +24,8 @@
public class DnsAaaaRecord extends DnsRecord {
public static final String AAAA_DNS_RECORD_TYPE = "AAAA";
- private final static String IP_V6_ADDRESS_NOT_VALID = "[DnsAaaaRecord Validation] ipV6Address does not contain a valid IP v6 address";
+ private final static String IP_V6_ADDRESS_NOT_VALID = "[DnsAaaaRecord Validation] ipV6Address does not contain a " +
+ "valid IP v6 address";
private Set ipV6Addresses;
@@ -72,17 +73,17 @@ public Collection validate() {
if (!isBlank(ipV6Addresses)) {
ipV6Addresses.stream()
- .filter(StringUtils::isNotBlank)
- .forEach(ipV6Address -> {
- var hasValidCharacters = isValidIpV6Address(ipV6Address);
- if (!hasValidCharacters) {
- errors.add(IP_V6_ADDRESS_NOT_VALID);
- }
- });
+ .filter(StringUtils::isNotBlank)
+ .forEach(ipV6Address -> {
+ var hasValidCharacters = isValidIpV6Address(ipV6Address);
+ if (!hasValidCharacters) {
+ errors.add(IP_V6_ADDRESS_NOT_VALID);
+ }
+ });
}
return errors.stream()
- .map(error -> "[DnsAaaaRecord Validation] " + error)
- .collect(Collectors.toList());
+ .map(error -> "[DnsAaaaRecord Validation] " + error)
+ .collect(Collectors.toList());
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCNameRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCNameRecord.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCNameRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCNameRecord.java
index 95c676e9..477581cc 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCNameRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCNameRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -18,9 +18,12 @@
public class DnsCNameRecord extends DnsRecord {
public static final String CNAME_DNS_RECORD_TYPE = "CNAME";
- private final static String ALIAS_NOT_VALID = "The alias value, concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String ALIAS_NOT_VALID = "The alias value, concatenated with its zone name, must contain no " +
+ "more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only " +
+ "contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a " +
+ "period. Each label must contain between 1 and 63 characters.";
private final static String ALIAS_LABEL_NOT_VALID = "The alias label must contain between 1 and 63 characters";
-
+
private String alias;
@@ -56,14 +59,14 @@ public DnsCNameRecord build() {
public Collection validate() {
var errors = super.validate();
- if(StringUtils.isNotBlank(alias)) {
+ if (StringUtils.isNotBlank(alias)) {
var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired(alias);
if (alias.contains(".")) {
Arrays.stream(alias.split("\\."))
- .filter(label -> label.length() > 63)
- .map(label -> ALIAS_LABEL_NOT_VALID)
- .forEach(errors::add);
+ .filter(label -> label.length() > 63)
+ .map(label -> ALIAS_LABEL_NOT_VALID)
+ .forEach(errors::add);
}
var withoutTrailingPeriod = StringUtils.stripEnd(alias, ".");
@@ -74,8 +77,8 @@ public Collection validate() {
}
return errors.stream()
- .map(error -> "[DnsCNameRecord Validation] " + error)
- .collect(Collectors.toList());
+ .map(error -> "[DnsCNameRecord Validation] " + error)
+ .collect(Collectors.toList());
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecord.java
similarity index 91%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecord.java
index a3e5c52d..2af5e33d 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -69,7 +69,7 @@ public Collection validate() {
}
return errors.stream()
- .map(error -> "[DnsCaaRecord Validation] " + error)
- .collect(Collectors.toList());
+ .map(error -> "[DnsCaaRecord Validation] " + error)
+ .collect(Collectors.toList());
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecordData.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecordData.java
similarity index 85%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecordData.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecordData.java
index 08b81e09..406b3d45 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsCaaRecordData.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsCaaRecordData.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.yanchware.fractal.sdk.domain.Validatable;
import lombok.AccessLevel;
@@ -19,10 +19,11 @@
public class DnsCaaRecordData implements Validatable {
private final static String FLAGS_NOT_VALID = "The Flags value must be between 0 and 255";
private final static String TAG_NOT_DEFINED = "The tag has not been defined and it is required";
- private final static String TAG_NOT_VALID = "The Tag value must have a length of at most 15. It must contain characters 'a' through 'z', 'A' through 'Z', and the numbers 0 through 9";
+ private final static String TAG_NOT_VALID = "The Tag value must have a length of at most 15. It must contain " +
+ "characters 'a' through 'z', 'A' through 'Z', and the numbers 0 through 9";
private final static String VALUE_NOT_DEFINED = "The value has not been defined and it is required";
private final static String VALUE_NOT_VALID = "The value must have a length of at most 1024";
-
+
public int flags;
public String tag;
public String value;
@@ -60,8 +61,8 @@ public DnsCaaRecordData build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "CaaRecordData validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "CaaRecordData validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
return recordData;
@@ -72,12 +73,12 @@ public DnsCaaRecordData build() {
public Collection validate() {
var errors = new ArrayList();
-
- if(flags < 0 || flags > 255) {
+
+ if (flags < 0 || flags > 255) {
errors.add(FLAGS_NOT_VALID);
}
-
- if(StringUtils.isBlank(tag)) {
+
+ if (StringUtils.isBlank(tag)) {
errors.add(TAG_NOT_DEFINED);
} else {
var hasValidCharacters = isValidLettersAndNumbers(tag);
@@ -87,7 +88,7 @@ public Collection validate() {
}
}
- if(StringUtils.isBlank(value)) {
+ if (StringUtils.isBlank(value)) {
errors.add(VALUE_NOT_DEFINED);
} else {
if (value.length() > 1024) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecord.java
similarity index 96%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecord.java
index ba56fa98..6b5c8e49 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecordData.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecordData.java
similarity index 74%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecordData.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecordData.java
index 31686eac..7f8a3162 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsMxRecordData.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsMxRecordData.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.yanchware.fractal.sdk.domain.Validatable;
import lombok.AccessLevel;
@@ -18,8 +18,12 @@
@NoArgsConstructor
public class DnsMxRecordData implements Validatable {
private final static String PRIORITY_NOT_VALID = "The Priority value must be between 0 and 65535";
- private final static String MAIL_EXCHANGE_NOT_VALID = "The mailExchange value, concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
- private final static String MAIL_EXCHANGE_LABEL_NOT_VALID = "The mailExchange label must contain between 1 and 63 characters";
+ private final static String MAIL_EXCHANGE_NOT_VALID = "The mailExchange value, concatenated with its zone name, " +
+ "must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each " +
+ "label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other " +
+ "labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String MAIL_EXCHANGE_LABEL_NOT_VALID = "The mailExchange label must contain between 1 and 63 " +
+ "characters";
private final static String MAIL_EXCHANGE_NOT_DEFINED = "The mailExchange has not been defined and it is required";
public int priority;
@@ -53,8 +57,8 @@ public DnsMxRecordData build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "MxRecordData validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "MxRecordData validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
return recordData;
@@ -66,24 +70,24 @@ public Collection validate() {
var errors = new ArrayList();
- if(priority < 0 || priority > 65535) {
+ if (priority < 0 || priority > 65535) {
errors.add(PRIORITY_NOT_VALID);
}
- if(StringUtils.isBlank(mailExchange)) {
+ if (StringUtils.isBlank(mailExchange)) {
errors.add(MAIL_EXCHANGE_NOT_DEFINED);
} else {
var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired(mailExchange);
if (mailExchange.contains(".")) {
Arrays.stream(mailExchange.split("\\."))
- .filter(label -> label.length() > 63)
- .map(label -> MAIL_EXCHANGE_LABEL_NOT_VALID)
- .forEach(errors::add);
+ .filter(label -> label.length() > 63)
+ .map(label -> MAIL_EXCHANGE_LABEL_NOT_VALID)
+ .forEach(errors::add);
}
var withoutTrailingPeriod = StringUtils.stripEnd(mailExchange, ".");
-
+
if (!hasValidCharacters || withoutTrailingPeriod.length() > 253) {
errors.add(MAIL_EXCHANGE_NOT_VALID);
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsNsRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsNsRecord.java
similarity index 82%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsNsRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsNsRecord.java
index a3407fcf..4e331b64 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsNsRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsNsRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -19,8 +19,12 @@
public class DnsNsRecord extends DnsRecord {
public static final String NS_DNS_RECORD_TYPE = "NS";
- private final static String NAME_SERVER_NOT_VALID_PATTERN = "The nameServer value ['%s'], concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
- private final static String NAME_SERVER_LABEL_NOT_VALID_PATTERN = "The nameServer ['%s'] label must contain between 1 and 63 characters";
+ private final static String NAME_SERVER_NOT_VALID_PATTERN = "The nameServer value ['%s'], concatenated with its " +
+ "zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 " +
+ "labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be " +
+ "separated from other labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String NAME_SERVER_LABEL_NOT_VALID_PATTERN = "The nameServer ['%s'] label must contain between" +
+ " 1 and 63 characters";
private List nameServers;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsPtrRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsPtrRecord.java
similarity index 77%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsPtrRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsPtrRecord.java
index db1f6c69..23dbb503 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsPtrRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsPtrRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -20,8 +20,12 @@
public class DnsPtrRecord extends DnsRecord {
public static final String PTR_DNS_RECORD_TYPE = "PTR";
- private final static String DOMAIN_NAME_NOT_VALID_PATTERN = "The domainName value ['%s'], concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
- private final static String DOMAIN_NAME_LABEL_NOT_VALID_PATTERN = "The domainName ['%s'] label must contain between 1 and 63 characters";
+ private final static String DOMAIN_NAME_NOT_VALID_PATTERN = "The domainName value ['%s'], concatenated with its " +
+ "zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 " +
+ "labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be " +
+ "separated from other labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String DOMAIN_NAME_LABEL_NOT_VALID_PATTERN = "The domainName ['%s'] label must contain between" +
+ " 1 and 63 characters";
private List domainNames;
@@ -44,7 +48,7 @@ public DnsPtrRecordBuilder withDomainName(String domainName) {
if (StringUtils.isBlank(domainName)) {
return builder;
}
-
+
return withDomainNames(List.of(domainName));
}
@@ -73,17 +77,17 @@ public Collection validate() {
if (!isBlank(domainNames)) {
for (var domainName : domainNames) {
- if(StringUtils.isBlank(domainName)) {
+ if (StringUtils.isBlank(domainName)) {
continue;
}
-
+
var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired(domainName);
if (domainName.contains(".")) {
Arrays.stream(domainName.split("\\."))
- .filter(label -> label.length() > 63)
- .map(label -> String.format(DOMAIN_NAME_LABEL_NOT_VALID_PATTERN, label))
- .forEach(errors::add);
+ .filter(label -> label.length() > 63)
+ .map(label -> String.format(DOMAIN_NAME_LABEL_NOT_VALID_PATTERN, label))
+ .forEach(errors::add);
}
var withoutTrailingPeriod = StringUtils.stripEnd(domainName, ".");
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsRecord.java
similarity index 55%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsRecord.java
index c6167246..845e8fc7 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
@@ -13,32 +13,34 @@
import java.util.Arrays;
import java.util.Collection;
-import static com.yanchware.fractal.sdk.domain.blueprint.iaas.DnsARecord.A_DNS_RECORD_TYPE;
+import static com.yanchware.fractal.sdk.domain.fractal.iaas.DnsARecord.A_DNS_RECORD_TYPE;
import static com.yanchware.fractal.sdk.utils.RegexValidationUtils.isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired;
@Getter
@Setter(AccessLevel.PROTECTED)
@JsonTypeInfo(
- use = JsonTypeInfo.Id.NAME,
- property = "@type"
+ use = JsonTypeInfo.Id.NAME,
+ property = "@type"
)
@JsonSubTypes({
- @JsonSubTypes.Type(value = DnsAaaaRecord.class, name = DnsAaaaRecord.AAAA_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsARecord.class, name = A_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsCaaRecord.class, name = DnsCaaRecord.CAA_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsCNameRecord.class, name = DnsCNameRecord.CNAME_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsMxRecord.class, name = DnsMxRecord.MX_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsNsRecord.class, name = DnsNsRecord.NS_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsPtrRecord.class, name = DnsPtrRecord.PTR_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsSrvRecord.class, name = DnsSrvRecord.SRV_DNS_RECORD_TYPE),
- @JsonSubTypes.Type(value = DnsTxtRecord.class, name = DnsTxtRecord.TXT_DNS_RECORD_TYPE)
+ @JsonSubTypes.Type(value = DnsAaaaRecord.class, name = DnsAaaaRecord.AAAA_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsARecord.class, name = A_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsCaaRecord.class, name = DnsCaaRecord.CAA_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsCNameRecord.class, name = DnsCNameRecord.CNAME_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsMxRecord.class, name = DnsMxRecord.MX_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsNsRecord.class, name = DnsNsRecord.NS_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsPtrRecord.class, name = DnsPtrRecord.PTR_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsSrvRecord.class, name = DnsSrvRecord.SRV_DNS_RECORD_TYPE),
+ @JsonSubTypes.Type(value = DnsTxtRecord.class, name = DnsTxtRecord.TXT_DNS_RECORD_TYPE)
})
public abstract class DnsRecord implements Validatable {
private final static String NAME_NOT_VALID = "The Name must contain between 1 and 63 characters. " +
- "It must only contain letters, numbers, underscores, and/or dashes. " +
- "Each label should be separated from other labels by a period. " +
- "A wildcard ('*' character) is permitted either as the single character in the name, or as the first label in the name. " +
- "An empty value, or a single '@' character is permitted for record sets at the zone apex (except for CNAME record sets)";
+ "It must only contain letters, numbers, underscores, and/or dashes. " +
+ "Each label should be separated from other labels by a period. " +
+ "A wildcard ('*' character) is permitted either as the single character in the name, or as the first label in the" +
+ " name. " +
+ "An empty value, or a single '@' character is permitted for record sets at the zone apex (except for CNAME record" +
+ " sets)";
private Duration ttl;
@@ -54,6 +56,7 @@ record = createRecord();
}
protected abstract T createRecord();
+
protected abstract B getBuilder();
public B withName(String name) {
@@ -71,9 +74,9 @@ public T build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "DnsRecord '%s' validation failed. Errors: %s",
- this.getClass().getSimpleName(),
- Arrays.toString(errors.toArray())));
+ "DnsRecord '%s' validation failed. Errors: %s",
+ this.getClass().getSimpleName(),
+ Arrays.toString(errors.toArray())));
}
return record;
@@ -89,7 +92,7 @@ public Collection validate() {
}
if (StringUtils.isNotBlank(name)) {
- if(!name.equals("@")) {
+ if (!name.equals("@")) {
var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired(name);
if (!hasValidCharacters || name.length() > 63) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecord.java
similarity index 76%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecord.java
index 91ed5701..8e0aa16a 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -18,14 +18,18 @@
public class DnsSrvRecord extends DnsRecord {
public static final String SRV_DNS_RECORD_TYPE = "SRV";
- private final static String DOMAIN_NAME_NOT_VALID_PATTERN = "The domainName value ['%s'], concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
- private final static String DOMAIN_NAME_LABEL_NOT_VALID_PATTERN = "The domainName ['%s'] label must contain between 1 and 63 characters";
+ private final static String DOMAIN_NAME_NOT_VALID_PATTERN = "The domainName value ['%s'], concatenated with its " +
+ "zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 " +
+ "labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be " +
+ "separated from other labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String DOMAIN_NAME_LABEL_NOT_VALID_PATTERN = "The domainName ['%s'] label must contain between" +
+ " 1 and 63 characters";
private final static String SERVICE_NOT_DEFINED = "Service has not been defined and it is required";
- private final static String PROTOCOL_NAME_NOT_DEFINED= "ProtocolName has not been defined and it is required";
-
+ private final static String PROTOCOL_NAME_NOT_DEFINED = "ProtocolName has not been defined and it is required";
+
private String service;
private String protocolName;
-
+
private List recordData;
public static DnsSrvRecordBuilder builder() {
@@ -72,7 +76,7 @@ public DnsSrvRecordBuilder withRecordData(Collection extends DnsSrvRecordData>
@Override
public DnsSrvRecord build() {
- if(StringUtils.isBlank(record.getName())) {
+ if (StringUtils.isBlank(record.getName())) {
record.setName(String.format("%s.%s", record.getService(), record.getProtocolName()));
} else {
record.setName(String.format("%s.%s.%s", record.getService(), record.getProtocolName(), record.getName()));
@@ -85,15 +89,14 @@ public DnsSrvRecord build() {
public Collection validate() {
var errors = super.validate();
- if(StringUtils.isBlank(service)) {
+ if (StringUtils.isBlank(service)) {
errors.add(SERVICE_NOT_DEFINED);
}
- if(StringUtils.isBlank(protocolName)) {
+ if (StringUtils.isBlank(protocolName)) {
errors.add(PROTOCOL_NAME_NOT_DEFINED);
}
-
-
+
if (!isBlank(recordData)) {
for (var data : recordData) {
@@ -101,7 +104,6 @@ public Collection validate() {
}
}
-
return errors;
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecordData.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecordData.java
similarity index 75%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecordData.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecordData.java
index c94a6f5d..70296463 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsSrvRecordData.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsSrvRecordData.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.yanchware.fractal.sdk.domain.Validatable;
import lombok.AccessLevel;
@@ -21,11 +21,14 @@ public class DnsSrvRecordData implements Validatable {
private final static String PRIORITY_NOT_VALID = "The priority value must be less than or equal to 65535";
private final static String WEIGHT_NOT_VALID = "The weight value must be less than or equal to 65535";
private final static String PORT_NOT_VALID = "The port value must be less than or equal to 65535";
- private final static String TARGET_NOT_VALID = "The target value, concatenated with its zone name, must contain no more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period. Each label must contain between 1 and 63 characters.";
+ private final static String TARGET_NOT_VALID = "The target value, concatenated with its zone name, must contain no " +
+ "more than 253 characters, excluding a trailing period. It must be between 2 and 34 labels. Each label must only " +
+ "contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a " +
+ "period. Each label must contain between 1 and 63 characters.";
private final static String TARGET_LABEL_NOT_VALID = "The target label must contain between 1 and 63 characters";
- private final static String TARGET_NOT_DEFINED= "Target has not been defined and it is required";
-
- private int priority;
+ private final static String TARGET_NOT_DEFINED = "Target has not been defined and it is required";
+
+ private int priority;
private int weight;
private int port;
private String target;
@@ -43,21 +46,22 @@ public DnsSrvRecordDataBuilder() {
builder = this;
}
-
-
+
public DnsSrvRecordDataBuilder withPriority(int priority) {
recordData.setPriority(priority);
return builder;
}
-
+
public DnsSrvRecordDataBuilder withWeight(int weight) {
recordData.setWeight(weight);
return builder;
}
+
public DnsSrvRecordDataBuilder withPort(int port) {
recordData.setPort(port);
return builder;
}
+
public DnsSrvRecordDataBuilder withTarget(String target) {
recordData.setTarget(target);
return builder;
@@ -68,8 +72,8 @@ public DnsSrvRecordData build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format(
- "CaaRecordData validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ "CaaRecordData validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
}
return recordData;
@@ -81,28 +85,28 @@ public Collection validate() {
var errors = new ArrayList();
- if(priority < 0 || priority > 65535) {
+ if (priority < 0 || priority > 65535) {
errors.add(PRIORITY_NOT_VALID);
}
- if(weight < 0 || weight > 65535) {
+ if (weight < 0 || weight > 65535) {
errors.add(WEIGHT_NOT_VALID);
}
- if(port < 0 || port > 65535) {
+ if (port < 0 || port > 65535) {
errors.add(PORT_NOT_VALID);
}
- if(StringUtils.isBlank(target)) {
+ if (StringUtils.isBlank(target)) {
errors.add(TARGET_NOT_DEFINED);
} else {
var hasValidCharacters = isValidLettersNumbersUnderscoresDashesAndPeriodsAndPeriodIsNotRequired(target);
if (target.contains(".")) {
Arrays.stream(target.split("\\."))
- .filter(label -> label.length() > 63)
- .map(label -> TARGET_LABEL_NOT_VALID)
- .forEach(errors::add);
+ .filter(label -> label.length() > 63)
+ .map(label -> TARGET_LABEL_NOT_VALID)
+ .forEach(errors::add);
}
var withoutTrailingPeriod = StringUtils.stripEnd(target, ".");
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsTxtRecord.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsTxtRecord.java
similarity index 90%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsTxtRecord.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsTxtRecord.java
index 2686b08d..78a40617 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsTxtRecord.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsTxtRecord.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import lombok.AccessLevel;
import lombok.Getter;
@@ -18,7 +18,8 @@
public class DnsTxtRecord extends DnsRecord {
public static final String TXT_DNS_RECORD_TYPE = "TXT";
- private final static String VALUES_NOT_VALID = "The combined length of all TXT records in a record set may not exceed 1024 characters";
+ private final static String VALUES_NOT_VALID = "The combined length of all TXT records in a record set may not " +
+ "exceed 1024 characters";
private List values;
@@ -66,8 +67,8 @@ public Collection validate() {
if (!isBlank(values)) {
var combinedTxt = String.join("", values);
-
- if(combinedTxt.length() > 1024) {
+
+ if (combinedTxt.length() > 1024) {
errors.add(VALUES_NOT_VALID);
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsZone.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsZone.java
similarity index 90%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsZone.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsZone.java
index adfd454f..03d1190b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/iaas/DnsZone.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/iaas/DnsZone.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.iaas;
+package com.yanchware.fractal.sdk.domain.fractal.iaas;
import com.yanchware.fractal.sdk.domain.Validatable;
import lombok.AccessLevel;
@@ -15,7 +15,9 @@
public class DnsZone implements Validatable {
public final static String DNS_ZONES_PARAM_KEY = "dnsZones";
- private final static String NAME_NOT_VALID = "[DnsZone Validation] The name must contain no more than 253 characters, excluding a trailing period and must be between 2 and 34 labels. Each label must only contain letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period";
+ private final static String NAME_NOT_VALID = "[DnsZone Validation] The name must contain no more than 253 " +
+ "characters, excluding a trailing period and must be between 2 and 34 labels. Each label must only contain " +
+ "letters, numbers, underscores, and/or dashes. Each label should be separated from other labels by a period";
private String name;
private boolean isPrivate;
@@ -53,7 +55,7 @@ public DnsZoneBuilder withRecord(String componentId, DnsRecord dnsRecord) {
if (!dnsZone.getRecords().containsKey(componentId)) {
dnsZone.getRecords().put(componentId, new ArrayList<>());
}
-
+
dnsZone.getRecords().get(componentId).add(dnsRecord);
return builder;
@@ -102,7 +104,7 @@ public DnsZone build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("DnsZone validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
return dnsZone;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSColumnOrientedDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSColumnOrientedDbms.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSColumnOrientedDbms.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSColumnOrientedDbms.java
index 266e6e9f..1cd2a5ba 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSColumnOrientedDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSColumnOrientedDbms.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_COLUMN_ORIENTED_DBMS;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSContainerPlatform.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSContainerPlatform.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSContainerPlatform.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSContainerPlatform.java
index c8e35452..e3527a1d 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSContainerPlatform.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSContainerPlatform.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_CONTAINER_PLATFORM;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDataStorage.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDataStorage.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDataStorage.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDataStorage.java
index d232e92a..d47d8c7e 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDataStorage.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDataStorage.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_DATA_STORAGE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDatabase.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDatabase.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDatabase.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDatabase.java
index 34d40aba..2e3e15fd 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDatabase.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDatabase.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_DOCUMENT_DATABASE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDbms.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDbms.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDbms.java
index 1bc1fb1f..c0ed2fbe 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSDocumentDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSDocumentDbms.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_DOCUMENT_DBMS;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSFileShare.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSFileShare.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSFileShare.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSFileShare.java
index 08b60331..35af9804 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSFileShare.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSFileShare.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_FILE_SHARE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDatabase.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDatabase.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDatabase.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDatabase.java
index 2f2593ab..e6a76adc 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDatabase.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDatabase.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_GRAPH_DATABASE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDbms.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDbms.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDbms.java
index 81281438..2f4e9c6e 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSGraphDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSGraphDbms.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_GRAPH_DBMS;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueDbms.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueDbms.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueDbms.java
index f4112c87..95a99627 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueDbms.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_KEY_VALUE_DBMS;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueEntity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueEntity.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueEntity.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueEntity.java
index c99ff220..35836442 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSKeyValueEntity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSKeyValueEntity.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_KEY_VALUE_ENTITY;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessageEntity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessageEntity.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessageEntity.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessageEntity.java
index a84e4b1a..58b907ca 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessageEntity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessageEntity.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_MESSAGE_ENTITY;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessaging.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessaging.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessaging.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessaging.java
index 95b9bccb..ede2a9e4 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSMessaging.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSMessaging.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_MESSAGE_BROKER;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSNetworkCdnProfile.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSNetworkCdnProfile.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSNetworkCdnProfile.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSNetworkCdnProfile.java
index 4a14d09b..19e14cc0 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSNetworkCdnProfile.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSNetworkCdnProfile.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_CDN_PROFILE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDatabase.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDatabase.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDatabase.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDatabase.java
index 05ecca90..f68e4ab3 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDatabase.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDatabase.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_RELATIONAL_DATABASE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDbms.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDbms.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDbms.java
index 598fa9d0..e0bd28c7 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSRelationalDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSRelationalDbms.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_RELATIONAL_DBMS;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSStorageContainer.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSStorageContainer.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSStorageContainer.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSStorageContainer.java
index fb4e5c5e..f91e8563 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSStorageContainer.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSStorageContainer.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_STORAGE_CONTAINER;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkload.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkload.java
similarity index 72%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkload.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkload.java
index 7eb5011a..56bc428b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkload.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkload.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_WORKLOAD;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkloadDeploymentSlot.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkloadDeploymentSlot.java
similarity index 74%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkloadDeploymentSlot.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkloadDeploymentSlot.java
index 497b067b..7bd10d92 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/paas/PaaSWorkloadDeploymentSlot.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/paas/PaaSWorkloadDeploymentSlot.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.paas;
+package com.yanchware.fractal.sdk.domain.fractal.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.PAAS_WORKLOAD_DEPLOYMENT_SLOT;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedBrokerComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedBrokerComponent.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedBrokerComponent.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedBrokerComponent.java
index f3f999df..3d0eaa84 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedBrokerComponent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedBrokerComponent.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.saas;
+package com.yanchware.fractal.sdk.domain.fractal.saas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.SAAS_UNMANAGED_BROKER;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedSecurityComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedSecurityComponent.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedSecurityComponent.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedSecurityComponent.java
index 71130646..b083bf28 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedSecurityComponent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedSecurityComponent.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.saas;
+package com.yanchware.fractal.sdk.domain.fractal.saas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.SAAS_UNMANAGED_SECURITY;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedStorageComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedStorageComponent.java
similarity index 73%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedStorageComponent.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedStorageComponent.java
index e072b6f3..2bd7601c 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/saas/UnmanagedStorageComponent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/saas/UnmanagedStorageComponent.java
@@ -1,7 +1,7 @@
-package com.yanchware.fractal.sdk.domain.blueprint.saas;
+package com.yanchware.fractal.sdk.domain.fractal.saas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.BlueprintComponent;
+import com.yanchware.fractal.sdk.domain.fractal.BlueprintComponent;
import lombok.ToString;
import static com.yanchware.fractal.sdk.domain.values.ComponentType.SAAS_UNMANAGED_STORAGE;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/BlueprintService.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/BlueprintService.java
similarity index 74%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/BlueprintService.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/BlueprintService.java
index 1b98e3e9..a763f764 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/BlueprintService.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/BlueprintService.java
@@ -1,14 +1,14 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service;
+package com.yanchware.fractal.sdk.domain.fractal.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
import com.yanchware.fractal.sdk.domain.Service;
-import com.yanchware.fractal.sdk.domain.blueprint.FractalIdValue;
-import com.yanchware.fractal.sdk.domain.blueprint.service.commands.CreateBlueprintCommandRequest;
-import com.yanchware.fractal.sdk.domain.blueprint.service.commands.UpdateBlueprintCommandRequest;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintComponentDto;
-import com.yanchware.fractal.sdk.domain.blueprint.service.dtos.BlueprintDto;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
+import com.yanchware.fractal.sdk.domain.fractal.FractalIdValue;
+import com.yanchware.fractal.sdk.domain.fractal.service.commands.CreateBlueprintCommandRequest;
+import com.yanchware.fractal.sdk.domain.fractal.service.commands.UpdateBlueprintCommandRequest;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintComponentDto;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintDto;
import com.yanchware.fractal.sdk.utils.HttpUtils;
import io.github.resilience4j.retry.RetryRegistry;
import lombok.extern.slf4j.Slf4j;
@@ -28,10 +28,10 @@ public BlueprintService(HttpClient client, SdkConfiguration sdkConfiguration, Re
}
public void createOrUpdate(
- FractalIdValue fractalId,
- String description,
- boolean isPrivate,
- Collection components) throws InstantiatorException
+ FractalIdValue fractalId,
+ String description,
+ boolean isPrivate,
+ Collection components) throws InstantiatorException
{
var command = new CreateBlueprintCommandRequest(description, isPrivate, components);
log.info("Create or update blueprint [FractalId: '{}']", fractalId);
@@ -69,13 +69,13 @@ protected void update(UpdateBlueprintCommandRequest command, FractalIdValue frac
protected BlueprintDto retrieve(FractalIdValue fractalId) throws InstantiatorException {
return executeRequestWithRetries(
- "retrieveBlueprint",
- fractalId.toString(),
- client,
- retryRegistry,
- HttpUtils.buildGetRequest(getBlueprintsUri(fractalId), sdkConfiguration),
- new int[]{200, 404},
- BlueprintDto.class);
+ "retrieveBlueprint",
+ fractalId.toString(),
+ client,
+ retryRegistry,
+ HttpUtils.buildGetRequest(getBlueprintsUri(fractalId), sdkConfiguration),
+ new int[]{200, 404},
+ BlueprintDto.class);
}
private URI getBlueprintsUri(FractalIdValue fractalId) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/CreateBlueprintCommandRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/CreateBlueprintCommandRequest.java
new file mode 100644
index 00000000..251fbecb
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/CreateBlueprintCommandRequest.java
@@ -0,0 +1,14 @@
+package com.yanchware.fractal.sdk.domain.fractal.service.commands;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintComponentDto;
+
+import java.util.Collection;
+
+public record CreateBlueprintCommandRequest(
+ String description,
+ @JsonProperty("private")
+ boolean isPrivate,
+ Collection components)
+{
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/UpdateBlueprintCommandRequest.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/UpdateBlueprintCommandRequest.java
new file mode 100644
index 00000000..84ca03fb
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/commands/UpdateBlueprintCommandRequest.java
@@ -0,0 +1,34 @@
+package com.yanchware.fractal.sdk.domain.fractal.service.commands;
+
+import com.yanchware.fractal.sdk.domain.fractal.FractalIdValue;
+import com.yanchware.fractal.sdk.domain.fractal.service.dtos.BlueprintComponentDto;
+import lombok.Builder;
+import lombok.Data;
+
+import java.util.Collection;
+
+@Data
+@Builder
+public class UpdateBlueprintCommandRequest {
+ private String resourceGroupId;
+ private String fractalName;
+ private String fractalVersion;
+ private String description;
+ private boolean isPrivate;
+ Collection components;
+
+ public static UpdateBlueprintCommandRequest fromCreateCommand(
+ CreateBlueprintCommandRequest command,
+ FractalIdValue fractalId)
+ {
+ String[] splitId = fractalId.toString().split("[/:]");
+ return UpdateBlueprintCommandRequest.builder()
+ .resourceGroupId(String.format("%s/%s/%s", splitId[0], splitId[1], splitId[2]))
+ .fractalName(splitId[3])
+ .fractalVersion(splitId[4])
+ .description(command.description())
+ .isPrivate(command.isPrivate())
+ .components(command.components())
+ .build();
+ }
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintComponentDto.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintComponentDto.java
new file mode 100644
index 00000000..4764667f
--- /dev/null
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintComponentDto.java
@@ -0,0 +1,72 @@
+package com.yanchware.fractal.sdk.domain.fractal.service.dtos;
+
+import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
+import com.yanchware.fractal.sdk.domain.services.contracts.ComponentDto;
+import com.yanchware.fractal.sdk.utils.ReflectionUtils;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.*;
+
+import static com.yanchware.fractal.sdk.configuration.Constants.BLUEPRINT_TYPE;
+import static java.util.Collections.emptySet;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@NoArgsConstructor
+@Slf4j
+public class BlueprintComponentDto extends ComponentDto {
+ private Set outputFields;
+
+ public static BlueprintComponentDtoBuilder builder() {
+ return new BlueprintComponentDtoBuilder();
+ }
+
+ public static class BlueprintComponentDtoBuilder extends Builder {
+
+ @Override
+ protected BlueprintComponentDto createComponent() {
+ return new BlueprintComponentDto();
+ }
+
+ @Override
+ protected BlueprintComponentDtoBuilder getBuilder() {
+ return this;
+ }
+
+ public BlueprintComponentDtoBuilder withOutputFields(Collection extends String> outputFields) {
+ if (componentDto.getOutputFields() == null) {
+ componentDto.setOutputFields(new HashSet<>());
+ }
+
+ componentDto.getOutputFields().addAll(outputFields);
+
+ return builder;
+ }
+ }
+
+ public static List fromLiveSystemComponents(Collection components) {
+ List blueprintComponentDtoList = new ArrayList<>();
+ for (LiveSystemComponent component : components) {
+ List> listOfComponents = ReflectionUtils.buildComponents(component);
+ for (var componentMap : listOfComponents) {
+ BlueprintComponentDto componentDto = BlueprintComponentDto.toBlueprintComponentDto(componentMap);
+ blueprintComponentDtoList.add(componentDto);
+ }
+ }
+ return blueprintComponentDtoList;
+ }
+
+ private static BlueprintComponentDto toBlueprintComponentDto(Map allFields) {
+ return BlueprintComponentDto.builder()
+ .withFields(allFields)
+ .withType(String.valueOf(allFields.get(BLUEPRINT_TYPE)))
+ .withOutputFields(emptySet())
+ .build();
+ }
+}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintDto.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintDto.java
similarity index 85%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintDto.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintDto.java
index c01aec22..a3fca230 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintDto.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintDto.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service.dtos;
+package com.yanchware.fractal.sdk.domain.fractal.service.dtos;
import lombok.Data;
import lombok.NoArgsConstructor;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintStatusDto.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintStatusDto.java
similarity index 62%
rename from fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintStatusDto.java
rename to fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintStatusDto.java
index 558dfe12..9fc3bf19 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/blueprint/service/dtos/BlueprintStatusDto.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/fractal/service/dtos/BlueprintStatusDto.java
@@ -1,4 +1,4 @@
-package com.yanchware.fractal.sdk.domain.blueprint.service.dtos;
+package com.yanchware.fractal.sdk.domain.fractal.service.dtos;
public enum BlueprintStatusDto {
UNKNOWN,
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkload.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkload.java
index 4d911246..8dfde540 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkload.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkload.java
@@ -10,44 +10,58 @@
public interface CustomWorkload {
String getPrivateSSHKeyPassphraseEnvironmentSecretShortName();
+
void setPrivateSSHKeyPassphraseEnvironmentSecretShortName(String privateSSHKeyPassphraseEnvironmentSecretShortName);
String getPrivateSSHKeyEnvironmentSecretShortName();
+
void setPrivateSSHKeyEnvironmentSecretShortName(String privateSSHKeyEnvironmentSecretShortName);
String getSshRepositoryURI();
+
void setSshRepositoryURI(String SshRepositoryURI);
String getRepoId();
+
void setRepoId(String repoId);
String getBranchName();
+
void setBranchName(String branchName);
String getWorkloadSecretIdKey();
+
void setWorkloadSecretIdKey(String workloadSecretIdKey);
String getWorkloadSecretPasswordKey();
+
void setWorkloadSecretPasswordKey(String WorkloadSecretPasswordKey);
List getRoles();
+
void setRoles(List roles);
Map> getDnsZoneConfig();
+
void setDnsZoneConfig(Map> getDnsZoneConfig);
List getEnvironmentSecretShortNames();
+
void setEnvironmentSecretShortNames(List secrets);
String getCiCdProfileShortName();
+
void setCiCdProfileShortName(String ciCdProfileShortName);
- static Collection validateCustomWorkload(CustomWorkload customWorkload, String workloadType){
- final var SSH_REPO_URI_IS_EMPTY_TEMPLATE = "[%s Validation] sshRepositoryURI is either empty or blank and it is required";
+ static Collection validateCustomWorkload(CustomWorkload customWorkload, String workloadType) {
+ final var SSH_REPO_URI_IS_EMPTY_TEMPLATE = "[%s Validation] sshRepositoryURI is either empty or blank and it is " +
+ "required";
final var REPO_ID_IS_EMPTY_TEMPLATE = "[%s Validation] repoId is either empty or blank and it is required";
final var BRANCH_NAME_IS_EMPTY_TEMPLATE = "[%s Validation] branchName is either empty or blank and it is required";
- final var WORKLOAD_SECRET_ID_KEY_IS_EMPTY_TEMPLATE = "[%s Validation] Workload Secret Id Key is either empty or blank and it is required";
- final var WORKLOAD_SECRET_PASSWORD_KEY_IS_EMPTY_TEMPLATE = "[%s Validation] Workload Secret Password Key is either empty or blank and it is required";
+ final var WORKLOAD_SECRET_ID_KEY_IS_EMPTY_TEMPLATE = "[%s Validation] Workload Secret Id Key is either empty or " +
+ "blank and it is required";
+ final var WORKLOAD_SECRET_PASSWORD_KEY_IS_EMPTY_TEMPLATE = "[%s Validation] Workload Secret Password Key is " +
+ "either empty or blank and it is required";
var errors = new ArrayList();
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkloadBuilder.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkloadBuilder.java
index 4bdd1957..db03a051 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkloadBuilder.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/CustomWorkloadBuilder.java
@@ -18,11 +18,12 @@
* our documentation page
*
*/
-public abstract class CustomWorkloadBuilder> extends Component.Builder {
+public abstract class CustomWorkloadBuilder> extends Component.Builder {
/**
*
- * Sets the short name of the environment secret containing the passphrase protecting the SSH private key
+ * Sets the short name of the environment secret containing the passphrase protecting the SSH private key
* used to access the code repository.
*
* This secret should be defined at the Environment level.
@@ -64,7 +65,7 @@ public B withSSHRepositoryURI(String sshRepositoryURI) {
/**
*
- * The ID of the repository as it is in the version control solution of your choice.
+ * The ID of the repository as it is in the version control solution of your choice.
* The repoId needs to match the repository ID that is being sent by the webhook.
*
*
@@ -78,7 +79,7 @@ public B withRepoId(String repoId) {
/**
*
- * Adds a role to the Custom Workload.
+ * Adds a role to the Custom Workload.
* The role can vary from a specific Cloud Vendor Built-in role to an AppRoleAssignment or other custom role.
*
*
@@ -93,7 +94,7 @@ public B withRole(CustomWorkloadRole role) {
/**
*
- * Adds a list of roles to the Custom Workload.
+ * Adds a list of roles to the Custom Workload.
* The roles can vary from specific Cloud Vendor Built-in roles to AppRoleAssignments or other custom roles.
*
*
@@ -156,7 +157,7 @@ public B withBranchName(String branchName) {
/**
*
- * Adds a single secret short name to the component.
+ * Adds a single secret short name to the component.
* This secret should be defined in the environment associated with this component.
*
* @param environmentSecretShortNames The short name of the secret to add.
@@ -168,7 +169,7 @@ public B withEnvironmentSecretShortName(String environmentSecretShortNames) {
/**
*
- * Adds a list of secret names to the component.
+ * Adds a list of secret names to the component.
* These secrets should be defined in the environment associated with this component.
*
* @param environmentSecretShortNames The list of secret names to add.
@@ -183,7 +184,7 @@ public B withEnvironmentSecretShortNames(List environmentSecretShortName
}
/**
- * Adds a CI/CD profile short name to the component.
+ * Adds a CI/CD profile short name to the component.
* This is to specify which CI/CD profile should be used by the component.
* The profile should be defined at the Environment level.
* This method only adds a reference to the profile by its short name.
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/EnvironmentReference.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/EnvironmentReference.java
index 68573102..fefda228 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/EnvironmentReference.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/EnvironmentReference.java
@@ -2,4 +2,5 @@
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
-public record EnvironmentReference(EnvironmentIdValue id) {}
\ No newline at end of file
+public record EnvironmentReference(EnvironmentIdValue id) {
+}
\ No newline at end of file
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemAggregate.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemAggregate.java
index 07ef6f4c..79d4f8f9 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemAggregate.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemAggregate.java
@@ -2,13 +2,13 @@
import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
import com.yanchware.fractal.sdk.domain.Validatable;
-import com.yanchware.fractal.sdk.domain.blueprint.FractalIdValue;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
import com.yanchware.fractal.sdk.domain.environment.service.EnvironmentService;
import com.yanchware.fractal.sdk.domain.environment.service.RestEnvironmentService;
import com.yanchware.fractal.sdk.domain.exceptions.EnvironmentException;
import com.yanchware.fractal.sdk.domain.exceptions.EnvironmentNotFoundException;
import com.yanchware.fractal.sdk.domain.exceptions.InstantiatorException;
+import com.yanchware.fractal.sdk.domain.fractal.FractalIdValue;
import com.yanchware.fractal.sdk.domain.livesystem.operationalservicewindow.OperationalServiceWindow;
import com.yanchware.fractal.sdk.domain.livesystem.service.LiveSystemService;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.*;
@@ -29,155 +29,163 @@
@Slf4j
@Setter(AccessLevel.PROTECTED)
public class LiveSystemAggregate implements Validatable {
- private final static String ID_IS_NULL = "[LiveSystem Validation] Id has not been defined and it is required";
- private final static String NAME_IS_NULL = "[LiveSystem Validation] Name has not been defined and it is required";
- private final static String RESOURCE_GROUP_ID_IS_NULL = "[LiveSystem Validation] ResourceGroupId has not been defined and it is required'";
- private final static String PROVIDER_ID_IS_NULL = "[LiveSystem Validation] Provider has not been defined and it is required'";
- private final static String EMPTY_COMPONENT_LIST = "[LiveSystem Validation] Components list is null or empty and at least one component is required";
- private final LiveSystemService service;
- private final EnvironmentService environmentService;
-
- @Getter
- private LiveSystemIdValue id;
- @Getter
- private FractalIdValue fractalId;
- @Getter
- private String description;
- @Getter
- private EnvironmentReference environment;
- @Getter
- private Date created;
- @Getter
- private Date lastUpdated;
- @Getter
- private Collection components;
- @Getter
- private ProviderType provider;
- @Getter
- private OperationalServiceWindow operationalServiceWindow;
-
- protected LiveSystemAggregate(
- HttpClient client,
- SdkConfiguration sdkConfiguration,
- RetryRegistry retryRegistry)
- {
- service = new LiveSystemService(client, sdkConfiguration, retryRegistry);
- environmentService = new RestEnvironmentService(client, sdkConfiguration, retryRegistry);
- components = new ArrayList<>();
+ private final static String ID_IS_NULL = "[LiveSystem Validation] Id has not been defined and it is required";
+ private final static String NAME_IS_NULL = "[LiveSystem Validation] Name has not been defined and it is required";
+ private final static String RESOURCE_GROUP_ID_IS_NULL = "[LiveSystem Validation] ResourceGroupId has not been " +
+ "defined and it is required'";
+ private final static String PROVIDER_ID_IS_NULL = "[LiveSystem Validation] Provider has not been defined and it is " +
+ "required'";
+ private final static String EMPTY_COMPONENT_LIST = "[LiveSystem Validation] Components list is null or empty and at" +
+ " least one component is required";
+ private final LiveSystemService service;
+ private final EnvironmentService environmentService;
+
+ @Getter
+ private LiveSystemIdValue id;
+ @Getter
+ private FractalIdValue fractalId;
+ @Getter
+ private String description;
+ @Getter
+ private EnvironmentReference environment;
+ @Getter
+ private Date created;
+ @Getter
+ private Date lastUpdated;
+ @Getter
+ private Collection components;
+ @Getter
+ private ProviderType provider;
+ @Getter
+ private OperationalServiceWindow operationalServiceWindow;
+
+ protected LiveSystemAggregate(
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
+ {
+ service = new LiveSystemService(client, sdkConfiguration, retryRegistry);
+ environmentService = new RestEnvironmentService(client, sdkConfiguration, retryRegistry);
+ components = new ArrayList<>();
+ }
+
+ // TODO FRA-1870: Use entity instead of LiveSystemComponentMutationDto
+ public LiveSystemComponentMutationDto instantiateComponent(String componentId) throws InstantiatorException {
+ var action = String.format("instantiate component [id: '%s']", componentId);
+
+ ensureEnvironmentExists(environment.id(), action);
+
+ return service.instantiateComponent(id, componentId);
+ }
+
+ public LiveSystemComponentMutationDto getComponentMutationStatus(String componentId, String mutationId)
+ throws InstantiatorException
+ {
+ return service.getComponentMutationStatus(getId().toString(), componentId, mutationId);
+ }
+
+ // TODO FRA-1870: Use entity instead of LiveSystemMutationDto
+ public LiveSystemMutationDto instantiate() throws InstantiatorException {
+
+ if (components == null || components.isEmpty()) {
+ throw new InstantiatorException(EMPTY_COMPONENT_LIST);
}
- // TODO FRA-1870: Use entity instead of LiveSystemComponentMutationDto
- public LiveSystemComponentMutationDto instantiateComponent(String componentId) throws InstantiatorException {
- var action = String.format("instantiate component [id: '%s']", componentId);
-
- ensureEnvironmentExists(environment.id(), action);
-
- return service.instantiateComponent(id, componentId);
- }
-
- public LiveSystemComponentMutationDto getComponentMutationStatus(String componentId, String mutationId)
- throws InstantiatorException
- {
- return service.getComponentMutationStatus(getId().toString(), componentId, mutationId);
+ ensureEnvironmentExists(environment.id(),
+ String.format("instantiate LiveSystem [id: '%s']", id));
+
+ if (service.retrieveLiveSystem(getId()) != null) {
+ return service.updateLiveSystem(
+ getId().toString(),
+ fractalId,
+ description,
+ provider.toString(),
+ blueprintMapFromLiveSystemComponents(),
+ environment);
}
- // TODO FRA-1870: Use entity instead of LiveSystemMutationDto
- public LiveSystemMutationDto instantiate() throws InstantiatorException {
-
- if (components == null || components.isEmpty()) {
- throw new InstantiatorException(EMPTY_COMPONENT_LIST);
- }
-
- ensureEnvironmentExists(environment.id(),
- String.format("instantiate LiveSystem [id: '%s']", id));
-
- if (service.retrieveLiveSystem(getId()) != null) {
- return service.updateLiveSystem(
- getId().toString(),
- fractalId,
- description,
- provider.toString(),
- blueprintMapFromLiveSystemComponents(),
- environment);
- }
-
- return service.instantiateLiveSystem(
- getId().toString(),
- fractalId,
- description,
- provider.toString(),
- blueprintMapFromLiveSystemComponents(),
- environment);
+ return service.instantiateLiveSystem(
+ getId().toString(),
+ fractalId,
+ description,
+ provider.toString(),
+ blueprintMapFromLiveSystemComponents(),
+ environment);
+ }
+
+ public void checkLiveSystemMutationStatus(String liveSystemMutationId) throws InstantiatorException {
+ service.checkLiveSystemMutationStatus(getId(), liveSystemMutationId);
+ }
+
+ protected Map blueprintMapFromLiveSystemComponents() {
+ Map map = new HashMap<>();
+ for (LiveSystemComponent comp : getComponents()) {
+ List> listOfComponents = ReflectionUtils.buildComponents(comp);
+ for (var component : listOfComponents) {
+ LiveSystemComponentDto componentDto = toLiveSystemComponentDto(comp, component);
+ map.put(componentDto.getId(), componentDto);
+ }
}
-
- public void checkLiveSystemMutationStatus(String liveSystemMutationId) throws InstantiatorException {
- service.checkLiveSystemMutationStatus(getId(), liveSystemMutationId);
- }
-
- protected Map blueprintMapFromLiveSystemComponents() {
- Map map = new HashMap<>();
- for (LiveSystemComponent comp : getComponents()) {
- List> listOfComponents = ReflectionUtils.buildComponents(comp);
- for (var component : listOfComponents) {
- LiveSystemComponentDto componentDto = toLiveSystemComponentDto(comp, component);
- map.put(componentDto.getId(), componentDto);
- }
- }
- return map;
+ return map;
+ }
+
+ private static LiveSystemComponentDto toLiveSystemComponentDto(
+ LiveSystemComponent component,
+ Map allFields)
+ {
+ return LiveSystemComponentDto.builder()
+ .withFields(allFields)
+ .withType(String.valueOf(allFields.get(COMPONENT_TYPE)))
+ .withStatus(LiveSystemComponentStatusDto.Instantiating)
+ .withOutputFields(emptyMap())
+ .withLastUpdated(new Date())
+ .withProvider(component.getProvider())
+ .build();
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = new ArrayList<>();
+
+ if (id == null) {
+ errors.add(ID_IS_NULL);
+ return errors;
}
- private static LiveSystemComponentDto toLiveSystemComponentDto(LiveSystemComponent component, Map allFields) {
- return LiveSystemComponentDto.builder()
- .withFields(allFields)
- .withType(String.valueOf(allFields.get(COMPONENT_TYPE)))
- .withStatus(LiveSystemComponentStatusDto.Instantiating)
- .withOutputFields(emptyMap())
- .withLastUpdated(new Date())
- .withProvider(component.getProvider())
- .build();
+ if (isBlank(id.name())) {
+ errors.add(NAME_IS_NULL);
}
-
- @Override
- public Collection validate() {
- Collection errors = new ArrayList<>();
-
- if (id == null) {
- errors.add(ID_IS_NULL);
- return errors;
- }
-
- if (isBlank(id.name())) {
- errors.add(NAME_IS_NULL);
- }
-
- if (id.resourceGroupId() == null) {
- errors.add(RESOURCE_GROUP_ID_IS_NULL);
- }
-
- if (provider == null) {
- errors.add(PROVIDER_ID_IS_NULL);
- }
-
- return errors;
+ if (id.resourceGroupId() == null) {
+ errors.add(RESOURCE_GROUP_ID_IS_NULL);
}
- public void delete() throws InstantiatorException {
- ensureEnvironmentExists(environment.id(), String.format("delete LiveSystem [id: '%s']", id));
- service.deleteLiveSystem(getId().toString());
+ if (provider == null) {
+ errors.add(PROVIDER_ID_IS_NULL);
}
- private void ensureEnvironmentExists(EnvironmentIdValue environmentId, String action) throws EnvironmentException, EnvironmentNotFoundException {
- try {
- var existingEnvironment = environmentService.tryGetById(environmentId);
- if (existingEnvironment == null) {
- throw new EnvironmentNotFoundException(
- String.format("Unable to %s. Environment [id: '%s'] not found.", action, environmentId));
- }
- } catch (EnvironmentNotFoundException e) {
- throw e;
- } catch (Exception e) {
- throw new EnvironmentException("Failed to check environment existence", e);
- }
+ return errors;
+ }
+
+ public void delete() throws InstantiatorException {
+ ensureEnvironmentExists(environment.id(), String.format("delete LiveSystem [id: '%s']", id));
+ service.deleteLiveSystem(getId().toString());
+ }
+
+ private void ensureEnvironmentExists(
+ EnvironmentIdValue environmentId,
+ String action) throws EnvironmentException, EnvironmentNotFoundException
+ {
+ try {
+ var existingEnvironment = environmentService.tryGetById(environmentId);
+ if (existingEnvironment == null) {
+ throw new EnvironmentNotFoundException(
+ String.format("Unable to %s. Environment [id: '%s'] not found.", action, environmentId));
+ }
+ } catch (EnvironmentNotFoundException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new EnvironmentException("Failed to check environment existence", e);
}
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemComponent.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemComponent.java
index c9fec4a1..c87cfece 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemComponent.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemComponent.java
@@ -3,5 +3,5 @@
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
public interface LiveSystemComponent {
- ProviderType getProvider();
+ ProviderType getProvider();
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemIdValue.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemIdValue.java
index 8dc41f3b..4174cf6d 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemIdValue.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemIdValue.java
@@ -7,7 +7,7 @@ public record LiveSystemIdValue(ResourceGroupId resourceGroupId, String name) {
@NotNull
@Override
- public String toString(){
+ public String toString() {
return String.format("%s/%s", resourceGroupId.toString(), name);
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemsFactory.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemsFactory.java
index 25a8a81a..4f973d93 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemsFactory.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/LiveSystemsFactory.java
@@ -1,8 +1,8 @@
package com.yanchware.fractal.sdk.domain.livesystem;
import com.yanchware.fractal.sdk.configuration.SdkConfiguration;
-import com.yanchware.fractal.sdk.domain.blueprint.FractalIdValue;
import com.yanchware.fractal.sdk.domain.environment.EnvironmentIdValue;
+import com.yanchware.fractal.sdk.domain.fractal.FractalIdValue;
import com.yanchware.fractal.sdk.domain.livesystem.operationalservicewindow.OperationalServiceWindow;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import com.yanchware.fractal.sdk.utils.CollectionUtils;
@@ -13,106 +13,106 @@
public class LiveSystemsFactory {
- private final HttpClient client;
- private final SdkConfiguration sdkConfiguration;
- private final RetryRegistry retryRegistry;
+ private final HttpClient client;
+ private final SdkConfiguration sdkConfiguration;
+ private final RetryRegistry retryRegistry;
+
+ public LiveSystemsFactory(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry)
+ {
+ this.client = client;
+ this.sdkConfiguration = sdkConfiguration;
+ this.retryRegistry = retryRegistry;
+ }
+
+ public LiveSystemBuilder builder() {
+ return new LiveSystemBuilder(client, sdkConfiguration, retryRegistry);
+ }
+
+ public static class LiveSystemBuilder {
+ private final LiveSystemAggregate liveSystem;
+ private final LiveSystemBuilder builder;
+
+ public LiveSystemBuilder(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
+ liveSystem = createLiveSystem(client, sdkConfiguration, retryRegistry);
+ builder = getBuilder();
+ liveSystem.setCreated(new Date());
+ }
- public LiveSystemsFactory(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry)
+ protected LiveSystemAggregate createLiveSystem(
+ HttpClient client,
+ SdkConfiguration sdkConfiguration,
+ RetryRegistry retryRegistry)
{
- this.client = client;
- this.sdkConfiguration = sdkConfiguration;
- this.retryRegistry = retryRegistry;
+ return new LiveSystemAggregate(client, sdkConfiguration, retryRegistry);
+ }
+
+ protected LiveSystemBuilder getBuilder() {
+ return this;
+ }
+
+ public LiveSystemBuilder withId(LiveSystemIdValue liveSystemId) {
+ liveSystem.setId(liveSystemId);
+ return builder;
+ }
+
+ public LiveSystemBuilder withServiceWindow(OperationalServiceWindow serviceWindow) {
+ if (serviceWindow == null) {
+ throw new IllegalArgumentException("Service Window cannot be null");
+ }
+ liveSystem.setOperationalServiceWindow(serviceWindow);
+ return builder;
+ }
+
+ public LiveSystemBuilder withFractalId(FractalIdValue fractalId) {
+ if (fractalId == null) {
+ throw new IllegalArgumentException("Fractal id cannot be null or empty");
+ }
+ liveSystem.setFractalId(fractalId);
+ return builder;
+ }
+
+ public LiveSystemBuilder withDescription(String description) {
+ liveSystem.setDescription(description);
+ return builder;
}
- public LiveSystemBuilder builder() {
- return new LiveSystemBuilder(client, sdkConfiguration, retryRegistry);
+ public LiveSystemBuilder withEnvironmentId(EnvironmentIdValue environmentId) {
+ liveSystem.setEnvironment(new EnvironmentReference(environmentId));
+ return builder;
}
- public static class LiveSystemBuilder {
- private final LiveSystemAggregate liveSystem;
- private final LiveSystemBuilder builder;
-
- public LiveSystemBuilder(HttpClient client, SdkConfiguration sdkConfiguration, RetryRegistry retryRegistry) {
- liveSystem = createLiveSystem(client, sdkConfiguration, retryRegistry);
- builder = getBuilder();
- liveSystem.setCreated(new Date());
- }
-
- protected LiveSystemAggregate createLiveSystem(
- HttpClient client,
- SdkConfiguration sdkConfiguration,
- RetryRegistry retryRegistry)
- {
- return new LiveSystemAggregate(client, sdkConfiguration, retryRegistry);
- }
-
- protected LiveSystemBuilder getBuilder() {
- return this;
- }
-
- public LiveSystemBuilder withId(LiveSystemIdValue liveSystemId) {
- liveSystem.setId(liveSystemId);
- return builder;
- }
-
- public LiveSystemBuilder withServiceWindow(OperationalServiceWindow serviceWindow) {
- if(serviceWindow == null) {
- throw new IllegalArgumentException("Service Window cannot be null");
- }
- liveSystem.setOperationalServiceWindow(serviceWindow);
+ public LiveSystemBuilder withComponents(Collection extends LiveSystemComponent> components) {
+ if (CollectionUtils.isBlank(components)) {
return builder;
}
- public LiveSystemBuilder withFractalId(FractalIdValue fractalId) {
- if(fractalId == null) {
- throw new IllegalArgumentException("Fractal id cannot be null or empty");
- }
- liveSystem.setFractalId(fractalId);
- return builder;
- }
-
- public LiveSystemBuilder withDescription(String description) {
- liveSystem.setDescription(description);
- return builder;
- }
-
- public LiveSystemBuilder withEnvironmentId(EnvironmentIdValue environmentId) {
- liveSystem.setEnvironment(new EnvironmentReference(environmentId));
- return builder;
- }
-
- public LiveSystemBuilder withComponents(Collection extends LiveSystemComponent> components) {
- if (CollectionUtils.isBlank(components)) {
- return builder;
- }
-
- if (liveSystem.getComponents() == null) {
- liveSystem.setComponents(new ArrayList<>());
- }
-
- liveSystem.getComponents().addAll(components);
- return builder;
- }
-
- public LiveSystemBuilder withComponent(LiveSystemComponent component) {
- return withComponents(List.of(component));
- }
-
- public LiveSystemBuilder withStandardProvider(ProviderType provider) {
- liveSystem.setProvider(provider);
- return this;
- }
-
- public LiveSystemAggregate build() {
- Collection errors = liveSystem.validate();
-
- if (!errors.isEmpty()) {
- throw new IllegalArgumentException(String.format(
- "LiveSystem validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
- }
-
- return liveSystem;
- }
+ if (liveSystem.getComponents() == null) {
+ liveSystem.setComponents(new ArrayList<>());
+ }
+
+ liveSystem.getComponents().addAll(components);
+ return builder;
+ }
+
+ public LiveSystemBuilder withComponent(LiveSystemComponent component) {
+ return withComponents(List.of(component));
+ }
+
+ public LiveSystemBuilder withStandardProvider(ProviderType provider) {
+ liveSystem.setProvider(provider);
+ return this;
+ }
+
+ public LiveSystemAggregate build() {
+ Collection errors = liveSystem.validate();
+
+ if (!errors.isEmpty()) {
+ throw new IllegalArgumentException(String.format(
+ "LiveSystem validation failed. Errors: %s",
+ Arrays.toString(errors.toArray())));
+ }
+
+ return liveSystem;
}
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/SourceControlType.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/SourceControlType.java
index 25bde04e..033bad03 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/SourceControlType.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/SourceControlType.java
@@ -20,7 +20,7 @@ public class SourceControlType extends ExtendableEnum {
public static final SourceControlType TFS = fromString("Tfs");
public static final SourceControlType VSO = fromString("VSO");
public static final SourceControlType VSTSRM = fromString("VSTSRM");
-
+
public SourceControlType() {
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAPIGatewayImpl.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAPIGatewayImpl.java
index ba550fb0..3b98be29 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAPIGatewayImpl.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAPIGatewayImpl.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSAPIGateway;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSAPIGateway;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import lombok.ToString;
@@ -8,8 +8,8 @@
@ToString(callSuper = true)
public abstract class CaaSAPIGatewayImpl extends CaaSAPIGateway implements LiveSystemComponent {
- @Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
- }
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAmbassador.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAmbassador.java
index 350b1353..b079be5b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAmbassador.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSAmbassador.java
@@ -24,10 +24,14 @@
@Setter(AccessLevel.PRIVATE)
@ToString(callSuper = true)
public class CaaSAmbassador extends CaaSAPIGatewayImpl {
- private final static String HOST_OWNER_EMAIL_IS_BLANK = "[CaaSAmbassador Validation] Host Owner Email has not been defined and it is required";
- private final static String ACME_PROVIDER_AUTHORITY_IS_BLANK = "[CaaSAmbassador Validation] Automated Certificate Management Environment (ACME) Provider Authority has not been defined and it is required";
- private final static String LICENSE_IS_BLANK = "[CaaSAmbassador Validation] License Key defined was either empty or blank and it is required";
- private final static String TLS_SECRET_IS_BLANK = "[CaaSAmbassador Validation] TLS Secret has not been defined and it is required";
+ private final static String HOST_OWNER_EMAIL_IS_BLANK = "[CaaSAmbassador Validation] Host Owner Email has not been " +
+ "defined and it is required";
+ private final static String ACME_PROVIDER_AUTHORITY_IS_BLANK = "[CaaSAmbassador Validation] Automated Certificate " +
+ "Management Environment (ACME) Provider Authority has not been defined and it is required";
+ private final static String LICENSE_IS_BLANK = "[CaaSAmbassador Validation] License Key defined was either empty or" +
+ " blank and it is required";
+ private final static String TLS_SECRET_IS_BLANK = "[CaaSAmbassador Validation] TLS Secret has not been defined and " +
+ "it is required";
private String host;
private String hostOwnerEmail;
@@ -76,7 +80,8 @@ public AmbassadorBuilder withContainerPlatform(String containerPlatform) {
/**
* Ambassador hostname
*
- * For more details please check Ambassador documentation
+ * For more details please check
+ * Ambassador documentation
*
* @param host
*/
@@ -88,7 +93,8 @@ public AmbassadorBuilder withHost(String host) {
/**
* Ambassador host owner email used for ACME TLS
*
- * For more details please check Ambassador documentation
+ * For more details please check
+ * Ambassador documentation
*
* @param hostOwnerEmail
*/
@@ -119,8 +125,9 @@ public AmbassadorBuilder withLicenseKey(String licenseKey) {
/**
* The name of the TLS secret that Ambassador will look for to use.
- *
- * For more details check Ambassador documentation
+ *
+ * For more details check
+ * Ambassador documentation
*
* @param tlsSecretName
*/
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticDataStore.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticDataStore.java
index bf175149..44ad261f 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticDataStore.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticDataStore.java
@@ -25,8 +25,10 @@
@Setter(AccessLevel.PRIVATE)
@ToString(callSuper = true)
public class CaaSElasticDataStore extends CaaSSearchImpl implements LiveSystemComponent {
- private final static String ELASTIC_INSTANCES_NEGATIVE_OR_ZERO = "[CaaSElasticDataStore Validation] Elastic Instances defined was either 0 or negative and it needs to be greater than 0";
- private final static String VERSION_IS_BLANK = "[CaaSElasticDataStore Validation] Elastic Version has not been defined and it is required";
+ private final static String ELASTIC_INSTANCES_NEGATIVE_OR_ZERO = "[CaaSElasticDataStore Validation] Elastic " +
+ "Instances defined was either 0 or negative and it needs to be greater than 0";
+ private final static String VERSION_IS_BLANK = "[CaaSElasticDataStore Validation] Elastic Version has not been " +
+ "defined and it is required";
private boolean isKibanaRequired;
private String elasticVersion;
@@ -105,7 +107,8 @@ public ElasticDataStoreBuilder withInstances(int elasticInstances) {
/**
* Storage that will be used for PersistentVolumeClaim
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param storage
*/
@@ -119,7 +122,8 @@ public ElasticDataStoreBuilder withStorage(String storage) {
*
* Default: 'standard'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param storageClassName
*/
@@ -132,7 +136,8 @@ public ElasticDataStoreBuilder withStorageClassName(String storageClassName) {
* Amount of memory, in gigabytes, that will be used for requests and limits
* Default: '8'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param memory
*/
@@ -145,7 +150,8 @@ public ElasticDataStoreBuilder withMemory(int memory) {
* CPU resources that will be used for requests and limits
* Default: '8'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param cpu
*/
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticLogging.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticLogging.java
index 67631de9..00f35019 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticLogging.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSElasticLogging.java
@@ -25,8 +25,10 @@
@Setter(AccessLevel.PRIVATE)
@ToString(callSuper = true)
public class CaaSElasticLogging extends CaaSLoggingImpl implements LiveSystemComponent {
- private final static String ELASTIC_INSTANCES_NEGATIVE_OR_ZERO = "[CaaSElasticLogging Validation] Elastic Instances defined was either 0 or negative and it needs to be greater than 0";
- private final static String VERSION_IS_BLANK = "[CaaSElasticLogging Validation] Elastic Version has not been defined and it is required";
+ private final static String ELASTIC_INSTANCES_NEGATIVE_OR_ZERO = "[CaaSElasticLogging Validation] Elastic Instances" +
+ " defined was either 0 or negative and it needs to be greater than 0";
+ private final static String VERSION_IS_BLANK = "[CaaSElasticLogging Validation] Elastic Version has not been " +
+ "defined and it is required";
private boolean isApmRequired;
private boolean isKibanaRequired;
@@ -77,7 +79,8 @@ public ElasticLoggingBuilder withNamespace(String namespace) {
/**
* If true, APM will be instantiated part of the elastic logging solution
*
- * For more details check APM documentation
+ * For more details check
+ * APM documentation
*
* @param isApmRequired
*/
@@ -122,7 +125,8 @@ public ElasticLoggingBuilder withInstances(int elasticInstances) {
/**
* Storage that will be used for PersistentVolumeClaim
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param storage
*/
@@ -136,7 +140,8 @@ public ElasticLoggingBuilder withStorage(String storage) {
*
* Default: 'standard'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param storageClassName
*/
@@ -149,7 +154,8 @@ public ElasticLoggingBuilder withStorageClassName(String storageClassName) {
* Amount of memory, in gigabytes, that will be used for requests and limits
* Default: '8'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param memory
*/
@@ -162,7 +168,8 @@ public ElasticLoggingBuilder withMemory(int memory) {
* CPU resources that will be used for requests and limits
* Default: '8'
*
- * For more details check Elastic documentation
+ * For more details check
+ * Elastic documentation
*
* @param cpu
*/
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSKubernetesWorkload.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSKubernetesWorkload.java
index b075fd11..4937e8a1 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSKubernetesWorkload.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSKubernetesWorkload.java
@@ -1,7 +1,7 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSWorkload;
-import com.yanchware.fractal.sdk.domain.blueprint.iaas.DnsRecord;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSWorkload;
+import com.yanchware.fractal.sdk.domain.fractal.iaas.DnsRecord;
import com.yanchware.fractal.sdk.domain.livesystem.CustomWorkload;
import com.yanchware.fractal.sdk.domain.livesystem.CustomWorkloadBuilder;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
@@ -19,164 +19,165 @@
@Setter
@ToString(callSuper = true)
public class CaaSKubernetesWorkload extends CaaSWorkload implements LiveSystemComponent, CustomWorkload {
- private String privateSSHKeyPassphraseEnvironmentSecretShortName;
- private String privateSSHKeyEnvironmentSecretShortName;
- private String sshRepositoryURI;
- private String repoId;
- private String branchName;
- private List roles;
- private String workloadSecretIdKey;
- private String workloadSecretPasswordKey;
- private String serviceAccountName;
- private Boolean workloadIdentityEnabled;
- private List environmentSecretShortNames;
- private String ciCdProfileShortName;
+ private String privateSSHKeyPassphraseEnvironmentSecretShortName;
+ private String privateSSHKeyEnvironmentSecretShortName;
+ private String sshRepositoryURI;
+ private String repoId;
+ private String branchName;
+ private List roles;
+ private String workloadSecretIdKey;
+ private String workloadSecretPasswordKey;
+ private String serviceAccountName;
+ private Boolean workloadIdentityEnabled;
+ private List environmentSecretShortNames;
+ private String ciCdProfileShortName;
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
+
+ protected CaaSKubernetesWorkload() {
+
+ roles = new ArrayList<>();
+ this.setRecreateOnFailure(true);
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
+ errors.addAll(CustomWorkload.validateCustomWorkload(this, "Kubernetes Workload"));
+ return errors;
+ }
+
+ public static KubernetesWorkloadBuilder builder() {
+ return new KubernetesWorkloadBuilder();
+ }
+
+
+ public static class KubernetesWorkloadBuilder extends CustomWorkloadBuilder {
@Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
- }
-
- protected CaaSKubernetesWorkload() {
-
- roles = new ArrayList<>();
- this.setRecreateOnFailure(true);
+ protected CaaSKubernetesWorkload createComponent() {
+ return new CaaSKubernetesWorkload();
}
@Override
- public Collection validate() {
- Collection errors = super.validate();
- errors.addAll(CustomWorkload.validateCustomWorkload(this, "Kubernetes Workload"));
- return errors;
+ protected KubernetesWorkloadBuilder getBuilder() {
+ return this;
}
- public static KubernetesWorkloadBuilder builder() {
- return new KubernetesWorkloadBuilder();
+ /**
+ *
+ * Sets the namespace where the workload will be instantiated.
+ *
+ *
+ * @param namespace The namespace for the workload.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withNamespace(String namespace) {
+ component.setNamespace(namespace);
+ return builder;
}
+ /**
+ *
+ * Sets the ID of the container platform where the workload will be instantiated.
+ *
+ *
+ * @param containerPlatform The ID of the container platform.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withContainerPlatform(String containerPlatform) {
+ component.setContainerPlatform(containerPlatform);
+ return builder;
+ }
- public static class KubernetesWorkloadBuilder extends CustomWorkloadBuilder {
-
- @Override
- protected CaaSKubernetesWorkload createComponent() {
- return new CaaSKubernetesWorkload();
- }
-
- @Override
- protected KubernetesWorkloadBuilder getBuilder() {
- return this;
- }
-
- /**
- *
- * Sets the namespace where the workload will be instantiated.
- *
- *
- * @param namespace The namespace for the workload.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withNamespace(String namespace) {
- component.setNamespace(namespace);
- return builder;
- }
-
- /**
- *
- * Sets the ID of the container platform where the workload will be instantiated.
- *
- *
- * @param containerPlatform The ID of the container platform.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withContainerPlatform(String containerPlatform) {
- component.setContainerPlatform(containerPlatform);
- return builder;
- }
+ /**
+ * Adds a DNS zone configuration with a single DNS record.
+ *
+ * @param dnsZoneName The name of the DNS zone.
+ * @param dnsRecord The DNS record to add.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withDnsZoneConfig(String dnsZoneName, DnsRecord dnsRecord) {
+ if (component.getDnsZoneConfig() == null) {
+ component.setDnsZoneConfig(new HashMap<>());
+ }
+
+ if (!component.getDnsZoneConfig().containsKey(dnsZoneName)) {
+ component.getDnsZoneConfig().put(dnsZoneName, new ArrayList<>());
+ }
+
+ component.getDnsZoneConfig().get(dnsZoneName).add(SerializationUtils.convertValueToMap(dnsRecord));
+
+ return builder;
+ }
- /**
- * Adds a DNS zone configuration with a single DNS record.
- *
- * @param dnsZoneName The name of the DNS zone.
- * @param dnsRecord The DNS record to add.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withDnsZoneConfig(String dnsZoneName, DnsRecord dnsRecord) {
- if (component.getDnsZoneConfig() == null) {
- component.setDnsZoneConfig(new HashMap<>());
- }
-
- if (!component.getDnsZoneConfig().containsKey(dnsZoneName)) {
- component.getDnsZoneConfig().put(dnsZoneName, new ArrayList<>());
- }
-
- component.getDnsZoneConfig().get(dnsZoneName).add(SerializationUtils.convertValueToMap(dnsRecord));
-
- return builder;
- }
+ /**
+ * Adds a DNS zone configuration with a collection of DNS records.
+ *
+ * @param dnsZoneName The name of the DNS zone.
+ * @param dnsRecords The collection of DNS records to add.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withDnsZoneConfig(String dnsZoneName, Collection dnsRecords) {
+ dnsRecords.forEach(dnsRecord -> withDnsZoneConfig(dnsZoneName, dnsRecord));
+ return builder;
+ }
- /**
- * Adds a DNS zone configuration with a collection of DNS records.
- *
- * @param dnsZoneName The name of the DNS zone.
- * @param dnsRecords The collection of DNS records to add.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withDnsZoneConfig(String dnsZoneName, Collection dnsRecords) {
- dnsRecords.forEach(dnsRecord -> withDnsZoneConfig(dnsZoneName, dnsRecord));
- return builder;
+ /**
+ * Adds DNS zone configurations from a map of DNS zone names to collections of DNS records.
+ *
+ * @param dnsRecordsMap The map of DNS zone configurations.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withDnsZoneConfig(Map extends String, ? extends Collection> dnsRecordsMap) {
+ if (dnsRecordsMap == null || dnsRecordsMap.isEmpty()) {
+ return builder;
+ }
+
+ dnsRecordsMap.forEach((key, value) -> {
+ for (var dnsRecord : value) {
+ withDnsZoneConfig(key, dnsRecord);
}
+ });
- /**
- * Adds DNS zone configurations from a map of DNS zone names to collections of DNS records.
- *
- * @param dnsRecordsMap The map of DNS zone configurations.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withDnsZoneConfig(Map extends String, ? extends Collection> dnsRecordsMap) {
- if (dnsRecordsMap == null || dnsRecordsMap.isEmpty()) {
- return builder;
- }
-
- dnsRecordsMap.forEach((key, value) -> {
- for (var dnsRecord : value) {
- withDnsZoneConfig(key, dnsRecord);
- }
- });
-
- return builder;
- }
+ return builder;
+ }
- /**
- *
- * Sets the ServiceAccount name for the Kubernetes workload.
- * This name is crucial for configuring workload identity by linking the Kubernetes ServiceAccount
- * to Azure User Managed Identity.
- *
- * @param serviceAccountName The name of the ServiceAccount.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withServiceAccountName(String serviceAccountName) {
- component.setServiceAccountName(serviceAccountName);
- return builder;
- }
+ /**
+ *
+ * Sets the ServiceAccount name for the Kubernetes workload.
+ * This name is crucial for configuring workload identity by linking the Kubernetes ServiceAccount
+ * to Azure User Managed Identity.
+ *
+ * @param serviceAccountName The name of the ServiceAccount.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withServiceAccountName(String serviceAccountName) {
+ component.setServiceAccountName(serviceAccountName);
+ return builder;
+ }
- /**
- *
- * Enables or disables the Workload Identity for the Kubernetes workload.
- * By default, Fractal Cloud Agent sets this to true.
- *
- * @param workloadIdentityEnabled A boolean flag to enable or disable Workload Identity.
- * @return The builder instance.
- */
- public KubernetesWorkloadBuilder withWorkloadIdentityEnabled(boolean workloadIdentityEnabled) {
- component.setWorkloadIdentityEnabled(workloadIdentityEnabled);
- return builder;
- }
+ /**
+ *
+ * Enables or disables the Workload Identity for the Kubernetes workload.
+ * By default, Fractal Cloud Agent sets this to true.
+ *
+ * @param workloadIdentityEnabled A boolean flag to enable or disable Workload Identity.
+ * @return The builder instance.
+ */
+ public KubernetesWorkloadBuilder withWorkloadIdentityEnabled(boolean workloadIdentityEnabled) {
+ component.setWorkloadIdentityEnabled(workloadIdentityEnabled);
+ return builder;
+ }
- @Override
- public CaaSKubernetesWorkload build() {
- component.setType(CAAS_K8S_WORKLOAD);
- return super.build();
- }
+ @Override
+ public CaaSKubernetesWorkload build() {
+ component.setType(CAAS_K8S_WORKLOAD);
+ return super.build();
}
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSLoggingImpl.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSLoggingImpl.java
index e2dde304..318ea269 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSLoggingImpl.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSLoggingImpl.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSLogging;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSLogging;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import lombok.AccessLevel;
@@ -17,28 +17,28 @@
@ToString(callSuper = true)
public abstract class CaaSLoggingImpl extends CaaSLogging implements LiveSystemComponent {
- private String storage;
- private String storageClassName;
- private int memory;
- private int cpu;
+ private String storage;
+ private String storageClassName;
+ private int memory;
+ private int cpu;
- @Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
- }
-
- @Override
- public Collection validate() {
- Collection errors = super.validate();
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
- if (isBlank(storage)) {
- errors.add(getStorageIsBlankErrorMessage());
- }
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
- return errors;
+ if (isBlank(storage)) {
+ errors.add(getStorageIsBlankErrorMessage());
}
- private String getStorageIsBlankErrorMessage() {
- return String.format("[%s Validation] Storage has not been defined and it is required", this.getClass().getName());
- }
+ return errors;
+ }
+
+ private String getStorageIsBlankErrorMessage() {
+ return String.format("[%s Validation] Storage has not been defined and it is required", this.getClass().getName());
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSMonitoringImpl.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSMonitoringImpl.java
index 5dfdd45a..22a5a3a0 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSMonitoringImpl.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSMonitoringImpl.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSMonitoring;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSMonitoring;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import lombok.ToString;
@@ -10,13 +10,13 @@
@ToString(callSuper = true)
public abstract class CaaSMonitoringImpl extends CaaSMonitoring implements LiveSystemComponent {
- @Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
- }
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
- @Override
- public Collection validate() {
- return super.validate();
- }
+ @Override
+ public Collection validate() {
+ return super.validate();
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSPrometheus.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSPrometheus.java
index 56f4bfef..2c9d7f0a 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSPrometheus.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSPrometheus.java
@@ -63,7 +63,8 @@ public PrometheusBuilder withContainerPlatform(String containerPlatform) {
}
/**
- * If specified, Prometheus will be made available at the URL specified below. For example, if the parameter is set to
+ * If specified, Prometheus will be made available at the URL specified below. For example, if the parameter is
+ * set to
* api.yourdomain.com, then Prometheus can be accessed at api.yourdomain.com/prometheus.
*
* This applies for all components available (Kibana, Grafana, Alert Manager)
@@ -84,6 +85,6 @@ public CaaSPrometheus build() {
@Override
public Collection validate() {
- return super.validate();
+ return super.validate();
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSSearchImpl.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSSearchImpl.java
index 50da69d9..6339ee4b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSSearchImpl.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSSearchImpl.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSSearch;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSSearch;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import lombok.AccessLevel;
@@ -16,28 +16,28 @@
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class CaaSSearchImpl extends CaaSSearch implements LiveSystemComponent {
- private String storage;
- private String storageClassName;
- private Integer memory;
- private Integer cpu;
-
- @Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
+ private String storage;
+ private String storageClassName;
+ private Integer memory;
+ private Integer cpu;
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
+
+ if (isBlank(storage)) {
+ errors.add(getStorageIsBlankErrorMessage());
}
- @Override
- public Collection validate() {
- Collection errors = super.validate();
+ return errors;
+ }
- if (isBlank(storage)) {
- errors.add(getStorageIsBlankErrorMessage());
- }
-
- return errors;
- }
-
- private String getStorageIsBlankErrorMessage() {
- return String.format("[%s Validation] Storage has not been defined and it is required", this.getClass().getName());
- }
+ private String getStorageIsBlankErrorMessage() {
+ return String.format("[%s Validation] Storage has not been defined and it is required", this.getClass().getName());
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSServiceMeshSecurityImpl.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSServiceMeshSecurityImpl.java
index 04fb367f..4c3c746b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSServiceMeshSecurityImpl.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSServiceMeshSecurityImpl.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.CaaSServiceMeshSecurity;
+import com.yanchware.fractal.sdk.domain.fractal.caas.CaaSServiceMeshSecurity;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
import lombok.AccessLevel;
@@ -17,36 +17,39 @@
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class CaaSServiceMeshSecurityImpl extends CaaSServiceMeshSecurity implements LiveSystemComponent {
- private final static String HOST_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Host has not been defined and it is required";
- private final static String HOST_OWNER_EMAIL_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Host Owner Email has not been defined and it is required";
- private final static String COOKIE_MAX_AGE_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Cookie max age has not been defined or is less than or equal to 0 and must be a positive number (in seconds)";
-
- private String host;
- private String hostOwnerEmail;
- private List corsOrigins;
- private int cookieMaxAgeSec;
- private String pathPrefix;
-
- @Override
- public ProviderType getProvider(){
- return ProviderType.CAAS;
+ private final static String HOST_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Host has not been defined" +
+ " and it is required";
+ private final static String HOST_OWNER_EMAIL_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Host Owner " +
+ "Email has not been defined and it is required";
+ private final static String COOKIE_MAX_AGE_IS_NULL_OR_EMPTY = "[CaaSServiceMeshSecurity Validation] Cookie max age " +
+ "has not been defined or is less than or equal to 0 and must be a positive number (in seconds)";
+
+ private String host;
+ private String hostOwnerEmail;
+ private List corsOrigins;
+ private int cookieMaxAgeSec;
+ private String pathPrefix;
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.CAAS;
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
+
+ if (isBlank(host)) {
+ errors.add(HOST_IS_NULL_OR_EMPTY);
}
- @Override
- public Collection validate() {
- Collection errors = super.validate();
-
- if (isBlank(host)) {
- errors.add(HOST_IS_NULL_OR_EMPTY);
- }
-
- if (isBlank(hostOwnerEmail)) {
- errors.add(HOST_OWNER_EMAIL_IS_NULL_OR_EMPTY);
- }
+ if (isBlank(hostOwnerEmail)) {
+ errors.add(HOST_OWNER_EMAIL_IS_NULL_OR_EMPTY);
+ }
- if (cookieMaxAgeSec <= 0) {
- errors.add(COOKIE_MAX_AGE_IS_NULL_OR_EMPTY);
- }
- return errors;
+ if (cookieMaxAgeSec <= 0) {
+ errors.add(COOKIE_MAX_AGE_IS_NULL_OR_EMPTY);
}
+ return errors;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSTraefik.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSTraefik.java
index 4666931e..b7c3639f 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSTraefik.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/CaaSTraefik.java
@@ -1,6 +1,6 @@
package com.yanchware.fractal.sdk.domain.livesystem.caas;
-import com.yanchware.fractal.sdk.domain.blueprint.iaas.DnsRecord;
+import com.yanchware.fractal.sdk.domain.fractal.iaas.DnsRecord;
import com.yanchware.fractal.sdk.utils.CollectionUtils;
import com.yanchware.fractal.sdk.utils.SerializationUtils;
import lombok.AccessLevel;
@@ -17,7 +17,8 @@
@Setter(AccessLevel.PRIVATE)
@ToString(callSuper = true)
public class CaaSTraefik extends CaaSAPIGatewayImpl {
- private final static String OIDC_IS_PARTIAL = "[CaaSTraefik Validation] OIDC has been partially configured. You must provide all required values or none of them";
+ private final static String OIDC_IS_PARTIAL = "[CaaSTraefik Validation] OIDC has been partially configured. You " +
+ "must provide all required values or none of them";
private final static String NO_ENTRY_POINTS = "[CaaSTraefik Validation] Traefik should have at least one entrypoint";
private final static String NO_HOSTNAME = "[CaaSTraefik Validation] Traefik should have a hostname";
@@ -138,7 +139,8 @@ public TraefikBuilder withEntryPoint(TraefikEntryPoint entryPoint) {
/**
* Configures Traefik's forward authentication settings.
- * For more details check Traefik documentation
+ * For more details check
+ * Traefik documentation
*
* @param forwardAuthSettings settings for forward authentication.
* @return the current builder instance
@@ -248,16 +250,16 @@ public Collection validate() {
private boolean allBlank() {
return isBlank(oidcIssuerUrl)
- && isBlank(oidcClientId)
- && isBlank(oidcClientSecretId)
- && isBlank(forwardAuthSecretId);
+ && isBlank(oidcClientId)
+ && isBlank(oidcClientSecretId)
+ && isBlank(forwardAuthSecretId);
}
private boolean allDefined() {
return !isBlank(oidcIssuerUrl)
- && !isBlank(oidcClientId)
- && !isBlank(oidcClientSecretId)
- && !isBlank(forwardAuthSecretId);
+ && !isBlank(oidcClientId)
+ && !isBlank(oidcClientSecretId)
+ && !isBlank(forwardAuthSecretId);
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ContainerResources.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ContainerResources.java
index 4e956815..f124c9d7 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ContainerResources.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ContainerResources.java
@@ -20,11 +20,11 @@ public class ContainerResources implements Validatable {
protected ContainerResources() {
}
-
+
public static ContainerResourcesBuilder builder() {
return new ContainerResourcesBuilder();
}
-
+
public static class ContainerResourcesBuilder {
private final ContainerResources resources;
private final ContainerResourcesBuilder builder;
@@ -38,8 +38,9 @@ public ContainerResourcesBuilder() {
*
* Sets the CPU resource request or limit for the container.
* This value can be specified in CPU units, where 1000m represents 1 CPU core.
- *
+ *
* For example, "250m" represents a quarter of a CPU core.
+ *
* @param cpu The amount of CPU to request or limit
*/
public ContainerResourcesBuilder withCpu(String cpu) {
@@ -50,19 +51,20 @@ public ContainerResourcesBuilder withCpu(String cpu) {
/**
*
* Sets the memory resource request or limit for the container. Memory can be specified in bytes or using
- * suffixes to denote fixed-point numbers. Supported decimal unit suffixes include E, P, T, G, M, k, and
+ * suffixes to denote fixed-point numbers. Supported decimal unit suffixes include E, P, T, G, M, k, and
* their power-of-two equivalents are Ei, Pi, Ti, Gi, Mi, Ki. It's crucial to use the correct suffix to accurately
* specify memory requirements.
*
- * For example, "64Mi" (64 Mebibytes) and "1Gi" (1 Gibibyte) use binary suffixes, while "500M" (500 Megabytes)
- * uses a decimal suffix. The case of the suffix is significant and directly impacts the allocated resources.
- * For instance, specifying "400m" would request 0.4 bytes, likely a mistake for "400Mi" (400 Mebibytes) or
+ * For example, "64Mi" (64 Mebibytes) and "1Gi" (1 Gibibyte) use binary suffixes, while "500M" (500 Megabytes)
+ * uses a decimal suffix. The case of the suffix is significant and directly impacts the allocated resources.
+ * For instance, specifying "400m" would request 0.4 bytes, likely a mistake for "400Mi" (400 Mebibytes) or
* "400M" (400 Megabytes). This distinction is vital to ensure resources are requested as intended.
*
- * Be mindful of the suffix case to avoid common pitfalls: 'M' denotes Megabytes, while 'Mi' denotes Mebibytes.
+ * Be mindful of the suffix case to avoid common pitfalls: 'M' denotes Megabytes, while 'Mi' denotes Mebibytes.
* A lowercase 'm' is not valid for memory specifications and could lead to configuration errors.
+ *
* @param memory The amount of memory to request or limit, specified as a plain integer or as a fixed-point
- * number with one of the supported suffixes.
+ * number with one of the supported suffixes.
*/
public ContainerResourcesBuilder withMemory(String memory) {
resources.setMemory(memory);
@@ -74,9 +76,9 @@ public ContainerResources build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("ContainerResources validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
-
+
return resources;
}
}
@@ -89,7 +91,7 @@ public Collection validate() {
if (!cpu.matches("\\d+[A-Za-z]|\\d+\\.\\d+|\\d+")) {
errors.add("CPU quantity is not in a valid format");
}
-
+
if (cpu.endsWith("m")) {
int value = Integer.parseInt(cpu.substring(0, cpu.length() - 1));
if (value < 1) {
@@ -102,18 +104,19 @@ public Collection validate() {
}
}
}
-
- if(isNotBlank(memory)) {
+
+ if (isNotBlank(memory)) {
if (!memory.matches("\\d+(\\.\\d+)?[EPTGMk]?i?|\\d+")) {
errors.add("Memory quantity is not in a valid format");
}
// Specific check for the incorrect 'm' suffix usage
if (memory.toLowerCase().endsWith("m")) {
- errors.add("The 'm' suffix is not valid for memory quantities. Did you mean 'Mi' for mebibytes or 'M' for megabytes?");
+ errors.add("The 'm' suffix is not valid for memory quantities. Did you mean 'Mi' for mebibytes or 'M' for " +
+ "megabytes?");
}
}
-
+
return errors;
}
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/JaegerTracing.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/JaegerTracing.java
index 25c48c16..081b164b 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/JaegerTracing.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/JaegerTracing.java
@@ -32,7 +32,7 @@ public JaegerTracingBuilder withCollectorEndpoint(String collectorEndpoint) {
jaeger.collectorEndpoint = collectorEndpoint;
return builder;
}
-
+
public JaegerTracingBuilder withLocalAgentPort(Integer localAgentPort) {
jaeger.localAgentPort = localAgentPort;
@@ -49,7 +49,7 @@ public JaegerTracing build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("JaegerTracingBuilder validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
return jaeger;
@@ -71,7 +71,7 @@ public Collection validate() {
if (localAgentUrlPath == null || localAgentUrlPath.isEmpty()) {
errors.add("localAgentUrlPath must be defined");
}
-
+
if (localAgentPort == null) {
errors.add("localAgentPort must be defined");
} else if (localAgentPort < 1 || localAgentPort > 65535) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/PriorityClass.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/PriorityClass.java
index 3a338512..6c19a8d1 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/PriorityClass.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/PriorityClass.java
@@ -12,7 +12,8 @@
@Getter
@Setter(AccessLevel.PRIVATE)
public class PriorityClass implements Validatable {
- private final static String VALUE_IS_NOT_ALLOWED = "[PriorityClass Validation] Value must be between 1 and 1_000_000_000";
+ private final static String VALUE_IS_NOT_ALLOWED = "[PriorityClass Validation] Value must be between 1 and " +
+ "1_000_000_000";
private String name;
private String description;
@@ -57,7 +58,7 @@ public PriorityClass build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("PriorityClass validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
return priorityClass;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ResourceManagement.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ResourceManagement.java
index b19cfff7..47474595 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ResourceManagement.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/ResourceManagement.java
@@ -31,12 +31,12 @@ public ResourceManagementBuilder() {
*
* Specifies the resource requests for a container.
*
- * @important.note If you choose to customize these values, please be aware that Fractal Cloud cannot guarantee the functionality of the deployment.
- *
You bear full responsibility for ensuring the correctness of your configuration.
- *
Misconfiguration can lead to application failures or resource allocation issues.
- *
Be mindful of the suffix case and the units of measurement to avoid common pitfalls.
- *
* @param requests The desired resource requests for the container, including CPU and memory specifications.
+ * @important.note If you choose to customize these values, please be aware that Fractal Cloud cannot
+ * guarantee the functionality of the deployment.
+ *
You bear full responsibility for ensuring the correctness of your configuration.
+ *
Misconfiguration can lead to application failures or resource allocation issues.
+ *
Be mindful of the suffix case and the units of measurement to avoid common pitfalls.
*/
public ResourceManagementBuilder withRequests(ContainerResources requests) {
resourceManagement.setRequests(requests);
@@ -46,13 +46,13 @@ public ResourceManagementBuilder withRequests(ContainerResources requests) {
/**
*
* Specifies the resource limits for a container.
- *
- * @important.note If you choose to customize these values, please be aware that Fractal Cloud cannot guarantee the functionality of the deployment.
- *
You bear full responsibility for ensuring the correctness of your configuration.
- *
Misconfiguration can lead to application failures or resource allocation issues.
- *
Be mindful of the suffix case and the units of measurement to avoid common pitfalls.
- *
+ *
* @param limits The desired resource limits for the container, including CPU and memory specifications.
+ * @important.note If you choose to customize these values, please be aware that Fractal Cloud cannot
+ * guarantee the functionality of the deployment.
+ *
You bear full responsibility for ensuring the correctness of your configuration.
+ *
Misconfiguration can lead to application failures or resource allocation issues.
+ *
Be mindful of the suffix case and the units of measurement to avoid common pitfalls.
*/
public ResourceManagementBuilder withLimits(ContainerResources limits) {
resourceManagement.setLimits(limits);
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TaintEffect.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TaintEffect.java
index d556fb23..b9e14e01 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TaintEffect.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TaintEffect.java
@@ -12,12 +12,12 @@
* Taints are a mechanism in Kubernetes used to evict pods from nodes. If a pod does not tolerate a taint,
* the effect of the taint determines what happens to the pod on that node.
*
- *
+ *
* The effects include:
* - NoSchedule: Pods that do not tolerate this effect are not scheduled on the node.
* - PreferNoSchedule: The scheduler tries to avoid scheduling pods that do not tolerate this effect on the node,
* but it is not a strict requirement.
- * - NoExecute: Pods that are already running on the node and do not tolerate this effect are evicted.
+ * - NoExecute: Pods that are already running on the node and do not tolerate this effect are evicted.
* New pods that do not tolerate this effect are not scheduled on the node.
*
*/
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/Toleration.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/Toleration.java
index fb0c6716..5e99d361 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/Toleration.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/Toleration.java
@@ -34,7 +34,7 @@ public Collection validate() {
if (isBlank(key)) {
errors.add("The key must be provided for a toleration");
}
-
+
if (effect == null) {
errors.add("The effect must be provided for a toleration");
}
@@ -42,13 +42,13 @@ public Collection validate() {
if (operator == null) {
errors.add("The operator must be provided for a toleration");
}
-
- if(operator != null) {
+
+ if (operator != null) {
if (TolerationOperator.EQUAL.equals(operator) && isBlank(value)) {
errors.add("A value must be provided when the operator is 'Equal'");
}
}
-
+
return errors;
}
@@ -63,7 +63,7 @@ public TolerationBuilder() {
/**
*
- * Sets the key for the toleration.
+ * Sets the key for the toleration.
* The key corresponds to the taint key that this toleration is meant to match.
*
* @param key The label key of the taint to tolerate.
@@ -75,7 +75,7 @@ public TolerationBuilder withKey(String key) {
/**
*
- * Sets the operator for the toleration.
+ * Sets the operator for the toleration.
* The operator defines how to match the taint's value.
* Use TolerationOperator.EQUAL for exact matches or TolerationOperator.EXISTS to ignore the taint's value.
*
@@ -88,7 +88,7 @@ public TolerationBuilder withOperator(TolerationOperator operator) {
/**
*
- * Sets the value for the toleration.
+ * Sets the value for the toleration.
* This is the value that the taint must have if the operator is TolerationOperator.EQUAL.
*
* @param value The value that must match the taint's value.
@@ -100,8 +100,8 @@ public TolerationBuilder withValue(String value) {
/**
*
- * Sets the effect for the toleration.
- * The effect specifies what happens to a pod if it does not tolerate the taint.
+ * Sets the effect for the toleration.
+ * The effect specifies what happens to a pod if it does not tolerate the taint.
* Common effects include NoSchedule, PreferNoSchedule, and NoExecute.
*
* @param effect The effect of the taint that the pod should tolerate.
@@ -110,14 +110,14 @@ public TolerationBuilder withEffect(TaintEffect effect) {
toleration.setEffect(effect);
return builder;
}
-
+
public Toleration build() {
var errors = toleration.validate();
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("Toleration validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
return toleration;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TolerationOperator.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TolerationOperator.java
index 886055db..dd3ed6c7 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TolerationOperator.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TolerationOperator.java
@@ -7,7 +7,7 @@
/**
*
- * Represents the set of valid operators used in Kubernetes tolerations.
+ * Represents the set of valid operators used in Kubernetes tolerations.
* A toleration operator determines how the toleration matches taints on nodes.
*
* - EQUAL: Specifies that the toleration matches taints with the same key and effect, and exactly the same value.
@@ -17,7 +17,7 @@
public final class TolerationOperator extends ExtendableEnum {
public static final TolerationOperator EQUAL = fromString("Equal");
public static final TolerationOperator EXISTS = fromString("Exists");
-
+
/**
* Creates or finds a TolerationOperator from its string representation.
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TraefikTracing.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TraefikTracing.java
index 88729955..e463eb2a 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TraefikTracing.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/caas/TraefikTracing.java
@@ -34,7 +34,7 @@ public TraefikTracing build() {
if (!errors.isEmpty()) {
throw new IllegalArgumentException(String.format("TraefikTracingBuilder validation failed. Errors: %s",
- Arrays.toString(errors.toArray())));
+ Arrays.toString(errors.toArray())));
}
return tracing;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Blackout.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Blackout.java
index 0bee3cf9..0689bbb3 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Blackout.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Blackout.java
@@ -9,14 +9,17 @@
* The start time is inclusive, while the end time is exclusive.
*
* @param start the start time of the blackout period, inclusive; must not be {@code null}
- * @param end the end time of the blackout period, exclusive; must not be {@code null};
- * must be strictly after {@code start}
+ * @param end the end time of the blackout period, exclusive; must not be {@code null};
+ * must be strictly after {@code start}
* @throws IllegalArgumentException if {@code end} is not after {@code start}
*/
public record Blackout(ZonedDateTime start, ZonedDateTime end) {
public Blackout {
- if (!end.isAfter(start)) throw new IllegalArgumentException("Blackout end must be after start");
+ if (!end.isAfter(start)) {
+ throw new IllegalArgumentException("Blackout end must be after start");
+ }
}
+
boolean overlaps(Window w) {
return !(w.end().isBefore(start) || w.start().isAfter(end));
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OneOffRule.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OneOffRule.java
index 2e0ee533..dda49c92 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OneOffRule.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OneOffRule.java
@@ -27,10 +27,10 @@ public class OneOffRule implements Rule {
* Constructs a new instance of {@code OneOffRule} that defines a single operational
* service window for a specific date and time range.
*
- * @param date the specific date for the one-off rule; must not be {@code null}
+ * @param date the specific date for the one-off rule; must not be {@code null}
* @param start the start time of the service window on the specified date; must not be {@code null}
- * @param end the end time of the service window on the specified date; must not be {@code null}
- * (if {@code end} is earlier than or equal to {@code start}, the window rolls over into the next day)
+ * @param end the end time of the service window on the specified date; must not be {@code null}
+ * (if {@code end} is earlier than or equal to {@code start}, the window rolls over into the next day)
*/
public OneOffRule(LocalDate date, LocalTime start, LocalTime end) {
this.date = Objects.requireNonNull(date);
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OperationalServiceWindow.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OperationalServiceWindow.java
index d6f42d26..7fe9bcbd 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OperationalServiceWindow.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/OperationalServiceWindow.java
@@ -113,7 +113,8 @@ public Optional currentWindow(ZonedDateTime zonedDateTime) {
}
/**
- * Searches for the next available operational service window starting after the given instant and within the specified search horizon.
+ * Searches for the next available operational service window starting after the given instant and within the
+ * specified search horizon.
*
* The search is conducted in the configured time zone of the service window, considering any applicable blackouts,
* active periods, and exclusions defined in the rules of the operational service window.
@@ -162,7 +163,8 @@ public Stream windowsBetween(Instant fromIncl, Instant toExcl) {
*
* @param fromIncl the inclusive start of the time range to evaluate, represented as a {@code ZonedDateTime}
* @param toExcl the exclusive end of the time range to evaluate, represented as a {@code ZonedDateTime}
- * @return a {@code Stream} containing the resulting operational service windows that match the specified criteria
+ * @return a {@code Stream} containing the resulting operational service windows that match the specified
+ * criteria
*/
public Stream windowsBetween(ZonedDateTime fromIncl, ZonedDateTime toExcl) {
// Respect active range
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Rule.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Rule.java
index 213ed31f..c7a2de51 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Rule.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/Rule.java
@@ -25,10 +25,10 @@ public interface Rule {
* the given range, adhering to the scheduling logic of the implemented rule.
*
* @param fromIncl the start of the range, inclusive; must not be {@code null}
- * @param toExcl the end of the range, exclusive; must not be {@code null}
- * @param zone the time zone in which the windows should be calculated; must not be {@code null}
+ * @param toExcl the end of the range, exclusive; must not be {@code null}
+ * @param zone the time zone in which the windows should be calculated; must not be {@code null}
* @return a stream of {@code Window} objects representing the enumerated time intervals
- * within the specified range; an empty stream is returned if no intervals match
+ * within the specified range; an empty stream is returned if no intervals match
*/
Stream enumerate(ZonedDateTime fromIncl, ZonedDateTime toExcl, ZoneId zone);
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/WeeklyRule.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/WeeklyRule.java
index d81fa349..c2d6c01d 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/WeeklyRule.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/operationalservicewindow/WeeklyRule.java
@@ -34,11 +34,11 @@ public class WeeklyRule implements Rule {
* the duration of each interval. The end time can roll over into the next day if it is earlier than or equal
* to the start time.
*
- * @param days the days of the week when the rule applies; must not be empty
+ * @param days the days of the week when the rule applies; must not be empty
* @param start the start time of the interval; must not be {@code null}
- * @param end the end time of the interval; must not be {@code null}
+ * @param end the end time of the interval; must not be {@code null}
* @throws IllegalArgumentException if {@code days} is empty
- * @throws NullPointerException if {@code start} or {@code end} is {@code null}
+ * @throws NullPointerException if {@code start} or {@code end} is {@code null}
*/
public WeeklyRule(EnumSet days, LocalTime start, LocalTime end) {
if (days.isEmpty()) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/KubernetesCluster.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/KubernetesCluster.java
index 1fd6d519..d5921b35 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/KubernetesCluster.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/KubernetesCluster.java
@@ -1,8 +1,8 @@
package com.yanchware.fractal.sdk.domain.livesystem.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.caas.*;
-import com.yanchware.fractal.sdk.domain.blueprint.paas.PaaSContainerPlatform;
+import com.yanchware.fractal.sdk.domain.fractal.caas.*;
+import com.yanchware.fractal.sdk.domain.fractal.paas.PaaSContainerPlatform;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import com.yanchware.fractal.sdk.domain.livesystem.caas.*;
import com.yanchware.fractal.sdk.domain.livesystem.service.dtos.ProviderType;
@@ -21,20 +21,22 @@
/**
*
- * Builder class to represent a Kubernetes cluster.
+ * Builder class to represent a Kubernetes cluster.
*
*
*
- * For more details about creating a Kubernetes cluster using Fractal Cloud check out
- * our documentation page
+ * For more details about creating a Kubernetes cluster using Fractal Cloud check out
+ * our documentation page
*
*/
@Getter
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class KubernetesCluster extends PaaSContainerPlatform implements LiveSystemComponent {
- private final static String SERVICE_IP_RANGE_NOT_VALID = "[KubernetesCluster Validation] Service IP Range does not contain a valid ip with mask";
- private final static String POD_RANGE_NOT_VALID = "[KubernetesCluster Validation] Pod IP Range does not contain a valid ip with mask";
+ private final static String SERVICE_IP_RANGE_NOT_VALID = "[KubernetesCluster Validation] Service IP Range does not " +
+ "contain a valid ip with mask";
+ private final static String POD_RANGE_NOT_VALID = "[KubernetesCluster Validation] Pod IP Range does not contain a " +
+ "valid ip with mask";
private String serviceIpRange;
private String podIpRange;
@@ -233,7 +235,7 @@ public B withWorkloadIdentityEnabled(boolean workloadIdentityEnabled) {
@Override
public T build() {
component.setType(PAAS_KUBERNETES);
-
+
return super.build();
}
@@ -247,37 +249,41 @@ public Collection validate() {
isPresentAndValidIpRange(podIpRange, errors, POD_RANGE_NOT_VALID);
priorityClasses.stream()
- .map(PriorityClass::validate)
- .forEach(errors::addAll);
+ .map(PriorityClass::validate)
+ .forEach(errors::addAll);
k8sWorkloadInstances.stream()
- .map(CaaSWorkload::validate)
- .forEach(errors::addAll);
+ .map(CaaSWorkload::validate)
+ .forEach(errors::addAll);
monitoringInstances.stream()
- .map(CaaSMonitoring::validate)
- .forEach(errors::addAll);
+ .map(CaaSMonitoring::validate)
+ .forEach(errors::addAll);
apiGatewayInstances.stream()
- .map(CaaSAPIGateway::validate)
- .forEach(errors::addAll);
+ .map(CaaSAPIGateway::validate)
+ .forEach(errors::addAll);
serviceMeshSecurityInstances.stream()
- .map(CaaSServiceMeshSecurity::validate)
- .forEach(errors::addAll);
+ .map(CaaSServiceMeshSecurity::validate)
+ .forEach(errors::addAll);
loggingInstances.stream()
- .map(CaaSLogging::validate)
- .forEach(errors::addAll);
+ .map(CaaSLogging::validate)
+ .forEach(errors::addAll);
documentDBInstances.stream()
- .map(CaaSSearch::validate)
- .forEach(errors::addAll);
+ .map(CaaSSearch::validate)
+ .forEach(errors::addAll);
- if(podManagedIdentity != null) {
+ if (podManagedIdentity != null) {
errors.addAll(podManagedIdentity.validate());
}
//FRA-684 - Add error until we implement in GCP
- if(this.getProvider().equals(ProviderType.GCP)) {
- if(podManagedIdentity != null) errors.add("Pod Managed Identity is not fully supported yet for GCP");
- if(!priorityClasses.isEmpty()) errors.add("Priority classes are not fully supported yet for GCP");
+ if (this.getProvider().equals(ProviderType.GCP)) {
+ if (podManagedIdentity != null) {
+ errors.add("Pod Managed Identity is not fully supported yet for GCP");
+ }
+ if (!priorityClasses.isEmpty()) {
+ errors.add("Priority classes are not fully supported yet for GCP");
+ }
}
-
+
return errors;
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSCassandra.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSCassandra.java
index 863e8053..bcf862df 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSCassandra.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSCassandra.java
@@ -1,7 +1,7 @@
package com.yanchware.fractal.sdk.domain.livesystem.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.paas.PaaSColumnOrientedDbms;
+import com.yanchware.fractal.sdk.domain.fractal.paas.PaaSColumnOrientedDbms;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import lombok.AccessLevel;
import lombok.Getter;
@@ -16,18 +16,20 @@
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class PaaSCassandra extends PaaSColumnOrientedDbms implements LiveSystemComponent {
- public static final String TYPE = PAAS_CASANDRA_DBMS.getId();
- public static abstract class Builder> extends Component.Builder {
+ public static final String TYPE = PAAS_CASANDRA_DBMS.getId();
- @Override
- public T build() {
- component.setType(PAAS_CASANDRA_DBMS);
- return super.build();
- }
- }
+ public static abstract class Builder> extends Component.Builder {
@Override
- public Collection validate() {
- return super.validate();
+ public T build() {
+ component.setType(PAAS_CASANDRA_DBMS);
+ return super.build();
}
+ }
+
+ @Override
+ public Collection validate() {
+ return super.validate();
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSDataStorage.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSDataStorage.java
index 9f8521d5..50cba824 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSDataStorage.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSDataStorage.java
@@ -12,23 +12,24 @@
@Getter
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
-public abstract class PaaSDataStorage extends com.yanchware.fractal.sdk.domain.blueprint.paas.PaaSDataStorage
- implements LiveSystemComponent {
+public abstract class PaaSDataStorage extends com.yanchware.fractal.sdk.domain.fractal.paas.PaaSDataStorage
+ implements LiveSystemComponent
+{
- protected PaaSDataStorage() {
- }
-
- public static abstract class Builder> extends Component.Builder {
+ protected PaaSDataStorage() {
+ }
- @Override
- public T build() {
- return super.build();
- }
- }
+ public static abstract class Builder> extends Component.Builder {
@Override
- public Collection validate() {
- Collection errors = super.validate();
- return errors;
+ public T build() {
+ return super.build();
}
+ }
+
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
+ return errors;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDatabase.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDatabase.java
index 4382c131..d0f34e44 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDatabase.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDatabase.java
@@ -1,7 +1,7 @@
package com.yanchware.fractal.sdk.domain.livesystem.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.paas.PaaSRelationalDatabase;
+import com.yanchware.fractal.sdk.domain.fractal.paas.PaaSRelationalDatabase;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import lombok.AccessLevel;
import lombok.Getter;
@@ -17,75 +17,82 @@
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class PaaSPostgreSqlDatabase extends PaaSRelationalDatabase implements LiveSystemComponent {
- private final static String COLLATION_IS_BLANK = "PostgreSQLDB collation defined was either empty or blank and it is required";
- private final static String SCHEMA_IS_BLANK = "PostgreSQLDB schema defined was either empty or blank and it is required";
-
- private String name;
- private PostgreSqlCharset charset;
- private String collation;
- private String schema;
+ private final static String COLLATION_IS_BLANK = "PostgreSQLDB collation defined was either empty or blank and it " +
+ "is required";
+ private final static String SCHEMA_IS_BLANK = "PostgreSQLDB schema defined was either empty or blank and it is " +
+ "required";
+
+ private String name;
+ private PostgreSqlCharset charset;
+ private String collation;
+ private String schema;
+
+ protected PaaSPostgreSqlDatabase() {
+ }
+
+
+ public static abstract class Builder> extends Component.Builder {
+
+ /**
+ * Name of the database
+ *
+ * @param name
+ */
+ public B withName(String name) {
+ component.setName(name);
+ return builder;
+ }
- protected PaaSPostgreSqlDatabase() {
+ /**
+ * Charset of the database
+ *
+ * @param charset
+ */
+ public B withCharset(PostgreSqlCharset charset) {
+ component.setCharset(charset);
+ return builder;
}
+ /**
+ * Collation of the database
+ *
+ * @param collation
+ */
+ public B withCollation(String collation) {
+ component.setCollation(collation);
+ return builder;
+ }
- public static abstract class Builder> extends Component.Builder {
-
- /**
- * Name of the database
- * @param name
- */
- public B withName(String name) {
- component.setName(name);
- return builder;
- }
-
- /**
- * Charset of the database
- * @param charset
- */
- public B withCharset(PostgreSqlCharset charset) {
- component.setCharset(charset);
- return builder;
- }
-
- /**
- * Collation of the database
- * @param collation
- */
- public B withCollation(String collation) {
- component.setCollation(collation);
- return builder;
- }
-
- /**
- * Schema of the database
- * @param schema
- */
- public B withSchema(String schema) {
- component.setSchema(schema);
- return builder;
- }
-
- @Override
- public T build() {
- component.setType(PAAS_POSTGRESQL_DATABASE);
- return super.build();
- }
+ /**
+ * Schema of the database
+ *
+ * @param schema
+ */
+ public B withSchema(String schema) {
+ component.setSchema(schema);
+ return builder;
}
@Override
- public Collection validate() {
- Collection errors = super.validate();
+ public T build() {
+ component.setType(PAAS_POSTGRESQL_DATABASE);
+ return super.build();
+ }
+ }
- if(collation != null && isBlank(collation)) {
- errors.add(COLLATION_IS_BLANK);
- }
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
- if(schema != null && isBlank(schema)) {
- errors.add(SCHEMA_IS_BLANK);
- }
+ if (collation != null && isBlank(collation)) {
+ errors.add(COLLATION_IS_BLANK);
+ }
- return errors;
+ if (schema != null && isBlank(schema)) {
+ errors.add(SCHEMA_IS_BLANK);
}
+
+ return errors;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDbms.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDbms.java
index 1a3b32f7..6ec32476 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDbms.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PaaSPostgreSqlDbms.java
@@ -1,7 +1,7 @@
package com.yanchware.fractal.sdk.domain.livesystem.paas;
import com.yanchware.fractal.sdk.domain.Component;
-import com.yanchware.fractal.sdk.domain.blueprint.paas.PaaSRelationalDbms;
+import com.yanchware.fractal.sdk.domain.fractal.paas.PaaSRelationalDbms;
import com.yanchware.fractal.sdk.domain.livesystem.LiveSystemComponent;
import lombok.AccessLevel;
import lombok.Getter;
@@ -17,29 +17,29 @@
@Setter(AccessLevel.PROTECTED)
@ToString(callSuper = true)
public abstract class PaaSPostgreSqlDbms extends PaaSRelationalDbms implements LiveSystemComponent {
- private Collection databases;
+ private Collection databases;
- protected PaaSPostgreSqlDbms() {
- databases = new ArrayList<>();
- }
+ protected PaaSPostgreSqlDbms() {
+ databases = new ArrayList<>();
+ }
- public static abstract class Builder> extends Component.Builder {
+ public static abstract class Builder> extends Component.Builder {
- @Override
- public T build() {
- component.setType(PAAS_POSTGRESQL_DBMS);
- return super.build();
- }
+ @Override
+ public T build() {
+ component.setType(PAAS_POSTGRESQL_DBMS);
+ return super.build();
}
+ }
- @Override
- public Collection validate() {
- Collection errors = super.validate();
+ @Override
+ public Collection validate() {
+ Collection errors = super.validate();
- databases.stream()
- .map(PaaSPostgreSqlDatabase::validate)
- .forEach(errors::addAll);
+ databases.stream()
+ .map(PaaSPostgreSqlDatabase::validate)
+ .forEach(errors::addAll);
- return errors;
- }
+ return errors;
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PodManagedIdentity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PodManagedIdentity.java
index 71621788..5e7cb07f 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PodManagedIdentity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/PodManagedIdentity.java
@@ -16,11 +16,16 @@
@Setter(AccessLevel.PRIVATE)
@Builder(setterPrefix = "with")
public class PodManagedIdentity implements Validatable {
- private final static String NAME_IS_BLANK = "[PodManagedIdentity Validation] Name has not been defined and it is required";
- private final static String NAMESPACE_IS_BLANK = "[PodManagedIdentity Validation] Namespace has not been defined and it is required";
- private final static String ENABLE_IS_BLANK = "[PodManagedIdentity Validation] Enable has not been defined and it is required";
- private final static String EXCEPTION_POD_LABELS_IS_BLANK = "[PodManagedIdentity Validation] Exception pod labels has not been defined and it is required";
- private final static String ALLOW_NETWORK_PLUGIN_KUBE_NET_IS_BLANK = "[PodManagedIdentity Validation] AllowNetworkPluginKubeNet has not been defined and it is required";
+ private final static String NAME_IS_BLANK = "[PodManagedIdentity Validation] Name has not been defined and it is " +
+ "required";
+ private final static String NAMESPACE_IS_BLANK = "[PodManagedIdentity Validation] Namespace has not been defined " +
+ "and it is required";
+ private final static String ENABLE_IS_BLANK = "[PodManagedIdentity Validation] Enable has not been defined and it " +
+ "is required";
+ private final static String EXCEPTION_POD_LABELS_IS_BLANK = "[PodManagedIdentity Validation] Exception pod labels " +
+ "has not been defined and it is required";
+ private final static String ALLOW_NETWORK_PLUGIN_KUBE_NET_IS_BLANK = "[PodManagedIdentity Validation] " +
+ "AllowNetworkPluginKubeNet has not been defined and it is required";
private String name;
private String namespace;
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/ResourceEntity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/ResourceEntity.java
index acb33686..4ba77b80 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/ResourceEntity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/ResourceEntity.java
@@ -3,9 +3,11 @@
import java.util.Map;
public interface ResourceEntity {
- Map getTags();
- void setTags(Map tags);
+ Map getTags();
- String getName();
- void setName(String Name);
+ void setTags(Map tags);
+
+ String getName();
+
+ void setName(String Name);
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsElasticKubernetesService.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsElasticKubernetesService.java
index 6f7ac314..6a536f53 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsElasticKubernetesService.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsElasticKubernetesService.java
@@ -18,221 +18,232 @@
@Getter
@Setter
public class AwsElasticKubernetesService extends KubernetesCluster implements AwsResourceEntity {
- private final static String REGION_IS_NULL = "[AwsElasticKuernetesService Validation] Region is not specified and it is required";
- private final static String NAME_NOT_VALID = "[KubernetesCluster Validation] The name can contain only letters, numbers, underscores, and hyphens. The name must start and end with a letter or number and must be between 1 and 63 characters long";
-
- private AwsRegion awsRegion;
- private Map tags;
- private String name;
- private String vpcCidrBlock;
- private List privateSubnetCidrs;
- private Integer desiredAvailabilityZoneCount;
+ private final static String REGION_IS_NULL = "[AwsElasticKuernetesService Validation] Region is not specified and " +
+ "it is required";
+ private final static String NAME_NOT_VALID = "[KubernetesCluster Validation] The name can contain only letters, " +
+ "numbers, underscores, and hyphens. The name must start and end with a letter or number and must be between 1 and" +
+ " 63 characters long";
+
+ private AwsRegion awsRegion;
+ private Map tags;
+ private String name;
+ private String vpcCidrBlock;
+ private List privateSubnetCidrs;
+ private Integer desiredAvailabilityZoneCount;
+
+ @Override
+ public ProviderType getProvider() {
+ return ProviderType.AWS;
+ }
+
+ public static AwsElasticKubernetesServiceBuilder builder() {
+ return new AwsElasticKubernetesServiceBuilder();
+ }
+
+ public static class AwsElasticKubernetesServiceBuilder extends Builder {
+ @Override
+ protected AwsElasticKubernetesService createComponent() {
+ return new AwsElasticKubernetesService();
+ }
@Override
- public ProviderType getProvider() {
- return ProviderType.AWS;
+ protected AwsElasticKubernetesServiceBuilder getBuilder() {
+ return this;
}
- public static AwsElasticKubernetesServiceBuilder builder() {
- return new AwsElasticKubernetesServiceBuilder();
+ public AwsElasticKubernetesServiceBuilder withRegion(AwsRegion region) {
+ component.setAwsRegion(region);
+ return builder;
}
- public static class AwsElasticKubernetesServiceBuilder extends Builder {
- @Override
- protected AwsElasticKubernetesService createComponent() {
- return new AwsElasticKubernetesService();
- }
+ public AwsElasticKubernetesServiceBuilder withName(String name) {
+ component.setName(name);
+ return builder;
+ }
- @Override
- protected AwsElasticKubernetesServiceBuilder getBuilder() {
- return this;
- }
+ public AwsElasticKubernetesServiceBuilder withTags(Map tags) {
+ component.setTags(tags);
+ return builder;
+ }
- public AwsElasticKubernetesServiceBuilder withRegion(AwsRegion region) {
- component.setAwsRegion(region);
- return builder;
- }
+ public AwsElasticKubernetesServiceBuilder withTag(String key, String value) {
+ if (component.getTags() == null) {
+ withTags(new HashMap<>());
+ }
- public AwsElasticKubernetesServiceBuilder withName(String name) {
- component.setName(name);
- return builder;
- }
+ component.getTags().put(key, value);
+ return builder;
+ }
- public AwsElasticKubernetesServiceBuilder withTags(Map tags) {
- component.setTags(tags);
- return builder;
- }
+ /**
+ * Sets the VPC CIDR block for the EKS cluster.
+ *
+ * Must be a valid CIDR block between /16 and /24 (inclusive).
+ * If not set, the default {@code 172.33.0.0/16} will be used.
+ *
+ * @param cidrBlock the VPC CIDR block (e.g., {@code "10.0.0.0/16"})
+ * @return the builder instance
+ */
+ public AwsElasticKubernetesServiceBuilder withVpcCidrBlock(String cidrBlock) {
+ component.setVpcCidrBlock(cidrBlock);
+ return builder;
+ }
- public AwsElasticKubernetesServiceBuilder withTag(String key, String value) {
- if (component.getTags() == null) {
- withTags(new HashMap<>());
- }
+ /**
+ * Sets the private subnet CIDRs for the EKS cluster.
+ *
+ * Each CIDR must:
+ *
+ * - Be within the configured VPC CIDR block
+ * - Have a longer prefix than the VPC CIDR (e.g., /20 if VPC is /16)
+ * - Not overlap with other subnets
+ *
+ *
+ * Default (if not explicitly set):
+ * Derived from the VPC CIDR prefix:
+ *
+ * - {@code .128.0/20}
+ * - {@code .144.0/20}
+ * - {@code .160.0/20}
+ *
+ *
+ * @param cidrs list of private subnet CIDRs
+ * @return the builder instance
+ */
+ public AwsElasticKubernetesServiceBuilder withPrivateSubnetCidrs(List cidrs) {
+ component.setPrivateSubnetCidrs(cidrs);
+ return builder;
+ }
- component.getTags().put(key, value);
- return builder;
- }
+ /**
+ * Sets how many availability zones the EKS cluster should span.
+ *
+ * Must be a value between 1 and 3 (inclusive), in accordance with AWS best practices.
+ * If set, the number of private subnets provided must match this count.
+ *
+ * Default: 3 availability zones
+ *
+ * @param count number of desired availability zones
+ * @return the builder instance
+ */
+ public AwsElasticKubernetesServiceBuilder withDesiredAvailabilityZoneCount(int count) {
+ component.setDesiredAvailabilityZoneCount(count);
+ return builder;
+ }
+ }
- /**
- * Sets the VPC CIDR block for the EKS cluster.
- *
- * Must be a valid CIDR block between /16 and /24 (inclusive).
- * If not set, the default {@code 172.33.0.0/16} will be used.
- *
- * @param cidrBlock the VPC CIDR block (e.g., {@code "10.0.0.0/16"})
- * @return the builder instance
- */
- public AwsElasticKubernetesServiceBuilder withVpcCidrBlock(String cidrBlock) {
- component.setVpcCidrBlock(cidrBlock);
- return builder;
- }
+ @Override
+ public Collection validate() {
- /**
- * Sets the private subnet CIDRs for the EKS cluster.
- *
- * Each CIDR must:
- *
- * - Be within the configured VPC CIDR block
- * - Have a longer prefix than the VPC CIDR (e.g., /20 if VPC is /16)
- * - Not overlap with other subnets
- *
- *
- * Default (if not explicitly set):
- * Derived from the VPC CIDR prefix:
- *
- * - {@code .128.0/20}
- * - {@code .144.0/20}
- * - {@code .160.0/20}
- *
- *
- * @param cidrs list of private subnet CIDRs
- * @return the builder instance
- */
- public AwsElasticKubernetesServiceBuilder withPrivateSubnetCidrs(List cidrs) {
- component.setPrivateSubnetCidrs(cidrs);
- return builder;
- }
+ Collection errors = super.validate();
+ errors.addAll(AwsResourceEntity.validateAwsResourceEntity(this, "Kubernetes Service"));
- /**
- * Sets how many availability zones the EKS cluster should span.
- *
- * Must be a value between 1 and 3 (inclusive), in accordance with AWS best practices.
- * If set, the number of private subnets provided must match this count.
- *
- * Default: 3 availability zones
- *
- * @param count number of desired availability zones
- * @return the builder instance
- */
- public AwsElasticKubernetesServiceBuilder withDesiredAvailabilityZoneCount(int count) {
- component.setDesiredAvailabilityZoneCount(count);
- return builder;
- }
+ if (StringUtils.isNotBlank(name)) {
+ var isAlphaNumerics = isValidAlphanumericsUnderscoresHyphens(name);
+ var hasValidLengths = isValidStringLength(name, 1, 63);
+ if (!isAlphaNumerics || !hasValidLengths) {
+ errors.add(NAME_NOT_VALID);
+ }
}
- @Override
- public Collection validate() {
+ if (awsRegion == null) {
+ errors.add(REGION_IS_NULL);
+ }
- Collection errors = super.validate();
- errors.addAll(AwsResourceEntity.validateAwsResourceEntity(this, "Kubernetes Service"));
+ if (StringUtils.isNotBlank(vpcCidrBlock)) {
+ try {
+ var vpcUtils = new SubnetUtils(vpcCidrBlock);
+ int vpcPrefix = Integer.parseInt(vpcCidrBlock.split("/")[1]);
- if(StringUtils.isNotBlank(name)) {
- var isAlphaNumerics = isValidAlphanumericsUnderscoresHyphens(name);
- var hasValidLengths = isValidStringLength(name, 1, 63);
- if(!isAlphaNumerics || !hasValidLengths) {
- errors.add(NAME_NOT_VALID);
- }
+ if (vpcPrefix < 16 || vpcPrefix > 24) {
+ errors.add("[AwsElasticKubernetesService Validation] vpcCidrBlock mask must be between /16 and /24");
}
- if (awsRegion == null) {
- errors.add(REGION_IS_NULL);
- }
-
- if (StringUtils.isNotBlank(vpcCidrBlock)) {
+ if (privateSubnetCidrs != null) {
+ for (String subnet : privateSubnetCidrs) {
try {
- var vpcUtils = new SubnetUtils(vpcCidrBlock);
- int vpcPrefix = Integer.parseInt(vpcCidrBlock.split("/")[1]);
-
- if (vpcPrefix < 16 || vpcPrefix > 24) {
- errors.add("[AwsElasticKubernetesService Validation] vpcCidrBlock mask must be between /16 and /24");
- }
-
- if (privateSubnetCidrs != null) {
- for (String subnet : privateSubnetCidrs) {
- try {
- var subnetUtils = new SubnetUtils(subnet);
- int subnetPrefix = Integer.parseInt(subnet.split("/")[1]);
-
- if (subnetPrefix <= vpcPrefix) {
- errors.add(String.format(
- "[AwsElasticKubernetesService Validation] Subnet %s mask must be greater than VPC's (%s)", subnet, vpcCidrBlock));
- }
-
- if (!vpcUtils.getInfo().isInRange(subnetUtils.getInfo().getAddress())) {
- errors.add(String.format(
- "[AwsElasticKubernetesService Validation] Subnet %s is not within the VPC CIDR range %s",
- subnet, vpcCidrBlock));
- }
- } catch (IllegalArgumentException e) {
- errors.add(String.format("[AwsElasticKubernetesService Validation] Invalid CIDR format: %s", subnet));
- }
- }
-
- // Optional: check subnet CIDRs do not overlap
- for (int i = 0; i < privateSubnetCidrs.size(); i++) {
- for (int j = i + 1; j < privateSubnetCidrs.size(); j++) {
- if (cidrOverlaps(privateSubnetCidrs.get(i), privateSubnetCidrs.get(j))) {
- errors.add(String.format(
- "[AwsElasticKubernetesService Validation] Subnet CIDRs %s and %s overlap",
- privateSubnetCidrs.get(i), privateSubnetCidrs.get(j)));
- }
- }
- }
- }
- } catch (IllegalArgumentException e) {
- errors.add("[AwsElasticKubernetesService Validation] vpcCidrBlock is not a valid CIDR");
- }
- }
+ var subnetUtils = new SubnetUtils(subnet);
+ int subnetPrefix = Integer.parseInt(subnet.split("/")[1]);
- if (desiredAvailabilityZoneCount != null) {
- if (desiredAvailabilityZoneCount <= 0) {
- errors.add("[AwsElasticKubernetesService Validation] desiredAvailabilityZoneCount must be greater than 0");
- }
+ if (subnetPrefix <= vpcPrefix) {
+ errors.add(String.format(
+ "[AwsElasticKubernetesService Validation] Subnet %s mask must be greater than VPC's (%s)", subnet,
+ vpcCidrBlock));
+ }
- if (desiredAvailabilityZoneCount > 3) {
- errors.add("[AwsElasticKubernetesService Validation] desiredAvailabilityZoneCount cannot be greater than 3 (AWS best practice)");
+ if (!vpcUtils.getInfo().isInRange(subnetUtils.getInfo().getAddress())) {
+ errors.add(String.format(
+ "[AwsElasticKubernetesService Validation] Subnet %s is not within the VPC CIDR range %s",
+ subnet, vpcCidrBlock));
+ }
+ } catch (IllegalArgumentException e) {
+ errors.add(String.format("[AwsElasticKubernetesService Validation] Invalid CIDR format: %s", subnet));
}
+ }
- if (privateSubnetCidrs != null && privateSubnetCidrs.size() != desiredAvailabilityZoneCount) {
+ // Optional: check subnet CIDRs do not overlap
+ for (int i = 0; i < privateSubnetCidrs.size(); i++) {
+ for (int j = i + 1; j < privateSubnetCidrs.size(); j++) {
+ if (cidrOverlaps(privateSubnetCidrs.get(i), privateSubnetCidrs.get(j))) {
errors.add(String.format(
- "[AwsElasticKubernetesService Validation] privateSubnetCidrs size (%d) must match desiredAvailabilityZoneCount (%d)",
- privateSubnetCidrs.size(), desiredAvailabilityZoneCount
- ));
+ "[AwsElasticKubernetesService Validation] Subnet CIDRs %s and %s overlap",
+ privateSubnetCidrs.get(i), privateSubnetCidrs.get(j)));
+ }
}
+ }
}
+ } catch (IllegalArgumentException e) {
+ errors.add("[AwsElasticKubernetesService Validation] vpcCidrBlock is not a valid CIDR");
+ }
+ }
- return errors;
+ if (desiredAvailabilityZoneCount != null) {
+ if (desiredAvailabilityZoneCount <= 0) {
+ errors.add("[AwsElasticKubernetesService Validation] desiredAvailabilityZoneCount must be greater than 0");
+ }
+
+ if (desiredAvailabilityZoneCount > 3) {
+ errors.add("[AwsElasticKubernetesService Validation] desiredAvailabilityZoneCount cannot be greater than 3 " +
+ "(AWS best practice)");
+ }
+
+ if (privateSubnetCidrs != null && privateSubnetCidrs.size() != desiredAvailabilityZoneCount) {
+ errors.add(String.format(
+ "[AwsElasticKubernetesService Validation] privateSubnetCidrs size (%d) must match " +
+ "desiredAvailabilityZoneCount (%d)",
+ privateSubnetCidrs.size(), desiredAvailabilityZoneCount
+ ));
+ }
}
- private boolean cidrOverlaps(String cidr1, String cidr2) {
- SubnetUtils subnet1 = new SubnetUtils(cidr1);
- SubnetUtils subnet2 = new SubnetUtils(cidr2);
+ return errors;
+ }
- var info1 = subnet1.getInfo();
- var info2 = subnet2.getInfo();
+ private boolean cidrOverlaps(String cidr1, String cidr2) {
+ SubnetUtils subnet1 = new SubnetUtils(cidr1);
+ SubnetUtils subnet2 = new SubnetUtils(cidr2);
- return !(ipLessThan(info1.getHighAddress(), info2.getLowAddress())
- || ipLessThan(info2.getHighAddress(), info1.getLowAddress()));
- }
+ var info1 = subnet1.getInfo();
+ var info2 = subnet2.getInfo();
- private boolean ipLessThan(String ip1, String ip2) {
- String[] a = ip1.split("\\.");
- String[] b = ip2.split("\\.");
+ return !(ipLessThan(info1.getHighAddress(), info2.getLowAddress())
+ || ipLessThan(info2.getHighAddress(), info1.getLowAddress()));
+ }
- for (int i = 0; i < 4; i++) {
- int diff = Integer.parseInt(a[i]) - Integer.parseInt(b[i]);
- if (diff < 0) return true;
- if (diff > 0) return false;
- }
- return false; // equal IPs means not less than
+ private boolean ipLessThan(String ip1, String ip2) {
+ String[] a = ip1.split("\\.");
+ String[] b = ip2.split("\\.");
+
+ for (int i = 0; i < 4; i++) {
+ int diff = Integer.parseInt(a[i]) - Integer.parseInt(b[i]);
+ if (diff < 0) {
+ return true;
+ }
+ if (diff > 0) {
+ return false;
+ }
}
+ return false; // equal IPs means not less than
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsRegion.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsRegion.java
index b892a5eb..4536fc89 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsRegion.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsRegion.java
@@ -9,57 +9,57 @@
* Choose the AWS region that's right for you and your customers
*/
public class AwsRegion extends ExtendableEnum {
- public static final AwsRegion US_EAST_1 = fromString("us-east-1");
- public static final AwsRegion US_EAST_2 = fromString("us-east-2");
- public static final AwsRegion US_WEST_1 = fromString("us-west-1");
- public static final AwsRegion US_WEST_2 = fromString("us-west-2");
- public static final AwsRegion AF_SOUTH_1 = fromString("af-south-1");
- public static final AwsRegion AP_EAST_1 = fromString("ap-east-1");
- public static final AwsRegion AP_SOUTH_2 = fromString("ap-south-2");
- public static final AwsRegion AP_SOUTHEAST_3 = fromString("ap-southeast-3");
- public static final AwsRegion AP_SOUTHEAST_5 = fromString("ap-southeast-5");
- public static final AwsRegion AP_SOUTHEAST_4 = fromString("ap-southeast-4");
- public static final AwsRegion AP_SOUTH_1 = fromString("ap-south-1");
- public static final AwsRegion AP_NORTHEAST_3 = fromString("ap-northeast-3");
- public static final AwsRegion AP_NORTHEAST_2 = fromString("ap-northeast-2");
- public static final AwsRegion AP_SOUTHEAST_1 = fromString("ap-southeast-1");
- public static final AwsRegion AP_SOUTHEAST_2 = fromString("ap-southeast-2");
- public static final AwsRegion AP_NORTHEAST_1 = fromString("ap-northeast-1");
- public static final AwsRegion CA_CENTRAL_1 = fromString("ca-central-1");
- public static final AwsRegion CA_WEST_1 = fromString("ca-west-1");
- public static final AwsRegion CN_NORTH_1 = fromString("cn-north-1");
- public static final AwsRegion CN_NORTHWEST_1 = fromString("cn-northwest-1");
- public static final AwsRegion EU_CENTRAL_1 = fromString("eu-central-1");
- public static final AwsRegion EU_WEST_1 = fromString("eu-west-1");
- public static final AwsRegion EU_WEST_2 = fromString("eu-west-2");
- public static final AwsRegion EU_SOUTH_1 = fromString("eu-south-1");
- public static final AwsRegion EU_WEST_3 = fromString("eu-west-3");
- public static final AwsRegion EU_SOUTH_2 = fromString("eu-south-2");
- public static final AwsRegion EU_NORTH_1 = fromString("eu-north-1");
- public static final AwsRegion EU_CENTRAL_2 = fromString("eu-central-2");
- public static final AwsRegion IL_CENTRAL_1 = fromString("il-central-1");
- public static final AwsRegion ME_SOUTH_1 = fromString("me-south-1");
- public static final AwsRegion ME_CENTRAL_1 = fromString("me-central-1");
- public static final AwsRegion SA_EAST_1 = fromString("sa-east-1");
+ public static final AwsRegion US_EAST_1 = fromString("us-east-1");
+ public static final AwsRegion US_EAST_2 = fromString("us-east-2");
+ public static final AwsRegion US_WEST_1 = fromString("us-west-1");
+ public static final AwsRegion US_WEST_2 = fromString("us-west-2");
+ public static final AwsRegion AF_SOUTH_1 = fromString("af-south-1");
+ public static final AwsRegion AP_EAST_1 = fromString("ap-east-1");
+ public static final AwsRegion AP_SOUTH_2 = fromString("ap-south-2");
+ public static final AwsRegion AP_SOUTHEAST_3 = fromString("ap-southeast-3");
+ public static final AwsRegion AP_SOUTHEAST_5 = fromString("ap-southeast-5");
+ public static final AwsRegion AP_SOUTHEAST_4 = fromString("ap-southeast-4");
+ public static final AwsRegion AP_SOUTH_1 = fromString("ap-south-1");
+ public static final AwsRegion AP_NORTHEAST_3 = fromString("ap-northeast-3");
+ public static final AwsRegion AP_NORTHEAST_2 = fromString("ap-northeast-2");
+ public static final AwsRegion AP_SOUTHEAST_1 = fromString("ap-southeast-1");
+ public static final AwsRegion AP_SOUTHEAST_2 = fromString("ap-southeast-2");
+ public static final AwsRegion AP_NORTHEAST_1 = fromString("ap-northeast-1");
+ public static final AwsRegion CA_CENTRAL_1 = fromString("ca-central-1");
+ public static final AwsRegion CA_WEST_1 = fromString("ca-west-1");
+ public static final AwsRegion CN_NORTH_1 = fromString("cn-north-1");
+ public static final AwsRegion CN_NORTHWEST_1 = fromString("cn-northwest-1");
+ public static final AwsRegion EU_CENTRAL_1 = fromString("eu-central-1");
+ public static final AwsRegion EU_WEST_1 = fromString("eu-west-1");
+ public static final AwsRegion EU_WEST_2 = fromString("eu-west-2");
+ public static final AwsRegion EU_SOUTH_1 = fromString("eu-south-1");
+ public static final AwsRegion EU_WEST_3 = fromString("eu-west-3");
+ public static final AwsRegion EU_SOUTH_2 = fromString("eu-south-2");
+ public static final AwsRegion EU_NORTH_1 = fromString("eu-north-1");
+ public static final AwsRegion EU_CENTRAL_2 = fromString("eu-central-2");
+ public static final AwsRegion IL_CENTRAL_1 = fromString("il-central-1");
+ public static final AwsRegion ME_SOUTH_1 = fromString("me-south-1");
+ public static final AwsRegion ME_CENTRAL_1 = fromString("me-central-1");
+ public static final AwsRegion SA_EAST_1 = fromString("sa-east-1");
- /**
- * Creates or finds a AwsRegion from its string representation.
- *
- * @param name a name to look for.
- * @return the corresponding AwsRegion.
- */
- @JsonCreator
- public static AwsRegion fromString(String name) {
- return fromString(name, AwsRegion.class);
- }
+ /**
+ * Creates or finds a AwsRegion from its string representation.
+ *
+ * @param name a name to look for.
+ * @return the corresponding AwsRegion.
+ */
+ @JsonCreator
+ public static AwsRegion fromString(String name) {
+ return fromString(name, AwsRegion.class);
+ }
- /**
- * Gets known AwsRegion values.
- *
- * @return known AwsRegion values.
- */
- public static Collection values() {
- return values(AwsRegion.class);
- }
+ /**
+ * Gets known AwsRegion values.
+ *
+ * @return known AwsRegion values.
+ */
+ public static Collection values() {
+ return values(AwsRegion.class);
+ }
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsResourceEntity.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsResourceEntity.java
index a756d76f..e800f4e0 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsResourceEntity.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/aws/AwsResourceEntity.java
@@ -7,6 +7,7 @@
public interface AwsResourceEntity extends ResourceEntity {
AwsRegion getAwsRegion();
+
void setAwsRegion(AwsRegion region);
static Collection validateAwsResourceEntity(AwsResourceEntity resourceEntity, String entityName) {
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureIdentityType.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureIdentityType.java
index 16c6540a..60d3c937 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureIdentityType.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureIdentityType.java
@@ -13,7 +13,7 @@ public final class AzureIdentityType extends ExtendableEnum {
public static final AzureIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned");
public static final AzureIdentityType USER_ASSIGNED = fromString("UserAssigned");
public static final AzureIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = fromString("SystemAssigned,UserAssigned");
-
+
@JsonCreator
public static AzureIdentityType fromString(String name) {
return fromString(name, AzureIdentityType.class);
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureMachineType.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureMachineType.java
index 3c2340b5..70cfbb97 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureMachineType.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureMachineType.java
@@ -824,7 +824,7 @@ public final class AzureMachineType extends ExtendableEnum {
public static final AzureMachineType STANDARD_NV6_PROMO = fromString("Standard_NV6_Promo");
public static final AzureMachineType STANDARD_NV72ADS_A10_V5 = fromString("Standard_NV72ads_A10_v5");
public static final AzureMachineType STANDARD_NV8AS_V4 = fromString("Standard_NV8as_v4");
- public static final AzureMachineType STANDARD_PB6S= fromString("Standard_PB6s");
+ public static final AzureMachineType STANDARD_PB6S = fromString("Standard_PB6s");
public AzureMachineType() {
}
diff --git a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureOsSku.java b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureOsSku.java
index 9841d8ec..92d9dc49 100644
--- a/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureOsSku.java
+++ b/fractal.sdk/src/main/java/com/yanchware/fractal/sdk/domain/livesystem/paas/providers/azure/AzureOsSku.java
@@ -7,16 +7,16 @@
/**
*
- * Specifies the OS SKU used by the agent pool.
- * The default is Ubuntu if OSType is Linux.
- * The default is Windows2019 when Kubernetes <= 1.24 or
+ * Specifies the OS SKU used by the agent pool.
+ * The default is Ubuntu if OSType is Linux.
+ * The default is Windows2019 when Kubernetes <= 1.24 or
* Windows2022 when Kubernetes >= 1.25 if OSType is Windows.
*
*/
public class AzureOsSku extends ExtendableEnum {
/**
- * Use AzureLinux as the OS for node images.
+ * Use AzureLinux as the OS for node images.
* Azure Linux is a container-optimized Linux distro built by Microsoft.
* For more information, visit