service

package
v0.10.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Index

Constants

View Source
const KCLVM_SERVER_ERROR_CODE int64 = 0x4B434C // the ASCII code of "KCL"

Variables

This section is empty.

Functions

func CallRestMethod

func CallRestMethod(host, method string, input, output proto.Message) error

CallRestMethod call an restful method.

func RunGrpcServer

func RunGrpcServer(address string) error

func RunRestServer

func RunRestServer(address string) error

Types

type BuiltinServiceClient

type BuiltinServiceClient = runtime.BuiltinServiceClient

func NewBuiltinServiceClient

func NewBuiltinServiceClient() *BuiltinServiceClient

type KclvmService

type KclvmService interface {
	// Ping KclvmService, return the same value as the parameter
	Ping(in *gpyrpc.Ping_Args) (out *gpyrpc.Ping_Result, err error)
	// Execute KCL file with arguments and return the JSON/YAML result.
	ExecProgram(in *gpyrpc.ExecProgram_Args) (out *gpyrpc.ExecProgram_Result, err error)
	// Depreciated: Please use the env.EnableFastEvalMode() and c.ExecutProgram method and will be removed in v0.11.0.
	BuildProgram(in *gpyrpc.BuildProgram_Args) (out *gpyrpc.BuildProgram_Result, err error)
	// Depreciated: Please use the env.EnableFastEvalMode() and c.ExecutProgram method and will be removed in v0.11.0.
	ExecArtifact(in *gpyrpc.ExecArtifact_Args) (out *gpyrpc.ExecProgram_Result, err error)
	// Parse KCL single file to Module AST JSON string with import dependencies and parse errors.
	ParseFile(in *gpyrpc.ParseFile_Args) (out *gpyrpc.ParseFile_Result, err error)
	// Parse KCL program with entry files and return the AST JSON string.
	ParseProgram(in *gpyrpc.ParseProgram_Args) (out *gpyrpc.ParseProgram_Result, err error)
	// ListOptions provides users with the ability to parse KCL program and get all option information.
	ListOptions(in *gpyrpc.ParseProgram_Args) (out *gpyrpc.ListOptions_Result, err error)
	// ListVariables provides users with the ability to parse KCL program and get all variables by specs.
	ListVariables(in *gpyrpc.ListVariables_Args) (out *gpyrpc.ListVariables_Result, err error)
	// LoadPackage provides users with the ability to parse KCL program and semantic model information including symbols, types, definitions, etc.
	LoadPackage(in *gpyrpc.LoadPackage_Args) (out *gpyrpc.LoadPackage_Result, err error)
	// Format the code source.
	FormatCode(in *gpyrpc.FormatCode_Args) (out *gpyrpc.FormatCode_Result, err error)
	// Format KCL file or directory path contains KCL files and returns the changed file paths.
	FormatPath(in *gpyrpc.FormatPath_Args) (out *gpyrpc.FormatPath_Result, err error)
	// Lint files and return error messages including errors and warnings.
	LintPath(in *gpyrpc.LintPath_Args) (out *gpyrpc.LintPath_Result, err error)
	// Override KCL file with arguments. See [https://www.kcl-lang.io/docs/user_docs/guides/automation](https://www.kcl-lang.io/docs/user_docs/guides/automation) for more override spec guide.
	OverrideFile(in *gpyrpc.OverrideFile_Args) (out *gpyrpc.OverrideFile_Result, err error)
	// Get schema type mapping defined in the program.
	GetSchemaTypeMapping(in *gpyrpc.GetSchemaTypeMapping_Args) (out *gpyrpc.GetSchemaTypeMapping_Result, err error)
	// Validate code using schema and JSON/YAML data strings.
	ValidateCode(in *gpyrpc.ValidateCode_Args) (out *gpyrpc.ValidateCode_Result, err error)
	// List dependencies files of input paths.
	ListDepFiles(in *gpyrpc.ListDepFiles_Args) (out *gpyrpc.ListDepFiles_Result, err error)
	// Load the setting file config defined in `kcl.yaml`.
	LoadSettingsFiles(in *gpyrpc.LoadSettingsFiles_Args) (out *gpyrpc.LoadSettingsFiles_Result, err error)
	// Rename all the occurrences of the target symbol in the files. This API will rewrite files if they contain symbols to be renamed. Return the file paths that got changed.
	Rename(in *gpyrpc.Rename_Args) (out *gpyrpc.Rename_Result, err error)
	// Rename all the occurrences of the target symbol and return the modified code if any code has been changed. This API won't rewrite files but return the changed code.
	RenameCode(in *gpyrpc.RenameCode_Args) (out *gpyrpc.RenameCode_Result, err error)
	// Test KCL packages with test arguments.
	Test(in *gpyrpc.Test_Args) (out *gpyrpc.Test_Result, err error)
	// Download and update dependencies defined in the `kcl.mod` file and return the external package name and location list.
	UpdateDependencies(in *gpyrpc.UpdateDependencies_Args) (out *gpyrpc.UpdateDependencies_Result, err error)
	// GetVersion KclvmService, return the kclvm service version information
	GetVersion(in *gpyrpc.GetVersion_Args) (out *gpyrpc.GetVersion_Result, err error)
}

func NewKclvmServiceClient

func NewKclvmServiceClient() KclvmService

type KclvmServiceClient

type KclvmServiceClient struct {
	Runtime *runtime.Runtime
}

