From a6d8fd287f9e4213011bd986bfa0c1fe1f898d55 Mon Sep 17 00:00:00 2001 From: saimedhi Date: Tue, 9 Jul 2024 15:38:42 -0700 Subject: [PATCH] Generated SecurityNamespace Endpoints Using OpenSearch API Specifications Signed-off-by: saimedhi --- .../Endpoints/Security/Authinfo.php | 47 + .../Endpoints/Security/Authtoken.php | 45 + .../Security/{GetAccount.php => Cache.php} | 19 +- .../Endpoints/Security/ChangePassword.php | 28 +- .../Endpoints/Security/ConfigUpgradeCheck.php | 45 + .../Security/ConfigUpgradePerform.php | 55 + .../Endpoints/Security/CreateActionGroup.php | 49 +- .../Endpoints/Security/CreateAllowlist.php | 55 + .../Endpoints/Security/CreateRole.php | 52 +- .../Endpoints/Security/CreateRoleMapping.php | 52 +- .../Endpoints/Security/CreateTenant.php | 50 +- .../Security/CreateUpdateTenancyConfig.php | 55 + .../Endpoints/Security/CreateUser.php | 53 +- .../Endpoints/Security/CreateUserLegacy.php | 74 + .../Endpoints/Security/DeleteActionGroup.php | 40 +- ...dNames.php => DeleteDistinguishedName.php} | 46 +- .../Security/DeleteDistinguishedNames.php | 56 - .../Endpoints/Security/DeleteRole.php | 40 +- .../Endpoints/Security/DeleteRoleMapping.php | 40 +- .../Endpoints/Security/DeleteTenant.php | 40 +- .../Endpoints/Security/DeleteUser.php | 40 +- .../Endpoints/Security/DeleteUserLegacy.php | 64 + .../Endpoints/Security/FlushCache.php | 17 +- .../Endpoints/Security/GenerateOboToken.php | 55 + .../Endpoints/Security/GenerateUserToken.php | 64 + .../Security/GenerateUserTokenLegacy.php | 64 + .../Endpoints/Security/GetAccountDetails.php | 45 + .../Endpoints/Security/GetActionGroup.php | 64 + .../Endpoints/Security/GetActionGroups.php | 32 +- .../Endpoints/Security/GetAllowlist.php | 45 + .../Security/GetAuditConfiguration.php | 45 + .../Endpoints/Security/GetCertificates.php | 17 +- .../{PatchConfig.php => GetConfiguration.php} | 21 +- .../Endpoints/Security/GetDashboardsInfo.php | 45 + .../Security/GetDistinguishedName.php | 65 + .../Security/GetDistinguishedNames.php | 33 +- .../Endpoints/Security/GetPermissionsInfo.php | 45 + src/OpenSearch/Endpoints/Security/GetRole.php | 64 + .../Endpoints/Security/GetRoleMapping.php | 64 + .../Endpoints/Security/GetRoleMappings.php | 32 +- .../Endpoints/Security/GetRoles.php | 32 +- .../Endpoints/Security/GetSslinfo.php | 46 + .../Endpoints/Security/GetTenancyConfig.php | 45 + .../Endpoints/Security/GetTenant.php | 64 + .../Endpoints/Security/GetTenants.php | 32 +- src/OpenSearch/Endpoints/Security/GetUser.php | 64 + .../Endpoints/Security/GetUserLegacy.php | 64 + .../Endpoints/Security/GetUsers.php | 32 +- .../Endpoints/Security/GetUsersLegacy.php | 45 + src/OpenSearch/Endpoints/Security/Health.php | 18 +- src/OpenSearch/Endpoints/Security/Migrate.php | 45 + .../Endpoints/Security/PatchActionGroup.php | 74 + .../Endpoints/Security/PatchActionGroups.php | 34 +- .../Endpoints/Security/PatchAllowlist.php | 55 + .../Security/PatchAuditConfiguration.php | 55 + .../Endpoints/Security/PatchConfiguration.php | 55 + .../Security/PatchDistinguishedName.php | 74 + .../Security/PatchDistinguishedNames.php | 55 + .../Endpoints/Security/PatchRole.php | 74 + .../Endpoints/Security/PatchRoleMapping.php | 74 + .../Endpoints/Security/PatchRoleMappings.php | 34 +- .../Endpoints/Security/PatchRoles.php | 34 +- .../Endpoints/Security/PatchTenant.php | 74 + .../Endpoints/Security/PatchTenants.php | 34 +- .../Endpoints/Security/PatchUser.php | 74 + .../Endpoints/Security/PatchUsers.php | 35 +- .../Endpoints/Security/PostDashboardsInfo.php | 55 + .../Security/ReloadHttpCertificates.php | 45 + .../Security/ReloadTransportCertificates.php | 45 + .../{GetConfig.php => TenantInfo.php} | 19 +- .../Security/UpdateAuditConfiguration.php | 55 + .../Security/UpdateConfiguration.php | 55 + .../Security/UpdateDistinguishedName.php | 74 + .../Endpoints/Security/Validate.php | 46 + .../Security/{UpdateConfig.php => WhoAmI.php} | 23 +- .../Endpoints/Security/WhoAmIProtected.php | 45 + .../Namespaces/SecurityNamespace.php | 1736 +++++++++++++++-- tests/Namespaces/SecurityNamespaceTest.php | 389 +++- .../createPointInTimeProxy.php | 16 +- .../deletePointInTimeProxy.php | 16 +- .../indices/getAliasesProxy.php | 20 +- .../security/changePasswordProxy.php | 58 +- .../security/createRoleMappingProxy.php | 68 +- .../security/createRoleProxy.php | 68 +- .../security/createTenantProxy.php | 60 +- .../security/createUserProxy.php | 2 +- .../deleteDistinguishedNamesProxy.php | 16 +- .../security/getAccountProxy.php | 16 +- .../security/getActionGroupsProxy.php | 53 +- .../security/getConfigProxy.php | 16 +- .../security/getDistinguishedNamesProxy.php | 4 +- .../security/getRoleMappingsProxy.php | 4 +- .../security/getRolesProxy.php | 4 +- .../security/getTenantsProxy.php | 4 +- .../security/getUsersProxy.php | 4 +- .../security/patchActionGroupsProxy.php | 6 +- .../security/patchConfigProxy.php | 22 +- .../security/patchRoleMappingsProxy.php | 4 +- .../security/patchRolesProxy.php | 4 +- .../security/patchTenantsProxy.php | 4 +- .../security/patchUsersProxy.php | 4 +- .../security/updateConfigProxy.php | 20 +- .../updateDistinguishedNamesProxy.php | 18 +- util/EndpointProxies/tasks/tasksListProxy.php | 14 +- 104 files changed, 5363 insertions(+), 933 deletions(-) create mode 100644 src/OpenSearch/Endpoints/Security/Authinfo.php create mode 100644 src/OpenSearch/Endpoints/Security/Authtoken.php rename src/OpenSearch/Endpoints/Security/{GetAccount.php => Cache.php} (66%) create mode 100644 src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php create mode 100644 src/OpenSearch/Endpoints/Security/ConfigUpgradePerform.php create mode 100644 src/OpenSearch/Endpoints/Security/CreateAllowlist.php create mode 100644 src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php create mode 100644 src/OpenSearch/Endpoints/Security/CreateUserLegacy.php rename src/OpenSearch/Endpoints/Security/{UpdateDistinguishedNames.php => DeleteDistinguishedName.php} (52%) delete mode 100644 src/OpenSearch/Endpoints/Security/DeleteDistinguishedNames.php create mode 100644 src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php create mode 100644 src/OpenSearch/Endpoints/Security/GenerateOboToken.php create mode 100644 src/OpenSearch/Endpoints/Security/GenerateUserToken.php create mode 100644 src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php create mode 100644 src/OpenSearch/Endpoints/Security/GetAccountDetails.php create mode 100644 src/OpenSearch/Endpoints/Security/GetActionGroup.php create mode 100644 src/OpenSearch/Endpoints/Security/GetAllowlist.php create mode 100644 src/OpenSearch/Endpoints/Security/GetAuditConfiguration.php rename src/OpenSearch/Endpoints/Security/{PatchConfig.php => GetConfiguration.php} (68%) create mode 100644 src/OpenSearch/Endpoints/Security/GetDashboardsInfo.php create mode 100644 src/OpenSearch/Endpoints/Security/GetDistinguishedName.php create mode 100644 src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php create mode 100644 src/OpenSearch/Endpoints/Security/GetRole.php create mode 100644 src/OpenSearch/Endpoints/Security/GetRoleMapping.php create mode 100644 src/OpenSearch/Endpoints/Security/GetSslinfo.php create mode 100644 src/OpenSearch/Endpoints/Security/GetTenancyConfig.php create mode 100644 src/OpenSearch/Endpoints/Security/GetTenant.php create mode 100644 src/OpenSearch/Endpoints/Security/GetUser.php create mode 100644 src/OpenSearch/Endpoints/Security/GetUserLegacy.php create mode 100644 src/OpenSearch/Endpoints/Security/GetUsersLegacy.php create mode 100644 src/OpenSearch/Endpoints/Security/Migrate.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchActionGroup.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchAllowlist.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchConfiguration.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchRole.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchRoleMapping.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchTenant.php create mode 100644 src/OpenSearch/Endpoints/Security/PatchUser.php create mode 100644 src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php create mode 100644 src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php create mode 100644 src/OpenSearch/Endpoints/Security/ReloadTransportCertificates.php rename src/OpenSearch/Endpoints/Security/{GetConfig.php => TenantInfo.php} (65%) create mode 100644 src/OpenSearch/Endpoints/Security/UpdateAuditConfiguration.php create mode 100644 src/OpenSearch/Endpoints/Security/UpdateConfiguration.php create mode 100644 src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php create mode 100644 src/OpenSearch/Endpoints/Security/Validate.php rename src/OpenSearch/Endpoints/Security/{UpdateConfig.php => WhoAmI.php} (66%) create mode 100644 src/OpenSearch/Endpoints/Security/WhoAmIProtected.php diff --git a/src/OpenSearch/Endpoints/Security/Authinfo.php b/src/OpenSearch/Endpoints/Security/Authinfo.php new file mode 100644 index 000000000..617b53c7b --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/Authinfo.php @@ -0,0 +1,47 @@ +body = $body; + + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php b/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php new file mode 100644 index 000000000..7f105c3d1 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/ConfigUpgradeCheck.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/CreateActionGroup.php b/src/OpenSearch/Endpoints/Security/CreateActionGroup.php index 1b3c32562..22424f366 100644 --- a/src/OpenSearch/Endpoints/Security/CreateActionGroup.php +++ b/src/OpenSearch/Endpoints/Security/CreateActionGroup.php @@ -18,40 +18,55 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class CreateActionGroup extends AbstractEndpoint { - /** - * @var string|null - */ protected $action_group; + public function getURI(): string + { + if (isset($this->action_group) !== true) { + throw new RuntimeException( + 'action_group is required for create_action_group' + ); + } + $action_group = $this->action_group; + return "/_plugins/_security/api/actiongroups/$action_group"; + } + public function getParamWhitelist(): array { return [ - 'allowed_actions' + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } - public function getURI(): string + public function getMethod(): 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"; + return 'PUT'; } - public function getMethod(): string + public function setBody($body): CreateActionGroup { - return 'PUT'; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; } - /** - * @param string|null $action_group - * @return CreateActionGroup - */ - public function setActionGroup(?string $action_group): CreateActionGroup + public function setActionGroup($action_group): CreateActionGroup { + if (isset($action_group) !== true) { + return $this; + } $this->action_group = $action_group; return $this; diff --git a/src/OpenSearch/Endpoints/Security/CreateAllowlist.php b/src/OpenSearch/Endpoints/Security/CreateAllowlist.php new file mode 100644 index 000000000..7562eb98d --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/CreateAllowlist.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/CreateRole.php b/src/OpenSearch/Endpoints/Security/CreateRole.php index b53a94e15..7402b3e95 100644 --- a/src/OpenSearch/Endpoints/Security/CreateRole.php +++ b/src/OpenSearch/Endpoints/Security/CreateRole.php @@ -18,43 +18,57 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class CreateRole extends AbstractEndpoint { - /** - * @var string|null - */ protected $role; + public function getURI(): string + { + if (isset($this->role) !== true) { + throw new RuntimeException( + 'role is required for create_role' + ); + } + $role = $this->role; + return "/_plugins/_security/api/roles/$role"; + } + public function getParamWhitelist(): array { return [ - 'cluster_permissions', - 'index_permissions', - 'tenant_permissions', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } - public function getURI(): string + public function getMethod(): string { - if (!isset($this->role)) { - throw new RuntimeException('Missing parameter for the endpoint security.create_role'); - } - - return "/_plugins/_security/api/roles/$this->role"; + return 'PUT'; } - public function getMethod(): string + public function setBody($body): CreateRole { - return 'PUT'; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; } - /** - * @param string|null $role - * @return CreateRole - */ - public function setRole(?string $role): CreateRole + public function setRole($role): CreateRole { + if (isset($role) !== true) { + return $this; + } $this->role = $role; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php b/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php index a138d6d1d..6fcd61b92 100644 --- a/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php +++ b/src/OpenSearch/Endpoints/Security/CreateRoleMapping.php @@ -18,43 +18,57 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class CreateRoleMapping extends AbstractEndpoint { - /** - * @var string|null - */ protected $role; + public function getURI(): string + { + if (isset($this->role) !== true) { + throw new RuntimeException( + 'role is required for create_role_mapping' + ); + } + $role = $this->role; + return "/_plugins/_security/api/rolesmapping/$role"; + } + public function getParamWhitelist(): array { return [ - 'backend_roles', - 'hosts', - 'users', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } - public function getURI(): string + public function getMethod(): string { - if (!isset($this->role)) { - throw new RuntimeException('Missing parameter for the endpoint security.create_role_mapping'); - } - - return "/_plugins/_security/api/rolesmapping/$this->role"; + return 'PUT'; } - public function getMethod(): string + public function setBody($body): CreateRoleMapping { - return 'PUT'; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; } - /** - * @param string|null $role - * @return CreateRoleMapping - */ - public function setRole(?string $role): CreateRoleMapping + public function setRole($role): CreateRoleMapping { + if (isset($role) !== true) { + return $this; + } $this->role = $role; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/CreateTenant.php b/src/OpenSearch/Endpoints/Security/CreateTenant.php index 99da6088b..54ce0ee09 100644 --- a/src/OpenSearch/Endpoints/Security/CreateTenant.php +++ b/src/OpenSearch/Endpoints/Security/CreateTenant.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ 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'); + if (isset($this->tenant) !== true) { + throw new RuntimeException( + 'tenant is required for create_tenant' + ); } + $tenant = $this->tenant; + return "/_plugins/_security/api/tenants/$tenant"; + } - return "/_plugins/_security/api/tenants/$this->tenant"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,23 @@ public function getMethod(): string return 'PUT'; } - /** - * @param string|null $tenant - * @return CreateTenant - */ - public function setTenant(?string $tenant): CreateTenant + public function setBody($body): CreateTenant { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTenant($tenant): CreateTenant + { + if (isset($tenant) !== true) { + return $this; + } $this->tenant = $tenant; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php b/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php new file mode 100644 index 000000000..3d60632f4 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/CreateUpdateTenancyConfig.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/CreateUser.php b/src/OpenSearch/Endpoints/Security/CreateUser.php index d6990bc13..b69347047 100644 --- a/src/OpenSearch/Endpoints/Security/CreateUser.php +++ b/src/OpenSearch/Endpoints/Security/CreateUser.php @@ -18,44 +18,57 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class CreateUser extends AbstractEndpoint { - /** - * @var string|null - */ protected $username; + public function getURI(): string + { + if (isset($this->username) !== true) { + throw new RuntimeException( + 'username is required for create_user' + ); + } + $username = $this->username; + return "/_plugins/_security/api/internalusers/$username"; + } + public function getParamWhitelist(): array { return [ - 'password', - 'opendistro_security_roles', - 'backend_roles', - 'attributes', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' ]; } - public function getURI(): string + public function getMethod(): string { - if (!isset($this->username)) { - throw new RuntimeException('Missing parameter for the endpoint security.create_user'); - } - - return "/_plugins/_security/api/internalusers/$this->username"; + return 'PUT'; } - public function getMethod(): string + public function setBody($body): CreateUser { - return 'PUT'; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; } - /** - * @param string|null $username - * @return CreateUser - */ - public function setUsername(?string $username): CreateUser + public function setUsername($username): CreateUser { + if (isset($username) !== true) { + return $this; + } $this->username = $username; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php b/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php new file mode 100644 index 000000000..e3f5ea21e --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/CreateUserLegacy.php @@ -0,0 +1,74 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for create_user_legacy' + ); + } + $username = $this->username; + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): CreateUserLegacy + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setUsername($username): CreateUserLegacy + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php b/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php index 412901f5e..4257f964c 100644 --- a/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php +++ b/src/OpenSearch/Endpoints/Security/DeleteActionGroup.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeleteActionGroup extends AbstractEndpoint { - /** - * @var string|null - */ protected $action_group; - public function getParamWhitelist(): array - { - return []; - } - public function getURI(): string { - if (!isset($this->action_group)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_action_group'); + if (isset($this->action_group) !== true) { + throw new RuntimeException( + 'action_group is required for delete_action_group' + ); } + $action_group = $this->action_group; + return "/_plugins/_security/api/actiongroups/$action_group"; + } - return "/_plugins/_security/api/actiongroups/$this->action_group"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,13 @@ public function getMethod(): string return 'DELETE'; } - /** - * @param string|null $action_group - * @return DeleteActionGroup - */ - public function setActionGroup(?string $action_group): DeleteActionGroup + public function setActionGroup($action_group): DeleteActionGroup { + if (isset($action_group) !== true) { + return $this; + } $this->action_group = $action_group; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/UpdateDistinguishedNames.php b/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php similarity index 52% rename from src/OpenSearch/Endpoints/Security/UpdateDistinguishedNames.php rename to src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php index bbcaabba8..8e8920729 100644 --- a/src/OpenSearch/Endpoints/Security/UpdateDistinguishedNames.php +++ b/src/OpenSearch/Endpoints/Security/DeleteDistinguishedName.php @@ -18,41 +18,47 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; -class UpdateDistinguishedNames extends AbstractEndpoint +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ +class DeleteDistinguishedName extends AbstractEndpoint { - /** - * @var string|null - */ protected $cluster_name; - public function getParamWhitelist(): array - { - return [ - 'nodes_dn', - ]; - } - public function getURI(): string { - if (!isset($this->cluster_name)) { - throw new RuntimeException('Missing parameter for the endpoint security.update_distinguished_names'); + if (isset($this->cluster_name) !== true) { + throw new RuntimeException( + 'cluster_name is required for delete_distinguished_name' + ); } + $cluster_name = $this->cluster_name; + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } - return "/_plugins/_security/api/nodesdn/{$this->cluster_name}"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { - return 'PUT'; + return 'DELETE'; } - /** - * @param string|null $cluster_name - * @return UpdateDistinguishedNames - */ - public function setClusterName(?string $cluster_name): UpdateDistinguishedNames + public function setClusterName($cluster_name): DeleteDistinguishedName { + if (isset($cluster_name) !== true) { + return $this; + } $this->cluster_name = $cluster_name; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/DeleteDistinguishedNames.php b/src/OpenSearch/Endpoints/Security/DeleteDistinguishedNames.php deleted file mode 100644 index 38bc2a2d0..000000000 --- a/src/OpenSearch/Endpoints/Security/DeleteDistinguishedNames.php +++ /dev/null @@ -1,56 +0,0 @@ -cluster_name)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_distinguished_names'); - } - - return "/_plugins/_security/api/nodesdn/$this->cluster_name"; - } - - public function getMethod(): string - { - return 'DELETE'; - } - - /** - * @param string|null $cluster_name - * @return DeleteDistinguishedNames - */ - public function setClusterName(?string $cluster_name): DeleteDistinguishedNames - { - $this->cluster_name = $cluster_name; - return $this; - } -} diff --git a/src/OpenSearch/Endpoints/Security/DeleteRole.php b/src/OpenSearch/Endpoints/Security/DeleteRole.php index 6d1824bb6..cea84504d 100644 --- a/src/OpenSearch/Endpoints/Security/DeleteRole.php +++ b/src/OpenSearch/Endpoints/Security/DeleteRole.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeleteRole extends AbstractEndpoint { - /** - * @var string|null - */ protected $role; - public function getParamWhitelist(): array - { - return []; - } - public function getURI(): string { - if (!isset($this->role)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_role'); + if (isset($this->role) !== true) { + throw new RuntimeException( + 'role is required for delete_role' + ); } + $role = $this->role; + return "/_plugins/_security/api/roles/$role"; + } - return "/_plugins/_security/api/roles/$this->role"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,13 @@ public function getMethod(): string return 'DELETE'; } - /** - * @param string|null $role - * @return DeleteRole - */ - public function setRole(?string $role): DeleteRole + public function setRole($role): DeleteRole { + if (isset($role) !== true) { + return $this; + } $this->role = $role; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php b/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php index 81d237c48..d1ec1f134 100644 --- a/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php +++ b/src/OpenSearch/Endpoints/Security/DeleteRoleMapping.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeleteRoleMapping extends AbstractEndpoint { - /** - * @var string|null - */ protected $role; - public function getParamWhitelist(): array - { - return []; - } - public function getURI(): string { - if (!isset($this->role)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_role_mapping'); + if (isset($this->role) !== true) { + throw new RuntimeException( + 'role is required for delete_role_mapping' + ); } + $role = $this->role; + return "/_plugins/_security/api/rolesmapping/$role"; + } - return "/_plugins/_security/api/rolesmapping/$this->role"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,13 @@ public function getMethod(): string return 'DELETE'; } - /** - * @param string|null $role - * @return DeleteRoleMapping - */ - public function setRole(?string $role): DeleteRoleMapping + public function setRole($role): DeleteRoleMapping { + if (isset($role) !== true) { + return $this; + } $this->role = $role; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/DeleteTenant.php b/src/OpenSearch/Endpoints/Security/DeleteTenant.php index 81b3b9495..be3a5d840 100644 --- a/src/OpenSearch/Endpoints/Security/DeleteTenant.php +++ b/src/OpenSearch/Endpoints/Security/DeleteTenant.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeleteTenant extends AbstractEndpoint { - /** - * @var string|null - */ protected $tenant; - public function getParamWhitelist(): array - { - return []; - } - public function getURI(): string { - if (!isset($this->tenant)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_tenant'); + if (isset($this->tenant) !== true) { + throw new RuntimeException( + 'tenant is required for delete_tenant' + ); } + $tenant = $this->tenant; + return "/_plugins/_security/api/tenants/$tenant"; + } - return "/_plugins/_security/api/tenants/$this->tenant"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,13 @@ public function getMethod(): string return 'DELETE'; } - /** - * @param string|null $tenant - * @return DeleteTenant - */ - public function setTenant(?string $tenant): DeleteTenant + public function setTenant($tenant): DeleteTenant { + if (isset($tenant) !== true) { + return $this; + } $this->tenant = $tenant; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/DeleteUser.php b/src/OpenSearch/Endpoints/Security/DeleteUser.php index b5b6580d9..639dc4a99 100644 --- a/src/OpenSearch/Endpoints/Security/DeleteUser.php +++ b/src/OpenSearch/Endpoints/Security/DeleteUser.php @@ -18,25 +18,33 @@ use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class DeleteUser extends AbstractEndpoint { - /** - * @var string|null - */ protected $username; - public function getParamWhitelist(): array - { - return []; - } - public function getURI(): string { - if (!isset($this->username)) { - throw new RuntimeException('Missing parameter for the endpoint security.delete_user'); + if (isset($this->username) !== true) { + throw new RuntimeException( + 'username is required for delete_user' + ); } + $username = $this->username; + return "/_plugins/_security/api/internalusers/$username"; + } - return "/_plugins/_security/api/internalusers/$this->username"; + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -44,13 +52,13 @@ public function getMethod(): string return 'DELETE'; } - /** - * @param string|null $username - * @return DeleteUser - */ - public function setUsername(?string $username): DeleteUser + public function setUsername($username): DeleteUser { + if (isset($username) !== true) { + return $this; + } $this->username = $username; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php b/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php new file mode 100644 index 000000000..590494f46 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/DeleteUserLegacy.php @@ -0,0 +1,64 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for delete_user_legacy' + ); + } + $username = $this->username; + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'DELETE'; + } + + public function setUsername($username): DeleteUserLegacy + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/FlushCache.php b/src/OpenSearch/Endpoints/Security/FlushCache.php index 834d082e5..b1ad5705e 100644 --- a/src/OpenSearch/Endpoints/Security/FlushCache.php +++ b/src/OpenSearch/Endpoints/Security/FlushCache.php @@ -17,16 +17,25 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class FlushCache extends AbstractEndpoint { - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/cache"; } - public function getURI(): string + public function getParamWhitelist(): array { - return "/_plugins/_security/api/cache"; + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string diff --git a/src/OpenSearch/Endpoints/Security/GenerateOboToken.php b/src/OpenSearch/Endpoints/Security/GenerateOboToken.php new file mode 100644 index 000000000..d9855ae2b --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GenerateOboToken.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GenerateUserToken.php b/src/OpenSearch/Endpoints/Security/GenerateUserToken.php new file mode 100644 index 000000000..476d259df --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GenerateUserToken.php @@ -0,0 +1,64 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for generate_user_token' + ); + } + $username = $this->username; + return "/_plugins/_security/api/internalusers/$username/authtoken"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setUsername($username): GenerateUserToken + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php b/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php new file mode 100644 index 000000000..b62ecc6e8 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GenerateUserTokenLegacy.php @@ -0,0 +1,64 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for generate_user_token_legacy' + ); + } + $username = $this->username; + return "/_plugins/_security/api/user/$username/authtoken"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function setUsername($username): GenerateUserTokenLegacy + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetAccountDetails.php b/src/OpenSearch/Endpoints/Security/GetAccountDetails.php new file mode 100644 index 000000000..4deb6f174 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetAccountDetails.php @@ -0,0 +1,45 @@ +action_group) !== true) { + throw new RuntimeException( + 'action_group is required for get_action_group' + ); + } + $action_group = $this->action_group; + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setActionGroup($action_group): GetActionGroup + { + if (isset($action_group) !== true) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetActionGroups.php b/src/OpenSearch/Endpoints/Security/GetActionGroups.php index e1fc67d56..9249fc6df 100644 --- a/src/OpenSearch/Endpoints/Security/GetActionGroups.php +++ b/src/OpenSearch/Endpoints/Security/GetActionGroups.php @@ -17,35 +17,29 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetActionGroups extends AbstractEndpoint { - /** - * @var string|null - */ - protected $action_group; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/actiongroups"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/actiongroups' . ($this->action_group ? "/{$this->action_group}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $action_group - * @return GetActionGroups - */ - public function setActionGroup(?string $action_group): GetActionGroups - { - $this->action_group = $action_group; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetAllowlist.php b/src/OpenSearch/Endpoints/Security/GetAllowlist.php new file mode 100644 index 000000000..a2c5532e7 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetAllowlist.php @@ -0,0 +1,45 @@ +cluster_name) !== true) { + throw new RuntimeException( + 'cluster_name is required for get_distinguished_name' + ); + } + $cluster_name = $this->cluster_name; + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'show_all', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setClusterName($cluster_name): GetDistinguishedName + { + if (isset($cluster_name) !== true) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php b/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php index cb009649b..1ce83583a 100644 --- a/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php +++ b/src/OpenSearch/Endpoints/Security/GetDistinguishedNames.php @@ -17,35 +17,30 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetDistinguishedNames extends AbstractEndpoint { - /** - * @var string|null - */ - protected $cluster_name; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/nodesdn"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/nodesdn' . ($this->cluster_name ? "/{$this->cluster_name}" : ''); + return [ + 'show_all', + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $cluster_name - * @return GetDistinguishedNames - */ - public function setClusterName(?string $cluster_name): GetDistinguishedNames - { - $this->cluster_name = $cluster_name; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php b/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php new file mode 100644 index 000000000..3be1a3bba --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetPermissionsInfo.php @@ -0,0 +1,45 @@ +role) !== true) { + throw new RuntimeException( + 'role is required for get_role' + ); + } + $role = $this->role; + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRole($role): GetRole + { + if (isset($role) !== true) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetRoleMapping.php b/src/OpenSearch/Endpoints/Security/GetRoleMapping.php new file mode 100644 index 000000000..34656ac79 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetRoleMapping.php @@ -0,0 +1,64 @@ +role) !== true) { + throw new RuntimeException( + 'role is required for get_role_mapping' + ); + } + $role = $this->role; + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setRole($role): GetRoleMapping + { + if (isset($role) !== true) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetRoleMappings.php b/src/OpenSearch/Endpoints/Security/GetRoleMappings.php index a260ec995..82ebfbfd2 100644 --- a/src/OpenSearch/Endpoints/Security/GetRoleMappings.php +++ b/src/OpenSearch/Endpoints/Security/GetRoleMappings.php @@ -17,35 +17,29 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetRoleMappings extends AbstractEndpoint { - /** - * @var string|null - */ - protected $role; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/rolesmapping"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/rolesmapping' . ($this->role ? "/{$this->role}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $role - * @return GetRoleMappings - */ - public function setRole(?string $role): GetRoleMappings - { - $this->role = $role; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetRoles.php b/src/OpenSearch/Endpoints/Security/GetRoles.php index 3ad4acce1..580daac95 100644 --- a/src/OpenSearch/Endpoints/Security/GetRoles.php +++ b/src/OpenSearch/Endpoints/Security/GetRoles.php @@ -17,35 +17,29 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetRoles extends AbstractEndpoint { - /** - * @var string|null - */ - protected $role; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/roles"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/roles' . ($this->role ? "/{$this->role}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $role - * @return GetRoles - */ - public function setRole(?string $role): GetRoles - { - $this->role = $role; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetSslinfo.php b/src/OpenSearch/Endpoints/Security/GetSslinfo.php new file mode 100644 index 000000000..7b52bca65 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetSslinfo.php @@ -0,0 +1,46 @@ +tenant) !== true) { + throw new RuntimeException( + 'tenant is required for get_tenant' + ); + } + $tenant = $this->tenant; + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setTenant($tenant): GetTenant + { + if (isset($tenant) !== true) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetTenants.php b/src/OpenSearch/Endpoints/Security/GetTenants.php index 9a2487978..f7c9daf85 100644 --- a/src/OpenSearch/Endpoints/Security/GetTenants.php +++ b/src/OpenSearch/Endpoints/Security/GetTenants.php @@ -17,35 +17,29 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetTenants extends AbstractEndpoint { - /** - * @var string|null - */ - protected $tenant; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/tenants"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/tenants' . ($this->tenant ? "/{$this->tenant}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $tenant - * @return GetTenants - */ - public function setTenant(?string $tenant): GetTenants - { - $this->tenant = $tenant; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetUser.php b/src/OpenSearch/Endpoints/Security/GetUser.php new file mode 100644 index 000000000..71616462f --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetUser.php @@ -0,0 +1,64 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for get_user' + ); + } + $username = $this->username; + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setUsername($username): GetUser + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetUserLegacy.php b/src/OpenSearch/Endpoints/Security/GetUserLegacy.php new file mode 100644 index 000000000..285bb3535 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetUserLegacy.php @@ -0,0 +1,64 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for get_user_legacy' + ); + } + $username = $this->username; + return "/_plugins/_security/api/user/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function setUsername($username): GetUserLegacy + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/GetUsers.php b/src/OpenSearch/Endpoints/Security/GetUsers.php index a3d64269e..abd54cfe2 100644 --- a/src/OpenSearch/Endpoints/Security/GetUsers.php +++ b/src/OpenSearch/Endpoints/Security/GetUsers.php @@ -17,35 +17,29 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class GetUsers extends AbstractEndpoint { - /** - * @var string|null - */ - protected $username; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/internalusers"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/internalusers' . ($this->username ? "/{$this->username}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string { return 'GET'; } - - /** - * @param string|null $username - * @return GetUsers - */ - public function setUsername(?string $username): GetUsers - { - $this->username = $username; - return $this; - } } diff --git a/src/OpenSearch/Endpoints/Security/GetUsersLegacy.php b/src/OpenSearch/Endpoints/Security/GetUsersLegacy.php new file mode 100644 index 000000000..e426be497 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/GetUsersLegacy.php @@ -0,0 +1,45 @@ +action_group) !== true) { + throw new RuntimeException( + 'action_group is required for patch_action_group' + ); + } + $action_group = $this->action_group; + return "/_plugins/_security/api/actiongroups/$action_group"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchActionGroup + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setActionGroup($action_group): PatchActionGroup + { + if (isset($action_group) !== true) { + return $this; + } + $this->action_group = $action_group; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchActionGroups.php b/src/OpenSearch/Endpoints/Security/PatchActionGroups.php index e7a03033a..1934ff7bb 100644 --- a/src/OpenSearch/Endpoints/Security/PatchActionGroups.php +++ b/src/OpenSearch/Endpoints/Security/PatchActionGroups.php @@ -17,21 +17,25 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class PatchActionGroups extends AbstractEndpoint { - /** - * @var string|null - */ - protected $action_group; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/actiongroups"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/actiongroups' . ($this->action_group ? "/{$this->action_group}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -39,13 +43,13 @@ public function getMethod(): string return 'PATCH'; } - /** - * @param string|null $action_group - * @return PatchActionGroups - */ - public function setActionGroup(?string $action_group): PatchActionGroups + public function setBody($body): PatchActionGroups { - $this->action_group = $action_group; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/PatchAllowlist.php b/src/OpenSearch/Endpoints/Security/PatchAllowlist.php new file mode 100644 index 000000000..1bf9c04fb --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchAllowlist.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php b/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php new file mode 100644 index 000000000..b20b9d438 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchAuditConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchConfiguration.php b/src/OpenSearch/Endpoints/Security/PatchConfiguration.php new file mode 100644 index 000000000..a1ab9a697 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php b/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php new file mode 100644 index 000000000..2a25baab0 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchDistinguishedName.php @@ -0,0 +1,74 @@ +cluster_name) !== true) { + throw new RuntimeException( + 'cluster_name is required for patch_distinguished_name' + ); + } + $cluster_name = $this->cluster_name; + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchDistinguishedName + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setClusterName($cluster_name): PatchDistinguishedName + { + if (isset($cluster_name) !== true) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php b/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php new file mode 100644 index 000000000..26e488a3c --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchDistinguishedNames.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchRole.php b/src/OpenSearch/Endpoints/Security/PatchRole.php new file mode 100644 index 000000000..5d285ec3a --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchRole.php @@ -0,0 +1,74 @@ +role) !== true) { + throw new RuntimeException( + 'role is required for patch_role' + ); + } + $role = $this->role; + return "/_plugins/_security/api/roles/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchRole + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): PatchRole + { + if (isset($role) !== true) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php b/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php new file mode 100644 index 000000000..f1e9bf4f5 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchRoleMapping.php @@ -0,0 +1,74 @@ +role) !== true) { + throw new RuntimeException( + 'role is required for patch_role_mapping' + ); + } + $role = $this->role; + return "/_plugins/_security/api/rolesmapping/$role"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchRoleMapping + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setRole($role): PatchRoleMapping + { + if (isset($role) !== true) { + return $this; + } + $this->role = $role; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php b/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php index 843359e5c..0282e9135 100644 --- a/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php +++ b/src/OpenSearch/Endpoints/Security/PatchRoleMappings.php @@ -17,21 +17,25 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class PatchRoleMappings extends AbstractEndpoint { - /** - * @var string|null - */ - protected $role; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/rolesmapping"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/rolesmapping' . ($this->role ? "/{$this->role}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -39,13 +43,13 @@ public function getMethod(): string return 'PATCH'; } - /** - * @param string|null $role - * @return PatchRoleMappings - */ - public function setRole(?string $role): PatchRoleMappings + public function setBody($body): PatchRoleMappings { - $this->role = $role; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/PatchRoles.php b/src/OpenSearch/Endpoints/Security/PatchRoles.php index a9b40a1ae..66c129624 100644 --- a/src/OpenSearch/Endpoints/Security/PatchRoles.php +++ b/src/OpenSearch/Endpoints/Security/PatchRoles.php @@ -17,21 +17,25 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class PatchRoles extends AbstractEndpoint { - /** - * @var string|null - */ - protected $role; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/roles"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/roles' . ($this->role ? "/{$this->role}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -39,13 +43,13 @@ public function getMethod(): string return 'PATCH'; } - /** - * @param string|null $role - * @return PatchRoles - */ - public function setRole(?string $role): PatchRoles + public function setBody($body): PatchRoles { - $this->role = $role; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/PatchTenant.php b/src/OpenSearch/Endpoints/Security/PatchTenant.php new file mode 100644 index 000000000..b7efa65d6 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchTenant.php @@ -0,0 +1,74 @@ +tenant) !== true) { + throw new RuntimeException( + 'tenant is required for patch_tenant' + ); + } + $tenant = $this->tenant; + return "/_plugins/_security/api/tenants/$tenant"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchTenant + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setTenant($tenant): PatchTenant + { + if (isset($tenant) !== true) { + return $this; + } + $this->tenant = $tenant; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchTenants.php b/src/OpenSearch/Endpoints/Security/PatchTenants.php index 8a4de9257..41a3dbc2b 100644 --- a/src/OpenSearch/Endpoints/Security/PatchTenants.php +++ b/src/OpenSearch/Endpoints/Security/PatchTenants.php @@ -17,21 +17,25 @@ use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class PatchTenants extends AbstractEndpoint { - /** - * @var string|null - */ - protected $tenant; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/tenants"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/tenants' . ($this->tenant ? "/{$this->tenant}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -39,13 +43,13 @@ public function getMethod(): string return 'PATCH'; } - /** - * @param string|null $tenant - * @return PatchTenants - */ - public function setTenant(?string $tenant): PatchTenants + public function setBody($body): PatchTenants { - $this->tenant = $tenant; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/PatchUser.php b/src/OpenSearch/Endpoints/Security/PatchUser.php new file mode 100644 index 000000000..147384652 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PatchUser.php @@ -0,0 +1,74 @@ +username) !== true) { + throw new RuntimeException( + 'username is required for patch_user' + ); + } + $username = $this->username; + return "/_plugins/_security/api/internalusers/$username"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PATCH'; + } + + public function setBody($body): PatchUser + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setUsername($username): PatchUser + { + if (isset($username) !== true) { + return $this; + } + $this->username = $username; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/PatchUsers.php b/src/OpenSearch/Endpoints/Security/PatchUsers.php index af4ae7740..dafff0a40 100644 --- a/src/OpenSearch/Endpoints/Security/PatchUsers.php +++ b/src/OpenSearch/Endpoints/Security/PatchUsers.php @@ -15,24 +15,27 @@ namespace OpenSearch\Endpoints\Security; -use OpenSearch\Common\Exceptions\RuntimeException; use OpenSearch\Endpoints\AbstractEndpoint; +/** + * NOTE: This file is autogenerated using util/GenerateEndpoints.php + */ class PatchUsers extends AbstractEndpoint { - /** - * @var string|null - */ - protected $username; - - public function getParamWhitelist(): array + public function getURI(): string { - return []; + return "/_plugins/_security/api/internalusers"; } - public function getURI(): string + public function getParamWhitelist(): array { - return '/_plugins/_security/api/internalusers' . ($this->username ? "/{$this->username}" : ''); + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; } public function getMethod(): string @@ -40,13 +43,13 @@ public function getMethod(): string return 'PATCH'; } - /** - * @param string|null $username - * @return PatchUsers - */ - public function setUsername(?string $username): PatchUsers + public function setBody($body): PatchUsers { - $this->username = $username; + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + return $this; } } diff --git a/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php b/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php new file mode 100644 index 000000000..75bff2113 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/PostDashboardsInfo.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php b/src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php new file mode 100644 index 000000000..262686d64 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/ReloadHttpCertificates.php @@ -0,0 +1,45 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php b/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php new file mode 100644 index 000000000..b805d6d57 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/UpdateConfiguration.php @@ -0,0 +1,55 @@ +body = $body; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php b/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php new file mode 100644 index 000000000..b78551c65 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/UpdateDistinguishedName.php @@ -0,0 +1,74 @@ +cluster_name) !== true) { + throw new RuntimeException( + 'cluster_name is required for update_distinguished_name' + ); + } + $cluster_name = $this->cluster_name; + return "/_plugins/_security/api/nodesdn/$cluster_name"; + } + + public function getParamWhitelist(): array + { + return [ + 'pretty', + 'human', + 'error_trace', + 'source', + 'filter_path' + ]; + } + + public function getMethod(): string + { + return 'PUT'; + } + + public function setBody($body): UpdateDistinguishedName + { + if (isset($body) !== true) { + return $this; + } + $this->body = $body; + + return $this; + } + + public function setClusterName($cluster_name): UpdateDistinguishedName + { + if (isset($cluster_name) !== true) { + return $this; + } + $this->cluster_name = $cluster_name; + + return $this; + } +} diff --git a/src/OpenSearch/Endpoints/Security/Validate.php b/src/OpenSearch/Endpoints/Security/Validate.php new file mode 100644 index 000000000..753af3324 --- /dev/null +++ b/src/OpenSearch/Endpoints/Security/Validate.php @@ -0,0 +1,46 @@ +endpoints; - $endpoint = $endpointBuilder('Security\ChangePassword'); - $endpoint->setBody([ - 'current_password' => $this->extractArgument($params, 'current_password'), - 'password' => $this->extractArgument($params, 'password'), - ]); + $endpoint = $endpointBuilder('Security\Authinfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['action_group'] = (string) The name of the action group to create - * $params['allowed_actions'] = (array) list of allowed actions + * Returns the authorization token. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function createActionGroup(array $params = []) + public function authtoken(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateActionGroup'); - $endpoint->setBody([ - 'allowed_actions' => $this->extractArgument($params, 'allowed_actions'), - ]); - $endpoint->setActionGroup($this->extractArgument($params, 'action_group')); + $endpoint = $endpointBuilder('Security\Authtoken'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role to create - * $params['cluster_permissions'] = (array) - * $params['index_permissions'] = (array) - * $params['tenant_permissions'] = (array) + * Not supported for cache API. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function createRole(array $params = []) + public function cache(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateRole'); - $endpoint->setBody(array_filter([ - 'cluster_permissions' => $this->extractArgument($params, 'cluster_permissions'), - 'index_permissions' => $this->extractArgument($params, 'index_permissions'), - 'tenant_permissions' => $this->extractArgument($params, 'tenant_permissions'), - ])); - $endpoint->setRole($this->extractArgument($params, 'role')); + $endpoint = $endpointBuilder('Security\Cache'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role mapping to create - * $params['backend_roles'] = (array) - * $params['hosts'] = (array) - * $params['users'] = (array) + * Check whether or not an upgrade can be performed and what resources can be updated. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function createRoleMapping(array $params = []) + public function configUpgradeCheck(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateRoleMapping'); - $endpoint->setBody(array_filter([ - 'backend_roles' => $this->extractArgument($params, 'backend_roles'), - 'hosts' => $this->extractArgument($params, 'hosts'), - 'users' => $this->extractArgument($params, 'users'), - ])); - $endpoint->setRole($this->extractArgument($params, 'role')); + $endpoint = $endpointBuilder('Security\ConfigUpgradeCheck'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['tenant'] = (string) The name of the tenant to create - * $params['description'] = (string) + * Helps cluster operator upgrade missing defaults and stale default definitions. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function createTenant(array $params = []) + public function configUpgradePerform(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateTenant'); - $endpoint->setBody([ - 'description' => $this->extractArgument($params, 'description'), - ]); - $endpoint->setTenant($this->extractArgument($params, 'tenant')); + $endpoint = $endpointBuilder('Security\ConfigUpgradePerform'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * Creates or replaces the allowlisted APIs. Accessible via Super Admin certificate or REST API permission. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createAllowlist(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateAllowlist'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } /** - * $params['username'] = (string) The username to give the created user - * $params['password'] = (string) - * $params['opendistro_security_roles'] = (array) - * $params['backend_roles'] = (array) - * $params['attributes'] = (array) + * Creates or replaces the multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function createUser(array $params = []) + public function createUpdateTenancyConfig(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateUser'); - $endpoint->setBody(array_filter([ - 'password' => $this->extractArgument($params, 'password'), - 'opendistro_security_roles' => $this->extractArgument($params, 'opendistro_security_roles'), - 'backend_roles' => $this->extractArgument($params, 'backend_roles'), - 'attributes' => $this->extractArgument($params, 'attributes'), - ])); - $endpoint->setUsername($this->extractArgument($params, 'username')); + $endpoint = $endpointBuilder('Security\CreateUpdateTenancyConfig'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * Creates or replaces the specified user. Legacy API. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateUserLegacy'); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } /** - * $params['action_group'] = (string) The name of the action group to delete + * Delete a specified action group. + * + * $params['action_group'] = (string) Action group to delete. (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ public function deleteActionGroup(array $params = []) { + $action_group = $this->extractArgument($params, 'action_group'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\DeleteActionGroup'); - $endpoint->setActionGroup($this->extractArgument($params, 'action_group')); $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); return $this->performRequest($endpoint); } - /** - * $params['cluster_name'] = (string) The name of the cluster to delete distinguished names from + * Deletes all distinguished names in the specified cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + * + * $params['cluster_name'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function deleteDistinguishedNames(array $params = []) + public function deleteDistinguishedName(array $params = []) { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\DeleteDistinguishedNames'); - $endpoint->setClusterName($this->extractArgument($params, 'cluster_name')); + $endpoint = $endpointBuilder('Security\DeleteDistinguishedName'); $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role to delete + * Delete the specified role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ public function deleteRole(array $params = []) { + $role = $this->extractArgument($params, 'role'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\DeleteRole'); - $endpoint->setRole($this->extractArgument($params, 'role')); $endpoint->setParams($params); + $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role mapping to delete + * Deletes the specified role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ public function deleteRoleMapping(array $params = []) { + $role = $this->extractArgument($params, 'role'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\DeleteRoleMapping'); - $endpoint->setRole($this->extractArgument($params, 'role')); $endpoint->setParams($params); + $endpoint->setRole($role); return $this->performRequest($endpoint); } - /** - * $params['tenant'] = (string) The name of the tenant to delete + * Delete the specified tenant. + * + * $params['tenant'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ public function deleteTenant(array $params = []) { + $tenant = $this->extractArgument($params, 'tenant'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\DeleteTenant'); - $endpoint->setTenant($this->extractArgument($params, 'tenant')); $endpoint->setParams($params); + $endpoint->setTenant($tenant); return $this->performRequest($endpoint); } - /** - * $params['username'] = (string) The username of the user to delete + * Delete the specified user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ public function deleteUser(array $params = []) { + $username = $this->extractArgument($params, 'username'); + $endpointBuilder = $this->endpoints; $endpoint = $endpointBuilder('Security\DeleteUser'); - $endpoint->setUsername($this->extractArgument($params, 'username')); $endpoint->setParams($params); + $endpoint->setUsername($username); return $this->performRequest($endpoint); } + /** + * Delete the specified user. Legacy API. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function deleteUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\DeleteUserLegacy'); + $endpoint->setParams($params); + $endpoint->setUsername($username); + return $this->performRequest($endpoint); + } /** + * Flushes the Security plugin user, authentication, and authorization cache. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * * @param array $params Associative array of parameters * @return array */ @@ -259,296 +389,1550 @@ public function flushCache(array $params = []) return $this->performRequest($endpoint); } - /** + * Generates On-Behalf-Of token for the current user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * * @param array $params Associative array of parameters * @return array */ - public function getAccount(array $params = []) + public function generateOboToken(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetAccount'); + $endpoint = $endpointBuilder('Security\GenerateOboToken'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } - /** - * $params['action_group'] = (string) The name of the action group to fetch, omit to fetch all (optional) + * Generates authorization token for the given user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getActionGroups(array $params = []) + public function generateUserToken(array $params = []) { + $username = $this->extractArgument($params, 'username'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetActionGroups'); - $endpoint->setActionGroup($this->extractArgument($params, 'action_group')); + $endpoint = $endpointBuilder('Security\GenerateUserToken'); $endpoint->setParams($params); + $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** + * Generates authorization token for the given user. Legacy API. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * * @param array $params Associative array of parameters * @return array */ - public function getCertificates(array $params = []) + public function generateUserTokenLegacy(array $params = []) { + $username = $this->extractArgument($params, 'username'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetCertificates'); + $endpoint = $endpointBuilder('Security\GenerateUserTokenLegacy'); $endpoint->setParams($params); + $endpoint->setUsername($username); return $this->performRequest($endpoint); } - /** + * Returns account details for the current user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * * @param array $params Associative array of parameters * @return array */ - public function getConfig(array $params = []) + public function getAccountDetails(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetConfig'); + $endpoint = $endpointBuilder('Security\GetAccountDetails'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['cluster_name'] = (string) The name of the cluster to get distinguished names for, omit to fetch all (optional) + * Retrieves one action group. + * + * $params['action_group'] = (string) Action group to retrieve. (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getDistinguishedNames(array $params = []) + public function getActionGroup(array $params = []) { + $action_group = $this->extractArgument($params, 'action_group'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetDistinguishedNames'); - $endpoint->setClusterName($this->extractArgument($params, 'cluster_name')); + $endpoint = $endpointBuilder('Security\GetActionGroup'); $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role to get mappings for, omit to fetch all (optional) + * Retrieves the current list of allowed API accessible to normal user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getRoleMappings(array $params = []) + public function getAllowlist(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetRoleMappings'); - $endpoint->setRole($this->extractArgument($params, 'role')); + $endpoint = $endpointBuilder('Security\GetAllowlist'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['role'] = (string) The name of the role fetch, omit to fetch all (optional) + * Retrieves the audit configuration. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getRoles(array $params = []) + public function getAuditConfiguration(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetRoles'); - $endpoint->setRole($this->extractArgument($params, 'role')); + $endpoint = $endpointBuilder('Security\GetAuditConfiguration'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['tenant'] = (string) The name of the tenant to fetch, omit to fetch all (optional) + * Retrieves the cluster security certificates. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getTenants(array $params = []) + public function getCertificates(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetTenants'); - $endpoint->setTenant($this->extractArgument($params, 'tenant')); + $endpoint = $endpointBuilder('Security\GetCertificates'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** - * $params['username'] = (string) The username of the user to fetch, omit to fetch all (optional) + * Returns the current Security plugin configuration in JSON format. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function getUsers(array $params = []) + public function getConfiguration(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\GetUsers'); - $endpoint->setUsername($this->extractArgument($params, 'username')); + $endpoint = $endpointBuilder('Security\GetConfiguration'); $endpoint->setParams($params); return $this->performRequest($endpoint); } - /** + * Retrieves the current security-dashboards plugin configuration. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * * @param array $params Associative array of parameters * @return array */ - public function health(array $params = []) + public function getDashboardsInfo(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\Health'); + $endpoint = $endpointBuilder('Security\GetDashboardsInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + * + * $params['cluster_name'] = (string) (Required) + * $params['show_all'] = (boolean) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetDistinguishedName'); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + return $this->performRequest($endpoint); + } /** - * $params['action_group'] = (string) The name of the action group to update, omit to patch multiple (optional) - * $params['ops'] = (array) List of operations to execute + * Gets the evaluated REST API permissions for the currently logged in user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchActionGroups(array $params = []) + public function getPermissionsInfo(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchActionGroups'); - $endpoint->setActionGroup($this->extractArgument($params, 'action_group')); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\GetPermissionsInfo'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * Retrieves one role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetRole'); + $endpoint->setParams($params); + $endpoint->setRole($role); + return $this->performRequest($endpoint); + } /** - * $params['ops'] = (array) List of operations to execute + * Retrieves one role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchConfig(array $params = []) + public function getRoleMapping(array $params = []) { + $role = $this->extractArgument($params, 'role'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchConfig'); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\GetRoleMapping'); $endpoint->setParams($params); + $endpoint->setRole($role); return $this->performRequest($endpoint); } + /** + * Retrieves the SSL configuration information. + * + * $params['show_dn'] = (string) The domain names from all certificates. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getSslinfo(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetSslinfo'); + $endpoint->setParams($params); + return $this->performRequest($endpoint); + } /** - * $params['role'] = (string) The name of the role mappings to update, omit to patch multiple (optional) - * $params['ops'] = (array) List of operations to execute + * Retrieves multi-tenancy configuration. Only accessible to admins and users with REST API permissions. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchRoleMappings(array $params = []) + public function getTenancyConfig(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchRoleMappings'); - $endpoint->setRole($this->extractArgument($params, 'role')); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\GetTenancyConfig'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * Retrieves one tenant. + * + * $params['tenant'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetTenant'); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + return $this->performRequest($endpoint); + } /** - * $params['role'] = (string) The name of the role to update, omit to patch multiple (optional) - * $params['ops'] = (array) List of operations to execute + * Retrieve one internal user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchRoles(array $params = []) + public function getUser(array $params = []) { + $username = $this->extractArgument($params, 'username'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchRoles'); - $endpoint->setRole($this->extractArgument($params, 'role')); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\GetUser'); $endpoint->setParams($params); + $endpoint->setUsername($username); return $this->performRequest($endpoint); } + /** + * Retrieve one user. Legacy API. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getUserLegacy(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\GetUserLegacy'); + $endpoint->setParams($params); + $endpoint->setUsername($username); + return $this->performRequest($endpoint); + } /** - * $params['tenant'] = (string) The name of the tenant to update, omit to patch multiple (optional) - * $params['ops'] = (array) List of operations to execute + * Retrieve all internal users. Legacy API. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchTenants(array $params = []) + public function getUsersLegacy(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchTenants'); - $endpoint->setTenant($this->extractArgument($params, 'tenant')); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\GetUsersLegacy'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * Checks to see if the Security plugin is up and running. + * + * $params['mode'] = (string) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function health(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Health'); + $endpoint->setParams($params); + return $this->performRequest($endpoint); + } /** - * $params['username'] = (string) The username of the user to update, omit to patch multiple (optional) - * $params['ops'] = (array) List of operations to execute + * Migrates security configuration from v6 to v7. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function patchUsers(array $params = []) + public function migrate(array $params = []) { $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\PatchUsers'); - $endpoint->setUsername($this->extractArgument($params, 'username')); - $endpoint->setBody($this->extractArgument($params, 'ops') ?? []); + $endpoint = $endpointBuilder('Security\Migrate'); $endpoint->setParams($params); return $this->performRequest($endpoint); } + /** + * Updates individual attributes of an action group. + * + * $params['action_group'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchActionGroup'); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + $endpoint->setBody($body); + return $this->performRequest($endpoint); + } /** - * $params['dynamic'] = (array) array of config options + * Updates the current list of allowed API accessible to normal user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function updateConfig(array $params = []) + public function patchAllowlist(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\UpdateConfig'); - $endpoint->setBody([ - 'dynamic' => $this->extractArgument($params, 'dynamic'), - ]); + $endpoint = $endpointBuilder('Security\PatchAllowlist'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * A PATCH call is used to update specified fields in the audit configuration. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchAuditConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchAuditConfiguration'); + $endpoint->setParams($params); + $endpoint->setBody($body); + return $this->performRequest($endpoint); + } /** - * $params['cluster_name'] = (string) name of cluster to add or update distinguished names for - * $params['nodes_dn'] = (array) distinguished names to add to cluster + * A PATCH call is used to update the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. * * @param array $params Associative array of parameters * @return array */ - public function updateDistinguishedNames(array $params = []) + public function patchConfiguration(array $params = []) { + $body = $this->extractArgument($params, 'body'); + $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\UpdateDistinguishedNames'); - $endpoint->setBody([ - 'nodes_dn' => $this->extractArgument($params, 'nodes_dn'), - ]); - $endpoint->setClusterName($this->extractArgument($params, 'cluster_name')); + $endpoint = $endpointBuilder('Security\PatchConfiguration'); $endpoint->setParams($params); + $endpoint->setBody($body); return $this->performRequest($endpoint); } + /** + * Updates a distinguished cluster name for a specific cluster. Only accessible to super-admins and with rest-api permissions when enabled. + * + * $params['cluster_name'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchDistinguishedName'); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Bulk update of distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchDistinguishedNames(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchDistinguishedNames'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Updates individual attributes of a role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchRole'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Updates individual attributes of a role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchRoleMapping'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Add, delete, or modify a single tenant. + * + * $params['tenant'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchTenant'); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Updates individual attributes of an internal user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PatchUser'); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Updates the current security-dashboards plugin configuration. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function postDashboardsInfo(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\PostDashboardsInfo'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Reload HTTP layer communication certificates. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function reloadHttpCertificates(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ReloadHttpCertificates'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Reload Transport layer communication certificates. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function reloadTransportCertificates(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ReloadTransportCertificates'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves the tenant names if any exist. Only accessible to super admins or kibanaserver user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function tenantInfo(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\TenantInfo'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Updates the audit configuration. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function updateAuditConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateAuditConfiguration'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Adds or updates the existing configuration using the REST API. Only accessible by admins and users with rest api access and only when put or patch is enabled. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function updateConfiguration(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateConfiguration'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Adds or updates the specified distinguished names in the cluster or node allow list. Only accessible to super-admins and with rest-api permissions when enabled. + * + * $params['cluster_name'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function updateDistinguishedName(array $params = []) + { + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $body = $this->extractArgument($params, 'body'); + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\UpdateDistinguishedName'); + $endpoint->setParams($params); + $endpoint->setClusterName($cluster_name); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Checks whether the v6 security configuration is valid and ready to be migrated to v7. + * + * $params['accept_invalid'] = (boolean) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function validate(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\Validate'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Gets the user identity related information for currently logged in user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function whoAmI(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\WhoAmI'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Gets the user identity related information for currently logged in user. User needs to have access to this endpoint when authorization at REST layer is enabled. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function whoAmIProtected(array $params = []) + { + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\WhoAmIProtected'); + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Changes the password for the current user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['current_password'] = (string) The current password + * $params['password'] = (string) New password + * + * @param array $params Associative array of parameters + * @return array + */ + public function changePassword(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'current_password' => $this->extractArgument($params, 'current_password'), + 'password' => $this->extractArgument($params, 'password'), + ]; + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ChangePassword'); + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified action group. + * + * $params['action_group'] = (string) The name of the action group to create or replace. (Required) + * $params['allowed_actions'] = (array) list of allowed actions + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createActionGroup(array $params = []) + { + $action_group = $this->extractArgument($params, 'action_group'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'allowed_actions' => $this->extractArgument($params, 'allowed_actions'), + ]; + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateActionGroup'); + $endpoint->setParams($params); + $endpoint->setActionGroup($action_group); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['backend_roles'] = (array) + * $params['hosts'] = (array) + * $params['users'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'backend_roles' => $this->extractArgument($params, 'backend_roles'), + 'hosts' => $this->extractArgument($params, 'hosts'), + 'users' => $this->extractArgument($params, 'users'), + ]); + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRoleMapping'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['cluster_permissions'] = (array) + * $params['index_permissions'] = (array) + * $params['tenant_permissions'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'cluster_permissions' => $this->extractArgument($params, 'cluster_permissions'), + 'index_permissions' => $this->extractArgument($params, 'index_permissions'), + 'tenant_permissions' => $this->extractArgument($params, 'tenant_permissions'), + ]); + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRole'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified tenant. + * + * $params['tenant'] = (string) The name of the tenant to create + * $params['description'] = (string) Description of the tenant + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = [ + 'description' => $this->extractArgument($params, 'description'), + ]; + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateTenant'); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates or replaces the specified user. + * + * $params['username'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['password'] = (string) + * $params['opendistro_security_roles'] = (array) + * $params['backend_roles'] = (array) + * $params['attributes'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createUser(array $params = []) + { + $username = $this->extractArgument($params, 'username'); + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = array_filter([ + 'password' => $this->extractArgument($params, 'password'), + 'opendistro_security_roles' => $this->extractArgument($params, 'opendistro_security_roles'), + 'backend_roles' => $this->extractArgument($params, 'backend_roles'), + 'attributes' => $this->extractArgument($params, 'attributes'), + ]); + } + + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateUser'); + $endpoint->setParams($params); + $endpoint->setUsername($username); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to deleteDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'deleteDistinguishedName' API instead. + */ + public function deleteDistinguishedNames(array $params = []) + { + return $this->deleteDistinguishedName($params); + } + /** + * Proxy function to getAccount() to prevent BC break. + * This API will be removed in a future version. Use 'getAccountDetails' API instead. + */ + public function getAccount(array $params = []) + { + return $this->getAccountDetails($params); + } + /** + * Retrieves all action groups. + * If 'action_group' is provided in $params, calls 'getActionGroup'. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getActionGroups(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['action_group'])) { + $endpoint = $endpointBuilder('Security\GetActionGroup'); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); + } else { + $endpoint = $endpointBuilder('Security\GetActionGroups'); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to getConfig() to prevent BC break. + * This API will be removed in a future version. Use 'getConfiguration' API instead. + */ + public function getConfig(array $params = []) + { + return $this->getConfiguration($params); + } + /** + * Retrieves distinguished names. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'cluster_name' is provided in $params, calls GetDistinguishedName. + * + * $params['cluster_name'] = (string) Name of the cluster. + * $params['show_all'] = (boolean) Show all DN. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getDistinguishedNames(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['cluster_name'])) { + $endpoint = $endpointBuilder('Security\GetDistinguishedName'); + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $endpoint->setClusterName($cluster_name); + } else { + $endpoint = $endpointBuilder('Security\GetDistinguishedNames'); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves role mappings. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'role' is provided in $params, calls GetRoleMapping. + * + * $params['role'] = (string) Name of the role. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getRoleMappings(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['role'])) { + $endpoint = $endpointBuilder('Security\GetRoleMapping'); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $endpointBuilder('Security\GetRoleMappings'); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves roles. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'role' is provided in $params, calls getRole. + * + * $params['role'] = (string) Name of the role. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getRoles(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['role'])) { + $endpoint = $endpointBuilder('Security\GetRole'); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $endpointBuilder('Security\GetRoles'); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieves tenants. Only accessible to super-admins and with rest-api permissions when enabled. + * If 'tenant' is provided in $params, calls GetTenant. + * + * $params['tenant'] = (string) Name of the tenant. + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getTenants(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['tenant'])) { + $endpoint = $endpointBuilder('Security\GetTenant'); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); + } else { + $endpoint = $endpointBuilder('Security\GetTenants'); + } + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Retrieve all internal users. + * If 'username' is provided in $params, calls 'getUser'. + * + * $params['username'] = (string) The username of the user to fetch, omit to fetch all (optional). + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getUsers(array $params = []): array + { + $endpointBuilder = $this->endpoints; + + if (isset($params['username'])) { + $endpoint = $endpointBuilder('Security\GetUser'); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); + } else { + $endpoint = $endpointBuilder('Security\GetUsers'); + } + + $endpoint->setParams($params); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple action groups in a single call. + * If 'action_group' is provided in $params, calls patchActionGroup. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchActionGroups(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + $endpointBuilder = $this->endpoints; + if (isset($params['action_group'])) { + $endpoint = $endpointBuilder('Security\PatchActionGroup'); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); + } else { + $endpoint = $endpointBuilder('Security\PatchActionGroups'); + } + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to patchConfig() to prevent BC break. + * This API will be removed in a future version. Use 'patchConfiguration' API instead. + */ + public function patchConfig(array $params = []) + { + $ops = $this->extractArgument($params, 'ops'); + if ($ops !== null) { + $params['body'] = $ops; + } + return $this->patchConfiguration($params); + } + /** + * Creates or updates multiple role mappings in a single call. + * If 'role' is provided in $params, calls patchRoleMappings. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRoleMappings(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + $endpointBuilder = $this->endpoints; + if (isset($params['role'])) { + $endpoint = $endpointBuilder('Security\PatchRoleMapping'); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $endpointBuilder('Security\PatchRoleMappings'); + } + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple roles in a single call. + * If 'role' is provided in $params, calls patchRole. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchRoles(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + $endpointBuilder = $this->endpoints; + if (isset($params['role'])) { + $endpoint = $endpointBuilder('Security\PatchRole'); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); + } else { + $endpoint = $endpointBuilder('Security\PatchRoles'); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Add, delete, or modify multiple tenants in a single call. + * If 'tenant' is provided in $params, calls 'patchTenant'. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchTenants(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + $endpointBuilder = $this->endpoints; + if (isset($params['tenant'])) { + $endpoint = $endpointBuilder('Security\PatchTenant'); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); + } else { + $endpoint = $endpointBuilder('Security\PatchTenants'); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Creates, updates, or deletes multiple internal users in a single call. + * If 'username' is provided in $params, calls patchUser. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function patchUsers(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body === null) { + $body = $this->extractArgument($params, 'ops') ?? []; + } + + $endpointBuilder = $this->endpoints; + if (isset($params['username'])) { + $endpoint = $endpointBuilder('Security\PatchUser'); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); + } else { + $endpoint = $endpointBuilder('Security\PatchUsers'); + } + + $endpoint->setParams($params); + $endpoint->setBody($body); + + return $this->performRequest($endpoint); + } + /** + * Proxy function to updateConfig() to prevent BC break. + * This API will be removed in a future version. Use 'updateConfiguration' API instead. + */ + public function updateConfig(array $params = []) + { + $body = [ 'dynamic' => $this->extractArgument($params, 'dynamic')]; + $params['body'] = $body; + return $this->updateConfiguration($params); + } + /** + * Proxy function to updateDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'updateDistinguishedName' API instead. + */ + public function updateDistinguishedNames(array $params = []) + { + $body = [ 'nodes_dn' => $this->extractArgument($params, 'nodes_dn')]; + $params['body'] = $body; + return $this->updateDistinguishedName($params); + } } diff --git a/tests/Namespaces/SecurityNamespaceTest.php b/tests/Namespaces/SecurityNamespaceTest.php index 496cde367..9c4a6e2e5 100644 --- a/tests/Namespaces/SecurityNamespaceTest.php +++ b/tests/Namespaces/SecurityNamespaceTest.php @@ -124,7 +124,7 @@ public function testCreateActionGroup(): void public function testCreateActionGroupThrowsWithoutActionGroup(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.create_action_group'); + $this->expectExceptionMessage('action_group is required for create_action_group'); $this->client->security()->createActionGroup([ 'allowed_actions' => ['indices:data/read*'] @@ -209,7 +209,7 @@ public function testCreateRole(): void public function testCreateRoleThrowsWithoutRole(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.create_role'); + $this->expectExceptionMessage('role is required for create_role'); $this->client->security()->createRole([ 'cluster_permissions' => [], @@ -254,7 +254,7 @@ public function testCreateRoleMapping(): void public function testCreateRoleMappingThrowsWithoutRole(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.create_role_mapping'); + $this->expectExceptionMessage('role is required for create_role_mapping'); $this->client->security()->createRoleMapping([ 'backend_roles' => ['starfleet', 'captains', 'defectors', 'cn=ldaprole,ou=groups,dc=example,dc=com'], @@ -289,7 +289,7 @@ public function testCreateTenant(): void public function testCreateTenantThrowsWithoutRole(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.create_tenant'); + $this->expectExceptionMessage('tenant is required for create_tenant'); $this->client->security()->createTenant([ 'description' => 'My test tenant' @@ -334,7 +334,7 @@ public function testCreateUser(): void public function testCreateUserThrowsWithoutUsername(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.create_user'); + $this->expectExceptionMessage('username is required for create_user'); $this->client->security()->createUser([ 'password' => 'kirkpass', @@ -370,7 +370,7 @@ public function testDeleteActionGroup(): void public function testDeleteActionGroupThrowsWithoutActionGroupName(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_action_group'); + $this->expectExceptionMessage('action_group is required for delete_action_group'); $this->client->security()->deleteActionGroup(); } @@ -395,10 +395,30 @@ public function testDeleteDistinguishedNames(): void ], $result); } + public function testDeleteDistinguishedName(): void + { + $this->transport->method('performRequest') + ->with('DELETE', '/_plugins/_security/api/nodesdn/my_test_cluster', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $result = $this->client->security()->deleteDistinguishedName([ + 'cluster_name' => 'my_test_cluster', + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $result); + } + public function testDeleteDistinguishedNamesThrowsWithoutRoleName(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_distinguished_names'); + $this->expectExceptionMessage('cluster_name is required for delete_distinguished_name'); $this->client->security()->deleteDistinguishedNames(); } @@ -426,7 +446,7 @@ public function testDeleteRole(): void public function testDeleteRoleThrowsWithoutRole(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_role'); + $this->expectExceptionMessage('role is required for delete_role'); $this->client->security()->deleteRole(); } @@ -454,7 +474,7 @@ public function testDeleteRoleMapping(): void public function testDeleteRoleMappingThrowsWithoutRoleMappingName(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_role_mapping'); + $this->expectExceptionMessage('role is required for delete_role_mapping'); $this->client->security()->deleteRoleMapping(); } @@ -482,7 +502,7 @@ public function testDeleteTenant(): void public function testDeleteTenantThrowsWithoutTenantName(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_tenant'); + $this->expectExceptionMessage('tenant is required for delete_tenant'); $this->client->security()->deleteTenant(); } @@ -510,7 +530,7 @@ public function testDeleteUser(): void public function testDeleteUserThrowsWithoutUsername(): void { $this->expectException(RuntimeException::class); - $this->expectExceptionMessage('Missing parameter for the endpoint security.delete_user'); + $this->expectExceptionMessage('username is required for delete_user'); $this->client->security()->deleteUser(); } @@ -539,6 +559,22 @@ public function testGetAccount(): void ], $response); } + public function testGetAccountDetails(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/account', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getAccountDetails(); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetActionGroups(): void { $this->transport->method('performRequest') @@ -573,10 +609,28 @@ public function testGetActionGroupsWithoutActionGroupName(): void ], $response); } + public function testGetActionGroup(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/actiongroups/my_test_action_group', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getActionGroup([ + 'action_group' => 'my_test_action_group', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetCertificates(): void { $this->transport->method('performRequest') - ->with('GET', '/_opendistro/_security/api/ssl/certs', [], null); + ->with('GET', '/_plugins/_security/api/ssl/certs', [], null); $this->transport->method('resultOrFuture') ->willReturn([ 'resource' => ['test_resource'], @@ -605,6 +659,22 @@ public function testGetConfig(): void ], $response); } + public function testGetConfiguration(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/securityconfig', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getConfiguration(); + + static::assertSame([ + 'resource' => ['test_resource'], + ], $response); + } + public function testGetDistinguishedNames(): void { $this->transport->method('performRequest') @@ -639,6 +709,24 @@ public function testGetDistinguishedNamesWithoutClusterName(): void ], $response); } + public function testGetDistinguishedName(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/nodesdn/my_test_cluster', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getDistinguishedName([ + 'cluster_name' => 'my_test_cluster', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetRoleMappings(): void { $this->transport->method('performRequest') @@ -673,6 +761,24 @@ public function testGetRoleMappingsWithoutRoleName(): void ], $response); } + public function testGetRoleMapping(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/rolesmapping/my_test_role', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getRoleMapping([ + 'role' => 'my_test_role', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetRoles(): void { $this->transport->method('performRequest') @@ -707,6 +813,24 @@ public function testGetRolesWithoutActionGroupName(): void ], $response); } + public function testGetRole(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/roles/my_test_role', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getRole([ + 'role' => 'my_test_role', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetTenants(): void { $this->transport->method('performRequest') @@ -741,6 +865,24 @@ public function testGetTenantsWithoutTenantName(): void ], $response); } + public function testGetTenant(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/tenants/my_test_tenant', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getTenant([ + 'tenant' => 'my_test_tenant', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testGetUsers(): void { $this->transport->method('performRequest') @@ -775,6 +917,24 @@ public function testGetUsersWithoutUsername(): void ], $response); } + public function testGetUser(): void + { + $this->transport->method('performRequest') + ->with('GET', '/_plugins/_security/api/internalusers/my_test_user', [], null); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'resource' => ['test_resource'], + ]); + + $response = $this->client->security()->getUser([ + 'username' => 'my_test_user', + ]); + + static::assertSame([ + 'resource' => ['test_resource'] + ], $response); + } + public function testHealth(): void { $this->transport->method('performRequest') @@ -842,6 +1002,31 @@ public function testPatchActionGroupsWithoutActionGroupName(): void ], $response); } + public function testPatchActionGroup(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/actiongroups/my_test_action_group', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchActionGroup([ + 'action_group' => 'my_test_action_group', + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testPatchConfig(): void { $this->transport->method('performRequest') @@ -866,6 +1051,30 @@ public function testPatchConfig(): void ], $response); } + public function testPatchConfiguration(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/securityconfig', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchConfiguration([ + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testPatchRoleMappings(): void { $this->transport->method('performRequest') @@ -915,6 +1124,31 @@ public function testPatchRoleMappingsWithoutRoleMappingName(): void ], $response); } + public function testPatchRoleMapping(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/rolesmapping/my_test_role_mapping', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchRoleMapping([ + 'role' => 'my_test_role_mapping', + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testPatchRoles(): void { $this->transport->method('performRequest') @@ -964,6 +1198,31 @@ public function testPatchRolesWithoutRoleName(): void ], $response); } + public function testPatchRole(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/roles/my_test_role', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchRole([ + 'role' => 'my_test_role', + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testPatchTenants(): void { $this->transport->method('performRequest') @@ -1013,6 +1272,31 @@ public function testPatchTenantsWithoutRoleName(): void ], $response); } + public function testPatchTenant(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/tenants/my_test_tenant', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchTenant([ + 'tenant' => 'my_test_tenant', + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testPatchUsers(): void { $this->transport->method('performRequest') @@ -1062,6 +1346,31 @@ public function testPatchUsersWithoutUsername(): void ], $response); } + public function testPatchUser(): void + { + $this->transport->method('performRequest') + ->with('PATCH', '/_plugins/_security/api/internalusers/my_test_user', [], [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->patchUser([ + 'username' => 'my_test_user', + 'body' => [ + ['op' => 'remove', 'path' => '/index_permissions/0/dls'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + public function testUpdateConfig(): void { $this->transport->method('performRequest') @@ -1088,7 +1397,7 @@ public function testUpdateConfig(): void ], $response); } - public function testUpdateDistinguishedNames(): void + public function testUpdateConfiguration(): void { $this->transport->method('performRequest') ->with('PUT', '/_plugins/_security/api/securityconfig/config', [], [ @@ -1102,9 +1411,9 @@ public function testUpdateDistinguishedNames(): void 'message' => 'Stubbed response' ]); - $response = $this->client->security()->updateConfig([ - 'dynamic' => [ - 'filtered_alias_mode' => 'warn', + $response = $this->client->security()->updateConfiguration([ + 'body' => [ + 'dynamic' => ['filtered_alias_mode' => 'warn',] ] ]); @@ -1113,4 +1422,52 @@ public function testUpdateDistinguishedNames(): void 'message' => 'Stubbed response' ], $response); } + + public function testUpdateDistinguishedNames(): void + { + $this->transport->method('performRequest') + ->with('PUT', '/_plugins/_security/api/nodesdn/my_test_cluster', [], [ + 'nodes_dn' => ['CN=cluster3.example.com'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->updateDistinguishedNames([ + 'cluster_name' => 'my_test_cluster', + 'nodes_dn' => ['CN=cluster3.example.com'] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } + + public function testUpdateDistinguishedName(): void + { + $this->transport->method('performRequest') + ->with('PUT', '/_plugins/_security/api/nodesdn/my_test_cluster', [], [ + 'nodes_dn' => ['CN=cluster3.example.com'] + ]); + $this->transport->method('resultOrFuture') + ->willReturn([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ]); + + $response = $this->client->security()->updateDistinguishedName([ + 'cluster_name' => 'my_test_cluster', + 'body' => [ + 'nodes_dn' => ['CN=cluster3.example.com'] + ] + ]); + + static::assertSame([ + 'status' => 'OK', + 'message' => 'Stubbed response' + ], $response); + } } diff --git a/util/EndpointProxies/createPointInTimeProxy.php b/util/EndpointProxies/createPointInTimeProxy.php index 12cc71b39..d4beb56e2 100644 --- a/util/EndpointProxies/createPointInTimeProxy.php +++ b/util/EndpointProxies/createPointInTimeProxy.php @@ -2,12 +2,12 @@ return <<<'EOD' -/** - * Proxy function to createPointInTime() to prevent BC break. - * This API will be removed in a future version. Use 'createPit' API instead. - */ -public function createPointInTime(array $params = []) -{ - return $this->createPit($params); -} + /** + * Proxy function to createPointInTime() to prevent BC break. + * This API will be removed in a future version. Use 'createPit' API instead. + */ + public function createPointInTime(array $params = []) + { + return $this->createPit($params); + } EOD; diff --git a/util/EndpointProxies/deletePointInTimeProxy.php b/util/EndpointProxies/deletePointInTimeProxy.php index 77d88d639..d6d22aeb0 100644 --- a/util/EndpointProxies/deletePointInTimeProxy.php +++ b/util/EndpointProxies/deletePointInTimeProxy.php @@ -2,12 +2,12 @@ return <<<'EOD' -/** - * Proxy function to deletePointInTime() to prevent BC break. - * This API will be removed in a future version. Use 'deletePit' API instead. - */ -public function deletePointInTime(array $params = []) -{ - return $this->deletePit($params); -} + /** + * Proxy function to deletePointInTime() to prevent BC break. + * This API will be removed in a future version. Use 'deletePit' API instead. + */ + public function deletePointInTime(array $params = []) + { + return $this->deletePit($params); + } EOD; diff --git a/util/EndpointProxies/indices/getAliasesProxy.php b/util/EndpointProxies/indices/getAliasesProxy.php index 3969b8d18..a0383d2ad 100644 --- a/util/EndpointProxies/indices/getAliasesProxy.php +++ b/util/EndpointProxies/indices/getAliasesProxy.php @@ -2,14 +2,14 @@ return <<<'EOD' -/** - * Alias function to getAlias() - * - * @deprecated added to prevent BC break introduced in 7.2.0 - * @see https://github.com/elastic/elasticsearch-php/issues/940 - */ -public function getAliases(array $params = []) -{ - return $this->getAlias($params); -} + /** + * Alias function to getAlias() + * + * @deprecated added to prevent BC break introduced in 7.2.0 + * @see https://github.com/elastic/elasticsearch-php/issues/940 + */ + public function getAliases(array $params = []) + { + return $this->getAlias($params); + } EOD; diff --git a/util/EndpointProxies/security/changePasswordProxy.php b/util/EndpointProxies/security/changePasswordProxy.php index 65d548d40..b99c9e508 100644 --- a/util/EndpointProxies/security/changePasswordProxy.php +++ b/util/EndpointProxies/security/changePasswordProxy.php @@ -2,35 +2,35 @@ return <<<'EOD' -/** - * Changes the password for the current user. - * - * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. - * $params['human'] = (boolean) Whether to return human readable values for statistics. - * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. - * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. - * $params['current_password'] = (string) The current password - * $params['password'] = (string) New password - * - * @param array $params Associative array of parameters - * @return array - */ -public function changePassword(array $params = []) -{ - $body = $this->extractArgument($params, 'body'); - if ($body ===null) { - $body =[ - 'current_password' => $this->extractArgument($params, 'current_password'), - 'password' => $this->extractArgument($params, 'password'), - ]; - } + /** + * Changes the password for the current user. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['current_password'] = (string) The current password + * $params['password'] = (string) New password + * + * @param array $params Associative array of parameters + * @return array + */ + public function changePassword(array $params = []) + { + $body = $this->extractArgument($params, 'body'); + if ($body ===null) { + $body =[ + 'current_password' => $this->extractArgument($params, 'current_password'), + 'password' => $this->extractArgument($params, 'password'), + ]; + } - $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\ChangePassword'); - $endpoint->setParams($params); - $endpoint->setBody($body); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\ChangePassword'); + $endpoint->setParams($params); + $endpoint->setBody($body); - return $this->performRequest($endpoint); -} + return $this->performRequest($endpoint); + } EOD; diff --git a/util/EndpointProxies/security/createRoleMappingProxy.php b/util/EndpointProxies/security/createRoleMappingProxy.php index 20635a669..550fe69bd 100644 --- a/util/EndpointProxies/security/createRoleMappingProxy.php +++ b/util/EndpointProxies/security/createRoleMappingProxy.php @@ -2,40 +2,40 @@ return <<<'EOD' -/** - * Creates or replaces the specified role mapping. - * - * $params['role'] = (string) (Required) - * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. - * $params['human'] = (boolean) Whether to return human readable values for statistics. - * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. - * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. - * $params['backend_roles'] = (array) - * $params['hosts'] = (array) - * $params['users'] = (array) - * - * @param array $params Associative array of parameters - * @return array - */ -public function createRoleMapping(array $params = []) -{ - $role = $this->extractArgument($params, 'role'); - $body = $this->extractArgument($params, 'body'); - if ($body ===null) { - $body = array_filter([ - 'backend_roles' => $this->extractArgument($params, 'backend_roles'), - 'hosts' => $this->extractArgument($params, 'hosts'), - 'users' => $this->extractArgument($params, 'users'), - ]); - } + /** + * Creates or replaces the specified role mapping. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['backend_roles'] = (array) + * $params['hosts'] = (array) + * $params['users'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRoleMapping(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body ===null) { + $body = array_filter([ + 'backend_roles' => $this->extractArgument($params, 'backend_roles'), + 'hosts' => $this->extractArgument($params, 'hosts'), + 'users' => $this->extractArgument($params, 'users'), + ]); + } - $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateRoleMapping'); - $endpoint->setParams($params); - $endpoint->setRole($role); - $endpoint->setBody($body); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRoleMapping'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); - return $this->performRequest($endpoint); -} + return $this->performRequest($endpoint); + } EOD; diff --git a/util/EndpointProxies/security/createRoleProxy.php b/util/EndpointProxies/security/createRoleProxy.php index 06d468e06..a7b92840a 100644 --- a/util/EndpointProxies/security/createRoleProxy.php +++ b/util/EndpointProxies/security/createRoleProxy.php @@ -2,40 +2,40 @@ return <<<'EOD' -/** - * Creates or replaces the specified role. - * - * $params['role'] = (string) (Required) - * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. - * $params['human'] = (boolean) Whether to return human readable values for statistics. - * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. - * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. - * $params['cluster_permissions'] = (array) - * $params['index_permissions'] = (array) - * $params['tenant_permissions'] = (array) - * - * @param array $params Associative array of parameters - * @return array - */ -public function createRole(array $params = []) -{ - $role = $this->extractArgument($params, 'role'); - $body = $this->extractArgument($params, 'body'); - if ($body ===null) { - $body = array_filter([ - 'cluster_permissions' => $this->extractArgument($params, 'cluster_permissions'), - 'index_permissions' => $this->extractArgument($params, 'index_permissions'), - 'tenant_permissions' => $this->extractArgument($params, 'tenant_permissions'), - ]); - } + /** + * Creates or replaces the specified role. + * + * $params['role'] = (string) (Required) + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * $params['cluster_permissions'] = (array) + * $params['index_permissions'] = (array) + * $params['tenant_permissions'] = (array) + * + * @param array $params Associative array of parameters + * @return array + */ + public function createRole(array $params = []) + { + $role = $this->extractArgument($params, 'role'); + $body = $this->extractArgument($params, 'body'); + if ($body ===null) { + $body = array_filter([ + 'cluster_permissions' => $this->extractArgument($params, 'cluster_permissions'), + 'index_permissions' => $this->extractArgument($params, 'index_permissions'), + 'tenant_permissions' => $this->extractArgument($params, 'tenant_permissions'), + ]); + } - $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateRole'); - $endpoint->setParams($params); - $endpoint->setRole($role); - $endpoint->setBody($body); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateRole'); + $endpoint->setParams($params); + $endpoint->setRole($role); + $endpoint->setBody($body); - return $this->performRequest($endpoint); -} + return $this->performRequest($endpoint); + } EOD; diff --git a/util/EndpointProxies/security/createTenantProxy.php b/util/EndpointProxies/security/createTenantProxy.php index da84477ac..f92f6b4fb 100644 --- a/util/EndpointProxies/security/createTenantProxy.php +++ b/util/EndpointProxies/security/createTenantProxy.php @@ -2,36 +2,36 @@ return <<<'EOD' -/** - * Creates or replaces the specified tenant. - * - * $params['tenant'] = (string) The name of the tenant to create - * $params['description'] = (string) Description of the tenant - * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. - * $params['human'] = (boolean) Whether to return human readable values for statistics. - * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. - * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. - * - * @param array $params Associative array of parameters - * @return array - */ -public function createTenant(array $params = []) -{ - $tenant = $this->extractArgument($params, 'tenant'); - $body = $this->extractArgument($params, 'body'); - if ($body ===null) { - $body = [ - 'description' => $this->extractArgument($params, 'description'), - ]; - } + /** + * Creates or replaces the specified tenant. + * + * $params['tenant'] = (string) The name of the tenant to create + * $params['description'] = (string) Description of the tenant + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function createTenant(array $params = []) + { + $tenant = $this->extractArgument($params, 'tenant'); + $body = $this->extractArgument($params, 'body'); + if ($body ===null) { + $body = [ + 'description' => $this->extractArgument($params, 'description'), + ]; + } - $endpointBuilder = $this->endpoints; - $endpoint = $endpointBuilder('Security\CreateTenant'); - $endpoint->setParams($params); - $endpoint->setTenant($tenant); - $endpoint->setBody($body); + $endpointBuilder = $this->endpoints; + $endpoint = $endpointBuilder('Security\CreateTenant'); + $endpoint->setParams($params); + $endpoint->setTenant($tenant); + $endpoint->setBody($body); - return $this->performRequest($endpoint); -} + return $this->performRequest($endpoint); + } EOD; diff --git a/util/EndpointProxies/security/createUserProxy.php b/util/EndpointProxies/security/createUserProxy.php index 77d22c02e..452aa96e2 100644 --- a/util/EndpointProxies/security/createUserProxy.php +++ b/util/EndpointProxies/security/createUserProxy.php @@ -2,7 +2,7 @@ return <<<'EOD' -/** + /** * Creates or replaces the specified user. * * $params['username'] = (string) (Required) diff --git a/util/EndpointProxies/security/deleteDistinguishedNamesProxy.php b/util/EndpointProxies/security/deleteDistinguishedNamesProxy.php index c0b83205e..f23cfec0a 100644 --- a/util/EndpointProxies/security/deleteDistinguishedNamesProxy.php +++ b/util/EndpointProxies/security/deleteDistinguishedNamesProxy.php @@ -2,12 +2,12 @@ return <<<'EOD' -/** - * Proxy function to deleteDistinguishedNames() to prevent BC break. - * This API will be removed in a future version. Use 'deleteDistinguishedName' API instead. - */ -public function deleteDistinguishedNames(array $params = []) -{ - return $this->deleteDistinguishedName($params); -} + /** + * Proxy function to deleteDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'deleteDistinguishedName' API instead. + */ + public function deleteDistinguishedNames(array $params = []) + { + return $this->deleteDistinguishedName($params); + } EOD; diff --git a/util/EndpointProxies/security/getAccountProxy.php b/util/EndpointProxies/security/getAccountProxy.php index c54458944..bee6f0576 100644 --- a/util/EndpointProxies/security/getAccountProxy.php +++ b/util/EndpointProxies/security/getAccountProxy.php @@ -2,12 +2,12 @@ return <<<'EOD' -/** - * Proxy function to getAccount() to prevent BC break. - * This API will be removed in a future version. Use 'getAccountDetails' API instead. - */ -public function getAccount(array $params = []) -{ - return $this->getAccountDetails($params); -} + /** + * Proxy function to getAccount() to prevent BC break. + * This API will be removed in a future version. Use 'getAccountDetails' API instead. + */ + public function getAccount(array $params = []) + { + return $this->getAccountDetails($params); + } EOD; diff --git a/util/EndpointProxies/security/getActionGroupsProxy.php b/util/EndpointProxies/security/getActionGroupsProxy.php index 2b09a8b63..9c015db98 100644 --- a/util/EndpointProxies/security/getActionGroupsProxy.php +++ b/util/EndpointProxies/security/getActionGroupsProxy.php @@ -2,32 +2,31 @@ return <<<'EOD' -/** - * Retrieves all action groups. - * If 'action_group' is provided in $params, calls 'getActionGroup'. - * - * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. - * $params['human'] = (boolean) Whether to return human readable values for statistics. - * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. - * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. - * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. - * - * @param array $params Associative array of parameters - * @return array - */ -public function getActionGroups(array $params = []) -{ - $endpointBuilder = $this->endpoints; - if (isset($params['action_group'])) { - $endpoint = $endpointBuilder('Security\GetActionGroup'); - $endpoint->setActionGroup($params['action_group']); - unset($params['action_group']); - } else { - $endpoint = $endpointBuilder('Security\GetActionGroups'); - } - $endpoint = $endpointBuilder('Security\GetActionGroups'); - $endpoint->setParams($params); + /** + * Retrieves all action groups. + * If 'action_group' is provided in $params, calls 'getActionGroup'. + * + * $params['pretty'] = (boolean) Whether to pretty format the returned JSON response. + * $params['human'] = (boolean) Whether to return human readable values for statistics. + * $params['error_trace'] = (boolean) Whether to include the stack trace of returned errors. + * $params['source'] = (string) The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests. + * $params['filter_path'] = (any) Comma-separated list of filters used to reduce the response. + * + * @param array $params Associative array of parameters + * @return array + */ + public function getActionGroups(array $params = []) + { + $endpointBuilder = $this->endpoints; + if (isset($params['action_group'])) { + $endpoint = $endpointBuilder('Security\GetActionGroup'); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); + } else { + $endpoint = $endpointBuilder('Security\GetActionGroups'); + } + $endpoint->setParams($params); - return $this->performRequest($endpoint); -} + return $this->performRequest($endpoint); + } EOD; diff --git a/util/EndpointProxies/security/getConfigProxy.php b/util/EndpointProxies/security/getConfigProxy.php index cf1f2ccd7..9cd588e89 100644 --- a/util/EndpointProxies/security/getConfigProxy.php +++ b/util/EndpointProxies/security/getConfigProxy.php @@ -2,12 +2,12 @@ return <<<'EOD' -/** - * Proxy function to getConfig() to prevent BC break. - * This API will be removed in a future version. Use 'getConfiguration' API instead. - */ -public function getConfig(array $params = []) -{ - return $this->getConfiguration($params); -} + /** + * Proxy function to getConfig() to prevent BC break. + * This API will be removed in a future version. Use 'getConfiguration' API instead. + */ + public function getConfig(array $params = []) + { + return $this->getConfiguration($params); + } EOD; diff --git a/util/EndpointProxies/security/getDistinguishedNamesProxy.php b/util/EndpointProxies/security/getDistinguishedNamesProxy.php index 2fc71d1f4..e3a478151 100644 --- a/util/EndpointProxies/security/getDistinguishedNamesProxy.php +++ b/util/EndpointProxies/security/getDistinguishedNamesProxy.php @@ -22,8 +22,8 @@ public function getDistinguishedNames(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['cluster_name'])) { $endpoint = $endpointBuilder('Security\GetDistinguishedName'); - $endpoint->setClusterName($params['cluster_name']); - unset($params['cluster_name']); + $cluster_name = $this->extractArgument($params, 'cluster_name'); + $endpoint->setClusterName($cluster_name); } else { $endpoint = $endpointBuilder('Security\GetDistinguishedNames'); } diff --git a/util/EndpointProxies/security/getRoleMappingsProxy.php b/util/EndpointProxies/security/getRoleMappingsProxy.php index 44f1710ae..b04a7c298 100644 --- a/util/EndpointProxies/security/getRoleMappingsProxy.php +++ b/util/EndpointProxies/security/getRoleMappingsProxy.php @@ -21,8 +21,8 @@ public function getRoleMappings(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['role'])) { $endpoint = $endpointBuilder('Security\GetRoleMapping'); - $endpoint->setRole($params['role']); - unset($params['role']); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); } else { $endpoint = $endpointBuilder('Security\GetRoleMappings'); } diff --git a/util/EndpointProxies/security/getRolesProxy.php b/util/EndpointProxies/security/getRolesProxy.php index eba22b917..f90cd7477 100644 --- a/util/EndpointProxies/security/getRolesProxy.php +++ b/util/EndpointProxies/security/getRolesProxy.php @@ -21,8 +21,8 @@ public function getRoles(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['role'])) { $endpoint = $endpointBuilder('Security\GetRole'); - $endpoint->setRole($params['role']); - unset($params['role']); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); } else { $endpoint = $endpointBuilder('Security\GetRoles'); } diff --git a/util/EndpointProxies/security/getTenantsProxy.php b/util/EndpointProxies/security/getTenantsProxy.php index e36e6640a..698748020 100644 --- a/util/EndpointProxies/security/getTenantsProxy.php +++ b/util/EndpointProxies/security/getTenantsProxy.php @@ -21,8 +21,8 @@ public function getTenants(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['tenant'])) { $endpoint = $endpointBuilder('Security\GetTenant'); - $endpoint->setTenant($params['tenant']); - unset($params['tenant']); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); } else { $endpoint = $endpointBuilder('Security\GetTenants'); } diff --git a/util/EndpointProxies/security/getUsersProxy.php b/util/EndpointProxies/security/getUsersProxy.php index 8209b6f5e..923861558 100644 --- a/util/EndpointProxies/security/getUsersProxy.php +++ b/util/EndpointProxies/security/getUsersProxy.php @@ -22,8 +22,8 @@ public function getUsers(array $params = []): array if (isset($params['username'])) { $endpoint = $endpointBuilder('Security\GetUser'); - $endpoint->setUsername($params['username']); - unset($params['username']); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); } else { $endpoint = $endpointBuilder('Security\GetUsers'); } diff --git a/util/EndpointProxies/security/patchActionGroupsProxy.php b/util/EndpointProxies/security/patchActionGroupsProxy.php index 1a8b3f281..e262947e2 100644 --- a/util/EndpointProxies/security/patchActionGroupsProxy.php +++ b/util/EndpointProxies/security/patchActionGroupsProxy.php @@ -1,6 +1,7 @@ endpoints; if (isset($params['action_group'])) { $endpoint = $endpointBuilder('Security\PatchActionGroup'); - $endpoint->setActionGroup($params['action_group']); - unset($params['action_group']); + $action_group = $this->extractArgument($params, 'action_group'); + $endpoint->setActionGroup($action_group); } else { $endpoint = $endpointBuilder('Security\PatchActionGroups'); } @@ -35,5 +36,4 @@ public function patchActionGroups(array $params = []) return $this->performRequest($endpoint); } - EOD; diff --git a/util/EndpointProxies/security/patchConfigProxy.php b/util/EndpointProxies/security/patchConfigProxy.php index 0ce6c9be9..9aac63bcd 100644 --- a/util/EndpointProxies/security/patchConfigProxy.php +++ b/util/EndpointProxies/security/patchConfigProxy.php @@ -2,16 +2,16 @@ return <<<'EOD' -/** - * Proxy function to patchConfig() to prevent BC break. - * This API will be removed in a future version. Use 'patchConfiguration' API instead. - */ -public function patchConfig(array $params = []) -{ - $ops = $this->extractArgument($params, 'ops'); - if ($ops !== null) { - $params['body'] = $ops; + /** + * Proxy function to patchConfig() to prevent BC break. + * This API will be removed in a future version. Use 'patchConfiguration' API instead. + */ + public function patchConfig(array $params = []) + { + $ops = $this->extractArgument($params, 'ops'); + if ($ops !== null) { + $params['body'] = $ops; + } + return $this->patchConfiguration($params); } - return $this->patchConfiguration($params); -} EOD; diff --git a/util/EndpointProxies/security/patchRoleMappingsProxy.php b/util/EndpointProxies/security/patchRoleMappingsProxy.php index b1b896567..f7ac213b9 100644 --- a/util/EndpointProxies/security/patchRoleMappingsProxy.php +++ b/util/EndpointProxies/security/patchRoleMappingsProxy.php @@ -25,8 +25,8 @@ public function patchRoleMappings(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['role'])) { $endpoint = $endpointBuilder('Security\PatchRoleMapping'); - $endpoint->setRole($params['role']); - unset($params['role']); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); } else { $endpoint = $endpointBuilder('Security\PatchRoleMappings'); } diff --git a/util/EndpointProxies/security/patchRolesProxy.php b/util/EndpointProxies/security/patchRolesProxy.php index 3428bf304..eed70d9b7 100644 --- a/util/EndpointProxies/security/patchRolesProxy.php +++ b/util/EndpointProxies/security/patchRolesProxy.php @@ -25,8 +25,8 @@ public function patchRoles(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['role'])) { $endpoint = $endpointBuilder('Security\PatchRole'); - $endpoint->setRole($params['role']); - unset($params['role']); + $role = $this->extractArgument($params, 'role'); + $endpoint->setRole($role); } else { $endpoint = $endpointBuilder('Security\PatchRoles'); } diff --git a/util/EndpointProxies/security/patchTenantsProxy.php b/util/EndpointProxies/security/patchTenantsProxy.php index 4ca52dc1d..10d6fa01b 100644 --- a/util/EndpointProxies/security/patchTenantsProxy.php +++ b/util/EndpointProxies/security/patchTenantsProxy.php @@ -25,8 +25,8 @@ public function patchTenants(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['tenant'])) { $endpoint = $endpointBuilder('Security\PatchTenant'); - $endpoint->setTenant($params['tenant']); - unset($params['tenant']); + $tenant = $this->extractArgument($params, 'tenant'); + $endpoint->setTenant($tenant); } else { $endpoint = $endpointBuilder('Security\PatchTenants'); } diff --git a/util/EndpointProxies/security/patchUsersProxy.php b/util/EndpointProxies/security/patchUsersProxy.php index 95ae5299e..81cba4171 100644 --- a/util/EndpointProxies/security/patchUsersProxy.php +++ b/util/EndpointProxies/security/patchUsersProxy.php @@ -25,8 +25,8 @@ public function patchUsers(array $params = []) $endpointBuilder = $this->endpoints; if (isset($params['username'])) { $endpoint = $endpointBuilder('Security\PatchUser'); - $endpoint->setUsername($params['username']); - unset($params['username']); + $username = $this->extractArgument($params, 'username'); + $endpoint->setUsername($username); } else { $endpoint = $endpointBuilder('Security\PatchUsers'); } diff --git a/util/EndpointProxies/security/updateConfigProxy.php b/util/EndpointProxies/security/updateConfigProxy.php index 1e57a052e..da5827da8 100644 --- a/util/EndpointProxies/security/updateConfigProxy.php +++ b/util/EndpointProxies/security/updateConfigProxy.php @@ -2,14 +2,14 @@ return <<<'EOD' -/** - * Proxy function to updateConfig() to prevent BC break. - * This API will be removed in a future version. Use 'updateConfiguration' API instead. - */ -public function updateConfig(array $params = []) -{ - $body = [ 'dynamic' => $this->extractArgument($params, 'dynamic')]; - $params['body'] = $body; - return $this->updateConfiguration($params); -} + /** + * Proxy function to updateConfig() to prevent BC break. + * This API will be removed in a future version. Use 'updateConfiguration' API instead. + */ + public function updateConfig(array $params = []) + { + $body = [ 'dynamic' => $this->extractArgument($params, 'dynamic')]; + $params['body'] = $body; + return $this->updateConfiguration($params); + } EOD; diff --git a/util/EndpointProxies/security/updateDistinguishedNamesProxy.php b/util/EndpointProxies/security/updateDistinguishedNamesProxy.php index d619d5c9b..852a175ad 100644 --- a/util/EndpointProxies/security/updateDistinguishedNamesProxy.php +++ b/util/EndpointProxies/security/updateDistinguishedNamesProxy.php @@ -2,12 +2,14 @@ return <<<'EOD' -/** - * Proxy function to updateDistinguishedNames() to prevent BC break. - * This API will be removed in a future version. Use 'updateDistinguishedName' API instead. - */ -public function updateDistinguishedNames(array $params = []) -{ - return $this->updateDistinguishedName($params); -} + /** + * Proxy function to updateDistinguishedNames() to prevent BC break. + * This API will be removed in a future version. Use 'updateDistinguishedName' API instead. + */ + public function updateDistinguishedNames(array $params = []) + { + $body = [ 'nodes_dn' => $this->extractArgument($params, 'nodes_dn')]; + $params['body'] = $body; + return $this->updateDistinguishedName($params); + } EOD; diff --git a/util/EndpointProxies/tasks/tasksListProxy.php b/util/EndpointProxies/tasks/tasksListProxy.php index 46067693a..6bf452140 100644 --- a/util/EndpointProxies/tasks/tasksListProxy.php +++ b/util/EndpointProxies/tasks/tasksListProxy.php @@ -2,11 +2,11 @@ return <<<'EOD' -/** - * Proxy function to list() to prevent BC break since 7.4.0 - */ -public function tasksList(array $params = []) -{ - return $this->list($params); -} + /** + * Proxy function to list() to prevent BC break since 7.4.0 + */ + public function tasksList(array $params = []) + { + return $this->list($params); + } EOD;