Class ContainerResource

java.lang.Object
com.ammann.servicemanager.resource.ContainerResource

@Path("/api/v1/containers") @Produces("application/json") @Consumes("application/json") @RolesAllowed("SUPER_ADMIN_ROLE") public class ContainerResource extends Object
REST Resource for Docker container management operations.

Provides endpoints for listing, starting, stopping, restarting, updating containers and streaming logs.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getContainerLogs(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId, @Min(value=1L,message="Tail must be at least 1") @Max(value=10000L,message="Tail must not exceed 10000") int tail)
     
    listContainers(boolean showAll)
     
    jakarta.ws.rs.core.Response
    restartContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
     
    jakarta.ws.rs.core.Response
    startContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
     
    jakarta.ws.rs.core.Response
    stopContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
     
    io.smallrye.mutiny.Multi<String>
    streamContainerLogs(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId, boolean follow)
     
    jakarta.ws.rs.core.Response
    updateContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ContainerResource

      public ContainerResource()
  • Method Details

    • listContainers

      @GET public List<ContainerInfoDTO> listContainers(@DefaultValue("false") boolean showAll)
    • restartContainer

      @POST @Path("/{id}/restart") public jakarta.ws.rs.core.Response restartContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
    • startContainer

      @POST @Path("/{id}/start") public jakarta.ws.rs.core.Response startContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
    • stopContainer

      @POST @Path("/{id}/stop") public jakarta.ws.rs.core.Response stopContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
    • updateContainer

      @POST @Path("/{id}/update") public jakarta.ws.rs.core.Response updateContainer(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId)
    • getContainerLogs

      @GET @Path("/{id}/logs") @Produces("text/plain") public String getContainerLogs(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId, @DefaultValue("100") @Min(value=1L,message="Tail must be at least 1") @Max(value=10000L,message="Tail must not exceed 10000") @Min(value=1L,message="Tail must be at least 1") @Max(value=10000L,message="Tail must not exceed 10000") int tail)
    • streamContainerLogs

      @GET @Path("/{id}/logs/stream") @Produces("text/event-stream") @RestStreamElementType("text/plain") public io.smallrye.mutiny.Multi<String> streamContainerLogs(@NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") @NotBlank @Pattern(regexp="^[a-fA-F0-9]{12,64}$",message="Invalid container ID format") String containerId, @DefaultValue("true") boolean follow)