ballerina/internal package
Records Summary
Record | Description | ||
---|---|---|---|
CompressionError | Represent all compression related errors. | ||
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
public type CompressionError record
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 JWTIssuerConfig record
Represents JWT issuer configurations.
Field Name | Data Type | Default Value | Description |
---|---|---|---|
keyAlias | string | ||
keyPassword | string | ||
keyStoreFilePath | string | ||
keyStorePassword | string |
public type JWTValidatorConfig record
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 record
Represents a JWT header.
Field Name | Data Type | Default Value | Description |
---|---|---|---|
alg | string | ||
typ | string | ||
cty | string | ||
kid | string | ||
customClaims | map |
public type JwtPayload record
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 byteArrayToString(byte[] content, string encoding) returns (string)
Converts given byte array to a string.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
content | byte[] | Byte array content to be converted |
|
encoding | string | Encoding to used in byte array conversion to string |
Return Type | Description | ||
---|---|---|---|
string | String representation of the given byte array |
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 compressToByteArray(internal:Path dirPath) returns (byte[] | error)
Compresses a directory into a byte array.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
dirPath | internal:Path | Path of the directory to be compressed |
Return Type | Description | ||
---|---|---|---|
byte[] | error | Compressed byte array of the file |
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 decompressFromByteArray(byte[] content, internal:Path destDir) returns (error)
Decompresses a byte array into a directory.
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
content | byte[] | Byte array 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 execBallerinaDoc(string[] packageList, string? sourceRoot, string? outputPath, string? templatesPath, string[]? exclude, boolean includeNatives, map<string>? envVars, string? config, boolean verbose) returns (string | error)
Executes a ballerina doc command
Parameter Name | Data Type | Default Value | Description |
---|---|---|---|
packageList | string[] |
|
|
sourceRoot | string? | null |
|
outputPath | string? | null |
|
templatesPath | string? | null |
|
exclude | string[]? | null |
|
includeNatives | boolean | false |
|
envVars | map |
null |
|
config | string? | null |
|
verbose | boolean | false |
|
Return Type | Description | ||
---|---|---|---|
string | error |
|
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 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 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.
-
<Path> new(string root)
Parameter Name Data Type Default Value Description root string -
<Path> getPathValue() returns (string)
Retreives the absolute path from the provided location.
Return Type Description string Returns the absolute path as a string
-
<Path> getName() returns (string)
Retreives the name of the file from the provided location.
Return Type Description string Returns the name of the file
-
<Path> getExtension() returns (string)
Retreives the extension of the file from the provided location.
Return Type Description string Returns the extension of the file. Empty string if no extension.
-
<Path> exists() returns (boolean)
Check for existance of the file.
Return Type Description boolean True if the file exists, else false
-
<Path> list() returns (Path[] | error)
Returns the files of folders in the directory.
Return Type Description Path[] | error True if the given file path is a directory. It is false otherwise
-
<Path> isDirectory() returns (boolean)
Check if given file is a directory
Return Type Description boolean True if directory, else false
-
<Path> delete() returns (error)
Deletes a file/directory.
Return Type Description error Error if the directory/file could not be deleted
-
<Path> createDirectory() returns (error)
Creates a directory.
Return Type Description error Error if the directory could not be created
-
<Path> createFile() returns (error)
Creates a file.
Return Type Description error Error if the file could not be created
-
<Path> getModifiedTime() returns (timeTime | error)
Retrieves the last modified time of the file of directory.
Return Type Description timeTime | error Last modified time or an error if the path cannot be resolved
-
<Path> copyTo(internal:Path target) returns (error)
Copy file or directory to another path.
Parameter Name Data Type Default Value Description target internal:Path The location to copy file or directory
Return Type Description error Error if the file could not be copied
-
<Path> moveTo(internal:Path target) returns (error)
Move file or directory to another path.
Parameter Name Data Type Default Value Description target internal:Path The location to move file or directory
Return Type Description error Error if the file could not be moved
-
<Path> getParentDirectory() returns (Path | error)
Get the enclosing parent directory.
Return Type Description Path | error Path of parent folder or error occurred while getting parent directory
-
<Path> resolve(string[] paths) returns (Path)
Resolve given path.
Parameter Name Data Type Default Value Description paths string[] Return Type Description Path Resolved path