Skip to content

Files

Latest commit

fec2731 · Nov 22, 2024

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Nov 22, 2024
Dec 29, 2023
Nov 19, 2024

Feilong Go Client Library Examples

The examples provided here do only queries: they do not create, modify, nor delete resources. They can therefore safely be used in production environments.

How to Compile the Examples

From the examples directory, create a symbolic link to the snippet you want to use:

$ ln -s snippets/get_version.go main.go

Generate the go.sum file:

$ go mod tidy

Compile the example, it will go to $GOPATH/bin:

$ go install

How to Run the Examples

To run the example, you need to export the URL of the Feilong connector:

$ export ZVM_CONNECTOR="http://1.2.3.4"
$ example

Some snippets need a parameter on the command line. For example, if you compiled get_guest_info.go:

$ export ZVM_CONNECTOR="http://1.2.3.4"
$ example MYGUEST

If you implemented token authentication on the server side, you need to export one more environment variable:

$ export ZVM_CONNECTOR="http://1.2.3.4"
$ export ZVM_ADMIN_TOKEN="zvX2mFxuj8HcrYkAacLReV0RTQ0K5IIEighOR9F8AG"
$ example

If you mandated SSL on the server side, you might need to add your Certification Authority to the client. On a SUSE system:

$ sudo cp feilongCA.crt /etc/pki/trust/anchors/
$ sudo update-ca-certificates

$ export ZVM_CONNECTOR="https://1.2.3.4"
$ example