Add viewer conlet (#25)
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
Some checks failed
Java CI with Gradle / build (push) Has been cancelled
This commit is contained in:
parent
b6f0299932
commit
a6525a2289
77 changed files with 2642 additions and 250 deletions
|
|
@ -11,4 +11,5 @@ plugins {
|
|||
dependencies {
|
||||
api 'org.jgrapes:org.jgrapes.core:[1.19.0,2)'
|
||||
api project(':org.jdrupes.vmoperator.common')
|
||||
api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:[2.16.1,3]'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class ChannelCache<K, C extends Channel, A> {
|
|||
*/
|
||||
@SuppressWarnings("PMD.ShortClassName")
|
||||
private static class Data<C extends Channel, A> {
|
||||
public WeakReference<C> channel;
|
||||
public final WeakReference<C> channel;
|
||||
public A associated;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.jgrapes.core.Event;
|
|||
* Indicates that a display secret has changed.
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataClass")
|
||||
public class DisplaySecretChanged extends Event<Void> {
|
||||
public class DisplayPasswordChanged extends Event<Void> {
|
||||
|
||||
private final ResponseType type;
|
||||
private final V1Secret secret;
|
||||
|
|
@ -39,7 +39,7 @@ public class DisplaySecretChanged extends Event<Void> {
|
|||
* @param type the type
|
||||
* @param secret the secret
|
||||
*/
|
||||
public DisplaySecretChanged(ResponseType type, V1Secret secret) {
|
||||
public DisplayPasswordChanged(ResponseType type, V1Secret secret) {
|
||||
this.type = type;
|
||||
this.secret = secret;
|
||||
}
|
||||
|
|
@ -68,8 +68,7 @@ public class DisplaySecretChanged extends Event<Void> {
|
|||
builder.append(Components.objectName(this)).append(" [")
|
||||
.append(secret.getMetadata().getName()).append(' ').append(type);
|
||||
if (channels() != null) {
|
||||
builder.append(", channels=");
|
||||
builder.append(Channel.toString(channels()));
|
||||
builder.append(", channels=").append(Channel.toString(channels()));
|
||||
}
|
||||
builder.append(']');
|
||||
return builder.toString();
|
||||
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* VM-Operator
|
||||
* Copyright (C) 2024 Michael N. Lipp
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.jdrupes.vmoperator.manager.events;
|
||||
|
||||
import java.util.Optional;
|
||||
import org.jgrapes.core.Event;
|
||||
|
||||
/**
|
||||
* Gets the current display secret.
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataClass")
|
||||
public class GetDisplayPassword extends Event<String> {
|
||||
|
||||
private final String vmName;
|
||||
|
||||
/**
|
||||
* Instantiates a new returns the display secret.
|
||||
*
|
||||
* @param vmName the vm name
|
||||
*/
|
||||
public GetDisplayPassword(String vmName) {
|
||||
this.vmName = vmName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vm name.
|
||||
*
|
||||
* @return the vm name
|
||||
*/
|
||||
public String vmName() {
|
||||
return vmName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the password. Should only be called when the event is completed.
|
||||
*
|
||||
* @return the optional
|
||||
*/
|
||||
public Optional<String> password() {
|
||||
return currentResults().stream().findFirst();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* VM-Operator
|
||||
* Copyright (C) 2024 Michael N. Lipp
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.jdrupes.vmoperator.manager.events;
|
||||
|
||||
import io.kubernetes.client.openapi.models.V1Service;
|
||||
import org.jdrupes.vmoperator.common.K8sObserver.ResponseType;
|
||||
import org.jgrapes.core.Channel;
|
||||
import org.jgrapes.core.Components;
|
||||
import org.jgrapes.core.Event;
|
||||
|
||||
/**
|
||||
* Indicates that a service has changed.
|
||||
*/
|
||||
@SuppressWarnings("PMD.DataClass")
|
||||
public class ServiceChanged extends Event<Void> {
|
||||
|
||||
private final ResponseType type;
|
||||
private final V1Service service;
|
||||
|
||||
/**
|
||||
* Initializes a new service changed event.
|
||||
*
|
||||
* @param type the type
|
||||
* @param service the service
|
||||
*/
|
||||
public ServiceChanged(ResponseType type, V1Service service) {
|
||||
this.type = type;
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public ResponseType type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the service.
|
||||
*
|
||||
* @return the service
|
||||
*/
|
||||
public V1Service service() {
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(Components.objectName(this)).append(" [")
|
||||
.append(service.getMetadata().getName()).append(' ').append(type);
|
||||
if (channels() != null) {
|
||||
builder.append(", channels=").append(Channel.toString(channels()));
|
||||
}
|
||||
builder.append(']');
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -83,8 +83,7 @@ public class VmDefChanged extends Event<Void> {
|
|||
builder.append(Components.objectName(this)).append(" [")
|
||||
.append(vmDef.getMetadata().getName()).append(' ').append(type);
|
||||
if (channels() != null) {
|
||||
builder.append(", channels=");
|
||||
builder.append(Channel.toString(channels()));
|
||||
builder.append(", channels=").append(Channel.toString(channels()));
|
||||
}
|
||||
builder.append(']');
|
||||
return builder.toString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue