Skip to content

Commit

Permalink
added getParentNamespace and isPulled property to ICloudTemplate & im…
Browse files Browse the repository at this point in the history
…plemented cli in node
  • Loading branch information
DinoMarlir committed May 24, 2024
1 parent 9f69094 commit c92b523
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package me.blueamethyst.bluecloud.api.template

interface ICloudTemplate {
fun getName(): String
fun getParentNamespace(): ICloudTemplateNamespace?
fun getProperties(): HashMap<String, String>
fun getProperty(key: String): String?
fun setProperty(key: String, value: String)
fun isPulled(): Boolean
}
15 changes: 14 additions & 1 deletion node/src/main/kotlin/me/blueamethyst/bluecloud/node/Node.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package me.blueamethyst.bluecloud.node
import me.blueamethyst.bluecloud.api.annontations.InternalBlueCloudApi
import me.blueamethyst.bluecloud.common.internal.AbstractSystemPart
import me.blueamethyst.bluecloud.common.internal.types.InternalSystemPartType
import me.blueamethyst.bluecloud.common.terminal.ConsoleColors
import me.blueamethyst.bluecloud.common.terminal.Logger
import me.blueamethyst.bluecloud.common.terminal.Terminal
import me.blueamethyst.bluecloud.common.terminal.cli.CLI
import me.blueamethyst.bluecloud.common.utils.LoggingUtils
import me.blueamethyst.bluecloud.node.injector.BlueCloudApiImpl
import me.blueamethyst.bluecloud.node.models.ClusterConfigModel
Expand All @@ -25,6 +27,7 @@ class Node: AbstractSystemPart(InternalSystemPartType.NODE) {
lateinit var logger: Logger
lateinit var config: NodeConfigModel
lateinit var cluster: ClusterConfigModel
lateinit var cli: CLI
internal lateinit var secrets: SecretsModel
}

Expand All @@ -45,7 +48,8 @@ class Node: AbstractSystemPart(InternalSystemPartType.NODE) {

private fun postStart() {
if (config.internalWrapperEnabled) provideWrapper()
provideKtorServer()
// TODO: provideKtorServer()
provideCli()
blockMainThread()
}

Expand Down Expand Up @@ -109,6 +113,15 @@ class Node: AbstractSystemPart(InternalSystemPartType.NODE) {
BlueCloudApiImpl()
}

private fun provideCli() {
cli = CLI(
logger,
"${ConsoleColors.YELLOW_BRIGHT}CLI${ConsoleColors.BLACK_BRIGHT}@${ConsoleColors.BLUE_BRIGHT}BlueCloud ${ConsoleColors.BLACK_BRIGHT}» ${ConsoleColors.RESET}",
listOf()
)
cli.start()
}

private fun blockMainThread() {
while (true) {
Thread.sleep(50000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package me.blueamethyst.bluecloud.node.templates

import kotlinx.serialization.Serializable
import me.blueamethyst.bluecloud.api.template.ICloudTemplate
import me.blueamethyst.bluecloud.api.template.ICloudTemplateNamespace

@Serializable
class CloudTemplateImpl(
Expand All @@ -13,6 +14,10 @@ class CloudTemplateImpl(
return name
}

override fun getParentNamespace(): ICloudTemplateNamespace? {
TODO("Not yet implemented")
}

override fun getProperties(): HashMap<String, String> {
return properties
}
Expand All @@ -24,4 +29,12 @@ class CloudTemplateImpl(
override fun setProperty(key: String, value: String) {
TODO("Not yet implemented")
}

override fun isPulled(): Boolean {
TODO("Not yet implemented")
}

override fun toString(): String {
return "$name:${getParentNamespace()?.getName() ?: "unknown"}"
}
}

0 comments on commit c92b523

Please sign in to comment.