Skip to content

Commit 9e78da6

Browse files
authored
Merge pull request #487 from ecloud-jay2/master
Adds more functionality for the affinity rule members
2 parents cfdc3d2 + 21fd42e commit 9e78da6

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/eCloud/AffinityRuleClient.php

+26
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,30 @@ public function getMembers($id, $filters = [])
5555
}
5656
return $items;
5757
}
58+
59+
/**
60+
* Assigns an instance to a rule
61+
* @param $id
62+
* @param $instanceId
63+
* @return bool
64+
*/
65+
public function assignMember($id, $instanceId)
66+
{
67+
$response = $this->post(
68+
$this->collectionPath . '/' . $id . '/members',
69+
json_encode([ 'instance_id' => $instanceId ])
70+
);
71+
return $response->getStatusCode() == 202;
72+
}
73+
/**
74+
* Detaches an instance from a rule
75+
* @param $id
76+
* @param $memberId
77+
* @return bool
78+
*/
79+
public function detachMember($id, $memberId)
80+
{
81+
$response = $this->delete($this->collectionPath . '/' . $id . '/members/' . $memberId);
82+
return $response->getStatusCode() == 202;
83+
}
5884
}

0 commit comments

Comments
 (0)