execute($this->api->postDomains(), $data); return $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function retrieve() { $response = $this->executeWithState($this->api->getDomain()); $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function update() { $response = $this->executeWithState($this->api->patchDomain()); $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function delete() { $this->executeWithState($this->api->deleteDomain()); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::getUserRoles} */ public function listUserRoles(array $options = []): \Generator { $options['domainId'] = $this->id; return $this->model(Role::class)->enumerate($this->api->getUserRoles(), $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::putUserRoles} */ public function grantUserRole(array $options = []) { $this->execute($this->api->putUserRoles(), ['domainId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::headUserRole} */ public function checkUserRole(array $options = []): bool { try { $this->execute($this->api->headUserRole(), ['domainId' => $this->id] + $options); return true; } catch (BadResponseError $e) { return false; } } /** * @param array $options {@see \OpenStack\Identity\v3\Api::deleteUserRole} */ public function revokeUserRole(array $options = []) { $this->execute($this->api->deleteUserRole(), ['domainId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::getGroupRoles} */ public function listGroupRoles(array $options = []): \Generator { $options['domainId'] = $this->id; return $this->model(Role::class)->enumerate($this->api->getGroupRoles(), $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::putGroupRole} */ public function grantGroupRole(array $options = []) { $this->execute($this->api->putGroupRole(), ['domainId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::headGroupRole} */ public function checkGroupRole(array $options = []): bool { try { $this->execute($this->api->headGroupRole(), ['domainId' => $this->id] + $options); return true; } catch (BadResponseError $e) { return false; } } /** * @param array $options {@see \OpenStack\Identity\v3\Api::deleteGroupRole} */ public function revokeGroupRole(array $options = []) { $this->execute($this->api->deleteGroupRole(), ['domainId' => $this->id] + $options); } }