From ba7cc118d7aa611077761243aafbc0b322c7712b Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Tue, 30 May 2023 21:51:57 -0400 Subject: [PATCH] work --- tfweb/openapi.yaml | 1928 +++++++++++++++++ tfweb/openapitools.json | 7 + tfweb/src/components/LoadingWrapper.svelte | 28 + tfweb/src/lib/api/.openapi-generator-ignore | 23 + tfweb/src/lib/api/.openapi-generator/FILES | 61 + tfweb/src/lib/api/.openapi-generator/VERSION | 1 + tfweb/src/lib/api/apis/AuditLogsApi.ts | 108 + tfweb/src/lib/api/apis/DownloadsApi.ts | 66 + tfweb/src/lib/api/apis/HostsApi.ts | 486 +++++ tfweb/src/lib/api/apis/NetworksApi.ts | 131 ++ tfweb/src/lib/api/apis/RolesApi.ts | 286 +++ tfweb/src/lib/api/apis/index.ts | 7 + tfweb/src/lib/api/index.ts | 5 + tfweb/src/lib/api/models/Actor.ts | 105 + tfweb/src/lib/api/models/ActorAPIKey.ts | 91 + tfweb/src/lib/api/models/ActorHost.ts | 91 + tfweb/src/lib/api/models/ActorOIDCUser.ts | 99 + tfweb/src/lib/api/models/ActorSupport.ts | 75 + tfweb/src/lib/api/models/ActorSystem.ts | 75 + tfweb/src/lib/api/models/ActorUser.ts | 91 + tfweb/src/lib/api/models/AuditLog.ts | 124 ++ .../api/models/AuditLogsList200Response.ts | 86 + tfweb/src/lib/api/models/Downloads.ts | 100 + .../lib/api/models/DownloadsDNClientLinks.ts | 108 + tfweb/src/lib/api/models/DownloadsDnclient.ts | 75 + .../api/models/DownloadsList200Response.ts | 72 + tfweb/src/lib/api/models/DownloadsMobile.ts | 73 + .../lib/api/models/DownloadsVersionInfo.ts | 86 + .../DownloadsVersionInfoDnclientValue.ts | 73 + .../api/models/DownloadsVersionInfoLatest.ts | 73 + tfweb/src/lib/api/models/Event.ts | 104 + tfweb/src/lib/api/models/FirewallRule.ts | 110 + .../lib/api/models/FirewallRulePortRange.ts | 75 + tfweb/src/lib/api/models/Host.ts | 168 ++ .../HostAndEnrollCodeCreate200Response.ts | 80 + .../HostAndEnrollCodeCreate200ResponseData.ts | 87 + ...CodeCreate200ResponseDataEnrollmentCode.ts | 73 + .../HostAndEnrollCodeCreate400Response.ts | 66 + .../lib/api/models/HostBlock200Response.ts | 80 + .../api/models/HostBlock200ResponseData.ts | 72 + .../lib/api/models/HostCreate200Response.ts | 80 + .../lib/api/models/HostCreate400Response.ts | 65 + tfweb/src/lib/api/models/HostCreateRequest.ts | 123 ++ .../lib/api/models/HostDelete200Response.ts | 73 + .../src/lib/api/models/HostEdit200Response.ts | 80 + tfweb/src/lib/api/models/HostEditRequest.ts | 73 + .../models/HostEnrollCodeCreate200Response.ts | 80 + .../HostEnrollCodeCreate200ResponseData.ts | 72 + ...CodeCreate200ResponseDataEnrollmentCode.ts | 73 + .../src/lib/api/models/HostGet200Response.ts | 80 + tfweb/src/lib/api/models/HostMetadata.ts | 101 + .../lib/api/models/HostsList200Response.ts | 86 + tfweb/src/lib/api/models/ModelError.ts | 83 + tfweb/src/lib/api/models/Network.ts | 113 + .../lib/api/models/NetworkGet200Response.ts | 80 + .../lib/api/models/NetworksList200Response.ts | 86 + .../src/lib/api/models/PaginationMetadata.ts | 112 + .../lib/api/models/PaginationMetadataPage.ts | 75 + tfweb/src/lib/api/models/Role.ts | 112 + .../lib/api/models/RoleCreate200Response.ts | 80 + tfweb/src/lib/api/models/RoleCreateRequest.ts | 89 + tfweb/src/lib/api/models/RoleEditRequest.ts | 80 + .../lib/api/models/RolesList200Response.ts | 86 + tfweb/src/lib/api/models/Target.ts | 89 + tfweb/src/lib/api/models/index.ts | 53 + tfweb/src/lib/api/runtime.ts | 425 ++++ tfweb/src/lib/auth.ts | 27 + tfweb/src/lib/i18n/locales/en.json | 17 +- tfweb/src/routes/+page.svelte | 26 +- tfweb/src/routes/admin/+page.svelte | 36 + tfweb/svelte.config.js | 5 +- trifid-api/src/routes/v2/mod.rs | 1 + trifid-api/src/routes/v2/whoami.rs | 162 ++ 73 files changed, 8362 insertions(+), 10 deletions(-) create mode 100644 tfweb/openapi.yaml create mode 100644 tfweb/openapitools.json create mode 100644 tfweb/src/components/LoadingWrapper.svelte create mode 100644 tfweb/src/lib/api/.openapi-generator-ignore create mode 100644 tfweb/src/lib/api/.openapi-generator/FILES create mode 100644 tfweb/src/lib/api/.openapi-generator/VERSION create mode 100644 tfweb/src/lib/api/apis/AuditLogsApi.ts create mode 100644 tfweb/src/lib/api/apis/DownloadsApi.ts create mode 100644 tfweb/src/lib/api/apis/HostsApi.ts create mode 100644 tfweb/src/lib/api/apis/NetworksApi.ts create mode 100644 tfweb/src/lib/api/apis/RolesApi.ts create mode 100644 tfweb/src/lib/api/apis/index.ts create mode 100644 tfweb/src/lib/api/index.ts create mode 100644 tfweb/src/lib/api/models/Actor.ts create mode 100644 tfweb/src/lib/api/models/ActorAPIKey.ts create mode 100644 tfweb/src/lib/api/models/ActorHost.ts create mode 100644 tfweb/src/lib/api/models/ActorOIDCUser.ts create mode 100644 tfweb/src/lib/api/models/ActorSupport.ts create mode 100644 tfweb/src/lib/api/models/ActorSystem.ts create mode 100644 tfweb/src/lib/api/models/ActorUser.ts create mode 100644 tfweb/src/lib/api/models/AuditLog.ts create mode 100644 tfweb/src/lib/api/models/AuditLogsList200Response.ts create mode 100644 tfweb/src/lib/api/models/Downloads.ts create mode 100644 tfweb/src/lib/api/models/DownloadsDNClientLinks.ts create mode 100644 tfweb/src/lib/api/models/DownloadsDnclient.ts create mode 100644 tfweb/src/lib/api/models/DownloadsList200Response.ts create mode 100644 tfweb/src/lib/api/models/DownloadsMobile.ts create mode 100644 tfweb/src/lib/api/models/DownloadsVersionInfo.ts create mode 100644 tfweb/src/lib/api/models/DownloadsVersionInfoDnclientValue.ts create mode 100644 tfweb/src/lib/api/models/DownloadsVersionInfoLatest.ts create mode 100644 tfweb/src/lib/api/models/Event.ts create mode 100644 tfweb/src/lib/api/models/FirewallRule.ts create mode 100644 tfweb/src/lib/api/models/FirewallRulePortRange.ts create mode 100644 tfweb/src/lib/api/models/Host.ts create mode 100644 tfweb/src/lib/api/models/HostAndEnrollCodeCreate200Response.ts create mode 100644 tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseData.ts create mode 100644 tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseDataEnrollmentCode.ts create mode 100644 tfweb/src/lib/api/models/HostAndEnrollCodeCreate400Response.ts create mode 100644 tfweb/src/lib/api/models/HostBlock200Response.ts create mode 100644 tfweb/src/lib/api/models/HostBlock200ResponseData.ts create mode 100644 tfweb/src/lib/api/models/HostCreate200Response.ts create mode 100644 tfweb/src/lib/api/models/HostCreate400Response.ts create mode 100644 tfweb/src/lib/api/models/HostCreateRequest.ts create mode 100644 tfweb/src/lib/api/models/HostDelete200Response.ts create mode 100644 tfweb/src/lib/api/models/HostEdit200Response.ts create mode 100644 tfweb/src/lib/api/models/HostEditRequest.ts create mode 100644 tfweb/src/lib/api/models/HostEnrollCodeCreate200Response.ts create mode 100644 tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseData.ts create mode 100644 tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseDataEnrollmentCode.ts create mode 100644 tfweb/src/lib/api/models/HostGet200Response.ts create mode 100644 tfweb/src/lib/api/models/HostMetadata.ts create mode 100644 tfweb/src/lib/api/models/HostsList200Response.ts create mode 100644 tfweb/src/lib/api/models/ModelError.ts create mode 100644 tfweb/src/lib/api/models/Network.ts create mode 100644 tfweb/src/lib/api/models/NetworkGet200Response.ts create mode 100644 tfweb/src/lib/api/models/NetworksList200Response.ts create mode 100644 tfweb/src/lib/api/models/PaginationMetadata.ts create mode 100644 tfweb/src/lib/api/models/PaginationMetadataPage.ts create mode 100644 tfweb/src/lib/api/models/Role.ts create mode 100644 tfweb/src/lib/api/models/RoleCreate200Response.ts create mode 100644 tfweb/src/lib/api/models/RoleCreateRequest.ts create mode 100644 tfweb/src/lib/api/models/RoleEditRequest.ts create mode 100644 tfweb/src/lib/api/models/RolesList200Response.ts create mode 100644 tfweb/src/lib/api/models/Target.ts create mode 100644 tfweb/src/lib/api/models/index.ts create mode 100644 tfweb/src/lib/api/runtime.ts create mode 100644 tfweb/src/lib/auth.ts create mode 100644 tfweb/src/routes/admin/+page.svelte create mode 100644 trifid-api/src/routes/v2/whoami.rs diff --git a/tfweb/openapi.yaml b/tfweb/openapi.yaml new file mode 100644 index 0000000..b3baf7b --- /dev/null +++ b/tfweb/openapi.yaml @@ -0,0 +1,1928 @@ +openapi: 3.0.3 +info: + version: 1.0.0 + description: | +
+
+ + 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). + +
+ title: Defined Networking API + termsOfService: http://defined.net/terms/ + contact: + url: https://www.defined.net/contact?reason=support + x-logo: + url: https://docs.defined.net/img/logo.svg + altText: Defined Networking logo + x-dark-logo: + url: https://docs.defined.net/img/logo-dark.svg + altText: Defined Networking logo +servers: + - url: https://api.defined.net + description: Default server +security: + - ApiToken: [] +tags: + - name: hosts + x-displayName: Hosts + description: Operations requiring `hosts:` permission scopes + - name: roles + x-displayName: Roles + description: Operations requiring `roles:` permission scopes + - name: auditLogs + x-displayName: Audit Logs + description: Operations requiring `audit-logs:` permission scopes + - name: networks + x-displayName: Networks + description: Operations requiring `networks:` permission scopes + - name: downloads + x-displayName: Downloads + description: Information about software downloads +externalDocs: + description: Find more about the API here + url: https://docs.defined.net/guides/automating-host-creation/ +paths: + /v1/hosts: + post: + summary: Create host + description: | + Create a new host, lighthouse, or relay. + + Token scope required: `hosts:create` + + ### Request + operationId: hostCreate + tags: + - hosts + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - name + - networkID + properties: + name: + description: Name of the new host + type: string + minLength: 1 + maxLength: 255 + example: My new host + networkID: + description: ID of your network + type: string + example: network-KAOWMXZHZWCVMGGFKM22XEGYLE + roleID: + description: ID of the role you want to assign + type: string + nullable: true + example: role-PZEDBXHQEXKACJPZ6XOQTIAJA4 + ipAddress: + description: 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 + format: ipv4 + example: 100.100.0.29 + staticAddresses: + description: List of static IPv4:port addresses. At least one is required if `isLighthouse` is `true`. + type: array + items: + type: string + format: ipv4:port + example: + - 84.123.10.1:4242 + default: [] + listenPort: + description: 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. + format: integer + minimum: 0 + maximum: 65535 + default: 0 + isLighthouse: + description: Set to true to create a new lighthouse. A Lighthouse cannot also be relay. + format: boolean + isRelay: + description: Set to true to create a new relay. A relay cannot also be a lighthouse. + format: boolean + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Host' + metadata: + type: object + example: + data: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: My new host + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHQEXKACJPZ6XOQTIAJA4 + staticAddresses: + - 84.123.10.1:4242 + metadata: + lastSeenAt: '2023-01-25T18:15:27Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + metadata: {} + '400': + description: Validation error + content: + application/json: + schema: + type: object + properties: + errors: + $ref: '#/components/schemas/Errors' + examples: + existingHostName: + summary: A host already exists with the name. + value: + errors: + - code: ERR_DUPLICATE_VALUE + message: value already exists + path: name + cannotFindNetwork: + summary: Cannot find the supplied networkID. + value: + errors: + - code: ERR_INVALID_REFERENCE + message: referenced value is invalid (perhaps it does not exist?) + path: networkID + duplicateIpAddress: + summary: A host with the ipAddress supplied already exists. + value: + errors: + - code: ERR_DUPLICATE_VALUE + message: value already exists + path: ipAddress + cannotFindRole: + summary: Cannot find the supplied roleID. + value: + errors: + - code: ERR_INVALID_REFERENCE + message: referenced value is invalid (perhaps it does not exist?) + path: roleID + lighthouseXorRelay: + summary: A host may be a lighthouse OR a relay, but not both. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must not also be relay hosts + lighthouseNeedsStaticIP: + summary: A lighthouse requires at least one static IP address. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must have at least one static ip address + path: staticAddresses + lighthouseNeedsStaticPort: + summary: A lighthouse requires a static listen port, like `4242`. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must specify a static listen port + path: listenPort + relayNeedsStaticPort: + summary: A relay requires a static listen port, like `4242`. + value: + errors: + - code: ERR_INVALID_VALUE + message: relay hosts must specify a static listen port + path: listenPort + get: + summary: List hosts + description: | + Get a paginated list of hosts, lighthouses, and relays. + + Token scope required: `hosts:list` + + ### Request + operationId: hostsList + tags: + - hosts + parameters: + - $ref: '#/components/parameters/includeCounts' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/filter-isBlocked' + - $ref: '#/components/parameters/filter-isLighthouse' + - $ref: '#/components/parameters/filter-isRelay' + - $ref: '#/components/parameters/filter-metadata-lastSeenAt' + - $ref: '#/components/parameters/filter-metadata-platform' + - $ref: '#/components/parameters/filter-metadata-updateAvailable' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Host' + metadata: + $ref: '#/components/schemas/PaginationMetadata' + examples: + noParams: + summary: When includeCounts parameter is not set to true + value: + data: + - createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + metadata: + hasNextPage: true + hasPrevPage: true + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + includeCounts: + summary: Metadata returned when including request params for includeCounts=true, pageSize=1, and cursor="somevalue". + value: + data: + - createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: mobile + updateAvailable: true + version: 0.1.9 + metadata: + totalCount: 500 + hasNextPage: true + hasPrevPage: true + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + page: + count: 1 + start: 5 + /v1/hosts/{hostID}: + get: + summary: Get host + description: | + Fetch information about a particular host, lighthouse, or relay. + + Token scope required: `hosts:read` + + ### Request + operationId: hostGet + tags: + - hosts + parameters: + - name: hostID + in: path + required: true + schema: + type: string + example: host-24NVITKMNU3CYCEDNFWKAOBX7I + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Host' + metadata: + type: object + examples: + Example: + value: + data: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + metadata: {} + noMetadata: + summary: If the host has not been enrolled, its metadata will be unknown (null values). + value: + data: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: null + platform: null + updateAvailable: null + version: null + metadata: {} + put: + summary: Edit host + description: | + Token scope required: `hosts:update` + + :::caution + + Any properties not provided in the request will be reset to their default values. + + ::: + + ### Request + operationId: hostEdit + tags: + - hosts + parameters: + - name: hostID + in: path + required: true + schema: + type: string + example: host-24NVITKMNU3CYCEDNFWKAOBX7I + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + staticAddresses: + description: List of static IPv4:port addresses. At least one is required if `isLighthouse` is `true`. + type: string + format: ipv4:port + example: + - 84.123.10.1:4242 + default: [] + listenPort: + description: 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. + format: integer + minimum: 0 + maximum: 65535 + default: 0 + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Host' + metadata: + type: object + example: + data: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + metadata: {} + delete: + summary: Delete host + description: | + Token scope required: `hosts:delete` + + ### Request + operationId: hostDelete + tags: + - hosts + parameters: + - name: hostID + in: path + required: true + schema: + type: string + example: host-24NVITKMNU3CYCEDNFWKAOBX7I + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: object + metadata: + type: object + /v1/hosts/{hostID}/block: + post: + summary: Block host + description: | + 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 + operationId: hostBlock + tags: + - hosts + parameters: + - name: hostID + in: path + required: true + schema: + type: string + example: host-24NVITKMNU3CYCEDNFWKAOBX7I + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + host: + $ref: '#/components/schemas/Host' + metadata: + type: object + example: + data: + host: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: true + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + metadata: {} + /v1/hosts/{hostID}/enrollment-code: + post: + summary: Create enrollment code + description: | + 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 + operationId: hostEnrollCodeCreate + tags: + - hosts + parameters: + - name: hostID + in: path + required: true + schema: + type: string + example: host-24NVITKMNU3CYCEDNFWKAOBX7I + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: object + properties: + enrollmentCode: + type: object + properties: + code: + type: string + description: Secret code to be used in `dnclient enroll` to allow the host/lighthouse/relay to join your Managed Nebula network. + lifetimeSeconds: + type: integer + format: int64 + description: The number of seconds the code is valid after being issued. + metadata: + type: object + example: + data: + code: H8NEbm99QvupjqW1PsdVR9DNSiFmoQtJXyGTQxerlSU + lifetimeSeconds: 86400 + metadata: {} + /v1/host-and-enrollment-code: + post: + summary: Create host & enrollment code + description: | + Token scopes required: `hosts:create`, `hosts:enroll` + + ### Request + operationId: hostAndEnrollCodeCreate + tags: + - hosts + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - name + - networkID + properties: + name: + description: Name of the new host + type: string + minLength: 1 + maxLength: 255 + example: My new host + networkID: + description: ID of your network + type: string + example: network-KAOWMXZHZWCVMGGFKM22XEGYLE + roleID: + description: ID of the role you want to assign + type: string + nullable: true + example: role-PZEDBXHQEXKACJPZ6XOQTIAJA4 + ipAddress: + description: 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 + format: ipv4 + example: 100.100.0.29 + staticAddresses: + description: List of static IPv4:port addresses. At least one is required if `isLighthouse` is `true`. + type: array + items: + type: string + format: ipv4:port + example: + - 84.123.10.1:4242 + default: [] + listenPort: + description: 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. + format: integer + minimum: 0 + maximum: 65535 + default: 0 + isLighthouse: + description: Set to true to create a new lighthouse. A Lighthouse cannot also be relay. + format: boolean + isRelay: + description: Set to true to create a new relay. A relay cannot also be a lighthouse. + format: boolean + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: object + required: + - host + properties: + host: + $ref: '#/components/schemas/Host' + enrollmentCode: + type: object + properties: + code: + type: string + lifetimeSeconds: + type: integer + format: int64 + metadata: + type: object + example: + data: + host: + createdAt: '2023-01-25T18:15:27Z' + id: host-24NVITKMNU3CYCEDNFWKAOBX7I + ipAddress: 100.100.0.29 + isBlocked: false + isLighthouse: false + isRelay: false + listenPort: 0 + name: Host 1 + networkID: network-KAOWMXZHZWCVMGGFKM22XEGYLE + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + roleID: role-PZEDBXHCEXKAKJPZ6XOQTIAJA4 + staticAddresses: [] + metadata: + lastSeenAt: '2023-04-05T17:19:42Z' + platform: dnclient + updateAvailable: false + version: 0.1.9 + enrollmentCode: + code: H8NEbm99QvupjqW1PsdVR9DNSiFmoQtJXyGTQxerlSU + lifetimeSeconds: 86400 + metadata: {} + '400': + description: Validation error + content: + application/json: + schema: + type: object + required: + - errors + properties: + errors: + $ref: '#/components/schemas/Errors' + examples: + existingHostName: + summary: A host already exists with the name. + value: + errors: + - code: ERR_DUPLICATE_VALUE + message: value already exists + path: name + cannotFindNetwork: + summary: Cannot find the supplied networkID. + value: + errors: + - code: ERR_INVALID_REFERENCE + message: referenced value is invalid (perhaps it does not exist?) + path: networkID + duplicateIpAddress: + summary: A host with the ipAddress supplied already exists. + value: + errors: + - code: ERR_DUPLICATE_VALUE + message: value already exists + path: ipAddress + cannotFindRole: + summary: Cannot find the supplied roleID. + value: + errors: + - code: ERR_INVALID_REFERENCE + message: referenced value is invalid (perhaps it does not exist?) + path: roleID + lighthouseXorRelay: + summary: A host may be a lighthouse OR a relay, but not both. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must not also be relay hosts + lighthouseNeedsStaticIP: + summary: A lighthouse requires at least one static IP address. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must have at least one static ip address + path: staticAddresses + lighthouseNeedsStaticPort: + summary: A lighthouse requires a static listen port, like `4242`. + value: + errors: + - code: ERR_INVALID_VALUE + message: lighthouse hosts must specify a static listen port + path: listenPort + relayNeedsStaticPort: + summary: A relay requires a static listen port, like `4242`. + value: + errors: + - code: ERR_INVALID_VALUE + message: relay hosts must specify a static listen port + path: listenPort + /v1/roles: + post: + summary: Create role + description: | + Create a new role. + + Token scope required: `roles:create` + + ### Request + operationId: roleCreate + tags: + - roles + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - name + properties: + name: + description: Name of the new role + type: string + minLength: 1 + maxLength: 50 + example: My new role + description: + description: Optional description + type: string + maxLength: 255 + firewallRules: + description: Incoming firewall rules + type: array + items: + $ref: '#/components/schemas/FirewallRule' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Role' + metadata: + type: object + example: + data: + id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + name: My new role + description: '' + createdAt: '2023-02-15T13:59:09Z' + modifiedAt: '2023-02-15T13:59:09Z' + firewallRules: + - protocol: TCP + description: allow SSH access + allowedRoleID: role-G3TWUQ4FASQEF44MGMTSRBTYKM + portRange: + from: 22 + to: 22 + metadata: {} + '400': + description: Validation error + content: + application/json: + schema: + type: object + required: + - errors + properties: + errors: + $ref: '#/components/schemas/Errors' + examples: + missingName: + summary: name not specified. + value: + errors: + - code: ERR_INVALID_VALUE_LENGTH + message: must have a length between 1 and 50 + path: name + duplicateName: + summary: A role with the name already exists. + value: + errors: + - code: ERR_DUPLICATE_VALUE + message: value already exists + path: name + protocol: + summary: Invalid protocol value. + value: + errors: + - code: ERR_INVALID_VALUE + message: 'must be a valid protocol: ANY, TCP, UDP, ICMP' + path: firewallRules[0].protocol + portRangeMissing: + summary: Invalid/missing from and to values. + value: + errors: + - code: ERR_INVALID_VALUE + message: must be between 1 and 65535 + path: firewallRules[0].portRange.from + - code: ERR_INVALID_VALUE + message: must be between 1 and 65535 + path: firewallRules[0].portRange.to + portRangeOrder: + summary: From cannot be greater than to + value: + errors: + - code: ERR_INVALID_VALUE + message: from must be less than or equal to to + path: firewallRules[0].portRange + get: + summary: List roles + description: | + Get a paginated list of roles. + + Token scope required: `roles:list` + + ### Request + operationId: rolesList + tags: + - roles + parameters: + - $ref: '#/components/parameters/includeCounts' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Role' + metadata: + $ref: '#/components/schemas/PaginationMetadata' + examples: + noParams: + summary: When includeCounts parameter is not set to true + value: + data: + - id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + name: My new role + description: '' + createdAt: '2023-02-15T13:59:09Z' + modifiedAt: '2023-02-15T13:59:09Z' + firewallRules: + - protocol: TCP + description: allow SSH access + allowedRoleID: role-G3TWUQ4FASQEF44MGMTSRBTYKM + portRange: + from: 22 + to: 22 + metadata: + hasNextPage: true + hasPrevPage: true + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + includeCounts: + summary: Metadata returned when including request params for includeCounts=true, pageSize=1, and cursor="somevalue". + value: + data: + - id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + name: My new role + description: '' + createdAt: '2023-02-15T13:59:09Z' + modifiedAt: '2023-02-15T13:59:09Z' + firewallRules: + - protocol: TCP + description: allow SSH access + allowedRoleID: role-G3TWUQ4FASQEF44MGMTSRBTYKM + portRange: + from: 22 + to: 22 + metadata: + totalCount: 500 + hasNextPage: true + hasPrevPage: true + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + page: + count: 1 + start: 5 + /v1/roles/{roleID}: + get: + summary: Get role + description: | + Fetch information about a particular role. + + Token scope required: `roles:read` + + ### Request + operationId: roleGet + tags: + - roles + parameters: + - name: roleID + in: path + required: true + schema: + type: string + example: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Role' + metadata: + type: object + example: + data: + id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + name: My new role + description: '' + createdAt: '2023-02-15T13:59:09Z' + modifiedAt: '2023-02-15T13:59:09Z' + firewallRules: + - protocol: TCP + description: allow SSH access + allowedRoleID: role-G3TWUQ4FASQEF44MGMTSRBTYKM + portRange: + from: 22 + to: 22 + metadata: {} + put: + summary: Edit role + description: | + 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 + operationId: roleEdit + tags: + - roles + parameters: + - name: roleID + in: path + required: true + schema: + type: string + example: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + description: + type: string + maxLength: 255 + firewallRules: + description: Incoming firewall rules. Will replace existing list of rules. + type: array + items: + $ref: '#/components/schemas/FirewallRule' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Role' + metadata: + type: object + example: + data: + id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + name: My new role + description: '' + createdAt: '2023-02-15T13:59:09Z' + modifiedAt: '2023-02-15T13:59:09Z' + firewallRules: + - protocol: TCP + description: allow SSH access + allowedRoleID: role-G3TWUQ4FASQEF44MGMTSRBTYKM + portRange: + from: 22 + to: 22 + metadata: {} + delete: + summary: Delete role + description: | + Token scope required: `roles:delete` + + ### Request + operationId: roleDelete + tags: + - roles + parameters: + - name: roleID + in: path + required: true + schema: + type: string + example: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: object + metadata: + type: object + /v1/networks: + get: + summary: List networks + description: | + 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 + operationId: networksList + tags: + - networks + parameters: + - $ref: '#/components/parameters/includeCounts' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/pageSize' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/Network' + metadata: + $ref: '#/components/schemas/PaginationMetadata' + examples: + noParams: + summary: When includeCounts parameter is not set to true + value: + data: + - cidr: 100.100.0.0/22 + id: network-ZJOW3QUQUX5ZAVPVYRHDQUAEIY + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + signingCAID: ca-TRJSVAAAPJXTOICJMG2KZBKQEE + name: Network1 + lighthousesAsRelays: false + createdAt: '2023-02-14T20:34:59Z' + metadata: + hasNextPage: true + hasPrevPage: true + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + includeCounts: + summary: Metadata returned when including request params for includeCounts=true, pageSize=1, and cursor="somevalue". + value: + data: + - cidr: 100.100.0.0/22 + id: network-ZJOW3QUQUX5ZAVPVYRHDQUAEIY + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + signingCAID: ca-TRJSVAAAPJXTOICJMG2KZBKQEE + name: Network1 + lighthousesAsRelays: false + createdAt: '2023-02-14T20:34:59Z' + metadata: + totalCount: 500 + hasNextPage: true + hasPrevPage: true + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + page: + count: 1 + start: 5 + /v1/networks/{networkID}: + get: + summary: Get network + description: | + Fetch information about a particular network. + + Token scope required: `networks:read` + + ### Request + operationId: networkGet + tags: + - networks + parameters: + - name: networkID + in: path + required: true + schema: + type: string + example: network-ZJOW3QUQUX5ZAVPVYRHDQUAEIY + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Network' + metadata: + type: object + example: + data: + cidr: 100.100.0.0/22 + id: network-ZJOW3QUQUX5ZAVPVYRHDQUAEIY + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + signingCAID: ca-TRJSVAAAPJXTOICJMG2KZBKQEE + name: Network1 + lighthousesAsRelays: false + createdAt: '2023-02-14T20:34:59Z' + metadata: {} + /v1/audit-logs: + get: + summary: List audit logs + description: | + Get a paginated list of audit logs. + + Token scope required: `audit-logs:list` + + ### Request + operationId: auditLogsList + tags: + - auditLogs + parameters: + - $ref: '#/components/parameters/includeCounts' + - $ref: '#/components/parameters/cursor' + - $ref: '#/components/parameters/pageSize' + - $ref: '#/components/parameters/filter-targetID' + - $ref: '#/components/parameters/filter-targetType' + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + type: array + items: + $ref: '#/components/schemas/AuditLog' + metadata: + $ref: '#/components/schemas/PaginationMetadata' + examples: + noParams: + summary: When includeCounts parameter is not set to true + value: + data: + - id: log-F3TTIDMKZH5XFH37RTRLIP3TOA + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + timestamp: '2023-02-15T13:59:09.828868Z' + actor: + id: dnkey-DXALSPQONG7H45QZAVTPRDMAPU + name: example api key + type: apiKey + target: + id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + type: role + event: + type: CREATED + before: null + after: + name: My New Role + description: '' + firewallRules: null + metadata: + hasNextPage: true + hasPrevPage: true + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + includeCounts: + summary: Metadata returned when including request params for includeCounts=true, pageSize=1, and cursor="somevalue". + value: + data: + - id: log-F3TTIDMKZH5XFH37RTRLIP3TOA + organizationID: org-F63A24JGCLJV3ZEUTLCBISGETA + timestamp: '2023-02-15T13:59:09.828868Z' + actor: + id: dnkey-DXALSPQONG7H45QZAVTPRDMAPU + name: example api key + type: apiKey + target: + id: role-LO4SPDSWTZNJC676WFCZKUB3ZQ + type: role + event: + type: CREATED + before: null + after: + name: My New Role + description: '' + firewallRules: null + metadata: + totalCount: 500 + hasNextPage: true + hasPrevPage: true + prevCursor: cHJldg.SI6ImIiLCJfdmFsdWUiOiI0dDVuREQreU + nextCursor: bmV4dA.bHVlIjoieGJVS0UvYkRjQmZsY1pUbGJCc + page: + count: 1 + start: 5 + /v1/downloads: + get: + summary: List software downloads + description: | + Get a list of recently released software download links and basic info. + + This endpoint is unauthenticated. + + ### Request + operationId: downloadsList + tags: + - downloads + responses: + '200': + description: Successful operation + content: + application/json: + schema: + type: object + properties: + data: + $ref: '#/components/schemas/Downloads' + examples: + Listing: + summary: An example downloads listing + value: + data: + dnclient: + 0.1.5: + linux-amd64: https://dl.defined.net/aa96f50d/v0.1.5/linux/amd64/dnclient + linux-arm64: https://dl.defined.net/aa96f50d/v0.1.5/linux/arm64/dnclient + linux-armv7: https://dl.defined.net/aa96f50d/v0.1.5/linux/arm-7/dnclient + linux-mips-softfloat: https://dl.defined.net/aa96f50d/v0.1.5/linux/mips-softfloat/dnclient + macos-universal: https://dl.defined.net/aa96f50d/v0.1.5/macos/dnclient + macos-universal-dmg: https://dl.defined.net/aa96f50d/v0.1.5/macos/dnclient.dmg + windows-amd64: https://dl.defined.net/aa96f50d/v0.1.5/windows/amd64/DNClient.msi + windows-arm64: https://dl.defined.net/aa96f50d/v0.1.5/windows/arm64/DNClient.msi + 0.1.6: + linux-amd64: https://dl.defined.net/02c6d0f9/v0.1.6/linux/amd64/dnclient + linux-arm64: https://dl.defined.net/02c6d0f9/v0.1.6/linux/arm64/dnclient + linux-armv7: https://dl.defined.net/02c6d0f9/v0.1.6/linux/arm-7/dnclient + linux-mips-softfloat: https://dl.defined.net/02c6d0f9/v0.1.6/linux/mips-softfloat/dnclient + macos-universal: https://dl.defined.net/02c6d0f9/v0.1.6/macos/dnclient + macos-universal-dmg: https://dl.defined.net/02c6d0f9/v0.1.6/macos/dnclient.dmg + windows-amd64: https://dl.defined.net/02c6d0f9/v0.1.6/windows/amd64/DNClient.msi + windows-arm64: https://dl.defined.net/02c6d0f9/v0.1.6/windows/arm64/DNClient.msi + 0.1.7: + linux-amd64: https://dl.defined.net/0ef94adc/v0.1.7/linux/amd64/dnclient + linux-arm64: https://dl.defined.net/0ef94adc/v0.1.7/linux/arm64/dnclient + linux-armv7: https://dl.defined.net/0ef94adc/v0.1.7/linux/arm-7/dnclient + linux-mips-softfloat: https://dl.defined.net/0ef94adc/v0.1.7/linux/mips-softfloat/dnclient + macos-universal: https://dl.defined.net/0ef94adc/v0.1.7/macos/dnclient + macos-universal-dmg: https://dl.defined.net/0ef94adc/v0.1.7/macos/dnclient.dmg + windows-amd64: https://dl.defined.net/0ef94adc/v0.1.7/windows/amd64/DNClient.msi + windows-arm64: https://dl.defined.net/0ef94adc/v0.1.7/windows/arm64/DNClient.msi + 0.1.8: + freebsd-amd64: https://dl.defined.net/e16d2e9f/v0.1.8/freebsd/amd64/dnclient + freebsd-arm64: https://dl.defined.net/e16d2e9f/v0.1.8/freebsd/arm64/dnclient + linux-386: https://dl.defined.net/e16d2e9f/v0.1.8/linux/386/dnclient + linux-amd64: https://dl.defined.net/e16d2e9f/v0.1.8/linux/amd64/dnclient + linux-arm64: https://dl.defined.net/e16d2e9f/v0.1.8/linux/arm64/dnclient + linux-armv5: https://dl.defined.net/e16d2e9f/v0.1.8/linux/arm-5/dnclient + linux-armv6: https://dl.defined.net/e16d2e9f/v0.1.8/linux/arm-6/dnclient + linux-armv7: https://dl.defined.net/e16d2e9f/v0.1.8/linux/arm-7/dnclient + linux-mips: https://dl.defined.net/e16d2e9f/v0.1.8/linux/mips/dnclient + linux-mips-softfloat: https://dl.defined.net/e16d2e9f/v0.1.8/linux/mips-softfloat/dnclient + linux-mips64: https://dl.defined.net/e16d2e9f/v0.1.8/linux/mips64/dnclient + linux-mips64le: https://dl.defined.net/e16d2e9f/v0.1.8/linux/mips64le/dnclient + linux-mipsle: https://dl.defined.net/e16d2e9f/v0.1.8/linux/mipsle/dnclient + linux-ppc64le: https://dl.defined.net/e16d2e9f/v0.1.8/linux/ppc64le/dnclient + linux-riscv64: https://dl.defined.net/e16d2e9f/v0.1.8/linux/riscv64/dnclient + macos-universal: https://dl.defined.net/e16d2e9f/v0.1.8/macos/dnclient + macos-universal-dmg: https://dl.defined.net/e16d2e9f/v0.1.8/macos/dnclient.dmg + windows-amd64: https://dl.defined.net/e16d2e9f/v0.1.8/windows/amd64/DNClient.msi + windows-arm64: https://dl.defined.net/e16d2e9f/v0.1.8/windows/arm64/DNClient.msi + 0.1.9: + freebsd-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/freebsd/amd64/dnclient, + freebsd-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/freebsd/arm64/dnclient, + linux-386: https://dl.defined.net/02c6d0f9/v0.1.9/linux/386/dnclient, + linux-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/amd64/dnclient, + linux-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm64/dnclient, + linux-armv5: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-5/dnclient, + linux-armv6: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-6/dnclient, + linux-armv7: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-7/dnclient, + linux-mips: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips/dnclient, + linux-mips-softfloat: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips-softfloat/dnclient, + linux-mips64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips64/dnclient, + linux-mips64le: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips64le/dnclient, + linux-mipsle: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mipsle/dnclient, + linux-ppc64le: https://dl.defined.net/02c6d0f9/v0.1.9/linux/ppc64le/dnclient, + linux-riscv64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/riscv64/dnclient, + macos-universal: https://dl.defined.net/02c6d0f9/v0.1.9/macos/dnclient, + macos-universal-dmg: https://dl.defined.net/02c6d0f9/v0.1.9/macos/dnclient.dmg, + windows-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/windows/amd64/DNClient.msi, + windows-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/windows/arm64/DNClient.msi + latest: + freebsd-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/freebsd/amd64/dnclient, + freebsd-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/freebsd/arm64/dnclient, + linux-386: https://dl.defined.net/02c6d0f9/v0.1.9/linux/386/dnclient, + linux-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/amd64/dnclient, + linux-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm64/dnclient, + linux-armv5: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-5/dnclient, + linux-armv6: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-6/dnclient, + linux-armv7: https://dl.defined.net/02c6d0f9/v0.1.9/linux/arm-7/dnclient, + linux-mips: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips/dnclient, + linux-mips-softfloat: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips-softfloat/dnclient, + linux-mips64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips64/dnclient, + linux-mips64le: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mips64le/dnclient, + linux-mipsle: https://dl.defined.net/02c6d0f9/v0.1.9/linux/mipsle/dnclient, + linux-ppc64le: https://dl.defined.net/02c6d0f9/v0.1.9/linux/ppc64le/dnclient, + linux-riscv64: https://dl.defined.net/02c6d0f9/v0.1.9/linux/riscv64/dnclient, + macos-universal: https://dl.defined.net/02c6d0f9/v0.1.9/macos/dnclient, + macos-universal-dmg: https://dl.defined.net/02c6d0f9/v0.1.9/macos/dnclient.dmg, + windows-amd64: https://dl.defined.net/02c6d0f9/v0.1.9/windows/amd64/DNClient.msi, + windows-arm64: https://dl.defined.net/02c6d0f9/v0.1.9/windows/arm64/DNClient.msi + mobile: + android: https://play.google.com/store/apps/details?id=net.defined.mobile_nebula + ios: https://apps.apple.com/us/app/mobile-nebula/id1509587936 + versionInfo: + dnclient: + 0.1.5: + latest: false + releaseDate: '2022-07-13' + 0.1.6: + latest: false + releaseDate: '2022-12-15' + 0.1.7: + latest: false + releaseDate: '2022-12-16' + 0.1.8: + latest: false + releaseDate: '2022-12-20' + 0.1.9: + latest: true + releaseDate: '2023-03-15' + latest: + dnclient: 0.1.9 + mobile: 0.2.0 +components: + securitySchemes: + ApiToken: + description: | + Get an api key from https://admin.defined.net/settings/api-keys with the permission scopes required. + type: http + scheme: bearer + bearerFormat: dnkey + parameters: + includeCounts: + name: includeCounts + in: query + description: If true, return count of total records and current page start and count in metadata + required: false + schema: + type: boolean + default: false + cursor: + name: cursor + in: query + description: Cursor value at which to start the results, provided in `nextCursor` or `prevCursor` of a prior request + example: bmV4dA.eyJsb2dzLmNyZQ5iIiwiX3ZhbHVlIjo9In19 + schema: + type: string + pageSize: + name: pageSize + in: query + description: Number of records to return in each page + required: false + schema: + type: integer + default: 25 + maximum: 500 + filter-isBlocked: + name: filter.isBlocked + in: query + description: Return only hosts that are blocked if true, unblocked if false + required: false + schema: + type: boolean + filter-isLighthouse: + name: filter.isLighthouse + in: query + description: Return only lighthouses if true, non-lighthouses if false + required: false + schema: + type: boolean + filter-isRelay: + name: filter.isRelay + in: query + description: Return only relays if true, non-relays if false + required: false + schema: + type: boolean + filter-metadata-lastSeenAt: + name: filter.metadata.lastSeenAt + in: query + description: When "null", returns hosts that have never communicated with the Defined Networking service. + required: false + schema: + type: string + enum: + - 'null' + filter-metadata-platform: + name: filter.metadata.platform + in: query + description: Return only hosts matching the specified client platform + required: false + schema: + type: string + enum: + - mobile + - dnclient + - 'null' + filter-metadata-updateAvailable: + name: filter.metadata.updateAvailable + in: query + description: Return only hosts that have updates available when true, or up-to-date hosts when false + required: false + schema: + type: boolean + filter-targetID: + name: filter.targetID + in: query + description: Return only audit logs for the specified target + required: false + schema: + type: string + filter-targetType: + name: filter.targetType + in: query + description: Return only audit logs matching the specified target type + required: false + schema: + type: string + enum: + - apiKey + - host + - network + - role + - user + - ca + - oidcProvider + schemas: + Host: + type: object + properties: + id: + type: string + organizationID: + type: string + networkID: + type: string + roleID: + type: string + nullable: true + name: + type: string + ipAddress: + type: string + format: ipv4 + staticAddresses: + type: array + items: + type: string + format: ipv4:port + listenPort: + type: integer + format: int64 + description: Will be zero if a regular host + isLighthouse: + type: boolean + default: false + isRelay: + type: boolean + default: false + createdAt: + type: string + format: date-time + isBlocked: + type: boolean + default: false + metadata: + type: object + properties: + lastSeenAt: + type: string + nullable: true + version: + type: string + nullable: true + platform: + type: string + nullable: true + enum: + - dnclient + - mobile + - null + updateAvailable: + type: boolean + nullable: true + PaginationMetadata: + type: object + properties: + totalCount: + type: integer + description: The total number of resources existing in the account + hasNextPage: + type: boolean + description: Is there a page of data that can be fetched using the `nextCursor`? + hasPrevPage: + type: boolean + description: Is there a page of data that can be fetched using the `prevCursor`? + nextCursor: + type: string + description: An opaque string that can be used to fetch the next page of results. Not provided if result set is empty. + prevCursor: + type: string + description: An opaque string that can be used to fetch the next page of results. Not provided if result set is empty. + page: + type: object + required: + - count + - start + properties: + count: + type: integer + description: The number of results returned in the response. + start: + type: integer + description: 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`. + Error: + type: object + required: + - code + - message + properties: + code: + type: string + description: A static name for the error type + message: + type: string + description: A short human readable description of the error + path: + type: string + nullable: true + description: Describes the variable missing or malformed + Errors: + type: array + items: + $ref: '#/components/schemas/Error' + FirewallRule: + type: object + required: + - protocol + properties: + protocol: + type: string + enum: + - ANY + - TCP + - UDP + - ICMP + description: + type: string + maxLength: 255 + allowedRoleID: + type: string + description: Role ID to allow with this firewall rule. If not specified, all roles are included. + portRange: + type: object + required: + - from + - to + description: Range of ports for this firewall rule. If not provided or set to null, all ports are allowed. + properties: + from: + type: integer + description: First port number included in range. + minimum: 1 + maximum: 65535 + to: + type: integer + description: Last port number included in range. Must be greater than `from` port. + minimum: 1 + maximum: 65535 + Role: + type: object + properties: + id: + type: string + name: + type: string + description: + type: string + firewallRules: + type: array + items: + $ref: '#/components/schemas/FirewallRule' + createdAt: + type: string + format: date-time + modifiedAt: + type: string + format: date-time + Network: + type: object + properties: + id: + type: string + cidr: + type: string + format: ipv4/cidr + organizationID: + type: string + signingCAID: + description: The ID of the Certificate Authority being used. + type: string + createdAt: + type: string + format: date-time + name: + type: string + default: Network1 + lighthousesAsRelays: + type: boolean + Actor-APIKey: + title: apiKey + type: object + properties: + type: + type: string + description: An API key which used to perform the action. + enum: + - apiKey + id: + type: string + name: + type: string + nullable: true + Actor-Host: + title: host + type: object + properties: + type: + type: string + description: A host. Used for example when hosts are enrolled. + enum: + - host + id: + type: string + name: + type: string + nullable: true + Actor-OIDCUser: + title: oidcUser + type: object + properties: + type: + type: string + description: A user who logged in using SSO. + enum: + - oidcUser + email: + type: string + format: email + issuer: + type: string + subject: + type: string + Actor-Support: + title: support + type: object + properties: + type: + type: string + description: A member of Defined Networking support staff. + enum: + - support + Actor-System: + title: system + type: object + properties: + type: + type: string + description: System actor, used for events such as creation or rotation of Certificate Authorities. + enum: + - system + Actor-User: + title: user + type: object + properties: + type: + type: string + description: A logged-in user. + enum: + - user + id: + type: string + email: + type: string + format: email + Actor: + description: The entity performing the action which caused a change. + oneOf: + - $ref: '#/components/schemas/Actor-APIKey' + - $ref: '#/components/schemas/Actor-Host' + - $ref: '#/components/schemas/Actor-OIDCUser' + - $ref: '#/components/schemas/Actor-Support' + - $ref: '#/components/schemas/Actor-System' + - $ref: '#/components/schemas/Actor-User' + Target: + type: object + description: The entity being acted upon. + properties: + id: + type: string + type: + type: string + enum: + - apiKey + - ca + - host + - network + - oidcProvider + - role + - user + Event: + type: object + description: Information about what happened, including relevant values before & after the change. + properties: + type: + type: string + description: The type of event that occurred. + enum: + - CREATED + - UPDATED + - DELETED + - DELETED_TOTP + - CREATED_TOTP + - SUCCEEDED_AUTH + - FAILED_AUTH + - ENROLLED + - RENEWED + - CREATED_ENROLL_CODE + - SET_NETWORK_CA + - BLOCKED_HOST + - UNBLOCKED_HOST + - SET_OVERRIDES + before: + description: 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: object + nullable: true + additionalProperties: {} + after: + description: 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: object + nullable: true + additionalProperties: {} + AuditLog: + type: object + properties: + id: + type: string + organizationID: + type: string + timestamp: + type: string + format: date-time + actor: + $ref: '#/components/schemas/Actor' + target: + $ref: '#/components/schemas/Target' + event: + $ref: '#/components/schemas/Event' + DownloadsDNClientLinks: + type: object + description: Download links for a given DNClient version + properties: + linux-amd64: + type: string + linux-arm64: + type: string + macos-universal: + type: string + macos-universal-dmg: + type: string + windows-amd64: + type: string + windows-arm64: + type: string + additionalProperties: + x-additionalPropertiesName: os-platform + type: string + Downloads: + type: object + properties: + dnclient: + type: object + properties: + latest: + description: Download links for the latest DNClient version + $ref: '#/components/schemas/DownloadsDNClientLinks' + additionalProperties: + $ref: '#/components/schemas/DownloadsDNClientLinks' + mobile: + type: object + properties: + android: + description: Mobile Nebula download URL for Android devices. + type: string + ios: + description: Mobile Nebula download URL for iOS devices. + type: string + versionInfo: + type: object + properties: + dnclient: + description: Information about available DNClient releases + type: object + additionalProperties: + description: Information about a given DNClient release + type: object + properties: + releaseDate: + type: string + latest: + type: boolean + latest: + description: The latest version for each software download. + type: object + properties: + dnclient: + description: The latest version of DNClient. + type: string + mobile: + description: The latest version of Mobile Nebula. + type: string diff --git a/tfweb/openapitools.json b/tfweb/openapitools.json new file mode 100644 index 0000000..cd53ff4 --- /dev/null +++ b/tfweb/openapitools.json @@ -0,0 +1,7 @@ +{ + "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", + "spaces": 2, + "generator-cli": { + "version": "6.6.0" + } +} diff --git a/tfweb/src/components/LoadingWrapper.svelte b/tfweb/src/components/LoadingWrapper.svelte new file mode 100644 index 0000000..8475f35 --- /dev/null +++ b/tfweb/src/components/LoadingWrapper.svelte @@ -0,0 +1,28 @@ + + +{#if isLoading} +

