@@ -172,41 +172,20 @@ public void deleteBlob(ContainerRef containerRef) {
172
172
}
173
173
handleError (response );
174
174
}
175
-
176
- /**
177
- * Upload an ORAS artifact
178
- * @param containerRef The container
179
- * @param paths The paths
180
- * @return The manifest
181
- */
182
- public Manifest pushArtifact (ContainerRef containerRef , Path ... paths ) {
183
- return pushArtifact (containerRef , null , Annotations .empty (), Config .empty (), paths );
184
- }
185
-
186
- /**
187
- * Upload an ORAS artifact
188
- * @param containerRef The container
189
- * @param artifactType The artifact type
190
- * @param paths The paths
191
- * @return The manifest
192
- */
193
- public Manifest pushArtifact (ContainerRef containerRef , String artifactType , Path ... paths ) {
194
- return pushArtifact (containerRef , artifactType , Annotations .empty (), Config .empty (), paths );
195
- }
196
-
197
- /**
198
- * Upload an ORAS artifact
199
- * @param containerRef The container
200
- * @param artifactType The artifact type
201
- * @param annotations The annotations
202
- * @param paths The paths
175
+ /**
176
+ * Push an ORAS artifact using the Builder pattern.
177
+ * @param builder The PushArtifactBuilder containing all configuration
203
178
* @return The manifest
204
179
*/
205
- public Manifest pushArtifact (
206
- ContainerRef containerRef , String artifactType , Annotations annotations , Path ... paths ) {
207
- return pushArtifact (containerRef , artifactType , annotations , Config .empty (), paths );
180
+ public Manifest pushArtifact (PushArtifactBuilder builder ) {
181
+ return pushArtifact (
182
+ builder .containerRef ,
183
+ builder .artifactType ,
184
+ builder .annotations ,
185
+ builder .config ,
186
+ builder .paths
187
+ );
208
188
}
209
-
210
189
/**
211
190
* Download an ORAS artifact
212
191
* @param containerRef The container
@@ -238,6 +217,7 @@ public void pullArtifact(ContainerRef containerRef, Path path, boolean overwrite
238
217
}
239
218
}
240
219
220
+
241
221
/**
242
222
* Upload an ORAS artifact
243
223
* @param containerRef The container
@@ -300,6 +280,46 @@ public Manifest pushArtifact(
300
280
LOG .debug ("Manifest pushed to: {}" , location );
301
281
return manifest ;
302
282
}
283
+ /**
284
+ * Builder class for configuring artifact uploads.
285
+ */
286
+ public static class PushArtifactBuilder {
287
+ private final ContainerRef containerRef ; // Required parameter
288
+ private String artifactType = null ; // Optional parameter
289
+ private Annotations annotations = Annotations .empty (); // Default value
290
+ private Config config = Config .empty (); // Default value
291
+ private Path [] paths ; // Required parameter
292
+
293
+ // Constructor for required fields
294
+ public PushArtifactBuilder (ContainerRef containerRef , Path ... paths ) {
295
+ this .containerRef = containerRef ;
296
+ this .paths = paths ;
297
+ }
298
+
299
+ // Setter for artifact type
300
+ public PushArtifactBuilder withArtifactType (String artifactType ) {
301
+ this .artifactType = artifactType ;
302
+ return this ;
303
+ }
304
+
305
+ // Setter for annotations
306
+ public PushArtifactBuilder withAnnotations (Annotations annotations ) {
307
+ this .annotations = annotations ;
308
+ return this ;
309
+ }
310
+
311
+ // Setter for config
312
+ public PushArtifactBuilder withConfig (Config config ) {
313
+ this .config = config ;
314
+ return this ;
315
+ }
316
+
317
+ // Build method (optional if you just want chaining)
318
+ public PushArtifactBuilder build () {
319
+ return this ;
320
+ }
321
+ }
322
+
303
323
304
324
/**
305
325
* Push a blob from file
0 commit comments