Skip to content

Latest commit

 

History

History
359 lines (238 loc) · 29.6 KB

File metadata and controls

359 lines (238 loc) · 29.6 KB

Machines

Overview

Available Operations

List

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)

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.ListAsync(
    limit: 20,
    offset: 10,
    orderBy: "-created_at"
);

// handle response

Parameters

Parameter Type Required Description Example
Limit long Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
20
Offset long Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.
10
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.

Response

ListMachinesResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Create

Creates a new machine.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

CreateMachineRequestBody? req = null;

var res = await sdk.Machines.CreateAsync(req);

// handle response

Parameters

Parameter Type Required Description
request CreateMachineRequestBody ✔️ The request object to use for the request.

Response

CreateMachineResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Get

Returns the details of a machine.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.GetAsync(machineId: "<id>");

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine to retrieve

Response

GetMachineResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Update

Updates an existing machine. Only the provided fields will be updated.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.UpdateAsync(machineId: "<id>");

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine to update
RequestBody UpdateMachineRequestBody N/A

Response

UpdateMachineResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

Delete

Deletes a machine.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.DeleteAsync(machineId: "<id>");

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine to delete

Response

DeleteMachineResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

GetSecretKey

Returns the secret key for a machine.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.GetSecretKeyAsync(machineId: "<id>");

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine to retrieve the secret key for

Response

GetMachineSecretKeyResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

RotateSecretKey

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.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;
using Clerk.BackendAPI.Models.Operations;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.RotateSecretKeyAsync(
    machineId: "<id>",
    requestBody: new RotateMachineSecretKeyRequestBody() {
        PreviousTokenTtl = 632625,
    }
);

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine to rotate the secret key for
RequestBody RotateMachineSecretKeyRequestBody ✔️ N/A

Response

RotateMachineSecretKeyResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

CreateScope

Creates a new machine scope, allowing the specified machine to access another machine. Maximum of 150 scopes per machine.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.CreateScopeAsync(machineId: "<id>");

// handle response

Parameters

Parameter Type Required Description
MachineId string ✔️ The ID of the machine that will have access to another machine
RequestBody CreateMachineScopeRequestBody N/A

Response

CreateMachineScopeResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 409, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*

DeleteScope

Deletes a machine scope, removing access from one machine to another.

Example Usage

using Clerk.BackendAPI;
using Clerk.BackendAPI.Models.Components;

var sdk = new ClerkBackendApi(bearerAuth: "<YOUR_BEARER_TOKEN_HERE>");

var res = await sdk.Machines.DeleteScopeAsync(
    machineId: "<id>",
    otherMachineId: "<id>"
);

// handle response

Parameters

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

Response

DeleteMachineScopeResponse

Errors

Error Type Status Code Content Type
Clerk.BackendAPI.Models.Errors.ClerkErrors 400, 401, 403, 404, 422 application/json
Clerk.BackendAPI.Models.Errors.SDKError 4XX, 5XX */*