-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Robin Cawser <[email protected]>
- Loading branch information
Showing
35 changed files
with
3,230 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class ChangePassword extends AbstractEndpoint | ||
{ | ||
public function getParamWhitelist(): array | ||
{ | ||
return [ | ||
'current_password', | ||
'password', | ||
]; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
return '/_plugins/_security/api/account'; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Common\Exceptions\RuntimeException; | ||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class CreateActionGroup extends AbstractEndpoint | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $action_group; | ||
|
||
public function getParamWhitelist(): array | ||
{ | ||
return [ | ||
'allowed_actions' | ||
]; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
if (!isset($this->action_group)) { | ||
throw new RuntimeException('Missing parameter for the endpoint security.create_action_group'); | ||
} | ||
|
||
return "/_plugins/_security/api/actiongroups/$this->action_group"; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
|
||
/** | ||
* @param string|null $action_group | ||
* @return CreateActionGroup | ||
*/ | ||
public function setActionGroup(?string $action_group): CreateActionGroup | ||
{ | ||
$this->action_group = $action_group; | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Common\Exceptions\RuntimeException; | ||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class CreateRole extends AbstractEndpoint | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $role; | ||
|
||
public function getParamWhitelist(): array | ||
{ | ||
return [ | ||
'cluster_permissions', | ||
'index_permissions', | ||
'tenant_permissions', | ||
]; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
if (!isset($this->role)) { | ||
throw new RuntimeException('Missing parameter for the endpoint security.create_role'); | ||
} | ||
|
||
return "/_plugins/_security/api/roles/$this->role"; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
|
||
/** | ||
* @param string|null $role | ||
* @return CreateRole | ||
*/ | ||
public function setRole(?string $role): CreateRole | ||
{ | ||
$this->role = $role; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Common\Exceptions\RuntimeException; | ||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class CreateRoleMapping extends AbstractEndpoint | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $role; | ||
|
||
public function getParamWhitelist(): array | ||
{ | ||
return [ | ||
'backend_roles', | ||
'hosts', | ||
'users', | ||
]; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
if (!isset($this->role)) { | ||
throw new RuntimeException('Missing parameter for the endpoint security.create_role_mapping'); | ||
} | ||
|
||
return "/_plugins/_security/api/rolesmapping/$this->role"; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
|
||
/** | ||
* @param string|null $role | ||
* @return CreateRoleMapping | ||
*/ | ||
public function setRole(?string $role): CreateRoleMapping | ||
{ | ||
$this->role = $role; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Common\Exceptions\RuntimeException; | ||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class CreateTenant extends AbstractEndpoint | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $tenant; | ||
|
||
public function getParamWhitelist(): array | ||
{ | ||
return ['description']; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
if (!isset($this->tenant)) { | ||
throw new RuntimeException('Missing parameter for the endpoint security.create_tenant'); | ||
} | ||
|
||
return "/_plugins/_security/api/tenants/$this->tenant"; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
|
||
/** | ||
* @param string|null $tenant | ||
* @return CreateTenant | ||
*/ | ||
public function setTenant(?string $tenant): CreateTenant | ||
{ | ||
$this->tenant = $tenant; | ||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
namespace OpenSearch\Endpoints\Security; | ||
|
||
use OpenSearch\Common\Exceptions\RuntimeException; | ||
use OpenSearch\Endpoints\AbstractEndpoint; | ||
|
||
class CreateUser extends AbstractEndpoint | ||
{ | ||
/** | ||
* @var string|null | ||
*/ | ||
protected $username; | ||
|
||
public function getParamWhitelist(): array | ||
{ | ||
return [ | ||
'password', | ||
'opendistro_security_roles', | ||
'backend_roles', | ||
'attributes', | ||
]; | ||
} | ||
|
||
public function getURI(): string | ||
{ | ||
if (!isset($this->username)) { | ||
throw new RuntimeException('Missing parameter for the endpoint security.create_user'); | ||
} | ||
|
||
return "/_plugins/_security/api/internalusers/$this->username"; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'PUT'; | ||
} | ||
|
||
/** | ||
* @param string|null $username | ||
* @return CreateUser | ||
*/ | ||
public function setUsername(?string $username): CreateUser | ||
{ | ||
$this->username = $username; | ||
return $this; | ||
} | ||
} |
Oops, something went wrong.