Install SDK for Go
Introduction
Welcome to Zenlayer Cloud API Software Developer Kit (SDK). SDK is a supporting tool for Zenlayer Cloud API. It currently supports Bare Metal Instance, Elastic IP, DDoS Protected IP and other products. More cloud services will be supported for SDK.
Requirements
You must use Go 1.9.x or later.
A Zenlayer Cloud account is created and an Access Key ID and an Access Key Password are created. See Generate an API Access Key for more details.
Installation
Use go get
to install SDK:
Quick Examples
Take DescribeInstances as an example.
Other Configurations
Before creating client, if needed, you can specify some other configuration by setting common.NewConfig
The configurations are as follows:
Request Timeout
The Zenlayer Cloud SDK for GO has default request timeout, and please do not modify the default value if necessary. You can check the latest default timeout value in the code. Unit: second. For example, the current default timeout value is 30 seconds.
You can set DEBUG=on
to enable the debug mode. The debug mode will print more detailed logs (including request and response data), which can be enabled when you need to troubleshoot errors in detail. By default, the debug mode is disabled. You can also set config.Debug = Bool(true) to enable the debug mode as follows:
Default value: false
Request Retries
If a request fails due to network error, it may be desirable to retry the request. By default, the request retries are disabled. You can enable request reties on all API interfaces or just on a specified one.
Last updated