'domainId', 'parent_id' => 'parentId', ]; protected $resourceKey = 'project'; protected $resourcesKey = 'projects'; /** * {@inheritdoc} * * @param array $data {@see \OpenStack\Identity\v3\Api::postProjects} */ public function create(array $data): Creatable { $response = $this->execute($this->api->postProjects(), $data); $this->populateFromResponse($response); return $this; } /** * {@inheritdoc} */ public function retrieve() { $response = $this->executeWithState($this->api->getProject()); $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function update() { $response = $this->executeWithState($this->api->patchProject()); $this->populateFromResponse($response); } /** * {@inheritdoc} */ public function delete() { $this->executeWithState($this->api->deleteProject()); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::getProjectUserRoles} */ public function listUserRoles(array $options = []): \Generator { $options['projectId'] = $this->id; return $this->model(Role::class)->enumerate($this->api->getProjectUserRoles(), $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::putProjectUserRole} */ public function grantUserRole(array $options) { $this->execute($this->api->putProjectUserRole(), ['projectId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::headProjectUserRole} */ public function checkUserRole(array $options): bool { try { $this->execute($this->api->headProjectUserRole(), ['projectId' => $this->id] + $options); return true; } catch (BadResponseError $e) { return false; } } /** * @param array $options {@see \OpenStack\Identity\v3\Api::deleteProjectUserRole} */ public function revokeUserRole(array $options) { $this->execute($this->api->deleteProjectUserRole(), ['projectId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::getProjectGroupRoles} */ public function listGroupRoles(array $options = []): \Generator { $options['projectId'] = $this->id; return $this->model(Role::class)->enumerate($this->api->getProjectGroupRoles(), $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::putProjectGroupRole} */ public function grantGroupRole(array $options) { $this->execute($this->api->putProjectGroupRole(), ['projectId' => $this->id] + $options); } /** * @param array $options {@see \OpenStack\Identity\v3\Api::headProjectGroupRole} */ public function checkGroupRole(array $options): bool { try { $this->execute($this->api->headProjectGroupRole(), ['projectId' => $this->id] + $options); return true; } catch (BadResponseError $e) { return false; } } /** * @param array $options {@see \OpenStack\Identity\v3\Api::deleteProjectGroupRole} */ public function revokeGroupRole(array $options) { $this->execute($this->api->deleteProjectGroupRole(), ['projectId' => $this->id] + $options); } }