ballerina/internal package
Type Definitions
| Type | Values | Description | |
|---|---|---|---|
| BallerinaCommand | version | uninstall | test | swagger | search | run | push | pull | install | init | grpc | encrypt | docker | doc | build |
Records Summary
| Record | Description | ||
|---|---|---|---|
| CompressionError | Represent all compression related errors. |
||
| IOError | Represents an I/O error that could occur when processing a file. |
||
| JWTIssuerConfig | Represents JWT issuer configurations. |
||
| JWTValidatorConfig | Represents JWT validator configurations. |
||
| JwtHeader | Represents a JWT header. |
||
| JwtPayload | Represents a JWT payload. |
Objects Summary
| Object | Description | ||
|---|---|---|---|
| Path | Reference to the file location. |
Functions Summary
| Return Type | Function and Description | ||
|---|---|---|---|
| error | compress(internal:Path dirPath, internal:Path destDir) Compresses a directory. |
||
| blob | error | compressToBlob(internal:Path dirPath) Compresses a directory into a blob. |
||
| boolean | IOError | createDirectory(internal:Path path) Creates a directory in the specified location. |
||
| boolean | IOError | createFile(internal:Path path) Creates a file in the specified location. |
||
| error | decompress(internal:Path dirPath, internal:Path destDir) Decompresses a compressed file. |
||
| error | decompressFromBlob(blob content, internal:Path destDir) Decompresses a blob into a directory. |
||
| boolean | IOError | delete(internal:Path path) Deletes a file/directory from the specified path. |
||
| string | error | execBallerina(uninstall|pull|version|grpc|encrypt|swagger|search|install|doc|push|build|init|test|docker|run command, string packagePath) Executes a ballerina command |
||
| timeTime | IOError | getModifiedTime(internal:Path path) Retrieves the last modified time of the path. |
||
| string | error | issue(internal:JwtHeader header, internal:JwtPayload payload, internal:JWTIssuerConfig config) Issue a JWT token. |
||
| Path[] | IOError | list(internal:Path path) Returns the list of paths in the directory. |
||
| json | error | parseJson(string s) Parse JSON string to generate JSON object. |
||
| boolean | pathExists(internal:Path path) Check for existance of the file. |
||
| JwtPayload | error | validate(string jwtToken, internal:JWTValidatorConfig config) Validity given JWT token. |
public type CompressionError
Represent all compression related errors.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| message | string | The error message |
|
| cause | error? | The error which caused the compression error |
public type IOError
Represents an I/O error that could occur when processing a file.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| message | string | ||
| cause | error? |
public type JWTIssuerConfig
Represents JWT issuer configurations.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| keyAlias | string | ||
| keyPassword | string | ||
| keyStoreFilePath | string | ||
| keyStorePassword | string |
public type JWTValidatorConfig
Represents JWT validator configurations.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| issuer | string | ||
| audience | string | ||
| clockSkew | int | ||
| certificateAlias | string | ||
| trustStoreFilePath | string | ||
| trustStorePassword | string |
public type JwtHeader
Represents a JWT header.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| alg | string | ||
| typ | string | ||
| cty | string | ||
| kid | string | ||
| customClaims | map |
public type JwtPayload
Represents a JWT payload.
| Field Name | Data Type | Default Value | Description |
|---|---|---|---|
| iss | string | ||
| sub | string | ||
| aud | string[] | ||
| jti | string | ||
| exp | int | ||
| nbf | int | ||
| iat | int | ||
| customClaims | map |
public function compress(internal:Path dirPath, internal:Path destDir) returns (error)
Compresses a directory.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| dirPath | internal:Path | Path of the directory to be compressed |
|
| destDir | internal:Path | Path of the directory to place the compressed file |
| Return Type | Description | ||
|---|---|---|---|
| error | An error if an error occurs during the compression process |
public function compressToBlob(internal:Path dirPath) returns (blob | error)
Compresses a directory into a blob.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| dirPath | internal:Path | Path of the directory to be compressed |
| Return Type | Description | ||
|---|---|---|---|
| blob | error | Compressed blob of the file |
public function createDirectory(internal:Path path) returns (boolean | IOError)
Creates a directory in the specified location.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path | Reference to the file path location |
| Return Type | Description | ||
|---|---|---|---|
| boolean | IOError | error if the directory could not be created |
public function createFile(internal:Path path) returns (boolean | IOError)
Creates a file in the specified location.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path | Reference to the file path location |
| Return Type | Description | ||
|---|---|---|---|
| boolean | IOError | error if the file could not be created |
public function decompress(internal:Path dirPath, internal:Path destDir) returns (error)
Decompresses a compressed file.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| dirPath | internal:Path | Path of the compressed file |
|
| destDir | internal:Path | Path of the directory to decompress the file |
| Return Type | Description | ||
|---|---|---|---|
| error | An error if an error occurs during the decompression process |
public function decompressFromBlob(blob content, internal:Path destDir) returns (error)
Decompresses a blob into a directory.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| content | blob | Blob of the compressed file |
|
| destDir | internal:Path | Path of the directory to decompress the file |
| Return Type | Description | ||
|---|---|---|---|
| error | An error if an error occurs during the decompression process |
public function delete(internal:Path path) returns (boolean | IOError)
Deletes a file/directory from the specified path.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path | Reference to the file path location |
| Return Type | Description | ||
|---|---|---|---|
| boolean | IOError | error if the directory/file could not be deleted |
public function execBallerina(uninstall|pull|version|grpc|encrypt|swagger|search|install|doc|push|build|init|test|docker|run command, string packagePath) returns (string | error)
Executes a ballerina command
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| command | uninstall|pull|version|grpc|encrypt|swagger|search|install|doc|push|build|init|test|docker|run |
|
|
| packagePath | string |
|
| Return Type | Description | ||
|---|---|---|---|
| string | error |
|
public function getModifiedTime(internal:Path path) returns (timeTime | IOError)
Retrieves the last modified time of the path.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path |
| Return Type | Description | ||
|---|---|---|---|
| timeTime | IOError | Last modified time or an error if the path cannot be resolved |
public function issue(internal:JwtHeader header, internal:JwtPayload payload, internal:JWTIssuerConfig config) returns (string | error)
Issue a JWT token.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| header | internal:JwtHeader | JwtHeader object |
|
| payload | internal:JwtPayload | JwtPayload object |
|
| config | internal:JWTIssuerConfig | JWTIssuerConfig object |
| Return Type | Description | ||
|---|---|---|---|
| string | error | JWT token string |
public function list(internal:Path path) returns (Path[] | IOError)
Returns the list of paths in the directory.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path | Reference to the file path location |
| Return Type | Description | ||
|---|---|---|---|
| Path[] | IOError | List of file paths in the directory or an I/O error |
public function parseJson(string s) returns (json | error)
Parse JSON string to generate JSON object.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| s | string | JSON string |
| Return Type | Description | ||
|---|---|---|---|
| json | error | JSON object. |
public function pathExists(internal:Path path) returns (boolean)
Check for existance of the file.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| path | internal:Path | Refernce to the file location |
| Return Type | Description | ||
|---|---|---|---|
| boolean | true if the file exists |
public function validate(string jwtToken, internal:JWTValidatorConfig config) returns (JwtPayload | error)
Validity given JWT token.
| Parameter Name | Data Type | Default Value | Description |
|---|---|---|---|
| jwtToken | string | JWT token that need to validate |
|
| config | internal:JWTValidatorConfig | JWTValidatorConfig object |
| Return Type | Description | ||
|---|---|---|---|
| JwtPayload | error | If JWT token is valied true , else false |
public type Path object
Reference to the file location.