- list - Get a list of machines for an instance
- create - Create a machine
- get - Retrieve a machine
- update - Update a machine
- delete - Delete a machine
- getSecretKey - Retrieve a machine secret key
- rotateSecretKey - Rotate a machine's secret key
- createScope - Create a machine scope
- deleteScope - Delete a machine scope
This request returns the list of machines for an instance. The machines are ordered by descending creation date (i.e. most recent machines will be returned first)
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->list(
limit: 10,
offset: 0,
orderBy: '-created_at'
);
if ($response->machineList !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
limit |
?int | ➖ | Applies a limit to the number of results returned. Can be used for paginating the results together with offset. |
offset |
?int | ➖ | Skip the first offset results when paginating.Needs to be an integer greater or equal to zero. To be used in conjunction with limit. |
query |
?string | ➖ | Returns machines with ID or name that match the given query. Uses exact match for machine ID and partial match for name. |
orderBy |
?string | ➖ | Allows to return machines in a particular order. You can order the returned machines by their name or created_at.To specify the direction, use the + or - symbols prepended to the property to order by.For example, to return machines in descending order by created_at, use -created_at.If you don't use + or -, then + is implied.Defaults to -created_at. |
?Operations\ListMachinesResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Creates a new machine.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->create(
request: $request
);
if ($response->machineCreated !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
$request |
Operations\CreateMachineRequestBody | ✔️ | The request object to use for the request. |
?Operations\CreateMachineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Returns the details of a machine.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->get(
machineId: '<id>'
);
if ($response->machine !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine to retrieve |
?Operations\GetMachineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Updates an existing machine. Only the provided fields will be updated.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->update(
machineId: '<id>',
requestBody: $requestBody
);
if ($response->machine !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine to update |
requestBody |
?Operations\UpdateMachineRequestBody | ➖ | N/A |
?Operations\UpdateMachineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Deletes a machine.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->delete(
machineId: '<id>'
);
if ($response->machineDeleted !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine to delete |
?Operations\DeleteMachineResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Returns the secret key for a machine.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->getSecretKey(
machineId: '<id>'
);
if ($response->machineSecretKey !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine to retrieve the secret key for |
?Operations\GetMachineSecretKeyResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Rotates the machine's secret key. When the secret key is rotated, make sure to update it in your machine/application. The previous secret key will remain valid for the duration specified by the previous_token_ttl parameter.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
use Clerk\Backend\Models\Operations;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$requestBody = new Operations\RotateMachineSecretKeyRequestBody(
previousTokenTtl: 632625,
);
$response = $sdk->machines->rotateSecretKey(
machineId: '<id>',
requestBody: $requestBody
);
if ($response->machineSecretKey !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine to rotate the secret key for |
requestBody |
Operations\RotateMachineSecretKeyRequestBody | ✔️ | N/A |
?Operations\RotateMachineSecretKeyResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Creates a new machine scope, allowing the specified machine to access another machine. Maximum of 150 scopes per machine.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->createScope(
machineId: '<id>',
requestBody: $requestBody
);
if ($response->machineScope !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine that will have access to another machine |
requestBody |
?Operations\CreateMachineScopeRequestBody | ➖ | N/A |
?Operations\CreateMachineScopeResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 409, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |
Deletes a machine scope, removing access from one machine to another.
declare(strict_types=1);
require 'vendor/autoload.php';
use Clerk\Backend;
$sdk = Backend\ClerkBackend::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->machines->deleteScope(
machineId: '<id>',
otherMachineId: '<id>'
);
if ($response->machineScopeDeleted !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
machineId |
string | ✔️ | The ID of the machine that has access to another machine |
otherMachineId |
string | ✔️ | The ID of the machine that is being accessed |
?Operations\DeleteMachineScopeResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ClerkErrors | 400, 401, 403, 404, 422 | application/json |
| Errors\SDKException | 4XX, 5XX | */* |