This commit is contained in:
c0repwn3r 2023-05-30 21:51:57 -04:00
parent 2792a8329c
commit ba7cc118d7
Signed by: core
GPG Key ID: FDBF740DADDCEECF
73 changed files with 8362 additions and 10 deletions

1928
tfweb/openapi.yaml Normal file

File diff suppressed because it is too large Load Diff

7
tfweb/openapitools.json Normal file
View File

@ -0,0 +1,7 @@
{
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.6.0"
}
}

View File

@ -0,0 +1,28 @@
<script lang="ts">
import {Logger, logSetup} from "$lib/logger";
export let isLoading;
export let isError;
export let error;
logSetup();
let logger = new Logger("LoadingWrapper.svelte");
function loadingproclog() {
if (!isLoading) {
logger.info("page loaded - content paint");
}
}
$: isLoading, loadingproclog();
</script>
{#if isLoading}
<h1>its loading</h1>
{:else}
{#if isError}
<h1>error: {error}</h1>
{:else}
<slot></slot>
{/if}
{/if}

View File

@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@ -0,0 +1,61 @@
.openapi-generator-ignore
apis/AuditLogsApi.ts
apis/DownloadsApi.ts
apis/HostsApi.ts
apis/NetworksApi.ts
apis/RolesApi.ts
apis/index.ts
index.ts
models/Actor.ts
models/ActorAPIKey.ts
models/ActorHost.ts
models/ActorOIDCUser.ts
models/ActorSupport.ts
models/ActorSystem.ts
models/ActorUser.ts
models/AuditLog.ts
models/AuditLogsList200Response.ts
models/Downloads.ts
models/DownloadsDNClientLinks.ts
models/DownloadsDnclient.ts
models/DownloadsList200Response.ts
models/DownloadsMobile.ts
models/DownloadsVersionInfo.ts
models/DownloadsVersionInfoDnclientValue.ts
models/DownloadsVersionInfoLatest.ts
models/Event.ts
models/FirewallRule.ts
models/FirewallRulePortRange.ts
models/Host.ts
models/HostAndEnrollCodeCreate200Response.ts
models/HostAndEnrollCodeCreate200ResponseData.ts
models/HostAndEnrollCodeCreate200ResponseDataEnrollmentCode.ts
models/HostAndEnrollCodeCreate400Response.ts
models/HostBlock200Response.ts
models/HostBlock200ResponseData.ts
models/HostCreate200Response.ts
models/HostCreate400Response.ts
models/HostCreateRequest.ts
models/HostDelete200Response.ts
models/HostEdit200Response.ts
models/HostEditRequest.ts
models/HostEnrollCodeCreate200Response.ts
models/HostEnrollCodeCreate200ResponseData.ts
models/HostEnrollCodeCreate200ResponseDataEnrollmentCode.ts
models/HostGet200Response.ts
models/HostMetadata.ts
models/HostsList200Response.ts
models/ModelError.ts
models/Network.ts
models/NetworkGet200Response.ts
models/NetworksList200Response.ts
models/PaginationMetadata.ts
models/PaginationMetadataPage.ts
models/Role.ts
models/RoleCreate200Response.ts
models/RoleCreateRequest.ts
models/RoleEditRequest.ts
models/RolesList200Response.ts
models/Target.ts
models/index.ts
runtime.ts

View File

@ -0,0 +1 @@
6.6.0

View File

@ -0,0 +1,108 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
AuditLogsList200Response,
} from '../models';
import {
AuditLogsList200ResponseFromJSON,
AuditLogsList200ResponseToJSON,
} from '../models';
export interface AuditLogsListRequest {
includeCounts?: boolean;
cursor?: string;
pageSize?: number;
filterTargetID?: string;
filterTargetType?: AuditLogsListFilterTargetTypeEnum;
}
/**
*
*/
export class AuditLogsApi extends runtime.BaseAPI {
/**
* Get a paginated list of audit logs. Token scope required: `audit-logs:list` ### Request
* List audit logs
*/
async auditLogsListRaw(requestParameters: AuditLogsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AuditLogsList200Response>> {
const queryParameters: any = {};
if (requestParameters.includeCounts !== undefined) {
queryParameters['includeCounts'] = requestParameters.includeCounts;
}
if (requestParameters.cursor !== undefined) {
queryParameters['cursor'] = requestParameters.cursor;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['pageSize'] = requestParameters.pageSize;
}
if (requestParameters.filterTargetID !== undefined) {
queryParameters['filter.targetID'] = requestParameters.filterTargetID;
}
if (requestParameters.filterTargetType !== undefined) {
queryParameters['filter.targetType'] = requestParameters.filterTargetType;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/audit-logs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AuditLogsList200ResponseFromJSON(jsonValue));
}
/**
* Get a paginated list of audit logs. Token scope required: `audit-logs:list` ### Request
* List audit logs
*/
async auditLogsList(requestParameters: AuditLogsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AuditLogsList200Response> {
const response = await this.auditLogsListRaw(requestParameters, initOverrides);
return await response.value();
}
}
/**
* @export
*/
export const AuditLogsListFilterTargetTypeEnum = {
ApiKey: 'apiKey',
Host: 'host',
Network: 'network',
Role: 'role',
User: 'user',
Ca: 'ca',
OidcProvider: 'oidcProvider'
} as const;
export type AuditLogsListFilterTargetTypeEnum = typeof AuditLogsListFilterTargetTypeEnum[keyof typeof AuditLogsListFilterTargetTypeEnum];

View File

@ -0,0 +1,66 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
DownloadsList200Response,
} from '../models';
import {
DownloadsList200ResponseFromJSON,
DownloadsList200ResponseToJSON,
} from '../models';
/**
*
*/
export class DownloadsApi extends runtime.BaseAPI {
/**
* Get a list of recently released software download links and basic info. This endpoint is unauthenticated. ### Request
* List software downloads
*/
async downloadsListRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DownloadsList200Response>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/downloads`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => DownloadsList200ResponseFromJSON(jsonValue));
}
/**
* Get a list of recently released software download links and basic info. This endpoint is unauthenticated. ### Request
* List software downloads
*/
async downloadsList(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DownloadsList200Response> {
const response = await this.downloadsListRaw(initOverrides);
return await response.value();
}
}

View File

@ -0,0 +1,486 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
HostAndEnrollCodeCreate200Response,
HostAndEnrollCodeCreate400Response,
HostBlock200Response,
HostCreate200Response,
HostCreate400Response,
HostCreateRequest,
HostDelete200Response,
HostEdit200Response,
HostEditRequest,
HostEnrollCodeCreate200Response,
HostGet200Response,
HostsList200Response,
} from '../models';
import {
HostAndEnrollCodeCreate200ResponseFromJSON,
HostAndEnrollCodeCreate200ResponseToJSON,
HostAndEnrollCodeCreate400ResponseFromJSON,
HostAndEnrollCodeCreate400ResponseToJSON,
HostBlock200ResponseFromJSON,
HostBlock200ResponseToJSON,
HostCreate200ResponseFromJSON,
HostCreate200ResponseToJSON,
HostCreate400ResponseFromJSON,
HostCreate400ResponseToJSON,
HostCreateRequestFromJSON,
HostCreateRequestToJSON,
HostDelete200ResponseFromJSON,
HostDelete200ResponseToJSON,
HostEdit200ResponseFromJSON,
HostEdit200ResponseToJSON,
HostEditRequestFromJSON,
HostEditRequestToJSON,
HostEnrollCodeCreate200ResponseFromJSON,
HostEnrollCodeCreate200ResponseToJSON,
HostGet200ResponseFromJSON,
HostGet200ResponseToJSON,
HostsList200ResponseFromJSON,
HostsList200ResponseToJSON,
} from '../models';
export interface HostAndEnrollCodeCreateRequest {
hostCreateRequest: HostCreateRequest;
}
export interface HostBlockRequest {
hostID: string;
}
export interface HostCreateOperationRequest {
hostCreateRequest: HostCreateRequest;
}
export interface HostDeleteRequest {
hostID: string;
}
export interface HostEditOperationRequest {
hostID: string;
hostEditRequest: HostEditRequest;
}
export interface HostEnrollCodeCreateRequest {
hostID: string;
}
export interface HostGetRequest {
hostID: string;
}
export interface HostsListRequest {
includeCounts?: boolean;
cursor?: string;
pageSize?: number;
filterIsBlocked?: boolean;
filterIsLighthouse?: boolean;
filterIsRelay?: boolean;
filterMetadataLastSeenAt?: HostsListFilterMetadataLastSeenAtEnum;
filterMetadataPlatform?: HostsListFilterMetadataPlatformEnum;
filterMetadataUpdateAvailable?: boolean;
}
/**
*
*/
export class HostsApi extends runtime.BaseAPI {
/**
* Token scopes required: `hosts:create`, `hosts:enroll` ### Request
* Create host & enrollment code
*/
async hostAndEnrollCodeCreateRaw(requestParameters: HostAndEnrollCodeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostAndEnrollCodeCreate200Response>> {
if (requestParameters.hostCreateRequest === null || requestParameters.hostCreateRequest === undefined) {
throw new runtime.RequiredError('hostCreateRequest','Required parameter requestParameters.hostCreateRequest was null or undefined when calling hostAndEnrollCodeCreate.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/host-and-enrollment-code`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: HostCreateRequestToJSON(requestParameters.hostCreateRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostAndEnrollCodeCreate200ResponseFromJSON(jsonValue));
}
/**
* Token scopes required: `hosts:create`, `hosts:enroll` ### Request
* Create host & enrollment code
*/
async hostAndEnrollCodeCreate(requestParameters: HostAndEnrollCodeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostAndEnrollCodeCreate200Response> {
const response = await this.hostAndEnrollCodeCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Prevent a host from being able to interact with other nodes on your network. See https://www.defined.net/blog/blocklisting/ for more details. To unblock, re-enroll the host. Token scope required: `hosts:block` ### Request
* Block host
*/
async hostBlockRaw(requestParameters: HostBlockRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostBlock200Response>> {
if (requestParameters.hostID === null || requestParameters.hostID === undefined) {
throw new runtime.RequiredError('hostID','Required parameter requestParameters.hostID was null or undefined when calling hostBlock.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts/{hostID}/block`.replace(`{${"hostID"}}`, encodeURIComponent(String(requestParameters.hostID))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostBlock200ResponseFromJSON(jsonValue));
}
/**
* Prevent a host from being able to interact with other nodes on your network. See https://www.defined.net/blog/blocklisting/ for more details. To unblock, re-enroll the host. Token scope required: `hosts:block` ### Request
* Block host
*/
async hostBlock(requestParameters: HostBlockRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostBlock200Response> {
const response = await this.hostBlockRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Create a new host, lighthouse, or relay. Token scope required: `hosts:create` ### Request
* Create host
*/
async hostCreateRaw(requestParameters: HostCreateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostCreate200Response>> {
if (requestParameters.hostCreateRequest === null || requestParameters.hostCreateRequest === undefined) {
throw new runtime.RequiredError('hostCreateRequest','Required parameter requestParameters.hostCreateRequest was null or undefined when calling hostCreate.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: HostCreateRequestToJSON(requestParameters.hostCreateRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostCreate200ResponseFromJSON(jsonValue));
}
/**
* Create a new host, lighthouse, or relay. Token scope required: `hosts:create` ### Request
* Create host
*/
async hostCreate(requestParameters: HostCreateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostCreate200Response> {
const response = await this.hostCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Token scope required: `hosts:delete` ### Request
* Delete host
*/
async hostDeleteRaw(requestParameters: HostDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostDelete200Response>> {
if (requestParameters.hostID === null || requestParameters.hostID === undefined) {
throw new runtime.RequiredError('hostID','Required parameter requestParameters.hostID was null or undefined when calling hostDelete.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts/{hostID}`.replace(`{${"hostID"}}`, encodeURIComponent(String(requestParameters.hostID))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostDelete200ResponseFromJSON(jsonValue));
}
/**
* Token scope required: `hosts:delete` ### Request
* Delete host
*/
async hostDelete(requestParameters: HostDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostDelete200Response> {
const response = await this.hostDeleteRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Token scope required: `hosts:update` :::caution Any properties not provided in the request will be reset to their default values. ::: ### Request
* Edit host
*/
async hostEditRaw(requestParameters: HostEditOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostEdit200Response>> {
if (requestParameters.hostID === null || requestParameters.hostID === undefined) {
throw new runtime.RequiredError('hostID','Required parameter requestParameters.hostID was null or undefined when calling hostEdit.');
}
if (requestParameters.hostEditRequest === null || requestParameters.hostEditRequest === undefined) {
throw new runtime.RequiredError('hostEditRequest','Required parameter requestParameters.hostEditRequest was null or undefined when calling hostEdit.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts/{hostID}`.replace(`{${"hostID"}}`, encodeURIComponent(String(requestParameters.hostID))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: HostEditRequestToJSON(requestParameters.hostEditRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostEdit200ResponseFromJSON(jsonValue));
}
/**
* Token scope required: `hosts:update` :::caution Any properties not provided in the request will be reset to their default values. ::: ### Request
* Edit host
*/
async hostEdit(requestParameters: HostEditOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostEdit200Response> {
const response = await this.hostEditRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Obtain a code that can be used with the `dnclient enroll` command on a host, lighthouse, or relay to enroll it into your Managed Nebula network. Token scope required: `hosts:enroll` ### Request
* Create enrollment code
*/
async hostEnrollCodeCreateRaw(requestParameters: HostEnrollCodeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostEnrollCodeCreate200Response>> {
if (requestParameters.hostID === null || requestParameters.hostID === undefined) {
throw new runtime.RequiredError('hostID','Required parameter requestParameters.hostID was null or undefined when calling hostEnrollCodeCreate.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts/{hostID}/enrollment-code`.replace(`{${"hostID"}}`, encodeURIComponent(String(requestParameters.hostID))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostEnrollCodeCreate200ResponseFromJSON(jsonValue));
}
/**
* Obtain a code that can be used with the `dnclient enroll` command on a host, lighthouse, or relay to enroll it into your Managed Nebula network. Token scope required: `hosts:enroll` ### Request
* Create enrollment code
*/
async hostEnrollCodeCreate(requestParameters: HostEnrollCodeCreateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostEnrollCodeCreate200Response> {
const response = await this.hostEnrollCodeCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Fetch information about a particular host, lighthouse, or relay. Token scope required: `hosts:read` ### Request
* Get host
*/
async hostGetRaw(requestParameters: HostGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostGet200Response>> {
if (requestParameters.hostID === null || requestParameters.hostID === undefined) {
throw new runtime.RequiredError('hostID','Required parameter requestParameters.hostID was null or undefined when calling hostGet.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts/{hostID}`.replace(`{${"hostID"}}`, encodeURIComponent(String(requestParameters.hostID))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostGet200ResponseFromJSON(jsonValue));
}
/**
* Fetch information about a particular host, lighthouse, or relay. Token scope required: `hosts:read` ### Request
* Get host
*/
async hostGet(requestParameters: HostGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostGet200Response> {
const response = await this.hostGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a paginated list of hosts, lighthouses, and relays. Token scope required: `hosts:list` ### Request
* List hosts
*/
async hostsListRaw(requestParameters: HostsListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostsList200Response>> {
const queryParameters: any = {};
if (requestParameters.includeCounts !== undefined) {
queryParameters['includeCounts'] = requestParameters.includeCounts;
}
if (requestParameters.cursor !== undefined) {
queryParameters['cursor'] = requestParameters.cursor;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['pageSize'] = requestParameters.pageSize;
}
if (requestParameters.filterIsBlocked !== undefined) {
queryParameters['filter.isBlocked'] = requestParameters.filterIsBlocked;
}
if (requestParameters.filterIsLighthouse !== undefined) {
queryParameters['filter.isLighthouse'] = requestParameters.filterIsLighthouse;
}
if (requestParameters.filterIsRelay !== undefined) {
queryParameters['filter.isRelay'] = requestParameters.filterIsRelay;
}
if (requestParameters.filterMetadataLastSeenAt !== undefined) {
queryParameters['filter.metadata.lastSeenAt'] = requestParameters.filterMetadataLastSeenAt;
}
if (requestParameters.filterMetadataPlatform !== undefined) {
queryParameters['filter.metadata.platform'] = requestParameters.filterMetadataPlatform;
}
if (requestParameters.filterMetadataUpdateAvailable !== undefined) {
queryParameters['filter.metadata.updateAvailable'] = requestParameters.filterMetadataUpdateAvailable;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/hosts`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostsList200ResponseFromJSON(jsonValue));
}
/**
* Get a paginated list of hosts, lighthouses, and relays. Token scope required: `hosts:list` ### Request
* List hosts
*/
async hostsList(requestParameters: HostsListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostsList200Response> {
const response = await this.hostsListRaw(requestParameters, initOverrides);
return await response.value();
}
}
/**
* @export
*/
export const HostsListFilterMetadataLastSeenAtEnum = {
Null: 'null'
} as const;
export type HostsListFilterMetadataLastSeenAtEnum = typeof HostsListFilterMetadataLastSeenAtEnum[keyof typeof HostsListFilterMetadataLastSeenAtEnum];
/**
* @export
*/
export const HostsListFilterMetadataPlatformEnum = {
Mobile: 'mobile',
Dnclient: 'dnclient',
Null: 'null'
} as const;
export type HostsListFilterMetadataPlatformEnum = typeof HostsListFilterMetadataPlatformEnum[keyof typeof HostsListFilterMetadataPlatformEnum];

View File

@ -0,0 +1,131 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
NetworkGet200Response,
NetworksList200Response,
} from '../models';
import {
NetworkGet200ResponseFromJSON,
NetworkGet200ResponseToJSON,
NetworksList200ResponseFromJSON,
NetworksList200ResponseToJSON,
} from '../models';
export interface NetworkGetRequest {
networkID: string;
}
export interface NetworksListRequest {
includeCounts?: boolean;
cursor?: string;
pageSize?: number;
}
/**
*
*/
export class NetworksApi extends runtime.BaseAPI {
/**
* Fetch information about a particular network. Token scope required: `networks:read` ### Request
* Get network
*/
async networkGetRaw(requestParameters: NetworkGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NetworkGet200Response>> {
if (requestParameters.networkID === null || requestParameters.networkID === undefined) {
throw new runtime.RequiredError('networkID','Required parameter requestParameters.networkID was null or undefined when calling networkGet.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/networks/{networkID}`.replace(`{${"networkID"}}`, encodeURIComponent(String(requestParameters.networkID))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => NetworkGet200ResponseFromJSON(jsonValue));
}
/**
* Fetch information about a particular network. Token scope required: `networks:read` ### Request
* Get network
*/
async networkGet(requestParameters: NetworkGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NetworkGet200Response> {
const response = await this.networkGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a paginated list of networks. :::note Currently, there is a limit of one network per Defined Networking account. ::: Token scope required: `networks:list` ### Request
* List networks
*/
async networksListRaw(requestParameters: NetworksListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<NetworksList200Response>> {
const queryParameters: any = {};
if (requestParameters.includeCounts !== undefined) {
queryParameters['includeCounts'] = requestParameters.includeCounts;
}
if (requestParameters.cursor !== undefined) {
queryParameters['cursor'] = requestParameters.cursor;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['pageSize'] = requestParameters.pageSize;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/networks`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => NetworksList200ResponseFromJSON(jsonValue));
}
/**
* Get a paginated list of networks. :::note Currently, there is a limit of one network per Defined Networking account. ::: Token scope required: `networks:list` ### Request
* List networks
*/
async networksList(requestParameters: NetworksListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<NetworksList200Response> {
const response = await this.networksListRaw(requestParameters, initOverrides);
return await response.value();
}
}

View File

@ -0,0 +1,286 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import * as runtime from '../runtime';
import type {
HostAndEnrollCodeCreate400Response,
HostDelete200Response,
RoleCreate200Response,
RoleCreateRequest,
RoleEditRequest,
RolesList200Response,
} from '../models';
import {
HostAndEnrollCodeCreate400ResponseFromJSON,
HostAndEnrollCodeCreate400ResponseToJSON,
HostDelete200ResponseFromJSON,
HostDelete200ResponseToJSON,
RoleCreate200ResponseFromJSON,
RoleCreate200ResponseToJSON,
RoleCreateRequestFromJSON,
RoleCreateRequestToJSON,
RoleEditRequestFromJSON,
RoleEditRequestToJSON,
RolesList200ResponseFromJSON,
RolesList200ResponseToJSON,
} from '../models';
export interface RoleCreateOperationRequest {
roleCreateRequest: RoleCreateRequest;
}
export interface RoleDeleteRequest {
roleID: string;
}
export interface RoleEditOperationRequest {
roleID: string;
roleEditRequest: RoleEditRequest;
}
export interface RoleGetRequest {
roleID: string;
}
export interface RolesListRequest {
includeCounts?: boolean;
cursor?: string;
pageSize?: number;
}
/**
*
*/
export class RolesApi extends runtime.BaseAPI {
/**
* Create a new role. Token scope required: `roles:create` ### Request
* Create role
*/
async roleCreateRaw(requestParameters: RoleCreateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RoleCreate200Response>> {
if (requestParameters.roleCreateRequest === null || requestParameters.roleCreateRequest === undefined) {
throw new runtime.RequiredError('roleCreateRequest','Required parameter requestParameters.roleCreateRequest was null or undefined when calling roleCreate.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/roles`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: RoleCreateRequestToJSON(requestParameters.roleCreateRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RoleCreate200ResponseFromJSON(jsonValue));
}
/**
* Create a new role. Token scope required: `roles:create` ### Request
* Create role
*/
async roleCreate(requestParameters: RoleCreateOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RoleCreate200Response> {
const response = await this.roleCreateRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Token scope required: `roles:delete` ### Request
* Delete role
*/
async roleDeleteRaw(requestParameters: RoleDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<HostDelete200Response>> {
if (requestParameters.roleID === null || requestParameters.roleID === undefined) {
throw new runtime.RequiredError('roleID','Required parameter requestParameters.roleID was null or undefined when calling roleDelete.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/roles/{roleID}`.replace(`{${"roleID"}}`, encodeURIComponent(String(requestParameters.roleID))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => HostDelete200ResponseFromJSON(jsonValue));
}
/**
* Token scope required: `roles:delete` ### Request
* Delete role
*/
async roleDelete(requestParameters: RoleDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<HostDelete200Response> {
const response = await this.roleDeleteRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Token scope required: `roles:update` :::caution Any properties not provided in the request will be reset to their default values. If only changing one firewall rule, be sure to include the others as well, otherwise they will be removed. ::: ### Request
* Edit role
*/
async roleEditRaw(requestParameters: RoleEditOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RoleCreate200Response>> {
if (requestParameters.roleID === null || requestParameters.roleID === undefined) {
throw new runtime.RequiredError('roleID','Required parameter requestParameters.roleID was null or undefined when calling roleEdit.');
}
if (requestParameters.roleEditRequest === null || requestParameters.roleEditRequest === undefined) {
throw new runtime.RequiredError('roleEditRequest','Required parameter requestParameters.roleEditRequest was null or undefined when calling roleEdit.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json';
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/roles/{roleID}`.replace(`{${"roleID"}}`, encodeURIComponent(String(requestParameters.roleID))),
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: RoleEditRequestToJSON(requestParameters.roleEditRequest),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RoleCreate200ResponseFromJSON(jsonValue));
}
/**
* Token scope required: `roles:update` :::caution Any properties not provided in the request will be reset to their default values. If only changing one firewall rule, be sure to include the others as well, otherwise they will be removed. ::: ### Request
* Edit role
*/
async roleEdit(requestParameters: RoleEditOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RoleCreate200Response> {
const response = await this.roleEditRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Fetch information about a particular role. Token scope required: `roles:read` ### Request
* Get role
*/
async roleGetRaw(requestParameters: RoleGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RoleCreate200Response>> {
if (requestParameters.roleID === null || requestParameters.roleID === undefined) {
throw new runtime.RequiredError('roleID','Required parameter requestParameters.roleID was null or undefined when calling roleGet.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/roles/{roleID}`.replace(`{${"roleID"}}`, encodeURIComponent(String(requestParameters.roleID))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RoleCreate200ResponseFromJSON(jsonValue));
}
/**
* Fetch information about a particular role. Token scope required: `roles:read` ### Request
* Get role
*/
async roleGet(requestParameters: RoleGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RoleCreate200Response> {
const response = await this.roleGetRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a paginated list of roles. Token scope required: `roles:list` ### Request
* List roles
*/
async rolesListRaw(requestParameters: RolesListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RolesList200Response>> {
const queryParameters: any = {};
if (requestParameters.includeCounts !== undefined) {
queryParameters['includeCounts'] = requestParameters.includeCounts;
}
if (requestParameters.cursor !== undefined) {
queryParameters['cursor'] = requestParameters.cursor;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['pageSize'] = requestParameters.pageSize;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("ApiToken", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
const response = await this.request({
path: `/v1/roles`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RolesList200ResponseFromJSON(jsonValue));
}
/**
* Get a paginated list of roles. Token scope required: `roles:list` ### Request
* List roles
*/
async rolesList(requestParameters: RolesListRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RolesList200Response> {
const response = await this.rolesListRaw(requestParameters, initOverrides);
return await response.value();
}
}

View File

@ -0,0 +1,7 @@
/* tslint:disable */
/* eslint-disable */
export * from './AuditLogsApi';
export * from './DownloadsApi';
export * from './HostsApi';
export * from './NetworksApi';
export * from './RolesApi';

View File

@ -0,0 +1,5 @@
/* tslint:disable */
/* eslint-disable */
export * from './runtime';
export * from './apis';
export * from './models';

View File

@ -0,0 +1,105 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import {
ActorAPIKey,
instanceOfActorAPIKey,
ActorAPIKeyFromJSON,
ActorAPIKeyFromJSONTyped,
ActorAPIKeyToJSON,
} from './ActorAPIKey';
import {
ActorHost,
instanceOfActorHost,
ActorHostFromJSON,
ActorHostFromJSONTyped,
ActorHostToJSON,
} from './ActorHost';
import {
ActorOIDCUser,
instanceOfActorOIDCUser,
ActorOIDCUserFromJSON,
ActorOIDCUserFromJSONTyped,
ActorOIDCUserToJSON,
} from './ActorOIDCUser';
import {
ActorSupport,
instanceOfActorSupport,
ActorSupportFromJSON,
ActorSupportFromJSONTyped,
ActorSupportToJSON,
} from './ActorSupport';
import {
ActorSystem,
instanceOfActorSystem,
ActorSystemFromJSON,
ActorSystemFromJSONTyped,
ActorSystemToJSON,
} from './ActorSystem';
import {
ActorUser,
instanceOfActorUser,
ActorUserFromJSON,
ActorUserFromJSONTyped,
ActorUserToJSON,
} from './ActorUser';
/**
* @type Actor
* The entity performing the action which caused a change.
* @export
*/
export type Actor = ActorAPIKey | ActorHost | ActorOIDCUser | ActorSupport | ActorSystem | ActorUser;
export function ActorFromJSON(json: any): Actor {
return ActorFromJSONTyped(json, false);
}
export function ActorFromJSONTyped(json: any, ignoreDiscriminator: boolean): Actor {
if ((json === undefined) || (json === null)) {
return json;
}
return { ...ActorAPIKeyFromJSONTyped(json, true), ...ActorHostFromJSONTyped(json, true), ...ActorOIDCUserFromJSONTyped(json, true), ...ActorSupportFromJSONTyped(json, true), ...ActorSystemFromJSONTyped(json, true), ...ActorUserFromJSONTyped(json, true) };
}
export function ActorToJSON(value?: Actor | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
if (instanceOfActorAPIKey(value)) {
return ActorAPIKeyToJSON(value as ActorAPIKey);
}
if (instanceOfActorHost(value)) {
return ActorHostToJSON(value as ActorHost);
}
if (instanceOfActorOIDCUser(value)) {
return ActorOIDCUserToJSON(value as ActorOIDCUser);
}
if (instanceOfActorSupport(value)) {
return ActorSupportToJSON(value as ActorSupport);
}
if (instanceOfActorSystem(value)) {
return ActorSystemToJSON(value as ActorSystem);
}
if (instanceOfActorUser(value)) {
return ActorUserToJSON(value as ActorUser);
}
return {};
}

View File

@ -0,0 +1,91 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorAPIKey
*/
export interface ActorAPIKey {
/**
* An API key which used to perform the action.
* @type {string}
* @memberof ActorAPIKey
*/
type?: ActorAPIKeyTypeEnum;
/**
*
* @type {string}
* @memberof ActorAPIKey
*/
id?: string;
/**
*
* @type {string}
* @memberof ActorAPIKey
*/
name?: string | null;
}
/**
* @export
*/
export const ActorAPIKeyTypeEnum = {
ApiKey: 'apiKey'
} as const;
export type ActorAPIKeyTypeEnum = typeof ActorAPIKeyTypeEnum[keyof typeof ActorAPIKeyTypeEnum];
/**
* Check if a given object implements the ActorAPIKey interface.
*/
export function instanceOfActorAPIKey(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorAPIKeyFromJSON(json: any): ActorAPIKey {
return ActorAPIKeyFromJSONTyped(json, false);
}
export function ActorAPIKeyFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorAPIKey {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
'id': !exists(json, 'id') ? undefined : json['id'],
'name': !exists(json, 'name') ? undefined : json['name'],
};
}
export function ActorAPIKeyToJSON(value?: ActorAPIKey | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
'id': value.id,
'name': value.name,
};
}

View File

@ -0,0 +1,91 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorHost
*/
export interface ActorHost {
/**
* A host. Used for example when hosts are enrolled.
* @type {string}
* @memberof ActorHost
*/
type?: ActorHostTypeEnum;
/**
*
* @type {string}
* @memberof ActorHost
*/
id?: string;
/**
*
* @type {string}
* @memberof ActorHost
*/
name?: string | null;
}
/**
* @export
*/
export const ActorHostTypeEnum = {
Host: 'host'
} as const;
export type ActorHostTypeEnum = typeof ActorHostTypeEnum[keyof typeof ActorHostTypeEnum];
/**
* Check if a given object implements the ActorHost interface.
*/
export function instanceOfActorHost(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorHostFromJSON(json: any): ActorHost {
return ActorHostFromJSONTyped(json, false);
}
export function ActorHostFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorHost {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
'id': !exists(json, 'id') ? undefined : json['id'],
'name': !exists(json, 'name') ? undefined : json['name'],
};
}
export function ActorHostToJSON(value?: ActorHost | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
'id': value.id,
'name': value.name,
};
}

View File

@ -0,0 +1,99 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorOIDCUser
*/
export interface ActorOIDCUser {
/**
* A user who logged in using SSO.
* @type {string}
* @memberof ActorOIDCUser
*/
type?: ActorOIDCUserTypeEnum;
/**
*
* @type {string}
* @memberof ActorOIDCUser
*/
email?: string;
/**
*
* @type {string}
* @memberof ActorOIDCUser
*/
issuer?: string;
/**
*
* @type {string}
* @memberof ActorOIDCUser
*/
subject?: string;
}
/**
* @export
*/
export const ActorOIDCUserTypeEnum = {
OidcUser: 'oidcUser'
} as const;
export type ActorOIDCUserTypeEnum = typeof ActorOIDCUserTypeEnum[keyof typeof ActorOIDCUserTypeEnum];
/**
* Check if a given object implements the ActorOIDCUser interface.
*/
export function instanceOfActorOIDCUser(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorOIDCUserFromJSON(json: any): ActorOIDCUser {
return ActorOIDCUserFromJSONTyped(json, false);
}
export function ActorOIDCUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorOIDCUser {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
'email': !exists(json, 'email') ? undefined : json['email'],
'issuer': !exists(json, 'issuer') ? undefined : json['issuer'],
'subject': !exists(json, 'subject') ? undefined : json['subject'],
};
}
export function ActorOIDCUserToJSON(value?: ActorOIDCUser | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
'email': value.email,
'issuer': value.issuer,
'subject': value.subject,
};
}

View File

@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorSupport
*/
export interface ActorSupport {
/**
* A member of Defined Networking support staff.
* @type {string}
* @memberof ActorSupport
*/
type?: ActorSupportTypeEnum;
}
/**
* @export
*/
export const ActorSupportTypeEnum = {
Support: 'support'
} as const;
export type ActorSupportTypeEnum = typeof ActorSupportTypeEnum[keyof typeof ActorSupportTypeEnum];
/**
* Check if a given object implements the ActorSupport interface.
*/
export function instanceOfActorSupport(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorSupportFromJSON(json: any): ActorSupport {
return ActorSupportFromJSONTyped(json, false);
}
export function ActorSupportFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorSupport {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
};
}
export function ActorSupportToJSON(value?: ActorSupport | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
};
}

View File

@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorSystem
*/
export interface ActorSystem {
/**
* System actor, used for events such as creation or rotation of Certificate Authorities.
* @type {string}
* @memberof ActorSystem
*/
type?: ActorSystemTypeEnum;
}
/**
* @export
*/
export const ActorSystemTypeEnum = {
System: 'system'
} as const;
export type ActorSystemTypeEnum = typeof ActorSystemTypeEnum[keyof typeof ActorSystemTypeEnum];
/**
* Check if a given object implements the ActorSystem interface.
*/
export function instanceOfActorSystem(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorSystemFromJSON(json: any): ActorSystem {
return ActorSystemFromJSONTyped(json, false);
}
export function ActorSystemFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorSystem {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
};
}
export function ActorSystemToJSON(value?: ActorSystem | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
};
}

View File

@ -0,0 +1,91 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ActorUser
*/
export interface ActorUser {
/**
* A logged-in user.
* @type {string}
* @memberof ActorUser
*/
type?: ActorUserTypeEnum;
/**
*
* @type {string}
* @memberof ActorUser
*/
id?: string;
/**
*
* @type {string}
* @memberof ActorUser
*/
email?: string;
}
/**
* @export
*/
export const ActorUserTypeEnum = {
User: 'user'
} as const;
export type ActorUserTypeEnum = typeof ActorUserTypeEnum[keyof typeof ActorUserTypeEnum];
/**
* Check if a given object implements the ActorUser interface.
*/
export function instanceOfActorUser(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function ActorUserFromJSON(json: any): ActorUser {
return ActorUserFromJSONTyped(json, false);
}
export function ActorUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ActorUser {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
'id': !exists(json, 'id') ? undefined : json['id'],
'email': !exists(json, 'email') ? undefined : json['email'],
};
}
export function ActorUserToJSON(value?: ActorUser | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
'id': value.id,
'email': value.email,
};
}

View File

@ -0,0 +1,124 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Actor } from './Actor';
import {
ActorFromJSON,
ActorFromJSONTyped,
ActorToJSON,
} from './Actor';
import type { Event } from './Event';
import {
EventFromJSON,
EventFromJSONTyped,
EventToJSON,
} from './Event';
import type { Target } from './Target';
import {
TargetFromJSON,
TargetFromJSONTyped,
TargetToJSON,
} from './Target';
/**
*
* @export
* @interface AuditLog
*/
export interface AuditLog {
/**
*
* @type {string}
* @memberof AuditLog
*/
id?: string;
/**
*
* @type {string}
* @memberof AuditLog
*/
organizationID?: string;
/**
*
* @type {Date}
* @memberof AuditLog
*/
timestamp?: Date;
/**
*
* @type {Actor}
* @memberof AuditLog
*/
actor?: Actor;
/**
*
* @type {Target}
* @memberof AuditLog
*/
target?: Target;
/**
*
* @type {Event}
* @memberof AuditLog
*/
event?: Event;
}
/**
* Check if a given object implements the AuditLog interface.
*/
export function instanceOfAuditLog(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function AuditLogFromJSON(json: any): AuditLog {
return AuditLogFromJSONTyped(json, false);
}
export function AuditLogFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuditLog {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'organizationID': !exists(json, 'organizationID') ? undefined : json['organizationID'],
'timestamp': !exists(json, 'timestamp') ? undefined : (new Date(json['timestamp'])),
'actor': !exists(json, 'actor') ? undefined : ActorFromJSON(json['actor']),
'target': !exists(json, 'target') ? undefined : TargetFromJSON(json['target']),
'event': !exists(json, 'event') ? undefined : EventFromJSON(json['event']),
};
}
export function AuditLogToJSON(value?: AuditLog | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'organizationID': value.organizationID,
'timestamp': value.timestamp === undefined ? undefined : (value.timestamp.toISOString()),
'actor': ActorToJSON(value.actor),
'target': TargetToJSON(value.target),
'event': EventToJSON(value.event),
};
}

View File

@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { AuditLog } from './AuditLog';
import {
AuditLogFromJSON,
AuditLogFromJSONTyped,
AuditLogToJSON,
} from './AuditLog';
import type { PaginationMetadata } from './PaginationMetadata';
import {
PaginationMetadataFromJSON,
PaginationMetadataFromJSONTyped,
PaginationMetadataToJSON,
} from './PaginationMetadata';
/**
*
* @export
* @interface AuditLogsList200Response
*/
export interface AuditLogsList200Response {
/**
*
* @type {Array<AuditLog>}
* @memberof AuditLogsList200Response
*/
data?: Array<AuditLog>;
/**
*
* @type {PaginationMetadata}
* @memberof AuditLogsList200Response
*/
metadata?: PaginationMetadata;
}
/**
* Check if a given object implements the AuditLogsList200Response interface.
*/
export function instanceOfAuditLogsList200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function AuditLogsList200ResponseFromJSON(json: any): AuditLogsList200Response {
return AuditLogsList200ResponseFromJSONTyped(json, false);
}
export function AuditLogsList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuditLogsList200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : ((json['data'] as Array<any>).map(AuditLogFromJSON)),
'metadata': !exists(json, 'metadata') ? undefined : PaginationMetadataFromJSON(json['metadata']),
};
}
export function AuditLogsList200ResponseToJSON(value?: AuditLogsList200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': value.data === undefined ? undefined : ((value.data as Array<any>).map(AuditLogToJSON)),
'metadata': PaginationMetadataToJSON(value.metadata),
};
}

View File

@ -0,0 +1,100 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { DownloadsDnclient } from './DownloadsDnclient';
import {
DownloadsDnclientFromJSON,
DownloadsDnclientFromJSONTyped,
DownloadsDnclientToJSON,
} from './DownloadsDnclient';
import type { DownloadsMobile } from './DownloadsMobile';
import {
DownloadsMobileFromJSON,
DownloadsMobileFromJSONTyped,
DownloadsMobileToJSON,
} from './DownloadsMobile';
import type { DownloadsVersionInfo } from './DownloadsVersionInfo';
import {
DownloadsVersionInfoFromJSON,
DownloadsVersionInfoFromJSONTyped,
DownloadsVersionInfoToJSON,
} from './DownloadsVersionInfo';
/**
*
* @export
* @interface Downloads
*/
export interface Downloads {
/**
*
* @type {DownloadsDnclient}
* @memberof Downloads
*/
dnclient?: DownloadsDnclient;
/**
*
* @type {DownloadsMobile}
* @memberof Downloads
*/
mobile?: DownloadsMobile;
/**
*
* @type {DownloadsVersionInfo}
* @memberof Downloads
*/
versionInfo?: DownloadsVersionInfo;
}
/**
* Check if a given object implements the Downloads interface.
*/
export function instanceOfDownloads(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsFromJSON(json: any): Downloads {
return DownloadsFromJSONTyped(json, false);
}
export function DownloadsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Downloads {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'dnclient': !exists(json, 'dnclient') ? undefined : DownloadsDnclientFromJSON(json['dnclient']),
'mobile': !exists(json, 'mobile') ? undefined : DownloadsMobileFromJSON(json['mobile']),
'versionInfo': !exists(json, 'versionInfo') ? undefined : DownloadsVersionInfoFromJSON(json['versionInfo']),
};
}
export function DownloadsToJSON(value?: Downloads | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'dnclient': DownloadsDnclientToJSON(value.dnclient),
'mobile': DownloadsMobileToJSON(value.mobile),
'versionInfo': DownloadsVersionInfoToJSON(value.versionInfo),
};
}

View File

@ -0,0 +1,108 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* Download links for a given DNClient version
* @export
* @interface DownloadsDNClientLinks
*/
export interface DownloadsDNClientLinks {
[key: string]: string | any;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
linuxAmd64?: string;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
linuxArm64?: string;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
macosUniversal?: string;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
macosUniversalDmg?: string;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
windowsAmd64?: string;
/**
*
* @type {string}
* @memberof DownloadsDNClientLinks
*/
windowsArm64?: string;
}
/**
* Check if a given object implements the DownloadsDNClientLinks interface.
*/
export function instanceOfDownloadsDNClientLinks(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsDNClientLinksFromJSON(json: any): DownloadsDNClientLinks {
return DownloadsDNClientLinksFromJSONTyped(json, false);
}
export function DownloadsDNClientLinksFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsDNClientLinks {
if ((json === undefined) || (json === null)) {
return json;
}
return {
...json,
'linuxAmd64': !exists(json, 'linux-amd64') ? undefined : json['linux-amd64'],
'linuxArm64': !exists(json, 'linux-arm64') ? undefined : json['linux-arm64'],
'macosUniversal': !exists(json, 'macos-universal') ? undefined : json['macos-universal'],
'macosUniversalDmg': !exists(json, 'macos-universal-dmg') ? undefined : json['macos-universal-dmg'],
'windowsAmd64': !exists(json, 'windows-amd64') ? undefined : json['windows-amd64'],
'windowsArm64': !exists(json, 'windows-arm64') ? undefined : json['windows-arm64'],
};
}
export function DownloadsDNClientLinksToJSON(value?: DownloadsDNClientLinks | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
...value,
'linux-amd64': value.linuxAmd64,
'linux-arm64': value.linuxArm64,
'macos-universal': value.macosUniversal,
'macos-universal-dmg': value.macosUniversalDmg,
'windows-amd64': value.windowsAmd64,
'windows-arm64': value.windowsArm64,
};
}

View File

@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { DownloadsDNClientLinks } from './DownloadsDNClientLinks';
import {
DownloadsDNClientLinksFromJSON,
DownloadsDNClientLinksFromJSONTyped,
DownloadsDNClientLinksToJSON,
} from './DownloadsDNClientLinks';
/**
*
* @export
* @interface DownloadsDnclient
*/
export interface DownloadsDnclient {
[key: string]: DownloadsDNClientLinks | any;
/**
*
* @type {DownloadsDNClientLinks}
* @memberof DownloadsDnclient
*/
latest?: DownloadsDNClientLinks;
}
/**
* Check if a given object implements the DownloadsDnclient interface.
*/
export function instanceOfDownloadsDnclient(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsDnclientFromJSON(json: any): DownloadsDnclient {
return DownloadsDnclientFromJSONTyped(json, false);
}
export function DownloadsDnclientFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsDnclient {
if ((json === undefined) || (json === null)) {
return json;
}
return {
...json,
'latest': !exists(json, 'latest') ? undefined : DownloadsDNClientLinksFromJSON(json['latest']),
};
}
export function DownloadsDnclientToJSON(value?: DownloadsDnclient | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
...value,
'latest': DownloadsDNClientLinksToJSON(value.latest),
};
}

View File

@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Downloads } from './Downloads';
import {
DownloadsFromJSON,
DownloadsFromJSONTyped,
DownloadsToJSON,
} from './Downloads';
/**
*
* @export
* @interface DownloadsList200Response
*/
export interface DownloadsList200Response {
/**
*
* @type {Downloads}
* @memberof DownloadsList200Response
*/
data?: Downloads;
}
/**
* Check if a given object implements the DownloadsList200Response interface.
*/
export function instanceOfDownloadsList200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsList200ResponseFromJSON(json: any): DownloadsList200Response {
return DownloadsList200ResponseFromJSONTyped(json, false);
}
export function DownloadsList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsList200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : DownloadsFromJSON(json['data']),
};
}
export function DownloadsList200ResponseToJSON(value?: DownloadsList200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': DownloadsToJSON(value.data),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface DownloadsMobile
*/
export interface DownloadsMobile {
/**
* Mobile Nebula download URL for Android devices.
* @type {string}
* @memberof DownloadsMobile
*/
android?: string;
/**
* Mobile Nebula download URL for iOS devices.
* @type {string}
* @memberof DownloadsMobile
*/
ios?: string;
}
/**
* Check if a given object implements the DownloadsMobile interface.
*/
export function instanceOfDownloadsMobile(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsMobileFromJSON(json: any): DownloadsMobile {
return DownloadsMobileFromJSONTyped(json, false);
}
export function DownloadsMobileFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsMobile {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'android': !exists(json, 'android') ? undefined : json['android'],
'ios': !exists(json, 'ios') ? undefined : json['ios'],
};
}
export function DownloadsMobileToJSON(value?: DownloadsMobile | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'android': value.android,
'ios': value.ios,
};
}

View File

@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { DownloadsVersionInfoDnclientValue } from './DownloadsVersionInfoDnclientValue';
import {
DownloadsVersionInfoDnclientValueFromJSON,
DownloadsVersionInfoDnclientValueFromJSONTyped,
DownloadsVersionInfoDnclientValueToJSON,
} from './DownloadsVersionInfoDnclientValue';
import type { DownloadsVersionInfoLatest } from './DownloadsVersionInfoLatest';
import {
DownloadsVersionInfoLatestFromJSON,
DownloadsVersionInfoLatestFromJSONTyped,
DownloadsVersionInfoLatestToJSON,
} from './DownloadsVersionInfoLatest';
/**
*
* @export
* @interface DownloadsVersionInfo
*/
export interface DownloadsVersionInfo {
/**
* Information about available DNClient releases
* @type {{ [key: string]: DownloadsVersionInfoDnclientValue; }}
* @memberof DownloadsVersionInfo
*/
dnclient?: { [key: string]: DownloadsVersionInfoDnclientValue; };
/**
*
* @type {DownloadsVersionInfoLatest}
* @memberof DownloadsVersionInfo
*/
latest?: DownloadsVersionInfoLatest;
}
/**
* Check if a given object implements the DownloadsVersionInfo interface.
*/
export function instanceOfDownloadsVersionInfo(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsVersionInfoFromJSON(json: any): DownloadsVersionInfo {
return DownloadsVersionInfoFromJSONTyped(json, false);
}
export function DownloadsVersionInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsVersionInfo {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'dnclient': !exists(json, 'dnclient') ? undefined : (mapValues(json['dnclient'], DownloadsVersionInfoDnclientValueFromJSON)),
'latest': !exists(json, 'latest') ? undefined : DownloadsVersionInfoLatestFromJSON(json['latest']),
};
}
export function DownloadsVersionInfoToJSON(value?: DownloadsVersionInfo | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'dnclient': value.dnclient === undefined ? undefined : (mapValues(value.dnclient, DownloadsVersionInfoDnclientValueToJSON)),
'latest': DownloadsVersionInfoLatestToJSON(value.latest),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* Information about a given DNClient release
* @export
* @interface DownloadsVersionInfoDnclientValue
*/
export interface DownloadsVersionInfoDnclientValue {
/**
*
* @type {string}
* @memberof DownloadsVersionInfoDnclientValue
*/
releaseDate?: string;
/**
*
* @type {boolean}
* @memberof DownloadsVersionInfoDnclientValue
*/
latest?: boolean;
}
/**
* Check if a given object implements the DownloadsVersionInfoDnclientValue interface.
*/
export function instanceOfDownloadsVersionInfoDnclientValue(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsVersionInfoDnclientValueFromJSON(json: any): DownloadsVersionInfoDnclientValue {
return DownloadsVersionInfoDnclientValueFromJSONTyped(json, false);
}
export function DownloadsVersionInfoDnclientValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsVersionInfoDnclientValue {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'releaseDate': !exists(json, 'releaseDate') ? undefined : json['releaseDate'],
'latest': !exists(json, 'latest') ? undefined : json['latest'],
};
}
export function DownloadsVersionInfoDnclientValueToJSON(value?: DownloadsVersionInfoDnclientValue | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'releaseDate': value.releaseDate,
'latest': value.latest,
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* The latest version for each software download.
* @export
* @interface DownloadsVersionInfoLatest
*/
export interface DownloadsVersionInfoLatest {
/**
* The latest version of DNClient.
* @type {string}
* @memberof DownloadsVersionInfoLatest
*/
dnclient?: string;
/**
* The latest version of Mobile Nebula.
* @type {string}
* @memberof DownloadsVersionInfoLatest
*/
mobile?: string;
}
/**
* Check if a given object implements the DownloadsVersionInfoLatest interface.
*/
export function instanceOfDownloadsVersionInfoLatest(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function DownloadsVersionInfoLatestFromJSON(json: any): DownloadsVersionInfoLatest {
return DownloadsVersionInfoLatestFromJSONTyped(json, false);
}
export function DownloadsVersionInfoLatestFromJSONTyped(json: any, ignoreDiscriminator: boolean): DownloadsVersionInfoLatest {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'dnclient': !exists(json, 'dnclient') ? undefined : json['dnclient'],
'mobile': !exists(json, 'mobile') ? undefined : json['mobile'],
};
}
export function DownloadsVersionInfoLatestToJSON(value?: DownloadsVersionInfoLatest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'dnclient': value.dnclient,
'mobile': value.mobile,
};
}

View File

@ -0,0 +1,104 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* Information about what happened, including relevant values before & after the change.
* @export
* @interface Event
*/
export interface Event {
/**
* The type of event that occurred.
* @type {string}
* @memberof Event
*/
type?: EventTypeEnum;
/**
* The state of the target before the change was made. The shape depends on the target and event type. Can also be a string or null (e.g. target was created).
* @type {{ [key: string]: any; }}
* @memberof Event
*/
before?: { [key: string]: any; } | null;
/**
* The state of the target before the change was made. The shape depends on the target and event type. Can also be a string or null (e.g. target was deleted).
* @type {{ [key: string]: any; }}
* @memberof Event
*/
after?: { [key: string]: any; } | null;
}
/**
* @export
*/
export const EventTypeEnum = {
Created: 'CREATED',
Updated: 'UPDATED',
Deleted: 'DELETED',
DeletedTotp: 'DELETED_TOTP',
CreatedTotp: 'CREATED_TOTP',
SucceededAuth: 'SUCCEEDED_AUTH',
FailedAuth: 'FAILED_AUTH',
Enrolled: 'ENROLLED',
Renewed: 'RENEWED',
CreatedEnrollCode: 'CREATED_ENROLL_CODE',
SetNetworkCa: 'SET_NETWORK_CA',
BlockedHost: 'BLOCKED_HOST',
UnblockedHost: 'UNBLOCKED_HOST',
SetOverrides: 'SET_OVERRIDES'
} as const;
export type EventTypeEnum = typeof EventTypeEnum[keyof typeof EventTypeEnum];
/**
* Check if a given object implements the Event interface.
*/
export function instanceOfEvent(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function EventFromJSON(json: any): Event {
return EventFromJSONTyped(json, false);
}
export function EventFromJSONTyped(json: any, ignoreDiscriminator: boolean): Event {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'type': !exists(json, 'type') ? undefined : json['type'],
'before': !exists(json, 'before') ? undefined : json['before'],
'after': !exists(json, 'after') ? undefined : json['after'],
};
}
export function EventToJSON(value?: Event | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'type': value.type,
'before': value.before,
'after': value.after,
};
}

View File

@ -0,0 +1,110 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { FirewallRulePortRange } from './FirewallRulePortRange';
import {
FirewallRulePortRangeFromJSON,
FirewallRulePortRangeFromJSONTyped,
FirewallRulePortRangeToJSON,
} from './FirewallRulePortRange';
/**
*
* @export
* @interface FirewallRule
*/
export interface FirewallRule {
/**
*
* @type {string}
* @memberof FirewallRule
*/
protocol: FirewallRuleProtocolEnum;
/**
*
* @type {string}
* @memberof FirewallRule
*/
description?: string;
/**
* Role ID to allow with this firewall rule. If not specified, all roles are included.
* @type {string}
* @memberof FirewallRule
*/
allowedRoleID?: string;
/**
*
* @type {FirewallRulePortRange}
* @memberof FirewallRule
*/
portRange?: FirewallRulePortRange;
}
/**
* @export
*/
export const FirewallRuleProtocolEnum = {
Any: 'ANY',
Tcp: 'TCP',
Udp: 'UDP',
Icmp: 'ICMP'
} as const;
export type FirewallRuleProtocolEnum = typeof FirewallRuleProtocolEnum[keyof typeof FirewallRuleProtocolEnum];
/**
* Check if a given object implements the FirewallRule interface.
*/
export function instanceOfFirewallRule(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "protocol" in value;
return isInstance;
}
export function FirewallRuleFromJSON(json: any): FirewallRule {
return FirewallRuleFromJSONTyped(json, false);
}
export function FirewallRuleFromJSONTyped(json: any, ignoreDiscriminator: boolean): FirewallRule {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'protocol': json['protocol'],
'description': !exists(json, 'description') ? undefined : json['description'],
'allowedRoleID': !exists(json, 'allowedRoleID') ? undefined : json['allowedRoleID'],
'portRange': !exists(json, 'portRange') ? undefined : FirewallRulePortRangeFromJSON(json['portRange']),
};
}
export function FirewallRuleToJSON(value?: FirewallRule | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'protocol': value.protocol,
'description': value.description,
'allowedRoleID': value.allowedRoleID,
'portRange': FirewallRulePortRangeToJSON(value.portRange),
};
}

View File

@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* Range of ports for this firewall rule. If not provided or set to null, all ports are allowed.
* @export
* @interface FirewallRulePortRange
*/
export interface FirewallRulePortRange {
/**
* First port number included in range.
* @type {number}
* @memberof FirewallRulePortRange
*/
from: number;
/**
* Last port number included in range. Must be greater than `from` port.
* @type {number}
* @memberof FirewallRulePortRange
*/
to: number;
}
/**
* Check if a given object implements the FirewallRulePortRange interface.
*/
export function instanceOfFirewallRulePortRange(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "from" in value;
isInstance = isInstance && "to" in value;
return isInstance;
}
export function FirewallRulePortRangeFromJSON(json: any): FirewallRulePortRange {
return FirewallRulePortRangeFromJSONTyped(json, false);
}
export function FirewallRulePortRangeFromJSONTyped(json: any, ignoreDiscriminator: boolean): FirewallRulePortRange {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'from': json['from'],
'to': json['to'],
};
}
export function FirewallRulePortRangeToJSON(value?: FirewallRulePortRange | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'from': value.from,
'to': value.to,
};
}

View File

@ -0,0 +1,168 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { HostMetadata } from './HostMetadata';
import {
HostMetadataFromJSON,
HostMetadataFromJSONTyped,
HostMetadataToJSON,
} from './HostMetadata';
/**
*
* @export
* @interface Host
*/
export interface Host {
/**
*
* @type {string}
* @memberof Host
*/
id?: string;
/**
*
* @type {string}
* @memberof Host
*/
organizationID?: string;
/**
*
* @type {string}
* @memberof Host
*/
networkID?: string;
/**
*
* @type {string}
* @memberof Host
*/
roleID?: string | null;
/**
*
* @type {string}
* @memberof Host
*/
name?: string;
/**
*
* @type {string}
* @memberof Host
*/
ipAddress?: string;
/**
*
* @type {Array<string>}
* @memberof Host
*/
staticAddresses?: Array<string>;
/**
* Will be zero if a regular host
* @type {number}
* @memberof Host
*/
listenPort?: number;
/**
*
* @type {boolean}
* @memberof Host
*/
isLighthouse?: boolean;
/**
*
* @type {boolean}
* @memberof Host
*/
isRelay?: boolean;
/**
*
* @type {Date}
* @memberof Host
*/
createdAt?: Date;
/**
*
* @type {boolean}
* @memberof Host
*/
isBlocked?: boolean;
/**
*
* @type {HostMetadata}
* @memberof Host
*/
metadata?: HostMetadata;
}
/**
* Check if a given object implements the Host interface.
*/
export function instanceOfHost(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostFromJSON(json: any): Host {
return HostFromJSONTyped(json, false);
}
export function HostFromJSONTyped(json: any, ignoreDiscriminator: boolean): Host {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'organizationID': !exists(json, 'organizationID') ? undefined : json['organizationID'],
'networkID': !exists(json, 'networkID') ? undefined : json['networkID'],
'roleID': !exists(json, 'roleID') ? undefined : json['roleID'],
'name': !exists(json, 'name') ? undefined : json['name'],
'ipAddress': !exists(json, 'ipAddress') ? undefined : json['ipAddress'],
'staticAddresses': !exists(json, 'staticAddresses') ? undefined : json['staticAddresses'],
'listenPort': !exists(json, 'listenPort') ? undefined : json['listenPort'],
'isLighthouse': !exists(json, 'isLighthouse') ? undefined : json['isLighthouse'],
'isRelay': !exists(json, 'isRelay') ? undefined : json['isRelay'],
'createdAt': !exists(json, 'createdAt') ? undefined : (new Date(json['createdAt'])),
'isBlocked': !exists(json, 'isBlocked') ? undefined : json['isBlocked'],
'metadata': !exists(json, 'metadata') ? undefined : HostMetadataFromJSON(json['metadata']),
};
}
export function HostToJSON(value?: Host | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'organizationID': value.organizationID,
'networkID': value.networkID,
'roleID': value.roleID,
'name': value.name,
'ipAddress': value.ipAddress,
'staticAddresses': value.staticAddresses,
'listenPort': value.listenPort,
'isLighthouse': value.isLighthouse,
'isRelay': value.isRelay,
'createdAt': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
'isBlocked': value.isBlocked,
'metadata': HostMetadataToJSON(value.metadata),
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { HostAndEnrollCodeCreate200ResponseData } from './HostAndEnrollCodeCreate200ResponseData';
import {
HostAndEnrollCodeCreate200ResponseDataFromJSON,
HostAndEnrollCodeCreate200ResponseDataFromJSONTyped,
HostAndEnrollCodeCreate200ResponseDataToJSON,
} from './HostAndEnrollCodeCreate200ResponseData';
/**
*
* @export
* @interface HostAndEnrollCodeCreate200Response
*/
export interface HostAndEnrollCodeCreate200Response {
/**
*
* @type {HostAndEnrollCodeCreate200ResponseData}
* @memberof HostAndEnrollCodeCreate200Response
*/
data?: HostAndEnrollCodeCreate200ResponseData;
/**
*
* @type {object}
* @memberof HostAndEnrollCodeCreate200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostAndEnrollCodeCreate200Response interface.
*/
export function instanceOfHostAndEnrollCodeCreate200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostAndEnrollCodeCreate200ResponseFromJSON(json: any): HostAndEnrollCodeCreate200Response {
return HostAndEnrollCodeCreate200ResponseFromJSONTyped(json, false);
}
export function HostAndEnrollCodeCreate200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostAndEnrollCodeCreate200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostAndEnrollCodeCreate200ResponseDataFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostAndEnrollCodeCreate200ResponseToJSON(value?: HostAndEnrollCodeCreate200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostAndEnrollCodeCreate200ResponseDataToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,87 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
import type { HostAndEnrollCodeCreate200ResponseDataEnrollmentCode } from './HostAndEnrollCodeCreate200ResponseDataEnrollmentCode';
import {
HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON,
HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped,
HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON,
} from './HostAndEnrollCodeCreate200ResponseDataEnrollmentCode';
/**
*
* @export
* @interface HostAndEnrollCodeCreate200ResponseData
*/
export interface HostAndEnrollCodeCreate200ResponseData {
/**
*
* @type {Host}
* @memberof HostAndEnrollCodeCreate200ResponseData
*/
host: Host;
/**
*
* @type {HostAndEnrollCodeCreate200ResponseDataEnrollmentCode}
* @memberof HostAndEnrollCodeCreate200ResponseData
*/
enrollmentCode?: HostAndEnrollCodeCreate200ResponseDataEnrollmentCode;
}
/**
* Check if a given object implements the HostAndEnrollCodeCreate200ResponseData interface.
*/
export function instanceOfHostAndEnrollCodeCreate200ResponseData(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "host" in value;
return isInstance;
}
export function HostAndEnrollCodeCreate200ResponseDataFromJSON(json: any): HostAndEnrollCodeCreate200ResponseData {
return HostAndEnrollCodeCreate200ResponseDataFromJSONTyped(json, false);
}
export function HostAndEnrollCodeCreate200ResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostAndEnrollCodeCreate200ResponseData {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'host': HostFromJSON(json['host']),
'enrollmentCode': !exists(json, 'enrollmentCode') ? undefined : HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON(json['enrollmentCode']),
};
}
export function HostAndEnrollCodeCreate200ResponseDataToJSON(value?: HostAndEnrollCodeCreate200ResponseData | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'host': HostToJSON(value.host),
'enrollmentCode': HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON(value.enrollmentCode),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostAndEnrollCodeCreate200ResponseDataEnrollmentCode
*/
export interface HostAndEnrollCodeCreate200ResponseDataEnrollmentCode {
/**
*
* @type {string}
* @memberof HostAndEnrollCodeCreate200ResponseDataEnrollmentCode
*/
code?: string;
/**
*
* @type {number}
* @memberof HostAndEnrollCodeCreate200ResponseDataEnrollmentCode
*/
lifetimeSeconds?: number;
}
/**
* Check if a given object implements the HostAndEnrollCodeCreate200ResponseDataEnrollmentCode interface.
*/
export function instanceOfHostAndEnrollCodeCreate200ResponseDataEnrollmentCode(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON(json: any): HostAndEnrollCodeCreate200ResponseDataEnrollmentCode {
return HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped(json, false);
}
export function HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostAndEnrollCodeCreate200ResponseDataEnrollmentCode {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'code': !exists(json, 'code') ? undefined : json['code'],
'lifetimeSeconds': !exists(json, 'lifetimeSeconds') ? undefined : json['lifetimeSeconds'],
};
}
export function HostAndEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON(value?: HostAndEnrollCodeCreate200ResponseDataEnrollmentCode | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'code': value.code,
'lifetimeSeconds': value.lifetimeSeconds,
};
}

View File

@ -0,0 +1,66 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostAndEnrollCodeCreate400Response
*/
export interface HostAndEnrollCodeCreate400Response {
/**
*
* @type {Array<Error>}
* @memberof HostAndEnrollCodeCreate400Response
*/
errors: Array<Error>;
}
/**
* Check if a given object implements the HostAndEnrollCodeCreate400Response interface.
*/
export function instanceOfHostAndEnrollCodeCreate400Response(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "errors" in value;
return isInstance;
}
export function HostAndEnrollCodeCreate400ResponseFromJSON(json: any): HostAndEnrollCodeCreate400Response {
return HostAndEnrollCodeCreate400ResponseFromJSONTyped(json, false);
}
export function HostAndEnrollCodeCreate400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostAndEnrollCodeCreate400Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'errors': json['errors'],
};
}
export function HostAndEnrollCodeCreate400ResponseToJSON(value?: HostAndEnrollCodeCreate400Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'errors': value.errors,
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { HostBlock200ResponseData } from './HostBlock200ResponseData';
import {
HostBlock200ResponseDataFromJSON,
HostBlock200ResponseDataFromJSONTyped,
HostBlock200ResponseDataToJSON,
} from './HostBlock200ResponseData';
/**
*
* @export
* @interface HostBlock200Response
*/
export interface HostBlock200Response {
/**
*
* @type {HostBlock200ResponseData}
* @memberof HostBlock200Response
*/
data?: HostBlock200ResponseData;
/**
*
* @type {object}
* @memberof HostBlock200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostBlock200Response interface.
*/
export function instanceOfHostBlock200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostBlock200ResponseFromJSON(json: any): HostBlock200Response {
return HostBlock200ResponseFromJSONTyped(json, false);
}
export function HostBlock200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostBlock200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostBlock200ResponseDataFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostBlock200ResponseToJSON(value?: HostBlock200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostBlock200ResponseDataToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
/**
*
* @export
* @interface HostBlock200ResponseData
*/
export interface HostBlock200ResponseData {
/**
*
* @type {Host}
* @memberof HostBlock200ResponseData
*/
host?: Host;
}
/**
* Check if a given object implements the HostBlock200ResponseData interface.
*/
export function instanceOfHostBlock200ResponseData(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostBlock200ResponseDataFromJSON(json: any): HostBlock200ResponseData {
return HostBlock200ResponseDataFromJSONTyped(json, false);
}
export function HostBlock200ResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostBlock200ResponseData {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'host': !exists(json, 'host') ? undefined : HostFromJSON(json['host']),
};
}
export function HostBlock200ResponseDataToJSON(value?: HostBlock200ResponseData | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'host': HostToJSON(value.host),
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
/**
*
* @export
* @interface HostCreate200Response
*/
export interface HostCreate200Response {
/**
*
* @type {Host}
* @memberof HostCreate200Response
*/
data?: Host;
/**
*
* @type {object}
* @memberof HostCreate200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostCreate200Response interface.
*/
export function instanceOfHostCreate200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostCreate200ResponseFromJSON(json: any): HostCreate200Response {
return HostCreate200ResponseFromJSONTyped(json, false);
}
export function HostCreate200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostCreate200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostCreate200ResponseToJSON(value?: HostCreate200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostCreate400Response
*/
export interface HostCreate400Response {
/**
*
* @type {Array<Error>}
* @memberof HostCreate400Response
*/
errors?: Array<Error>;
}
/**
* Check if a given object implements the HostCreate400Response interface.
*/
export function instanceOfHostCreate400Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostCreate400ResponseFromJSON(json: any): HostCreate400Response {
return HostCreate400ResponseFromJSONTyped(json, false);
}
export function HostCreate400ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostCreate400Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'errors': !exists(json, 'errors') ? undefined : json['errors'],
};
}
export function HostCreate400ResponseToJSON(value?: HostCreate400Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'errors': value.errors,
};
}

View File

@ -0,0 +1,123 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostCreateRequest
*/
export interface HostCreateRequest {
/**
* Name of the new host
* @type {string}
* @memberof HostCreateRequest
*/
name: string;
/**
* ID of your network
* @type {string}
* @memberof HostCreateRequest
*/
networkID: string;
/**
* ID of the role you want to assign
* @type {string}
* @memberof HostCreateRequest
*/
roleID?: string | null;
/**
* Assign an IP address to be used within the Managed Nebula network. Must be within the network's CIDR range. Will be chosen automatically if not provided.
* @type {string}
* @memberof HostCreateRequest
*/
ipAddress?: string;
/**
* List of static IPv4:port addresses. At least one is required if `isLighthouse` is `true`.
* @type {Array<string>}
* @memberof HostCreateRequest
*/
staticAddresses?: Array<string>;
/**
* The UDP port nebula should use on the host. An available port will be automatically selected if `0` is specified. Required for lighthouses and relays.
* @type {any}
* @memberof HostCreateRequest
*/
listenPort?: any | null;
/**
* Set to true to create a new lighthouse. A Lighthouse cannot also be relay.
* @type {any}
* @memberof HostCreateRequest
*/
isLighthouse?: any | null;
/**
* Set to true to create a new relay. A relay cannot also be a lighthouse.
* @type {any}
* @memberof HostCreateRequest
*/
isRelay?: any | null;
}
/**
* Check if a given object implements the HostCreateRequest interface.
*/
export function instanceOfHostCreateRequest(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "name" in value;
isInstance = isInstance && "networkID" in value;
return isInstance;
}
export function HostCreateRequestFromJSON(json: any): HostCreateRequest {
return HostCreateRequestFromJSONTyped(json, false);
}
export function HostCreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostCreateRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'name': json['name'],
'networkID': json['networkID'],
'roleID': !exists(json, 'roleID') ? undefined : json['roleID'],
'ipAddress': !exists(json, 'ipAddress') ? undefined : json['ipAddress'],
'staticAddresses': !exists(json, 'staticAddresses') ? undefined : json['staticAddresses'],
'listenPort': !exists(json, 'listenPort') ? undefined : json['listenPort'],
'isLighthouse': !exists(json, 'isLighthouse') ? undefined : json['isLighthouse'],
'isRelay': !exists(json, 'isRelay') ? undefined : json['isRelay'],
};
}
export function HostCreateRequestToJSON(value?: HostCreateRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'networkID': value.networkID,
'roleID': value.roleID,
'ipAddress': value.ipAddress,
'staticAddresses': value.staticAddresses,
'listenPort': value.listenPort,
'isLighthouse': value.isLighthouse,
'isRelay': value.isRelay,
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostDelete200Response
*/
export interface HostDelete200Response {
/**
*
* @type {object}
* @memberof HostDelete200Response
*/
data?: object;
/**
*
* @type {object}
* @memberof HostDelete200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostDelete200Response interface.
*/
export function instanceOfHostDelete200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostDelete200ResponseFromJSON(json: any): HostDelete200Response {
return HostDelete200ResponseFromJSONTyped(json, false);
}
export function HostDelete200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostDelete200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : json['data'],
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostDelete200ResponseToJSON(value?: HostDelete200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': value.data,
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
/**
*
* @export
* @interface HostEdit200Response
*/
export interface HostEdit200Response {
/**
*
* @type {Host}
* @memberof HostEdit200Response
*/
data?: Host;
/**
*
* @type {object}
* @memberof HostEdit200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostEdit200Response interface.
*/
export function instanceOfHostEdit200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostEdit200ResponseFromJSON(json: any): HostEdit200Response {
return HostEdit200ResponseFromJSONTyped(json, false);
}
export function HostEdit200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostEdit200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostEdit200ResponseToJSON(value?: HostEdit200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostEditRequest
*/
export interface HostEditRequest {
/**
* List of static IPv4:port addresses. At least one is required if `isLighthouse` is `true`.
* @type {string}
* @memberof HostEditRequest
*/
staticAddresses?: string;
/**
* The UDP port nebula should use on the host. An available port will be automatically selected if `0` is specified. Required for lighthouses and relays.
* @type {any}
* @memberof HostEditRequest
*/
listenPort?: any | null;
}
/**
* Check if a given object implements the HostEditRequest interface.
*/
export function instanceOfHostEditRequest(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostEditRequestFromJSON(json: any): HostEditRequest {
return HostEditRequestFromJSONTyped(json, false);
}
export function HostEditRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostEditRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'staticAddresses': !exists(json, 'staticAddresses') ? undefined : json['staticAddresses'],
'listenPort': !exists(json, 'listenPort') ? undefined : json['listenPort'],
};
}
export function HostEditRequestToJSON(value?: HostEditRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'staticAddresses': value.staticAddresses,
'listenPort': value.listenPort,
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { HostEnrollCodeCreate200ResponseData } from './HostEnrollCodeCreate200ResponseData';
import {
HostEnrollCodeCreate200ResponseDataFromJSON,
HostEnrollCodeCreate200ResponseDataFromJSONTyped,
HostEnrollCodeCreate200ResponseDataToJSON,
} from './HostEnrollCodeCreate200ResponseData';
/**
*
* @export
* @interface HostEnrollCodeCreate200Response
*/
export interface HostEnrollCodeCreate200Response {
/**
*
* @type {HostEnrollCodeCreate200ResponseData}
* @memberof HostEnrollCodeCreate200Response
*/
data?: HostEnrollCodeCreate200ResponseData;
/**
*
* @type {object}
* @memberof HostEnrollCodeCreate200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostEnrollCodeCreate200Response interface.
*/
export function instanceOfHostEnrollCodeCreate200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostEnrollCodeCreate200ResponseFromJSON(json: any): HostEnrollCodeCreate200Response {
return HostEnrollCodeCreate200ResponseFromJSONTyped(json, false);
}
export function HostEnrollCodeCreate200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostEnrollCodeCreate200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostEnrollCodeCreate200ResponseDataFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostEnrollCodeCreate200ResponseToJSON(value?: HostEnrollCodeCreate200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostEnrollCodeCreate200ResponseDataToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { HostEnrollCodeCreate200ResponseDataEnrollmentCode } from './HostEnrollCodeCreate200ResponseDataEnrollmentCode';
import {
HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON,
HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped,
HostEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON,
} from './HostEnrollCodeCreate200ResponseDataEnrollmentCode';
/**
*
* @export
* @interface HostEnrollCodeCreate200ResponseData
*/
export interface HostEnrollCodeCreate200ResponseData {
/**
*
* @type {HostEnrollCodeCreate200ResponseDataEnrollmentCode}
* @memberof HostEnrollCodeCreate200ResponseData
*/
enrollmentCode?: HostEnrollCodeCreate200ResponseDataEnrollmentCode;
}
/**
* Check if a given object implements the HostEnrollCodeCreate200ResponseData interface.
*/
export function instanceOfHostEnrollCodeCreate200ResponseData(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostEnrollCodeCreate200ResponseDataFromJSON(json: any): HostEnrollCodeCreate200ResponseData {
return HostEnrollCodeCreate200ResponseDataFromJSONTyped(json, false);
}
export function HostEnrollCodeCreate200ResponseDataFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostEnrollCodeCreate200ResponseData {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'enrollmentCode': !exists(json, 'enrollmentCode') ? undefined : HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON(json['enrollmentCode']),
};
}
export function HostEnrollCodeCreate200ResponseDataToJSON(value?: HostEnrollCodeCreate200ResponseData | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'enrollmentCode': HostEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON(value.enrollmentCode),
};
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostEnrollCodeCreate200ResponseDataEnrollmentCode
*/
export interface HostEnrollCodeCreate200ResponseDataEnrollmentCode {
/**
* Secret code to be used in `dnclient enroll` to allow the host/lighthouse/relay to join your Managed Nebula network.
* @type {string}
* @memberof HostEnrollCodeCreate200ResponseDataEnrollmentCode
*/
code?: string;
/**
* The number of seconds the code is valid after being issued.
* @type {number}
* @memberof HostEnrollCodeCreate200ResponseDataEnrollmentCode
*/
lifetimeSeconds?: number;
}
/**
* Check if a given object implements the HostEnrollCodeCreate200ResponseDataEnrollmentCode interface.
*/
export function instanceOfHostEnrollCodeCreate200ResponseDataEnrollmentCode(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSON(json: any): HostEnrollCodeCreate200ResponseDataEnrollmentCode {
return HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped(json, false);
}
export function HostEnrollCodeCreate200ResponseDataEnrollmentCodeFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostEnrollCodeCreate200ResponseDataEnrollmentCode {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'code': !exists(json, 'code') ? undefined : json['code'],
'lifetimeSeconds': !exists(json, 'lifetimeSeconds') ? undefined : json['lifetimeSeconds'],
};
}
export function HostEnrollCodeCreate200ResponseDataEnrollmentCodeToJSON(value?: HostEnrollCodeCreate200ResponseDataEnrollmentCode | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'code': value.code,
'lifetimeSeconds': value.lifetimeSeconds,
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
/**
*
* @export
* @interface HostGet200Response
*/
export interface HostGet200Response {
/**
*
* @type {Host}
* @memberof HostGet200Response
*/
data?: Host;
/**
*
* @type {object}
* @memberof HostGet200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the HostGet200Response interface.
*/
export function instanceOfHostGet200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostGet200ResponseFromJSON(json: any): HostGet200Response {
return HostGet200ResponseFromJSONTyped(json, false);
}
export function HostGet200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostGet200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : HostFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function HostGet200ResponseToJSON(value?: HostGet200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': HostToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,101 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HostMetadata
*/
export interface HostMetadata {
/**
*
* @type {string}
* @memberof HostMetadata
*/
lastSeenAt?: string | null;
/**
*
* @type {string}
* @memberof HostMetadata
*/
version?: string | null;
/**
*
* @type {string}
* @memberof HostMetadata
*/
platform?: HostMetadataPlatformEnum;
/**
*
* @type {boolean}
* @memberof HostMetadata
*/
updateAvailable?: boolean | null;
}
/**
* @export
*/
export const HostMetadataPlatformEnum = {
Dnclient: 'dnclient',
Mobile: 'mobile',
Null: 'null'
} as const;
export type HostMetadataPlatformEnum = typeof HostMetadataPlatformEnum[keyof typeof HostMetadataPlatformEnum];
/**
* Check if a given object implements the HostMetadata interface.
*/
export function instanceOfHostMetadata(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostMetadataFromJSON(json: any): HostMetadata {
return HostMetadataFromJSONTyped(json, false);
}
export function HostMetadataFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostMetadata {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'lastSeenAt': !exists(json, 'lastSeenAt') ? undefined : json['lastSeenAt'],
'version': !exists(json, 'version') ? undefined : json['version'],
'platform': !exists(json, 'platform') ? undefined : json['platform'],
'updateAvailable': !exists(json, 'updateAvailable') ? undefined : json['updateAvailable'],
};
}
export function HostMetadataToJSON(value?: HostMetadata | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'lastSeenAt': value.lastSeenAt,
'version': value.version,
'platform': value.platform,
'updateAvailable': value.updateAvailable,
};
}

View File

@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Host } from './Host';
import {
HostFromJSON,
HostFromJSONTyped,
HostToJSON,
} from './Host';
import type { PaginationMetadata } from './PaginationMetadata';
import {
PaginationMetadataFromJSON,
PaginationMetadataFromJSONTyped,
PaginationMetadataToJSON,
} from './PaginationMetadata';
/**
*
* @export
* @interface HostsList200Response
*/
export interface HostsList200Response {
/**
*
* @type {Array<Host>}
* @memberof HostsList200Response
*/
data?: Array<Host>;
/**
*
* @type {PaginationMetadata}
* @memberof HostsList200Response
*/
metadata?: PaginationMetadata;
}
/**
* Check if a given object implements the HostsList200Response interface.
*/
export function instanceOfHostsList200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HostsList200ResponseFromJSON(json: any): HostsList200Response {
return HostsList200ResponseFromJSONTyped(json, false);
}
export function HostsList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): HostsList200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : ((json['data'] as Array<any>).map(HostFromJSON)),
'metadata': !exists(json, 'metadata') ? undefined : PaginationMetadataFromJSON(json['metadata']),
};
}
export function HostsList200ResponseToJSON(value?: HostsList200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': value.data === undefined ? undefined : ((value.data as Array<any>).map(HostToJSON)),
'metadata': PaginationMetadataToJSON(value.metadata),
};
}

View File

@ -0,0 +1,83 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ModelError
*/
export interface ModelError {
/**
* A static name for the error type
* @type {string}
* @memberof ModelError
*/
code: string;
/**
* A short human readable description of the error
* @type {string}
* @memberof ModelError
*/
message: string;
/**
* Describes the variable missing or malformed
* @type {string}
* @memberof ModelError
*/
path?: string | null;
}
/**
* Check if a given object implements the ModelError interface.
*/
export function instanceOfModelError(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "code" in value;
isInstance = isInstance && "message" in value;
return isInstance;
}
export function ModelErrorFromJSON(json: any): ModelError {
return ModelErrorFromJSONTyped(json, false);
}
export function ModelErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ModelError {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'code': json['code'],
'message': json['message'],
'path': !exists(json, 'path') ? undefined : json['path'],
};
}
export function ModelErrorToJSON(value?: ModelError | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'code': value.code,
'message': value.message,
'path': value.path,
};
}

View File

@ -0,0 +1,113 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface Network
*/
export interface Network {
/**
*
* @type {string}
* @memberof Network
*/
id?: string;
/**
*
* @type {string}
* @memberof Network
*/
cidr?: string;
/**
*
* @type {string}
* @memberof Network
*/
organizationID?: string;
/**
* The ID of the Certificate Authority being used.
* @type {string}
* @memberof Network
*/
signingCAID?: string;
/**
*
* @type {Date}
* @memberof Network
*/
createdAt?: Date;
/**
*
* @type {string}
* @memberof Network
*/
name?: string;
/**
*
* @type {boolean}
* @memberof Network
*/
lighthousesAsRelays?: boolean;
}
/**
* Check if a given object implements the Network interface.
*/
export function instanceOfNetwork(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function NetworkFromJSON(json: any): Network {
return NetworkFromJSONTyped(json, false);
}
export function NetworkFromJSONTyped(json: any, ignoreDiscriminator: boolean): Network {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'cidr': !exists(json, 'cidr') ? undefined : json['cidr'],
'organizationID': !exists(json, 'organizationID') ? undefined : json['organizationID'],
'signingCAID': !exists(json, 'signingCAID') ? undefined : json['signingCAID'],
'createdAt': !exists(json, 'createdAt') ? undefined : (new Date(json['createdAt'])),
'name': !exists(json, 'name') ? undefined : json['name'],
'lighthousesAsRelays': !exists(json, 'lighthousesAsRelays') ? undefined : json['lighthousesAsRelays'],
};
}
export function NetworkToJSON(value?: Network | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'cidr': value.cidr,
'organizationID': value.organizationID,
'signingCAID': value.signingCAID,
'createdAt': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
'name': value.name,
'lighthousesAsRelays': value.lighthousesAsRelays,
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Network } from './Network';
import {
NetworkFromJSON,
NetworkFromJSONTyped,
NetworkToJSON,
} from './Network';
/**
*
* @export
* @interface NetworkGet200Response
*/
export interface NetworkGet200Response {
/**
*
* @type {Network}
* @memberof NetworkGet200Response
*/
data?: Network;
/**
*
* @type {object}
* @memberof NetworkGet200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the NetworkGet200Response interface.
*/
export function instanceOfNetworkGet200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function NetworkGet200ResponseFromJSON(json: any): NetworkGet200Response {
return NetworkGet200ResponseFromJSONTyped(json, false);
}
export function NetworkGet200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NetworkGet200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : NetworkFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function NetworkGet200ResponseToJSON(value?: NetworkGet200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': NetworkToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Network } from './Network';
import {
NetworkFromJSON,
NetworkFromJSONTyped,
NetworkToJSON,
} from './Network';
import type { PaginationMetadata } from './PaginationMetadata';
import {
PaginationMetadataFromJSON,
PaginationMetadataFromJSONTyped,
PaginationMetadataToJSON,
} from './PaginationMetadata';
/**
*
* @export
* @interface NetworksList200Response
*/
export interface NetworksList200Response {
/**
*
* @type {Array<Network>}
* @memberof NetworksList200Response
*/
data?: Array<Network>;
/**
*
* @type {PaginationMetadata}
* @memberof NetworksList200Response
*/
metadata?: PaginationMetadata;
}
/**
* Check if a given object implements the NetworksList200Response interface.
*/
export function instanceOfNetworksList200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function NetworksList200ResponseFromJSON(json: any): NetworksList200Response {
return NetworksList200ResponseFromJSONTyped(json, false);
}
export function NetworksList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): NetworksList200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : ((json['data'] as Array<any>).map(NetworkFromJSON)),
'metadata': !exists(json, 'metadata') ? undefined : PaginationMetadataFromJSON(json['metadata']),
};
}
export function NetworksList200ResponseToJSON(value?: NetworksList200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': value.data === undefined ? undefined : ((value.data as Array<any>).map(NetworkToJSON)),
'metadata': PaginationMetadataToJSON(value.metadata),
};
}

View File

@ -0,0 +1,112 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { PaginationMetadataPage } from './PaginationMetadataPage';
import {
PaginationMetadataPageFromJSON,
PaginationMetadataPageFromJSONTyped,
PaginationMetadataPageToJSON,
} from './PaginationMetadataPage';
/**
*
* @export
* @interface PaginationMetadata
*/
export interface PaginationMetadata {
/**
* The total number of resources existing in the account
* @type {number}
* @memberof PaginationMetadata
*/
totalCount?: number;
/**
* Is there a page of data that can be fetched using the `nextCursor`?
* @type {boolean}
* @memberof PaginationMetadata
*/
hasNextPage?: boolean;
/**
* Is there a page of data that can be fetched using the `prevCursor`?
* @type {boolean}
* @memberof PaginationMetadata
*/
hasPrevPage?: boolean;
/**
* An opaque string that can be used to fetch the next page of results. Not provided if result set is empty.
* @type {string}
* @memberof PaginationMetadata
*/
nextCursor?: string;
/**
* An opaque string that can be used to fetch the next page of results. Not provided if result set is empty.
* @type {string}
* @memberof PaginationMetadata
*/
prevCursor?: string;
/**
*
* @type {PaginationMetadataPage}
* @memberof PaginationMetadata
*/
page?: PaginationMetadataPage;
}
/**
* Check if a given object implements the PaginationMetadata interface.
*/
export function instanceOfPaginationMetadata(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function PaginationMetadataFromJSON(json: any): PaginationMetadata {
return PaginationMetadataFromJSONTyped(json, false);
}
export function PaginationMetadataFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginationMetadata {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'totalCount': !exists(json, 'totalCount') ? undefined : json['totalCount'],
'hasNextPage': !exists(json, 'hasNextPage') ? undefined : json['hasNextPage'],
'hasPrevPage': !exists(json, 'hasPrevPage') ? undefined : json['hasPrevPage'],
'nextCursor': !exists(json, 'nextCursor') ? undefined : json['nextCursor'],
'prevCursor': !exists(json, 'prevCursor') ? undefined : json['prevCursor'],
'page': !exists(json, 'page') ? undefined : PaginationMetadataPageFromJSON(json['page']),
};
}
export function PaginationMetadataToJSON(value?: PaginationMetadata | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'totalCount': value.totalCount,
'hasNextPage': value.hasNextPage,
'hasPrevPage': value.hasPrevPage,
'nextCursor': value.nextCursor,
'prevCursor': value.prevCursor,
'page': PaginationMetadataPageToJSON(value.page),
};
}

View File

@ -0,0 +1,75 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface PaginationMetadataPage
*/
export interface PaginationMetadataPage {
/**
* The number of results returned in the response.
* @type {number}
* @memberof PaginationMetadataPage
*/
count: number;
/**
* The zero-based index of the first result within the overall list. For example, the first page will have a `start` of `0`. If 25 results are fetched, and the `nextCursor` used to fetch a new page of results, the second request's `start` will be `25`.
* @type {number}
* @memberof PaginationMetadataPage
*/
start: number;
}
/**
* Check if a given object implements the PaginationMetadataPage interface.
*/
export function instanceOfPaginationMetadataPage(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "count" in value;
isInstance = isInstance && "start" in value;
return isInstance;
}
export function PaginationMetadataPageFromJSON(json: any): PaginationMetadataPage {
return PaginationMetadataPageFromJSONTyped(json, false);
}
export function PaginationMetadataPageFromJSONTyped(json: any, ignoreDiscriminator: boolean): PaginationMetadataPage {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'count': json['count'],
'start': json['start'],
};
}
export function PaginationMetadataPageToJSON(value?: PaginationMetadataPage | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'count': value.count,
'start': value.start,
};
}

View File

@ -0,0 +1,112 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { FirewallRule } from './FirewallRule';
import {
FirewallRuleFromJSON,
FirewallRuleFromJSONTyped,
FirewallRuleToJSON,
} from './FirewallRule';
/**
*
* @export
* @interface Role
*/
export interface Role {
/**
*
* @type {string}
* @memberof Role
*/
id?: string;
/**
*
* @type {string}
* @memberof Role
*/
name?: string;
/**
*
* @type {string}
* @memberof Role
*/
description?: string;
/**
*
* @type {Array<FirewallRule>}
* @memberof Role
*/
firewallRules?: Array<FirewallRule>;
/**
*
* @type {Date}
* @memberof Role
*/
createdAt?: Date;
/**
*
* @type {Date}
* @memberof Role
*/
modifiedAt?: Date;
}
/**
* Check if a given object implements the Role interface.
*/
export function instanceOfRole(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function RoleFromJSON(json: any): Role {
return RoleFromJSONTyped(json, false);
}
export function RoleFromJSONTyped(json: any, ignoreDiscriminator: boolean): Role {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'name': !exists(json, 'name') ? undefined : json['name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'firewallRules': !exists(json, 'firewallRules') ? undefined : ((json['firewallRules'] as Array<any>).map(FirewallRuleFromJSON)),
'createdAt': !exists(json, 'createdAt') ? undefined : (new Date(json['createdAt'])),
'modifiedAt': !exists(json, 'modifiedAt') ? undefined : (new Date(json['modifiedAt'])),
};
}
export function RoleToJSON(value?: Role | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'name': value.name,
'description': value.description,
'firewallRules': value.firewallRules === undefined ? undefined : ((value.firewallRules as Array<any>).map(FirewallRuleToJSON)),
'createdAt': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()),
'modifiedAt': value.modifiedAt === undefined ? undefined : (value.modifiedAt.toISOString()),
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { Role } from './Role';
import {
RoleFromJSON,
RoleFromJSONTyped,
RoleToJSON,
} from './Role';
/**
*
* @export
* @interface RoleCreate200Response
*/
export interface RoleCreate200Response {
/**
*
* @type {Role}
* @memberof RoleCreate200Response
*/
data?: Role;
/**
*
* @type {object}
* @memberof RoleCreate200Response
*/
metadata?: object;
}
/**
* Check if a given object implements the RoleCreate200Response interface.
*/
export function instanceOfRoleCreate200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function RoleCreate200ResponseFromJSON(json: any): RoleCreate200Response {
return RoleCreate200ResponseFromJSONTyped(json, false);
}
export function RoleCreate200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoleCreate200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : RoleFromJSON(json['data']),
'metadata': !exists(json, 'metadata') ? undefined : json['metadata'],
};
}
export function RoleCreate200ResponseToJSON(value?: RoleCreate200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': RoleToJSON(value.data),
'metadata': value.metadata,
};
}

View File

@ -0,0 +1,89 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { FirewallRule } from './FirewallRule';
import {
FirewallRuleFromJSON,
FirewallRuleFromJSONTyped,
FirewallRuleToJSON,
} from './FirewallRule';
/**
*
* @export
* @interface RoleCreateRequest
*/
export interface RoleCreateRequest {
/**
* Name of the new role
* @type {string}
* @memberof RoleCreateRequest
*/
name: string;
/**
* Optional description
* @type {string}
* @memberof RoleCreateRequest
*/
description?: string;
/**
* Incoming firewall rules
* @type {Array<FirewallRule>}
* @memberof RoleCreateRequest
*/
firewallRules?: Array<FirewallRule>;
}
/**
* Check if a given object implements the RoleCreateRequest interface.
*/
export function instanceOfRoleCreateRequest(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "name" in value;
return isInstance;
}
export function RoleCreateRequestFromJSON(json: any): RoleCreateRequest {
return RoleCreateRequestFromJSONTyped(json, false);
}
export function RoleCreateRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoleCreateRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'name': json['name'],
'description': !exists(json, 'description') ? undefined : json['description'],
'firewallRules': !exists(json, 'firewallRules') ? undefined : ((json['firewallRules'] as Array<any>).map(FirewallRuleFromJSON)),
};
}
export function RoleCreateRequestToJSON(value?: RoleCreateRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'name': value.name,
'description': value.description,
'firewallRules': value.firewallRules === undefined ? undefined : ((value.firewallRules as Array<any>).map(FirewallRuleToJSON)),
};
}

View File

@ -0,0 +1,80 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { FirewallRule } from './FirewallRule';
import {
FirewallRuleFromJSON,
FirewallRuleFromJSONTyped,
FirewallRuleToJSON,
} from './FirewallRule';
/**
*
* @export
* @interface RoleEditRequest
*/
export interface RoleEditRequest {
/**
*
* @type {string}
* @memberof RoleEditRequest
*/
description?: string;
/**
* Incoming firewall rules. Will replace existing list of rules.
* @type {Array<FirewallRule>}
* @memberof RoleEditRequest
*/
firewallRules?: Array<FirewallRule>;
}
/**
* Check if a given object implements the RoleEditRequest interface.
*/
export function instanceOfRoleEditRequest(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function RoleEditRequestFromJSON(json: any): RoleEditRequest {
return RoleEditRequestFromJSONTyped(json, false);
}
export function RoleEditRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RoleEditRequest {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'description': !exists(json, 'description') ? undefined : json['description'],
'firewallRules': !exists(json, 'firewallRules') ? undefined : ((json['firewallRules'] as Array<any>).map(FirewallRuleFromJSON)),
};
}
export function RoleEditRequestToJSON(value?: RoleEditRequest | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'description': value.description,
'firewallRules': value.firewallRules === undefined ? undefined : ((value.firewallRules as Array<any>).map(FirewallRuleToJSON)),
};
}

View File

@ -0,0 +1,86 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
import type { PaginationMetadata } from './PaginationMetadata';
import {
PaginationMetadataFromJSON,
PaginationMetadataFromJSONTyped,
PaginationMetadataToJSON,
} from './PaginationMetadata';
import type { Role } from './Role';
import {
RoleFromJSON,
RoleFromJSONTyped,
RoleToJSON,
} from './Role';
/**
*
* @export
* @interface RolesList200Response
*/
export interface RolesList200Response {
/**
*
* @type {Array<Role>}
* @memberof RolesList200Response
*/
data?: Array<Role>;
/**
*
* @type {PaginationMetadata}
* @memberof RolesList200Response
*/
metadata?: PaginationMetadata;
}
/**
* Check if a given object implements the RolesList200Response interface.
*/
export function instanceOfRolesList200Response(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function RolesList200ResponseFromJSON(json: any): RolesList200Response {
return RolesList200ResponseFromJSONTyped(json, false);
}
export function RolesList200ResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RolesList200Response {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'data': !exists(json, 'data') ? undefined : ((json['data'] as Array<any>).map(RoleFromJSON)),
'metadata': !exists(json, 'metadata') ? undefined : PaginationMetadataFromJSON(json['metadata']),
};
}
export function RolesList200ResponseToJSON(value?: RolesList200Response | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'data': value.data === undefined ? undefined : ((value.data as Array<any>).map(RoleToJSON)),
'metadata': PaginationMetadataToJSON(value.metadata),
};
}

View File

@ -0,0 +1,89 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { exists, mapValues } from '../runtime';
/**
* The entity being acted upon.
* @export
* @interface Target
*/
export interface Target {
/**
*
* @type {string}
* @memberof Target
*/
id?: string;
/**
*
* @type {string}
* @memberof Target
*/
type?: TargetTypeEnum;
}
/**
* @export
*/
export const TargetTypeEnum = {
ApiKey: 'apiKey',
Ca: 'ca',
Host: 'host',
Network: 'network',
OidcProvider: 'oidcProvider',
Role: 'role',
User: 'user'
} as const;
export type TargetTypeEnum = typeof TargetTypeEnum[keyof typeof TargetTypeEnum];
/**
* Check if a given object implements the Target interface.
*/
export function instanceOfTarget(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function TargetFromJSON(json: any): Target {
return TargetFromJSONTyped(json, false);
}
export function TargetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Target {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'id': !exists(json, 'id') ? undefined : json['id'],
'type': !exists(json, 'type') ? undefined : json['type'],
};
}
export function TargetToJSON(value?: Target | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'id': value.id,
'type': value.type,
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
export * from './Actor';
export * from './ActorAPIKey';
export * from './ActorHost';
export * from './ActorOIDCUser';
export * from './ActorSupport';
export * from './ActorSystem';
export * from './ActorUser';
export * from './AuditLog';
export * from './AuditLogsList200Response';
export * from './Downloads';
export * from './DownloadsDNClientLinks';
export * from './DownloadsDnclient';
export * from './DownloadsList200Response';
export * from './DownloadsMobile';
export * from './DownloadsVersionInfo';
export * from './DownloadsVersionInfoDnclientValue';
export * from './DownloadsVersionInfoLatest';
export * from './Event';
export * from './FirewallRule';
export * from './FirewallRulePortRange';
export * from './Host';
export * from './HostAndEnrollCodeCreate200Response';
export * from './HostAndEnrollCodeCreate200ResponseData';
export * from './HostAndEnrollCodeCreate200ResponseDataEnrollmentCode';
export * from './HostAndEnrollCodeCreate400Response';
export * from './HostBlock200Response';
export * from './HostBlock200ResponseData';
export * from './HostCreate200Response';
export * from './HostCreate400Response';
export * from './HostCreateRequest';
export * from './HostDelete200Response';
export * from './HostEdit200Response';
export * from './HostEditRequest';
export * from './HostEnrollCodeCreate200Response';
export * from './HostEnrollCodeCreate200ResponseData';
export * from './HostEnrollCodeCreate200ResponseDataEnrollmentCode';
export * from './HostGet200Response';
export * from './HostMetadata';
export * from './HostsList200Response';
export * from './ModelError';
export * from './Network';
export * from './NetworkGet200Response';
export * from './NetworksList200Response';
export * from './PaginationMetadata';
export * from './PaginationMetadataPage';
export * from './Role';
export * from './RoleCreate200Response';
export * from './RoleCreateRequest';
export * from './RoleEditRequest';
export * from './RolesList200Response';
export * from './Target';

View File

@ -0,0 +1,425 @@
/* tslint:disable */
/* eslint-disable */
/**
* Defined Networking API
* <br/> <br/> This API enables automated administration of Defined Networking hosts, roles, logs, and more. To authenticate, obtain an api key to use as a bearer token from your Defined Networking admin panel [API Keys page](https://admin.defined.net/settings/api-keys). API keys must be given the appropriate permission scopes for every method and endpoint, as specified throughout this documentation. Please [contact us](https://www.defined.net/contact?reason=support) for any questions or issues. In the event of a token leak, please take care to [rotate the key](/guides/rotating-api-keys). <div className=\'introduction-end\'></div>
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export const BASE_PATH = "https://api.defined.net".replace(/\/+$/, "");
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
set config(configuration: Configuration) {
this.configuration = configuration;
}
get basePath(): string {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi(): FetchAPI | undefined {
return this.configuration.fetchApi;
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get queryParamsStringify(): (params: HTTPQuery) => string {
return this.configuration.queryParamsStringify || querystring;
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
}
return undefined;
}
get headers(): HTTPHeaders | undefined {
return this.configuration.headers;
}
get credentials(): RequestCredentials | undefined {
return this.configuration.credentials;
}
}
export const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
private middleware: Middleware[];
constructor(protected configuration = DefaultConfig) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
protected isJsonMime(mime: string | null | undefined): boolean {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
const { url, init } = await this.createFetchParams(context, initOverrides);
const response = await this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
}
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn =
typeof initOverrides === "function"
? initOverrides
: async () => initOverrides;
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit: RequestInit = {
...initParams,
...(await initOverrideFn({
init: initParams,
context,
}))
};
const init: RequestInit = {
...overriddenInit,
body:
isFormData(overriddenInit.body) ||
overriddenInit.body instanceof URLSearchParams ||
isBlob(overriddenInit.body)
? overriddenInit.body
: JSON.stringify(overriddenInit.body),
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = await middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
}) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
} else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
function isBlob(value: any): value is Blob {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value: any): value is FormData {
return typeof FormData !== "undefined" && value instanceof FormData;
}
export class ResponseError extends Error {
override name: "ResponseError" = "ResponseError";
constructor(public response: Response, msg?: string) {
super(msg);
}
}
export class FetchError extends Error {
override name: "FetchError" = "FetchError";
constructor(public cause: Error, msg?: string) {
super(msg);
}
}
export class RequiredError extends Error {
override name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
export type HTTPBody = Json | FormData | URLSearchParams;
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value as HTTPQuery, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface ErrorContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
error: unknown;
response?: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
onError?(context: ErrorContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value(): Promise<T> {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value(): Promise<void> {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value(): Promise<Blob> {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value(): Promise<string> {
return await this.raw.text();
};
}

27
tfweb/src/lib/auth.ts Normal file
View File

@ -0,0 +1,27 @@
import {Logger, logSetup} from "$lib/logger";
export enum AuthResult {
Failed = 0,
Successful = 1
}
export interface SessionInfo {
id: string,
org_id: string,
email: string,
createdAt: string,
hasTOTP: boolean
}
export interface SessionAuthError {
code: string,
message: string
}
logSetup();
const logger = new Logger("auth.ts");
export async function isAuthedSession(): Promise<[AuthResult, SessionInfo | SessionAuthError]> {
logger.info('Checking for session authentication');
return [AuthResult.Failed, {code: "asdji", message: "asdioj"}]
}

View File

@ -1,8 +1,15 @@
{
"home": {
"itworks": "It works!",
"itworkssub": "If you're seeing this page, tfweb is installed and (probably) correctly configured.",
"adminlink": "Perhaps you meant to visit the {link0}?",
"adminlink.link0": "admin panel"
"itworks": {
"header": "It works!",
"body": "If you're seeing this page, tfweb is installed and (probably) correctly configured.",
"linkbody": "Perhaps you meant to visit the {link0}?",
"linkbody.link0": "admin panel"
},
"common": {
"title": "{title} | Trifid Web UI",
"page": {
"itworks": "It Works!",
"admin": "Admin Panel"
}
}
}

View File

@ -1,7 +1,25 @@
<script lang="ts">
import {t} from 'svelte-i18n';
import {isLoading, t} from "svelte-i18n";
import LoadingWrapper from "$components/LoadingWrapper.svelte";
import {onMount} from "svelte";
let loading = true;
let isError = false;
let error = '';
$: currentlyLoading = $isLoading || loading;
onMount(() => {
setTimeout(() => loading = false, 1000);
})
</script>
<h1>{$t('home.itworks')}</h1>
<p>{$t('home.itworkssub')}</p>
<p>{@html $t('home.adminlink', {values:{link0:'<a href="/admin">'+$t('home.adminlink.link0')+'</a>'}})}</p>
<svelte:head>
<title>{$t("common.title", {values: {title: $t("common.page.admin")}})}</title>
</svelte:head>
<LoadingWrapper isLoading={currentlyLoading} isError={isError} error={error}>
<h1>{$t('itworks.header')}</h1>
<p>{$t('itworks.body')}</p>
<!-- eslint-disable-next-line -->
<p>{@html $t('itworks.linkbody', {values:{link0:'<a href="/admin">'+$t('itworks.linkbody.link0')+'</a>'}})}</p>
</LoadingWrapper>

View File

@ -0,0 +1,36 @@
<script lang="ts">
import {isLoading, t} from "svelte-i18n";
import LoadingWrapper from "$components/LoadingWrapper.svelte";
import {onMount} from "svelte";
import {AuthResult, isAuthedSession} from "$lib/auth.ts";
import {Logger, logSetup} from "$lib/logger";
import type {SessionAuthError} from "$lib/auth.ts";
let loading = true;
let isError = false;
let error = '';
$: currentlyLoading = $isLoading || loading;
logSetup();
let logger = new Logger("admin/+page.svelte");
onMount(async () => {
let session_load_info = await isAuthedSession();
if (session_load_info[0] == AuthResult.Failed) {
let err = session_load_info[1] as SessionAuthError;
logger.error(`session load failed: ${err.code} ${err.message}`);
window.location.href = '/login';
return;
}
loading = false;
})
</script>
<svelte:head>
<title>{$t("common.title", {values: {title: $t("common.page.admin")}})}</title>
</svelte:head>
<LoadingWrapper isLoading={currentlyLoading} isError={isError} error={error}>
<h1>its not loading anymore</h1>
</LoadingWrapper>

View File

@ -11,7 +11,10 @@ const config = {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter: adapter(),
alias: {
'$components': 'src/components'
}
}
};

View File

@ -1 +1,2 @@
pub mod enroll;
pub mod whoami;

View File

@ -0,0 +1,162 @@
// trifid-api, an open source reimplementation of the Defined Networking nebula management server.
// Copyright (C) 2023 c0repwn3r
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
//#POST /v2/whoami t+parity:full t+type:reverse_engineered t+status:done t+features:definednetworking
// This endpoint has full parity with the original API. It has been reverse-engineered from the original API as the original API docs do not have this item.
// This endpoint is considered done. No major features should be added or removed, unless it fixes bugs.
// This endpoint requires the `definednetworking` extension to be enabled to be used.
use actix_web::{get, HttpRequest, HttpResponse};
use actix_web::web::Data;
use chrono::{TimeZone, Utc};
use log::error;
use sea_orm::{ColumnTrait, EntityTrait, QueryFilter};
use serde::{Deserialize, Serialize};
use trifid_api_entities::entity::{organization, totp_authenticator};
use crate::AppState;
use crate::auth_tokens::{enforce_2fa, enforce_session, TokenInfo};
use crate::error::{APIError, APIErrorsResponse};
use crate::timers::TIME_FORMAT;
#[derive(Serialize, Deserialize)]
pub struct WhoamiResponse {
pub data: WhoamiResponseData,
pub metadata: WhoamiResponseMetadata,
}
#[derive(Serialize, Deserialize)]
pub struct WhoamiResponseData {
#[serde(rename = "actorType")]
pub actor_type: String,
pub actor: WhoamiResponseDataActor,
}
#[derive(Serialize, Deserialize)]
pub struct WhoamiResponseDataActor {
pub id: String,
#[serde(rename = "organizationID")]
pub organization_id: Option<String>,
pub email: String,
#[serde(rename = "createdAt")]
pub created_at: String,
#[serde(rename = "hasTOTPAuthenticator")]
pub has_totp_authenticator: bool,
}
#[derive(Serialize, Deserialize)]
pub struct WhoamiResponseMetadata {}
#[get("/v2/whoami")]
pub async fn whoami(req_info: HttpRequest, db: Data<AppState>) -> HttpResponse {
// For this endpoint, you to be a partially authenticated user
let mut session_info = enforce_session(&req_info, &db.conn)
.await
.unwrap_or(TokenInfo::NotPresent);
match enforce_2fa(&req_info, &db.conn).await {
Ok(r) => session_info = r,
Err(e) if e.to_string() == "Missing auth token" => (),
Err(e) => {
error!("database error: {}", e);
return HttpResponse::InternalServerError().json(APIErrorsResponse {
errors: vec![
APIError {
code: "ERR_UNAUTHORIZED".to_string(),
message: "Your authentication token is invalid.".to_string(),
path: None,
}
],
});
}
}
// If it isnt present, throw an error
if matches!(session_info, TokenInfo::NotPresent) {
return HttpResponse::Unauthorized().json(APIErrorsResponse {
errors: vec![
APIError {
code: "ERR_UNAUTHORIZED".to_string(),
message: "This endpoint requires either a fully authenticated user or a token with the hosts:list scope".to_string(),
path: None,
}
],
});
}
// we have a session token, which means we have to do a db request to get the organization that this user owns
let user = match session_info {
TokenInfo::SessionToken(tkn) => tkn.user,
TokenInfo::AuthToken(tkn) => tkn.session_info.user,
_ => unreachable!(),
};
let org = match organization::Entity::find()
.filter(organization::Column::Owner.eq(&user.id))
.one(&db.conn)
.await
{
Ok(r) => r,
Err(e) => {
error!("database error: {}", e);
return HttpResponse::InternalServerError().json(APIErrorsResponse {
errors: vec![
APIError {
code: "ERR_DB_ERROR".to_string(),
message: "There was an error performing the database request, please try again later.".to_string(),
path: None,
}
],
});
}
};
let org = if let Some(org) = org {
Some(org.id)
} else {
None
};
let has_totp = match trifid_api_entities::entity::totp_authenticator::Entity::find().filter(totp_authenticator::Column::User.eq(&user.id)).all(&db.conn).await {
Ok(r) => !r.is_empty(),
Err(e) => {
error!("database error: {}", e);
return HttpResponse::InternalServerError().json(APIErrorsResponse {
errors: vec![
APIError {
code: "ERR_DB_ERROR".to_string(),
message: "There was an error performing the database request, please try again later.".to_string(),
path: None,
}
],
});
}
};
HttpResponse::Ok().json(WhoamiResponse {
data: WhoamiResponseData { actor_type: "user".to_string(), actor: WhoamiResponseDataActor {
id: user.id,
organization_id: org,
email: user.email,
created_at: Utc
.timestamp_opt(1, 0)
.unwrap()
.format(TIME_FORMAT)
.to_string(),
has_totp_authenticator: has_totp,
} },
metadata: WhoamiResponseMetadata {},
})
}