41 lines
974 B
Java
41 lines
974 B
Java
package dev.dinauer;
|
|
|
|
import java.util.List;
|
|
|
|
import jakarta.enterprise.context.ApplicationScoped;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.ws.rs.GET;
|
|
import jakarta.ws.rs.Path;
|
|
import jakarta.ws.rs.Produces;
|
|
import jakarta.ws.rs.QueryParam;
|
|
import jakarta.ws.rs.core.MediaType;
|
|
|
|
import io.fabric8.kubernetes.api.model.Service;
|
|
import io.quarkus.runtime.Startup;
|
|
import io.quarkus.security.Authenticated;
|
|
import io.smallrye.common.annotation.Blocking;
|
|
|
|
import dev.dinauer.service.ServiceService;
|
|
|
|
@Path("/services")
|
|
@Startup
|
|
@ApplicationScoped
|
|
@Blocking
|
|
@Authenticated
|
|
public class ServiceResource
|
|
{
|
|
@Inject
|
|
ServiceService serviceService;
|
|
|
|
@GET
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
public List<Service> getServices(@QueryParam("namespace") String namespace)
|
|
{
|
|
if(namespace != null && !namespace.isBlank())
|
|
{
|
|
return serviceService.findByNamespace(namespace);
|
|
}
|
|
return serviceService.findAll();
|
|
}
|
|
}
|