UNPKG

@c8y/ngx-components

Version:

Angular modules for Cumulocity IoT applications

100 lines 4.04 kB
import { CanActivateFn } from '@angular/router'; import { FetchClient, IManagedObject } from '@c8y/client'; import { ServiceRegistry } from '@c8y/ngx-components'; import { Observable } from 'rxjs'; import { RemoteAccessProtocolProvider } from './remote-access-protocol-provider'; import * as i0 from "@angular/core"; export interface RemoteAccessConfiguration { id: string; name: string; hostname: string; port: number; protocol: string; attrs?: any; credentials?: any; credentialsType?: string; } export declare const CREDENTIALS_TYPES: { readonly NONE: { readonly name: "NONE"; readonly value: "NONE"; readonly label: "No password"; }; readonly USER_PASS: { readonly name: "USER_PASS"; readonly value: "USER_PASS"; readonly label: "Username and password"; }; readonly PASS_ONLY: { readonly name: "PASS_ONLY"; readonly value: "PASS_ONLY"; readonly label: "Password only"; }; readonly KEY_PAIR: { readonly name: "KEY_PAIR"; readonly value: "KEY_PAIR"; readonly label: "Public/private keys"; }; readonly CERTIFICATE: { readonly name: "CERTIFICATE"; readonly value: "CERTIFICATE"; readonly label: "Certificate"; }; }; export declare const canActivateRemoteAccess: CanActivateFn; export declare class RemoteAccessService { private fetchClient; private serviceRegistry; private cachedIsAvailable$; readonly baseUrl = "/service/remoteaccess"; constructor(fetchClient: FetchClient, serviceRegistry: ServiceRegistry); /** * Verifies if the remote access service is available by sending a HEAD request to is's health endpoint. * @returns cached Observable that emits true if the service is available, false otherwise. */ isAvailable$(): Observable<boolean>; /** * misses the leading ? for the query params */ getAuthQueryParamsForWebsocketConnection(): string; /** * Returns the URI for the websocket connection to the remote access service. */ getWebSocketUri<K extends string, I extends string>(deviceId: K, configurationId: I): `ws://${string}/service/remoteaccess/client/${K}/configurations/${I}` | `wss://${string}/service/remoteaccess/client/${K}/configurations/${I}` | `ws://${string}/service/remoteaccess/client/${K}/configurations/${I}?${string}` | `wss://${string}/service/remoteaccess/client/${K}/configurations/${I}?${string}`; /** * Retrieves all configurations for a given device. */ listConfigurations(deviceId: string): Promise<RemoteAccessConfiguration[]>; /** * Deletes a configuration for a given device. */ deleteConfiguration(deviceId: string, configurationId: string): Promise<void>; /** * Retrieves all available remote access protocol providers. */ getProtocolProviders(): RemoteAccessProtocolProvider[]; /** * Retrieves all supported protocol providers for a given device. * Based on the declarations in the fragment c8y_RemoteAccessSupportedProtocols of the device managed object. */ getSupportedProtocolProvidersFor(device: IManagedObject): RemoteAccessProtocolProvider[]; /** * Creates a new configuration for a given device. */ addConfiguration(deviceId: string, configuration: Omit<RemoteAccessConfiguration, 'id'>): Promise<RemoteAccessConfiguration>; /** * Updates a configuration for a given device. */ updateConfiguration(deviceId: string, configuration: RemoteAccessConfiguration): Promise<RemoteAccessConfiguration>; /** * Generates a SSH key pair for a given hostname. */ generateKeyPair(hostname: string): Promise<{ publicKey: string; privateKey: string; }>; private healthEndpointAvailable; static ɵfac: i0.ɵɵFactoryDeclaration<RemoteAccessService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RemoteAccessService>; } //# sourceMappingURL=remote-access.service.d.ts.map