@onzag/itemize / Modules / server/services/openstack / OpenstackService
server/services/openstack.OpenstackService
Provides the pkgloud client container
Param
the client to use
Param
the container name
-
default<ISensitiveConfigOpenstackContainerType>↳
OpenstackService
- appConfig
- appDbConfig
- appRedisConfig
- appSensitiveConfig
- config
- globalCustomServices
- globalDatabaseConnection
- globalInstance
- globalMailProvider
- globalPhoneProvider
- globalRawDB
- globalRedis
- globalRedisPub
- globalRedisSub
- globalRoot
- id
- instanceName
- localAppData
- localInstance
- prefix
- registry
- copyFolder
- download
- dumpFolder
- execute
- exists
- expressRouter
- getId
- getInstanceName
- getPrefix
- getRouter
- getRunCycleTime
- getTriggerRegistry
- initialize
- isInstanceGlobal
- isInstanceLocal
- logDebug
- logError
- logInfo
- read
- removeFolder
- run
- setId
- setInstanceName
- setPrefix
- setupGlobalResources
- setupLocalResources
- upload
- verifyResourceIsReady
- expressRouter
- getRouter
- getTriggerRegistry
- getType
- logDebug
- logError
- logInfo
• new OpenstackService(config, registry, configs): OpenstackService
| Name | Type |
|---|---|
config |
ISensitiveConfigOpenstackContainerType |
registry |
RegistryService |
configs |
Object |
configs.config |
IConfigRawJSONDataType |
configs.dbConfig |
IDBConfigRawJSONDataType |
configs.redisConfig |
IRedisConfigRawJSONDataType |
configs.sensitiveConfig |
ISensitiveConfigRawJSONDataType |
• appConfig: IConfigRawJSONDataType
• appDbConfig: IDBConfigRawJSONDataType
• appRedisConfig: IRedisConfigRawJSONDataType
• appSensitiveConfig: ISensitiveConfigRawJSONDataType
• config: ISensitiveConfigOpenstackContainerType
• globalCustomServices: Object
▪ [name: string]: ServiceProvider<any>
• globalDatabaseConnection: DatabaseConnection
default.globalDatabaseConnection
• globalInstance: boolean = false
• globalMailProvider: default<any>
• globalPhoneProvider: default<any>
• globalRawDB: ItemizeRawDB
• globalRedis: ItemizeRedisClient
• globalRedisPub: ItemizeRedisClient
• globalRedisSub: ItemizeRedisClient
• globalRoot: default
• id: string
server/services/base/StorageProvider.ts:16
• instanceName: string
• localAppData: IAppDataType
• localInstance: boolean = false
• prefix: string
server/services/base/StorageProvider.ts:15
• registry: RegistryService
▸ copyFolder(remotePath, targetPath, target): Promise<void>
Should copy a folder from one container to another target container, note that during calls the target container may be itself, optimize if necessary for such calls
NECESSARY FOR CUSTOM SERVER COPY CALLS TO FUNCTION
| Name | Type |
|---|---|
remotePath |
string |
targetPath |
string |
target |
default<any> |
Promise<void>
server/services/base/StorageProvider.ts:112
▸ download(at): ReadStream
This function is necessary for downloading a file
| Name | Type | Description |
|---|---|---|
at |
string |
the remote file to download |
ReadStream
server/services/base/StorageProvider.ts:56
▸ dumpFolder(remotePath, localPath): Promise<void>
This function is executed once an entire folder is requested to be downloaded locally in the given local path
NECESSARY FOR DUMPING TO FUNCTION
| Name | Type | Description |
|---|---|---|
remotePath |
string |
the remote path |
localPath |
string |
the local path |
Promise<void>
server/services/base/StorageProvider.ts:97
▸ execute(): void
Performs the execution of the service, basically it will do the run function and then re-run as specified
void
▸ exists(at): Promise<boolean>
It's executed to verify whether a given remote resource exists
NECESSARY FOR CORE ITEMIZE TO FUNCTION
| Name | Type | Description |
|---|---|---|
at |
string |
the resource to check for |
Promise<boolean>
server/services/base/StorageProvider.ts:82
▸ expressRouter(options?): Router
| Name | Type |
|---|---|
options? |
RouterOptions |
Router
▸ getId(): string
string
server/services/base/StorageProvider.ts:30
▸ getInstanceName(): string
string
▸ getPrefix(): string
string
server/services/base/StorageProvider.ts:26
▸ getRouter(appData): Router | Promise<Router>
Provides a router endpoint, the router endpoint will exist directly under the rest services this enables to create webhooks and other subservices that are attached to this service
If the service provider if executed on a global environment the endpoint does not get created, this means that in the global manager this won't be executed, or anything that is meant for the global manager
The router gets attached to /rest/service
| Name | Type |
|---|---|
appData |
IAppDataType |
Router | Promise<Router>
▸ getRunCycleTime(): number
Determines whether the run function should run over again
number
▸ getTriggerRegistry(): ITriggerRegistry | Promise<ITriggerRegistry>
Allows to setup trigger registries via the service so that they trigger just as normal trigger will do
ITriggerRegistry | Promise<ITriggerRegistry>
▸ initialize(): Promise<void>
This function is executed during the initialization of the service
If your service is a global service you will have access to the global resources while this function executes
Promise<void>
server/services/openstack.ts:58
▸ isInstanceGlobal(): boolean
boolean
▸ isInstanceLocal(): boolean
boolean
▸ logDebug<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ logError<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingErrorStructure<T> |
void
▸ logInfo<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ read(at): Promise<string>
It's executed to read files
NECESSARY FOR SEO TO FUNCTION
| Name | Type | Description |
|---|---|---|
at |
string |
the file to read |
Promise<string>
server/services/base/StorageProvider.ts:124
▸ removeFolder(at): Promise<void>
This function is executed once a folder removal is requested
NECESSARY FOR CORE ITEMIZE TO FUNCTION
| Name | Type | Description |
|---|---|---|
at |
string |
the remote folder to remove |
Promise<void>
server/services/base/StorageProvider.ts:69
▸ run(): void | Promise<void>
Executes some code
void | Promise<void>
▸ setId(id): void
| Name | Type |
|---|---|
id |
string |
void
server/services/base/StorageProvider.ts:22
▸ setInstanceName(n): void
| Name | Type |
|---|---|
n |
string |
void
▸ setPrefix(prefix): void
| Name | Type |
|---|---|
prefix |
string |
void
server/services/base/StorageProvider.ts:18
▸ setupGlobalResources(globalDatabaseConnection, globalClient, globalPub, globalSub, globalMailProvider, globalPhoneProvider, globalCustomServices, root): void
| Name | Type |
|---|---|
globalDatabaseConnection |
DatabaseConnection |
globalClient |
ItemizeRedisClient |
globalPub |
ItemizeRedisClient |
globalSub |
ItemizeRedisClient |
globalMailProvider |
default<any> |
globalPhoneProvider |
default<any> |
globalCustomServices |
Object |
root |
default |
void
▸ setupLocalResources(appData): void
| Name | Type |
|---|---|
appData |
IAppDataType |
void
▸ upload(at, readStream, mustBeVerified): Promise<void>
This function is executed when the service uploading a read stream
NECESSARY FOR CORE ITEMIZE TO FUNCTION
| Name | Type | Description |
|---|---|---|
at |
string |
the remote file to use |
readStream |
ReadStream |
the stream to read from |
mustBeVerified |
boolean |
a boolean that specifies whether the resouce must be verified and return a 200 when requested |
Promise<void>
server/services/openstack.ts:115
▸ verifyResourceIsReady(url, done): void
Verifies whether a given uploaded resource is actually ready, as containers, might have been done uploading but are not ready to serve the file itself
| Name | Type | Description |
|---|---|---|
url |
URL |
the url to verify |
done |
() => void |
the callback once it's done |
void
server/services/openstack.ts:80
▸ expressRouter(options?): Router
| Name | Type |
|---|---|
options? |
RouterOptions |
Router
▸ getRouter(appData): Router | Promise<Router>
Provides a router endpoint, but this method is static, which means it only gets added once
If the service provider if executed on a global environment the endpoint does not get created, this means that in the global manager this won't be executed, or anything that is meant for the global manager
the router gets attached to /rest/service
| Name | Type |
|---|---|
appData |
IAppDataType |
Router | Promise<Router>
▸ getTriggerRegistry(): ITriggerRegistry | Promise<ITriggerRegistry>
Allows to setup trigger registries via the service so that they trigger just as normal trigger will do
This gets attached if a class is used rather than per instance
ITriggerRegistry | Promise<ITriggerRegistry>
▸ getType(): ServiceProviderType
Specifies whether the current service is a global service if true global services will only execute initialize and a router will not be extracted from them
it will instead have access to the global resources
server/services/openstack.ts:54
▸ logDebug<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void
▸ logError<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingErrorStructure<T> |
void
▸ logInfo<T>(data): void
| Name |
|---|
T |
| Name | Type |
|---|---|
data |
IItemizeLoggingStructure<T> |
void