Skip to content

Commit b5c220d

Browse files
thomassagaborigloi
authored andcommitted
CP-24903: Network.purposes field for CLI
In the CLI, the Network object now has a purposes field. The field has accessors get get_set add_to_set remove_from_set Signed-off-by: Thomas Sanders <[email protected]>
1 parent 6a1d68d commit b5c220d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

ocaml/xapi/records.ml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,15 @@ let net_record rpc session_id net =
443443
~get:(fun () -> Record_util.network_default_locking_mode_to_string (x ()).API.network_default_locking_mode)
444444
~set:(fun value -> Client.Network.set_default_locking_mode rpc session_id net
445445
(Record_util.string_to_network_default_locking_mode value)) ();
446+
447+
make_field ~name:"purposes"
448+
~get:(fun () -> (x ()).API.network_purposes |> List.map Record_util.network_purpose_to_string |> (String.concat ", "))
449+
~get_set:(fun () -> (x ()).API.network_purposes |> List.map Record_util.network_purpose_to_string)
450+
~add_to_set:(fun s -> Client.Network.add_purpose rpc session_id net
451+
(Record_util.string_to_network_purpose s))
452+
~remove_from_set:(fun s -> Client.Network.remove_purpose rpc session_id net
453+
(Record_util.string_to_network_purpose s)) ();
454+
446455
]}
447456

448457

0 commit comments

Comments
 (0)