Client for Hydra
All URIs are relative to http://localhost
Method | HTTP request | Description |
---|---|---|
createPolicy | POST /policies | Create an Access Control Policy |
deletePolicy | DELETE /policies/{id} | Delete an Access Control Policy |
getPolicy | GET /policies/{id} | Get an Access Control Policy |
listPolicies | GET /policies | List Access Control Policies |
updatePolicy | PUT /policies/{id} | Update an Access Control Polic |
\Hydra\SDK\Model\Policy createPolicy($body)
Create an Access Control Policy
The subject making the request needs to be assigned to a policy containing: { \"resources\": [\"rn:hydra:policies\"], \"actions\": [\"create\"], \"effect\": \"allow\" }
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Hydra\SDK\Api\PolicyApi();
$body = new \Hydra\SDK\Model\Policy(); // \Hydra\SDK\Model\Policy |
try {
$result = $api_instance->createPolicy($body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PolicyApi->createPolicy: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
body | \Hydra\SDK\Model\Policy | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
deletePolicy($id)
Delete an Access Control Policy
The subject making the request needs to be assigned to a policy containing: { \"resources\": [\"rn:hydra:policies:<id>\"], \"actions\": [\"delete\"], \"effect\": \"allow\" }
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Hydra\SDK\Api\PolicyApi();
$id = "id_example"; // string | The id of the policy.
try {
$api_instance->deletePolicy($id);
} catch (Exception $e) {
echo 'Exception when calling PolicyApi->deletePolicy: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
id | string | The id of the policy. |
void (empty response body)
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\Hydra\SDK\Model\Policy getPolicy($id)
Get an Access Control Policy
The subject making the request needs to be assigned to a policy containing: { \"resources\": [\"rn:hydra:policies:<id>\"], \"actions\": [\"get\"], \"effect\": \"allow\" }
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Hydra\SDK\Api\PolicyApi();
$id = "id_example"; // string | The id of the policy.
try {
$result = $api_instance->getPolicy($id);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PolicyApi->getPolicy: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
id | string | The id of the policy. |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\Hydra\SDK\Model\Policy[] listPolicies($offset, $limit)
List Access Control Policies
The subject making the request needs to be assigned to a policy containing: { \"resources\": [\"rn:hydra:policies\"], \"actions\": [\"list\"], \"effect\": \"allow\" }
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Hydra\SDK\Api\PolicyApi();
$offset = 789; // int | The offset from where to start looking.
$limit = 789; // int | The maximum amount of policies returned.
try {
$result = $api_instance->listPolicies($offset, $limit);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PolicyApi->listPolicies: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
offset | int | The offset from where to start looking. | [optional] |
limit | int | The maximum amount of policies returned. | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
\Hydra\SDK\Model\Policy updatePolicy($id, $body)
Update an Access Control Polic
The subject making the request needs to be assigned to a policy containing: { \"resources\": [\"rn:hydra:policies\"], \"actions\": [\"update\"], \"effect\": \"allow\" }
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: oauth2
Hydra\SDK\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$api_instance = new Hydra\SDK\Api\PolicyApi();
$id = "id_example"; // string | The id of the policy.
$body = new \Hydra\SDK\Model\Policy(); // \Hydra\SDK\Model\Policy |
try {
$result = $api_instance->updatePolicy($id, $body);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling PolicyApi->updatePolicy: ', $e->getMessage(), PHP_EOL;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
id | string | The id of the policy. | |
body | \Hydra\SDK\Model\Policy | [optional] |
- Content-Type: application/json
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]