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.
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:0.0.0:Path dirPath, internal:0.0.0:Path destDir)

Compresses a directory.

blob | error compressToBlob(internal:0.0.0:Path dirPath)

Compresses a directory into a blob.

error decompress(internal:0.0.0:Path dirPath, internal:0.0.0:Path destDir)

Decompresses a compressed file.

error decompressFromBlob(blob content, internal:0.0.0:Path destDir)

Decompresses a blob into a directory.

string | error execBallerina(swagger|doc|version|encrypt|pull|build|run|install|init|push|grpc|search|uninstall|test|docker command, string packagePath)

Executes a ballerina command

string | error issue(internal:0.0.0:JwtHeader header, internal:0.0.0:JwtPayload payload, internal:0.0.0:JWTIssuerConfig config)

Issue a JWT token.

json | error parseJson(string s)

Parse JSON string to generate JSON object.

JwtPayload | error validate(string jwtToken, internal:0.0.0:JWTValidatorConfig config)

Validity given JWT token.

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 compress(internal:0.0.0:Path dirPath, internal:0.0.0:Path destDir) returns (error)

Compresses a directory.

Parameter Name Data Type Default Value Description
dirPath internal:0.0.0:Path

Path of the directory to be compressed

destDir internal:0.0.0: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:0.0.0:Path dirPath) returns (blob | error)

Compresses a directory into a blob.

Parameter Name Data Type Default Value Description
dirPath internal:0.0.0:Path

Path of the directory to be compressed

Return Type Description
blob | error

Compressed blob of the file

public function decompress(internal:0.0.0:Path dirPath, internal:0.0.0:Path destDir) returns (error)

Decompresses a compressed file.

Parameter Name Data Type Default Value Description
dirPath internal:0.0.0:Path

Path of the compressed file

destDir internal:0.0.0: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:0.0.0: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:0.0.0: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 execBallerina(swagger|doc|version|encrypt|pull|build|run|install|init|push|grpc|search|uninstall|test|docker command, string packagePath) returns (string | error)

Executes a ballerina command

Parameter Name Data Type Default Value Description
command swagger|doc|version|encrypt|pull|build|run|install|init|push|grpc|search|uninstall|test|docker
  • Ballerina command
packagePath string
  • Package path with necessary flags
Return Type Description
string | error
  • Data piped from the standard output and error output of the process

public function issue(internal:0.0.0:JwtHeader header, internal:0.0.0:JwtPayload payload, internal:0.0.0:JWTIssuerConfig config) returns (string | error)

Issue a JWT token.

Parameter Name Data Type Default Value Description
header internal:0.0.0:JwtHeader

JwtHeader object

payload internal:0.0.0:JwtPayload

JwtPayload object

config internal:0.0.0: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:0.0.0: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:0.0.0: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:0.0.0:Path target) returns (error)

    Copy file or directory to another path.

    Parameter Name Data Type Default Value Description
    target internal:0.0.0:Path

    The location to copy file or directory

    Return Type Description
    error

    Error if the file could not be copied

  • <Path> moveTo(internal:0.0.0:Path target) returns (error)

    Move file or directory to another path.

    Parameter Name Data Type Default Value Description
    target internal:0.0.0: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