func (*KclvmServiceClient) BuildProgram added in v0.8.0

func (p *KclvmServiceClient) BuildProgram(args *gpyrpc.BuildProgram_Args) (resp *gpyrpc.BuildProgram_Result, err error)

Depreciated: Please use the env.EnableFastEvalMode() and c.ExecutProgram method and will be removed in v0.11.0.

func (*KclvmServiceClient) ExecArtifact added in v0.8.0

func (p *KclvmServiceClient) ExecArtifact(args *gpyrpc.ExecArtifact_Args) (resp *gpyrpc.ExecProgram_Result, err error)

Depreciated: Please use the env.EnableFastEvalMode() and c.ExecutProgram method and will be removed in v0.11.0.

func (*KclvmServiceClient) ExecProgram

func (p *KclvmServiceClient) ExecProgram(args *gpyrpc.ExecProgram_Args) (resp *gpyrpc.ExecProgram_Result, err error)

func (*KclvmServiceClient) FormatCode

func (p *KclvmServiceClient) FormatCode(args *gpyrpc.FormatCode_Args) (resp *gpyrpc.FormatCode_Result, err error)

func (*KclvmServiceClient) FormatPath

func (p *KclvmServiceClient) FormatPath(args *gpyrpc.FormatPath_Args) (resp *gpyrpc.FormatPath_Result, err error)

func (*KclvmServiceClient) GetSchemaTypeMapping

func (p *KclvmServiceClient) GetSchemaTypeMapping(args *gpyrpc.GetSchemaTypeMapping_Args) (resp *gpyrpc.GetSchemaTypeMapping_Result, err error)

func (*KclvmServiceClient) GetVersion added in v0.9.2

func (p *KclvmServiceClient) GetVersion(args *gpyrpc.GetVersion_Args) (resp *gpyrpc.GetVersion_Result, err error)

func (*KclvmServiceClient) LintPath

func (p *KclvmServiceClient) LintPath(args *gpyrpc.LintPath_Args) (resp *gpyrpc.LintPath_Result, err error)

func (*KclvmServiceClient) ListDepFiles

func (p *KclvmServiceClient) ListDepFiles(args *gpyrpc.ListDepFiles_Args) (resp *gpyrpc.ListDepFiles_Result, err error)

func (*KclvmServiceClient) ListOptions added in v0.8.1

func (p *KclvmServiceClient) ListOptions(args *gpyrpc.ParseProgram_Args) (resp *gpyrpc.ListOptions_Result, err error)

func (*KclvmServiceClient) ListVariables added in v0.8.4

func (p *KclvmServiceClient) ListVariables(args *gpyrpc.ListVariables_Args) (resp *gpyrpc.ListVariables_Result, err error)

func (*KclvmServiceClient) LoadPackage added in v0.7.5

func (p *KclvmServiceClient) LoadPackage(args *gpyrpc.LoadPackage_Args) (resp *gpyrpc.LoadPackage_Result, err error)

func (*KclvmServiceClient) LoadSettingsFiles

func (p *KclvmServiceClient) LoadSettingsFiles(args *gpyrpc.LoadSettingsFiles_Args) (resp *gpyrpc.LoadSettingsFiles_Result, err error)

func (*KclvmServiceClient) OverrideFile

func (p *KclvmServiceClient) OverrideFile(args *gpyrpc.OverrideFile_Args) (resp *gpyrpc.OverrideFile_Result, err error)

func (*KclvmServiceClient) ParseFile added in v0.7.3

func (p *KclvmServiceClient) ParseFile(args *gpyrpc.ParseFile_Args) (resp *gpyrpc.ParseFile_Result, err error)

func (*KclvmServiceClient) ParseProgram added in v0.7.3

func (p *KclvmServiceClient) ParseProgram(args *gpyrpc.ParseProgram_Args) (resp *gpyrpc.ParseProgram_Result, err error)

func (*KclvmServiceClient) Ping

func (p *KclvmServiceClient) Ping(args *gpyrpc.Ping_Args) (resp *gpyrpc.Ping_Result, err error)

func (*KclvmServiceClient) Rename added in v0.7.0

func (p *KclvmServiceClient) Rename(args *gpyrpc.Rename_Args) (resp *gpyrpc.Rename_Result, err error)

func (*KclvmServiceClient) RenameCode added in v0.7.0

func (p *KclvmServiceClient) RenameCode(args *gpyrpc.RenameCode_Args) (resp *gpyrpc.RenameCode_Result, err error)

func (*KclvmServiceClient) Test added in v0.7.0

func (p *KclvmServiceClient) Test(args *gpyrpc.Test_Args) (resp *gpyrpc.Test_Result, err error)

func (*KclvmServiceClient) UpdateDependencies added in v0.9.0

func (p *KclvmServiceClient) UpdateDependencies(args *gpyrpc.UpdateDependencies_Args) (resp *gpyrpc.UpdateDependencies_Result, err error)

func (*KclvmServiceClient) ValidateCode

func (p *KclvmServiceClient) ValidateCode(args *gpyrpc.ValidateCode_Args) (resp *gpyrpc.ValidateCode_Result, err error)

type RestfulResult

type RestfulResult struct {
	Error  string        `json:"error"`
	Result proto.Message `json:"result"`
}

Client represents an restful method result.

type ServerError

type ServerError struct {
	Code int64  `json:"code,omitempty"`
	Msg  string `json:"message,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL