File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,22 @@ public function create(string $app, ?array $data = null): string
60
60
*
61
61
* @param string $name Name of the Brancher node
62
62
* @param array $data Data to be updated
63
+ * @param bool $appendLabels Whether to append labels or to overwrite
63
64
* @return array Updated data
64
65
* @throws HypernodeApiClientException
65
66
* @throws HypernodeApiServerException
66
67
*/
67
- public function update (string $ name , array $ data ): array
68
+ public function update (string $ name , array $ data, bool $ appendLabels = false ): array
68
69
{
69
70
$ url = sprintf (App::V2_BRANCHER_DETAIL_URL , $ name );
71
+
72
+ if ($ appendLabels ) {
73
+ $ originHypernode = substr ($ name , 0 , strrpos ($ name , '- ' ));
74
+ $ existingLabels = $ this ->list ($ originHypernode )[0 ]['labels ' ] ?? [];
75
+ foreach (explode ('& ' , http_build_query ($ existingLabels )) as $ label ) {
76
+ $ data ['labels ' ][] = $ label ;
77
+ }
78
+ }
70
79
71
80
$ response = $ this ->client ->api ->put ($ url , [], json_encode ($ data ));
72
81
You can’t perform that action at this time.
0 commit comments