its loading

+{:else} + {#if isError} +

error: {error}

+ {:else} + + {/if} +{/if} diff --git a/tfweb/src/lib/api/.openapi-generator-ignore b/tfweb/src/lib/api/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/tfweb/src/lib/api/.openapi-generator-ignore @@ -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 diff --git a/tfweb/src/lib/api/.openapi-generator/FILES b/tfweb/src/lib/api/.openapi-generator/FILES new file mode 100644 index 0000000..13e85ad --- /dev/null +++ b/tfweb/src/lib/api/.openapi-generator/FILES @@ -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 diff --git a/tfweb/src/lib/api/.openapi-generator/VERSION b/tfweb/src/lib/api/.openapi-generator/VERSION new file mode 100644 index 0000000..cd802a1 --- /dev/null +++ b/tfweb/src/lib/api/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/tfweb/src/lib/api/apis/AuditLogsApi.ts b/tfweb/src/lib/api/apis/AuditLogsApi.ts new file mode 100644 index 0000000..d46b8a0 --- /dev/null +++ b/tfweb/src/lib/api/apis/AuditLogsApi.ts @@ -0,0 +1,108 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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> { + 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 { + 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]; diff --git a/tfweb/src/lib/api/apis/DownloadsApi.ts b/tfweb/src/lib/api/apis/DownloadsApi.ts new file mode 100644 index 0000000..78cfb8b --- /dev/null +++ b/tfweb/src/lib/api/apis/DownloadsApi.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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> { + 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 { + const response = await this.downloadsListRaw(initOverrides); + return await response.value(); + } + +} diff --git a/tfweb/src/lib/api/apis/HostsApi.ts b/tfweb/src/lib/api/apis/HostsApi.ts new file mode 100644 index 0000000..ed245fd --- /dev/null +++ b/tfweb/src/lib/api/apis/HostsApi.ts @@ -0,0 +1,486 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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]; diff --git a/tfweb/src/lib/api/apis/NetworksApi.ts b/tfweb/src/lib/api/apis/NetworksApi.ts new file mode 100644 index 0000000..ffb3e14 --- /dev/null +++ b/tfweb/src/lib/api/apis/NetworksApi.ts @@ -0,0 +1,131 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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> { + 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 { + 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> { + 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 { + const response = await this.networksListRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/tfweb/src/lib/api/apis/RolesApi.ts b/tfweb/src/lib/api/apis/RolesApi.ts new file mode 100644 index 0000000..92f491f --- /dev/null +++ b/tfweb/src/lib/api/apis/RolesApi.ts @@ -0,0 +1,286 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + 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> { + 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 { + const response = await this.rolesListRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/tfweb/src/lib/api/apis/index.ts b/tfweb/src/lib/api/apis/index.ts new file mode 100644 index 0000000..8bb005c --- /dev/null +++ b/tfweb/src/lib/api/apis/index.ts @@ -0,0 +1,7 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './AuditLogsApi'; +export * from './DownloadsApi'; +export * from './HostsApi'; +export * from './NetworksApi'; +export * from './RolesApi'; diff --git a/tfweb/src/lib/api/index.ts b/tfweb/src/lib/api/index.ts new file mode 100644 index 0000000..be9d1ed --- /dev/null +++ b/tfweb/src/lib/api/index.ts @@ -0,0 +1,5 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './apis'; +export * from './models'; diff --git a/tfweb/src/lib/api/models/Actor.ts b/tfweb/src/lib/api/models/Actor.ts new file mode 100644 index 0000000..1059f8e --- /dev/null +++ b/tfweb/src/lib/api/models/Actor.ts @@ -0,0 +1,105 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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 {}; +} + diff --git a/tfweb/src/lib/api/models/ActorAPIKey.ts b/tfweb/src/lib/api/models/ActorAPIKey.ts new file mode 100644 index 0000000..55b9952 --- /dev/null +++ b/tfweb/src/lib/api/models/ActorAPIKey.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/ActorHost.ts b/tfweb/src/lib/api/models/ActorHost.ts new file mode 100644 index 0000000..a753f78 --- /dev/null +++ b/tfweb/src/lib/api/models/ActorHost.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/ActorOIDCUser.ts b/tfweb/src/lib/api/models/ActorOIDCUser.ts new file mode 100644 index 0000000..91a716c --- /dev/null +++ b/tfweb/src/lib/api/models/ActorOIDCUser.ts @@ -0,0 +1,99 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/ActorSupport.ts b/tfweb/src/lib/api/models/ActorSupport.ts new file mode 100644 index 0000000..2c00ac2 --- /dev/null +++ b/tfweb/src/lib/api/models/ActorSupport.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/ActorSystem.ts b/tfweb/src/lib/api/models/ActorSystem.ts new file mode 100644 index 0000000..8a50f90 --- /dev/null +++ b/tfweb/src/lib/api/models/ActorSystem.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/ActorUser.ts b/tfweb/src/lib/api/models/ActorUser.ts new file mode 100644 index 0000000..b9d43b3 --- /dev/null +++ b/tfweb/src/lib/api/models/ActorUser.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/AuditLog.ts b/tfweb/src/lib/api/models/AuditLog.ts new file mode 100644 index 0000000..bb05ee8 --- /dev/null +++ b/tfweb/src/lib/api/models/AuditLog.ts @@ -0,0 +1,124 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/AuditLogsList200Response.ts b/tfweb/src/lib/api/models/AuditLogsList200Response.ts new file mode 100644 index 0000000..27359d3 --- /dev/null +++ b/tfweb/src/lib/api/models/AuditLogsList200Response.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof AuditLogsList200Response + */ + data?: Array; + /** + * + * @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).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).map(AuditLogToJSON)), + 'metadata': PaginationMetadataToJSON(value.metadata), + }; +} + diff --git a/tfweb/src/lib/api/models/Downloads.ts b/tfweb/src/lib/api/models/Downloads.ts new file mode 100644 index 0000000..5d34405 --- /dev/null +++ b/tfweb/src/lib/api/models/Downloads.ts @@ -0,0 +1,100 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsDNClientLinks.ts b/tfweb/src/lib/api/models/DownloadsDNClientLinks.ts new file mode 100644 index 0000000..1844dbc --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsDNClientLinks.ts @@ -0,0 +1,108 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsDnclient.ts b/tfweb/src/lib/api/models/DownloadsDnclient.ts new file mode 100644 index 0000000..f1cd831 --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsDnclient.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsList200Response.ts b/tfweb/src/lib/api/models/DownloadsList200Response.ts new file mode 100644 index 0000000..0ff466a --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsList200Response.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsMobile.ts b/tfweb/src/lib/api/models/DownloadsMobile.ts new file mode 100644 index 0000000..e8d810a --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsMobile.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsVersionInfo.ts b/tfweb/src/lib/api/models/DownloadsVersionInfo.ts new file mode 100644 index 0000000..64c0541 --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsVersionInfo.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsVersionInfoDnclientValue.ts b/tfweb/src/lib/api/models/DownloadsVersionInfoDnclientValue.ts new file mode 100644 index 0000000..8e108c2 --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsVersionInfoDnclientValue.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/DownloadsVersionInfoLatest.ts b/tfweb/src/lib/api/models/DownloadsVersionInfoLatest.ts new file mode 100644 index 0000000..b4e9f8e --- /dev/null +++ b/tfweb/src/lib/api/models/DownloadsVersionInfoLatest.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/Event.ts b/tfweb/src/lib/api/models/Event.ts new file mode 100644 index 0000000..064215f --- /dev/null +++ b/tfweb/src/lib/api/models/Event.ts @@ -0,0 +1,104 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/FirewallRule.ts b/tfweb/src/lib/api/models/FirewallRule.ts new file mode 100644 index 0000000..4f272da --- /dev/null +++ b/tfweb/src/lib/api/models/FirewallRule.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/FirewallRulePortRange.ts b/tfweb/src/lib/api/models/FirewallRulePortRange.ts new file mode 100644 index 0000000..28c045b --- /dev/null +++ b/tfweb/src/lib/api/models/FirewallRulePortRange.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/Host.ts b/tfweb/src/lib/api/models/Host.ts new file mode 100644 index 0000000..c397257 --- /dev/null +++ b/tfweb/src/lib/api/models/Host.ts @@ -0,0 +1,168 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof Host + */ + staticAddresses?: Array; + /** + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200Response.ts b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200Response.ts new file mode 100644 index 0000000..02b861e --- /dev/null +++ b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseData.ts b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseData.ts new file mode 100644 index 0000000..4b7fb3e --- /dev/null +++ b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseData.ts @@ -0,0 +1,87 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseDataEnrollmentCode.ts b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseDataEnrollmentCode.ts new file mode 100644 index 0000000..763e616 --- /dev/null +++ b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate200ResponseDataEnrollmentCode.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostAndEnrollCodeCreate400Response.ts b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate400Response.ts new file mode 100644 index 0000000..648489f --- /dev/null +++ b/tfweb/src/lib/api/models/HostAndEnrollCodeCreate400Response.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof HostAndEnrollCodeCreate400Response + */ + errors: Array; +} + +/** + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostBlock200Response.ts b/tfweb/src/lib/api/models/HostBlock200Response.ts new file mode 100644 index 0000000..f550ea2 --- /dev/null +++ b/tfweb/src/lib/api/models/HostBlock200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostBlock200ResponseData.ts b/tfweb/src/lib/api/models/HostBlock200ResponseData.ts new file mode 100644 index 0000000..4c617de --- /dev/null +++ b/tfweb/src/lib/api/models/HostBlock200ResponseData.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/HostCreate200Response.ts b/tfweb/src/lib/api/models/HostCreate200Response.ts new file mode 100644 index 0000000..33a68d3 --- /dev/null +++ b/tfweb/src/lib/api/models/HostCreate200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostCreate400Response.ts b/tfweb/src/lib/api/models/HostCreate400Response.ts new file mode 100644 index 0000000..a2f355c --- /dev/null +++ b/tfweb/src/lib/api/models/HostCreate400Response.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof HostCreate400Response + */ + errors?: Array; +} + +/** + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostCreateRequest.ts b/tfweb/src/lib/api/models/HostCreateRequest.ts new file mode 100644 index 0000000..2975619 --- /dev/null +++ b/tfweb/src/lib/api/models/HostCreateRequest.ts @@ -0,0 +1,123 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof HostCreateRequest + */ + staticAddresses?: Array; + /** + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostDelete200Response.ts b/tfweb/src/lib/api/models/HostDelete200Response.ts new file mode 100644 index 0000000..38aad6a --- /dev/null +++ b/tfweb/src/lib/api/models/HostDelete200Response.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostEdit200Response.ts b/tfweb/src/lib/api/models/HostEdit200Response.ts new file mode 100644 index 0000000..d38bf9a --- /dev/null +++ b/tfweb/src/lib/api/models/HostEdit200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostEditRequest.ts b/tfweb/src/lib/api/models/HostEditRequest.ts new file mode 100644 index 0000000..13ea809 --- /dev/null +++ b/tfweb/src/lib/api/models/HostEditRequest.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostEnrollCodeCreate200Response.ts b/tfweb/src/lib/api/models/HostEnrollCodeCreate200Response.ts new file mode 100644 index 0000000..d0101dd --- /dev/null +++ b/tfweb/src/lib/api/models/HostEnrollCodeCreate200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseData.ts b/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseData.ts new file mode 100644 index 0000000..6008ad4 --- /dev/null +++ b/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseData.ts @@ -0,0 +1,72 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseDataEnrollmentCode.ts b/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseDataEnrollmentCode.ts new file mode 100644 index 0000000..56cf94b --- /dev/null +++ b/tfweb/src/lib/api/models/HostEnrollCodeCreate200ResponseDataEnrollmentCode.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostGet200Response.ts b/tfweb/src/lib/api/models/HostGet200Response.ts new file mode 100644 index 0000000..e56bcd3 --- /dev/null +++ b/tfweb/src/lib/api/models/HostGet200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostMetadata.ts b/tfweb/src/lib/api/models/HostMetadata.ts new file mode 100644 index 0000000..38178f2 --- /dev/null +++ b/tfweb/src/lib/api/models/HostMetadata.ts @@ -0,0 +1,101 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/HostsList200Response.ts b/tfweb/src/lib/api/models/HostsList200Response.ts new file mode 100644 index 0000000..f81b419 --- /dev/null +++ b/tfweb/src/lib/api/models/HostsList200Response.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof HostsList200Response + */ + data?: Array; + /** + * + * @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).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).map(HostToJSON)), + 'metadata': PaginationMetadataToJSON(value.metadata), + }; +} + diff --git a/tfweb/src/lib/api/models/ModelError.ts b/tfweb/src/lib/api/models/ModelError.ts new file mode 100644 index 0000000..e42dee2 --- /dev/null +++ b/tfweb/src/lib/api/models/ModelError.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/Network.ts b/tfweb/src/lib/api/models/Network.ts new file mode 100644 index 0000000..af7a555 --- /dev/null +++ b/tfweb/src/lib/api/models/Network.ts @@ -0,0 +1,113 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/NetworkGet200Response.ts b/tfweb/src/lib/api/models/NetworkGet200Response.ts new file mode 100644 index 0000000..3e102de --- /dev/null +++ b/tfweb/src/lib/api/models/NetworkGet200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/NetworksList200Response.ts b/tfweb/src/lib/api/models/NetworksList200Response.ts new file mode 100644 index 0000000..d0f8e61 --- /dev/null +++ b/tfweb/src/lib/api/models/NetworksList200Response.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof NetworksList200Response + */ + data?: Array; + /** + * + * @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).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).map(NetworkToJSON)), + 'metadata': PaginationMetadataToJSON(value.metadata), + }; +} + diff --git a/tfweb/src/lib/api/models/PaginationMetadata.ts b/tfweb/src/lib/api/models/PaginationMetadata.ts new file mode 100644 index 0000000..ce9f957 --- /dev/null +++ b/tfweb/src/lib/api/models/PaginationMetadata.ts @@ -0,0 +1,112 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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), + }; +} + diff --git a/tfweb/src/lib/api/models/PaginationMetadataPage.ts b/tfweb/src/lib/api/models/PaginationMetadataPage.ts new file mode 100644 index 0000000..92de2c1 --- /dev/null +++ b/tfweb/src/lib/api/models/PaginationMetadataPage.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/Role.ts b/tfweb/src/lib/api/models/Role.ts new file mode 100644 index 0000000..f0f6c01 --- /dev/null +++ b/tfweb/src/lib/api/models/Role.ts @@ -0,0 +1,112 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof Role + */ + firewallRules?: Array; + /** + * + * @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).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).map(FirewallRuleToJSON)), + 'createdAt': value.createdAt === undefined ? undefined : (value.createdAt.toISOString()), + 'modifiedAt': value.modifiedAt === undefined ? undefined : (value.modifiedAt.toISOString()), + }; +} + diff --git a/tfweb/src/lib/api/models/RoleCreate200Response.ts b/tfweb/src/lib/api/models/RoleCreate200Response.ts new file mode 100644 index 0000000..38bada8 --- /dev/null +++ b/tfweb/src/lib/api/models/RoleCreate200Response.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/RoleCreateRequest.ts b/tfweb/src/lib/api/models/RoleCreateRequest.ts new file mode 100644 index 0000000..80e760d --- /dev/null +++ b/tfweb/src/lib/api/models/RoleCreateRequest.ts @@ -0,0 +1,89 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof RoleCreateRequest + */ + firewallRules?: Array; +} + +/** + * 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).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).map(FirewallRuleToJSON)), + }; +} + diff --git a/tfweb/src/lib/api/models/RoleEditRequest.ts b/tfweb/src/lib/api/models/RoleEditRequest.ts new file mode 100644 index 0000000..3ab0f78 --- /dev/null +++ b/tfweb/src/lib/api/models/RoleEditRequest.ts @@ -0,0 +1,80 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof RoleEditRequest + */ + firewallRules?: Array; +} + +/** + * 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).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).map(FirewallRuleToJSON)), + }; +} + diff --git a/tfweb/src/lib/api/models/RolesList200Response.ts b/tfweb/src/lib/api/models/RolesList200Response.ts new file mode 100644 index 0000000..016624f --- /dev/null +++ b/tfweb/src/lib/api/models/RolesList200Response.ts @@ -0,0 +1,86 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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} + * @memberof RolesList200Response + */ + data?: Array; + /** + * + * @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).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).map(RoleToJSON)), + 'metadata': PaginationMetadataToJSON(value.metadata), + }; +} + diff --git a/tfweb/src/lib/api/models/Target.ts b/tfweb/src/lib/api/models/Target.ts new file mode 100644 index 0000000..687c3ac --- /dev/null +++ b/tfweb/src/lib/api/models/Target.ts @@ -0,0 +1,89 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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, + }; +} + diff --git a/tfweb/src/lib/api/models/index.ts b/tfweb/src/lib/api/models/index.ts new file mode 100644 index 0000000..d3e4829 --- /dev/null +++ b/tfweb/src/lib/api/models/index.ts @@ -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'; diff --git a/tfweb/src/lib/api/runtime.ts b/tfweb/src/lib/api/runtime.ts new file mode 100644 index 0000000..5e98cae --- /dev/null +++ b/tfweb/src/lib/api/runtime.ts @@ -0,0 +1,425 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Defined Networking API + *

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).
+ * + * 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 | ((name?: string, scopes?: string[]) => string | Promise); // 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) | 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(this: T, ...middlewares: Middleware[]) { + const next = this.clone(); + next.middleware = next.middleware.concat(...middlewares); + return next; + } + + withPreMiddleware(this: T, ...preMiddlewares: Array) { + const middlewares = preMiddlewares.map((pre) => ({ pre })); + return this.withMiddleware(...middlewares); + } + + withPostMiddleware(this: T, ...postMiddlewares: Array) { + const middlewares = postMiddlewares.map((post) => ({ post })); + return this.withMiddleware(...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 { + 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(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 | Set | 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 + +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 | Set | 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; + post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; +} + +export interface ApiResponse { + raw: Response; + value(): Promise; +} + +export interface ResponseTransformer { + (json: any): T; +} + +export class JSONApiResponse { + constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} + + async value(): Promise { + return this.transformer(await this.raw.json()); + } +} + +export class VoidApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return undefined; + } +} + +export class BlobApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.blob(); + }; +} + +export class TextApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.text(); + }; +} diff --git a/tfweb/src/lib/auth.ts b/tfweb/src/lib/auth.ts new file mode 100644 index 0000000..2ea052c --- /dev/null +++ b/tfweb/src/lib/auth.ts @@ -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"}] +} diff --git a/tfweb/src/lib/i18n/locales/en.json b/tfweb/src/lib/i18n/locales/en.json index 4ba9efa..7686c52 100644 --- a/tfweb/src/lib/i18n/locales/en.json +++ b/tfweb/src/lib/i18n/locales/en.json @@ -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" + } } } diff --git a/tfweb/src/routes/+page.svelte b/tfweb/src/routes/+page.svelte index a35ecdc..b2df83b 100644 --- a/tfweb/src/routes/+page.svelte +++ b/tfweb/src/routes/+page.svelte @@ -1,7 +1,25 @@ -

{$t('home.itworks')}

-

{$t('home.itworkssub')}

-

{@html $t('home.adminlink', {values:{link0:''+$t('home.adminlink.link0')+''}})}

+ + {$t("common.title", {values: {title: $t("common.page.admin")}})} + + + +

{$t('itworks.header')}

+

{$t('itworks.body')}

+ +

{@html $t('itworks.linkbody', {values:{link0:''+$t('itworks.linkbody.link0')+''}})}

+
diff --git a/tfweb/src/routes/admin/+page.svelte b/tfweb/src/routes/admin/+page.svelte new file mode 100644 index 0000000..0cfe654 --- /dev/null +++ b/tfweb/src/routes/admin/+page.svelte @@ -0,0 +1,36 @@ + + + + {$t("common.title", {values: {title: $t("common.page.admin")}})} + + + +

its not loading anymore

+
diff --git a/tfweb/svelte.config.js b/tfweb/svelte.config.js index 1cf26a0..bfd912f 100644 --- a/tfweb/svelte.config.js +++ b/tfweb/svelte.config.js @@ -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' + } } }; diff --git a/trifid-api/src/routes/v2/mod.rs b/trifid-api/src/routes/v2/mod.rs index fa6b687..e1535b0 100644 --- a/trifid-api/src/routes/v2/mod.rs +++ b/trifid-api/src/routes/v2/mod.rs @@ -1 +1,2 @@ pub mod enroll; +pub mod whoami; \ No newline at end of file diff --git a/trifid-api/src/routes/v2/whoami.rs b/trifid-api/src/routes/v2/whoami.rs new file mode 100644 index 0000000..eeb96ba --- /dev/null +++ b/trifid-api/src/routes/v2/whoami.rs @@ -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 . +// +//#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, + 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) -> 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 {}, + }) +} \ No newline at end of file