@@ -53,7 +53,7 @@ public class MLRegisterModelInput implements ToXContentObject, Writeable {
53
53
public static final String ACCESS_MODE_FIELD = "access_mode" ;
54
54
public static final String BACKEND_ROLES_FIELD = "backend_roles" ;
55
55
public static final String ADD_ALL_BACKEND_ROLES_FIELD = "add_all_backend_roles" ;
56
-
56
+ public static final String DOES_VERSION_CREATE_MODEL_GROUP = "does_version_create_model_group" ;
57
57
private FunctionName functionName ;
58
58
private String modelName ;
59
59
private String modelGroupId ;
@@ -73,6 +73,7 @@ public class MLRegisterModelInput implements ToXContentObject, Writeable {
73
73
private List <String > backendRoles ;
74
74
private Boolean addAllBackendRoles ;
75
75
private AccessMode accessMode ;
76
+ private Boolean doesVersionCreateModelGroup ;
76
77
77
78
@ Builder (toBuilder = true )
78
79
public MLRegisterModelInput (FunctionName functionName ,
@@ -90,7 +91,8 @@ public MLRegisterModelInput(FunctionName functionName,
90
91
String connectorId ,
91
92
List <String > backendRoles ,
92
93
Boolean addAllBackendRoles ,
93
- AccessMode accessMode
94
+ AccessMode accessMode ,
95
+ Boolean doesVersionCreateModelGroup
94
96
) {
95
97
if (functionName == null ) {
96
98
this .functionName = FunctionName .TEXT_EMBEDDING ;
@@ -123,6 +125,7 @@ public MLRegisterModelInput(FunctionName functionName,
123
125
this .backendRoles = backendRoles ;
124
126
this .addAllBackendRoles = addAllBackendRoles ;
125
127
this .accessMode = accessMode ;
128
+ this .doesVersionCreateModelGroup = doesVersionCreateModelGroup ;
126
129
}
127
130
128
131
@@ -157,6 +160,7 @@ public MLRegisterModelInput(StreamInput in) throws IOException {
157
160
if (in .readBoolean ()) {
158
161
this .accessMode = in .readEnum (AccessMode .class );
159
162
}
163
+ this .doesVersionCreateModelGroup = in .readOptionalBoolean ();
160
164
}
161
165
162
166
@ Override
@@ -202,6 +206,7 @@ public void writeTo(StreamOutput out) throws IOException {
202
206
} else {
203
207
out .writeBoolean (false );
204
208
}
209
+ out .writeOptionalBoolean (doesVersionCreateModelGroup );
205
210
}
206
211
207
212
@ Override
@@ -249,6 +254,9 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
249
254
if (accessMode != null ) {
250
255
builder .field (ACCESS_MODE_FIELD , accessMode );
251
256
}
257
+ if (doesVersionCreateModelGroup != null ) {
258
+ builder .field (DOES_VERSION_CREATE_MODEL_GROUP , doesVersionCreateModelGroup );
259
+ }
252
260
builder .endObject ();
253
261
return builder ;
254
262
}
@@ -267,6 +275,7 @@ public static MLRegisterModelInput parse(XContentParser parser, String modelName
267
275
List <String > backendRoles = new ArrayList <>();
268
276
Boolean addAllBackendRoles = null ;
269
277
AccessMode accessMode = null ;
278
+ Boolean doesVersionCreateModelGroup = null ;
270
279
271
280
ensureExpectedToken (XContentParser .Token .START_OBJECT , parser .currentToken (), parser );
272
281
while (parser .nextToken () != XContentParser .Token .END_OBJECT ) {
@@ -318,12 +327,15 @@ public static MLRegisterModelInput parse(XContentParser parser, String modelName
318
327
case ACCESS_MODE_FIELD :
319
328
accessMode = AccessMode .from (parser .text ());
320
329
break ;
330
+ case DOES_VERSION_CREATE_MODEL_GROUP :
331
+ doesVersionCreateModelGroup = parser .booleanValue ();
332
+ break ;
321
333
default :
322
334
parser .skipChildren ();
323
335
break ;
324
336
}
325
337
}
326
- return new MLRegisterModelInput (functionName , modelName , modelGroupId , version , description , url , hashValue , modelFormat , modelConfig , deployModel , modelNodeIds .toArray (new String [0 ]), connector , connectorId , backendRoles , addAllBackendRoles , accessMode );
338
+ return new MLRegisterModelInput (functionName , modelName , modelGroupId , version , description , url , hashValue , modelFormat , modelConfig , deployModel , modelNodeIds .toArray (new String [0 ]), connector , connectorId , backendRoles , addAllBackendRoles , accessMode , doesVersionCreateModelGroup );
327
339
}
328
340
329
341
public static MLRegisterModelInput parse (XContentParser parser , boolean deployModel ) throws IOException {
@@ -342,6 +354,7 @@ public static MLRegisterModelInput parse(XContentParser parser, boolean deployMo
342
354
List <String > backendRoles = new ArrayList <>();
343
355
AccessMode accessMode = null ;
344
356
Boolean addAllBackendRoles = null ;
357
+ Boolean doesVersionCreateModelGroup = null ;
345
358
346
359
ensureExpectedToken (XContentParser .Token .START_OBJECT , parser .currentToken (), parser );
347
360
while (parser .nextToken () != XContentParser .Token .END_OBJECT ) {
@@ -400,11 +413,14 @@ public static MLRegisterModelInput parse(XContentParser parser, boolean deployMo
400
413
case ACCESS_MODE_FIELD :
401
414
accessMode = AccessMode .from (parser .text ());
402
415
break ;
416
+ case DOES_VERSION_CREATE_MODEL_GROUP :
417
+ doesVersionCreateModelGroup = parser .booleanValue ();
418
+ break ;
403
419
default :
404
420
parser .skipChildren ();
405
421
break ;
406
422
}
407
423
}
408
- return new MLRegisterModelInput (functionName , name , modelGroupId , version , description , url , hashValue , modelFormat , modelConfig , deployModel , modelNodeIds .toArray (new String [0 ]), connector , connectorId , backendRoles , addAllBackendRoles , accessMode );
424
+ return new MLRegisterModelInput (functionName , name , modelGroupId , version , description , url , hashValue , modelFormat , modelConfig , deployModel , modelNodeIds .toArray (new String [0 ]), connector , connectorId , backendRoles , addAllBackendRoles , accessMode , doesVersionCreateModelGroup );
409
425
}
410
426
}
0 commit comments