Skip to content

Commit 0bd6b2d

Browse files
authored
Various cleanups (#370)
1 parent c90a846 commit 0bd6b2d

File tree

8 files changed

+17
-30
lines changed

8 files changed

+17
-30
lines changed

.java-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
21.0

onyxia-api/src/main/java/fr/insee/onyxia/api/configuration/CatalogWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
66
import com.fasterxml.jackson.annotation.JsonProperty;
77
import fr.insee.onyxia.model.catalog.CatalogStatus;
8+
import fr.insee.onyxia.model.helm.Repository;
89
import io.swagger.v3.oas.annotations.media.Schema;
910
import java.util.ArrayList;
1011
import java.util.List;
@@ -15,7 +16,7 @@
1516
public class CatalogWrapper {
1617

1718
@Schema(description = "Catalog")
18-
private fr.insee.onyxia.model.catalog.CatalogWrapper catalog;
19+
private fr.insee.onyxia.model.catalog.CatalogWrapper catalog = new Repository();
1920

2021
@Schema(description = "Catalog id")
2122
private String id;

onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/mylab/MyLabController.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public MyLabController(
5050
"List the services installed in a namespace. With a Kubernetes backend, utilize Helm to list all installed services in a namespace.",
5151
parameters = {
5252
@Parameter(
53-
required = false,
5453
name = "ONYXIA-PROJECT",
5554
description =
5655
"Project associated with the namespace, defaults to user project.",
@@ -62,7 +61,6 @@ public MyLabController(
6261
description = "Generated project id.",
6362
example = "project-id-example")),
6463
@Parameter(
65-
required = false,
6664
name = "groupId",
6765
description = "Deprectated.",
6866
deprecated = true,
@@ -104,7 +102,6 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
104102
"Get the description of an installed service in the namespace. With Kubernetes backend, an installed service can be seen as a Helm chart. Its unique identifier will be the release name on the namespace.",
105103
parameters = {
106104
@Parameter(
107-
required = false,
108105
name = "ONYXIA-PROJECT",
109106
description =
110107
"Project associated with the namespace, defaults to user project.",
@@ -122,7 +119,7 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
122119
in = ParameterIn.QUERY)
123120
})
124121
@GetMapping("/app")
125-
public @ResponseBody Service getApp(
122+
public Service getApp(
126123
@Parameter(hidden = true) Region region,
127124
@Parameter(hidden = true) Project project,
128125
@RequestParam("serviceId") String serviceId)
@@ -140,7 +137,6 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
140137
"Get the logs of a task in an installed service. With Kubernetes backend, it can be seen as the logs of a pod in the service.",
141138
parameters = {
142139
@Parameter(
143-
required = false,
144140
name = "ONYXIA-PROJECT",
145141
description =
146142
"Project associated with the namespace, defaults to user project.",
@@ -163,7 +159,7 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
163159
in = ParameterIn.QUERY)
164160
})
165161
@GetMapping("/app/logs")
166-
public @ResponseBody String getLogs(
162+
public String getLogs(
167163
@Parameter(hidden = true) Region region,
168164
@Parameter(hidden = true) Project project,
169165
@RequestParam("serviceId") String serviceId,
@@ -181,7 +177,6 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
181177
"Delete an installed service launched through Onyxia on the namespace given the path, or delete *ALL* installed services on the namespace on bulk deletes. It will prioritize the bulk parameter.",
182178
parameters = {
183179
@Parameter(
184-
required = false,
185180
name = "ONYXIA-PROJECT",
186181
description =
187182
"Project associated with the namespace, defaults to user project.",
@@ -195,13 +190,11 @@ public Catalogs getMyCatalogs(@Parameter(hidden = true) Region region) {
195190
@Parameter(
196191
name = "path",
197192
description = "Path to the installed service in that namespace.",
198-
required = false,
199193
in = ParameterIn.QUERY),
200194
@Parameter(
201195
name = "bulk",
202196
description =
203197
"Wheather to delete all services in a namespace, if set to true, or to look at path.",
204-
required = false,
205198
in = ParameterIn.QUERY)
206199
})
207200
@DeleteMapping("/app")
@@ -224,7 +217,6 @@ public UninstallService destroyApp(
224217
"Launch a service package through Onyxia in the namespace, given its catalog, package and configurations out of the available services in this Onyxia instance. More information of available catalogs and packages can be found in the public endpoints.",
225218
parameters = {
226219
@Parameter(
227-
required = false,
228220
name = "ONYXIA-PROJECT",
229221
description =
230222
"Project associated with the namespace, defaults to user project.",

onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/mylab/QuotaController.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public QuotaController(KubernetesService kubernetesService, UserProvider userPro
5151
"Obtain both the quota limit for a namespace and the current quota usage, if quota limits are enabled on Onyxia.",
5252
parameters = {
5353
@Parameter(
54-
required = false,
5554
name = "ONYXIA-PROJECT",
5655
description =
5756
"Project associated with the namespace, defaults to user project.",
@@ -97,7 +96,6 @@ public QuotaUsage getQuota(
9796
"Change the quota for a namespace if the quota changing option is enabled.",
9897
parameters = {
9998
@Parameter(
100-
required = false,
10199
name = "ONYXIA-PROJECT",
102100
description =
103101
"Project associated with the namespace, defaults to user project.",
@@ -129,7 +127,6 @@ public void applyQuota(
129127
"Reset the quota for a namespace to the default value if the quota changing option is enabled.",
130128
parameters = {
131129
@Parameter(
132-
required = false,
133130
name = "ONYXIA-PROJECT",
134131
description =
135132
"Project associated with the namespace, defaults to user project.",

onyxia-api/src/main/java/fr/insee/onyxia/api/controller/api/onboarding/OnboardingController.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public OnboardingController(KubernetesService kubernetesService, UserProvider us
4040
"create or replace the namespace of the user or the namespace of a group if the user is in the requested group and the according rbac policies. with the group prefix / user prefix of the region",
4141
parameters = {
4242
@Parameter(
43-
required = false,
4443
name = "ONYXIA-REGION",
4544
description =
4645
"The region used by the user, if not provided default to the first region configured.",
@@ -82,8 +81,7 @@ private void checkPermissions(Region region, OnboardingRequest request)
8281
"Specification on which namespace to create. If group is provided, create a group namespace, otherwise create the user namespace.")
8382
public static class OnboardingRequest {
8483

85-
@Schema(required = false)
86-
private String group;
84+
@Schema private String group;
8785

8886
public String getGroup() {
8987
return group;

onyxia-api/src/main/java/fr/insee/onyxia/api/dao/universe/CatalogLoader.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.apache.commons.compress.compressors.gzip.GzipCompressorInputStream;
2424
import org.slf4j.Logger;
2525
import org.slf4j.LoggerFactory;
26-
import org.springframework.beans.factory.annotation.Autowired;
2726
import org.springframework.beans.factory.annotation.Qualifier;
2827
import org.springframework.core.io.Resource;
2928
import org.springframework.core.io.ResourceLoader;
@@ -35,11 +34,15 @@ public class CatalogLoader {
3534

3635
private static final Logger LOGGER = LoggerFactory.getLogger(CatalogLoader.class);
3736

38-
@Autowired private ResourceLoader resourceLoader;
37+
private final ResourceLoader resourceLoader;
3938

40-
@Autowired
41-
@Qualifier("helm")
42-
private ObjectMapper mapperHelm;
39+
private final ObjectMapper mapperHelm;
40+
41+
public CatalogLoader(
42+
ResourceLoader resourceLoader, @Qualifier("helm") ObjectMapper mapperHelm) {
43+
this.resourceLoader = resourceLoader;
44+
this.mapperHelm = mapperHelm;
45+
}
4346

4447
public void updateCatalog(CatalogWrapper cw) {
4548
LOGGER.info("updating catalog with id :{} and type {}", cw.getId(), cw.getType());

onyxia-model/src/main/java/fr/insee/onyxia/model/catalog/CatalogWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
public abstract class CatalogWrapper {
1111

1212
@Schema(description = "This entries are those from a standard helm repository")
13-
private Map<String, List<Chart>> entries;
13+
private Map<String, List<Chart>> entries = Map.of();
1414

1515
public Optional<Chart> getPackageByName(String name) {
1616
return entries.get(name).stream().findFirst();

onyxia-model/src/main/java/fr/insee/onyxia/model/dto/CreateServiceDTO.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
public class CreateServiceDTO {
99
@Schema(
1010
description = "Catalog where the package of the service is taken from.",
11-
required = false,
1211
defaultValue = "internal")
1312
String catalogId;
1413

@@ -20,21 +19,17 @@ public class CreateServiceDTO {
2019

2120
@Schema(
2221
description =
23-
"Version of the helm package, passe la version dans la création, si pas null",
24-
required = false)
22+
"Version of the helm package, passe la version dans la création, si pas null")
2523
String packageVersion;
2624

27-
@Schema(
28-
description = "A chosen name for the service, si null un nom est généré par helm",
29-
required = false)
25+
@Schema(description = "A chosen name for the service, si null un nom est généré par helm")
3026
String name;
3127

3228
@Schema(description = "Contenu du values.yaml", required = true)
3329
Object options;
3430

3531
@Schema(
3632
description = "when true nothing is run (mode dry run de helm) faux par défaut",
37-
required = false,
3833
defaultValue = "false")
3934
boolean dryRun = false;
4035

0 commit comments

Comments
 (0)