Skip to content

Latest commit

 

History

History
411 lines (361 loc) · 29.7 KB

README.md

File metadata and controls

411 lines (361 loc) · 29.7 KB

Go API client for publiccloud

The base URL for this API is: https://api.leaseweb.com/publicCloud/v1/_

This API provides ways to launch and manage Public Cloud instances.

BETA
This API is in BETA. Documentation might be incorrect or incomplete. Functionality might change with the final release.>

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v1
  • Package version: 1.0.0
  • Generator version: 7.10.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import publiccloud "github.com/leaseweb/leaseweb-go-sdk/publiccloud"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value publiccloud.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), publiccloud.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value publiccloud.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), publiccloud.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using publiccloud.ContextOperationServerIndices and publiccloud.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), publiccloud.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), publiccloud.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.leaseweb.com/publicCloud/v1

Class Method HTTP request Description
PubliccloudAPI AddToPrivateNetwork Put /instances/{instanceId}/addToPrivateNetwork Add instance to Private Network
PubliccloudAPI AttachInstanceISO Post /instances/{instanceId}/attachIso Attach ISO to a specific Instance
PubliccloudAPI AttachVPSISO Post /vps/{vpsId}/attachIso Attach ISO to a specific VPS
PubliccloudAPI CancelInstanceTermination Post /instances/{instanceId}/cancelTermination Cancel instance termination
PubliccloudAPI CreateAutoScalingGroup Post /autoScalingGroups Create Auto Scaling Group
PubliccloudAPI CreateImage Post /images Create Custom Image
PubliccloudAPI CreateLoadBalancerListener Post /loadBalancers/{loadBalancerId}/listeners Create listener
PubliccloudAPI CreateSnapshot Post /instances/{instanceId}/snapshots Create instance snapshot
PubliccloudAPI CreateTargetGroup Post /targetGroups Create Target Group
PubliccloudAPI DeleteAutoScalingGroup Delete /autoScalingGroups/{autoScalingGroupId} Delete Auto Scaling Group
PubliccloudAPI DeleteInstanceCredential Delete /instances/{instanceId}/credentials/{type}/{username} Delete Instance credential for a given type and username
PubliccloudAPI DeleteInstanceCredentials Delete /instances/{instanceId}/credentials Delete all credentials associated with a specific Instance
PubliccloudAPI DeleteLoadBalancerListener Delete /loadBalancers/{loadBalancerId}/listeners/{listenerId} Delete load balancer listener
PubliccloudAPI DeleteSnapshot Delete /instances/{instanceId}/snapshots/{snapshotId} Delete instance snapshot
PubliccloudAPI DeleteTargetGroup Delete /targetGroups/{targetGroupId} Delete Target Group
PubliccloudAPI DeleteVPSCredential Delete /vps/{vpsId}/credentials/{type}/{username} Delete VPS credential
PubliccloudAPI DeleteVPSCredentials Delete /vps/{vpsId}/credentials Delete all credentials associated with a specific VPS
PubliccloudAPI DeregisterAutoScalingGroupTargetGroup Post /autoScalingGroups/{autoScalingGroupId}/deregisterTargetGroup Deregister Target Group
PubliccloudAPI DeregisterTargets Post /targetGroups/{targetGroupId}/deregisterTargets Deregister Targets
PubliccloudAPI DetachInstanceISO Post /instances/{instanceId}/detachIso Detach ISO from a specific Instance
PubliccloudAPI DetachVPSISO Post /vps/{vpsId}/detachIso Detach ISO from a specific VPS
PubliccloudAPI GetAutoScalingGroup Get /autoScalingGroups/{autoScalingGroupId} Get Auto Scaling Group details
PubliccloudAPI GetAutoScalingGroupInstanceList Get /autoScalingGroups/{autoScalingGroupId}/instances Get list of instances belonging to an Auto Scaling Group
PubliccloudAPI GetAutoScalingGroupList Get /autoScalingGroups Get Auto Scaling Group list
PubliccloudAPI GetConnectionsMetrics Get /loadBalancers/{loadBalancerId}/metrics/connections Get connections metrics
PubliccloudAPI GetConnectionsPerSecondMetrics Get /loadBalancers/{loadBalancerId}/metrics/connectionsPerSecond Get connections per second metrics
PubliccloudAPI GetConsoleAccessToInstance Get /instances/{instanceId}/console Get console access
PubliccloudAPI GetCpuMetrics Get /instances/{instanceId}/metrics/cpu Get instance CPU metrics
PubliccloudAPI GetDataTransferredMetrics Get /loadBalancers/{loadBalancerId}/metrics/dataTransferred Get load balancer data transferred metrics
PubliccloudAPI GetDataTransferredPerSecondMetrics Get /loadBalancers/{loadBalancerId}/metrics/dataTransferredPerSecond Get load balancer data transferred per second metrics
PubliccloudAPI GetExpenses Get /equipments/{equipmentId}/expenses Get costs for a given month.
PubliccloudAPI GetImageList Get /images List all available Images
PubliccloudAPI GetInstance Get /instances/{instanceId} Get instance details
PubliccloudAPI GetInstanceCredential Get /instances/{instanceId}/credentials/{type}/{username} Get Instance credentials by type and username.
PubliccloudAPI GetInstanceCredentialList Get /instances/{instanceId}/credentials List credentials stored for a specific Instance
PubliccloudAPI GetInstanceCredentialListByType Get /instances/{instanceId}/credentials/{type} Get credentials by type for a specific Instance
PubliccloudAPI GetInstanceDataTrafficMetrics Get /instances/{instanceId}/metrics/datatraffic Get data traffic metrics for a specific Instance
PubliccloudAPI GetInstanceIP Get /instances/{instanceId}/ips/{ip} Get IP details for a specific Instance
PubliccloudAPI GetInstanceIPList Get /instances/{instanceId}/ips List IP addresses associated with a specific Instance
PubliccloudAPI GetInstanceList Get /instances Get instance list
PubliccloudAPI GetInstanceTypeList Get /instanceTypes List instance types
PubliccloudAPI GetIsoList Get /isos List available ISOs
PubliccloudAPI GetLoadBalancer Get /loadBalancers/{loadBalancerId} Get load balancer details
PubliccloudAPI GetLoadBalancerDataTrafficMetrics Get /loadBalancers/{loadBalancerId}/metrics/datatraffic Get data traffic metrics for a specific Load Balancer
PubliccloudAPI GetLoadBalancerIP Get /loadBalancers/{loadBalancerId}/ips/{ip} Get IP details for a specific Load Balancer
PubliccloudAPI GetLoadBalancerIPList Get /loadBalancers/{loadBalancerId}/ips List IP addresses associated with a specific Load Balancer
PubliccloudAPI GetLoadBalancerList Get /loadBalancers Get load balancer list
PubliccloudAPI GetLoadBalancerListener Get /loadBalancers/{loadBalancerId}/listeners/{listenerId} Get listener details
PubliccloudAPI GetLoadBalancerListenerList Get /loadBalancers/{loadBalancerId}/listeners Get listener list
PubliccloudAPI GetMarketAppList Get /marketApps Get marketplace apps
PubliccloudAPI GetRegionList Get /regions List regions
PubliccloudAPI GetReinstallInstanceImageList Get /instances/{instanceId}/reinstall/images List images available for reinstall
PubliccloudAPI GetReinstallVPSImageList Get /vps/{vpsId}/reinstall/images List images available for reinstall
PubliccloudAPI GetRequestsMetrics Get /loadBalancers/{loadBalancerId}/metrics/requests Get load balancer requests metrics
PubliccloudAPI GetRequestsPerSecondMetrics Get /loadBalancers/{loadBalancerId}/metrics/requestsPerSecond Get load balancer requests per second metrics
PubliccloudAPI GetResponseCodesMetrics Get /loadBalancers/{loadBalancerId}/metrics/responseCodes Get response codes metrics
PubliccloudAPI GetResponseCodesPerSecondMetrics Get /loadBalancers/{loadBalancerId}/metrics/responseCodesPerSecond Get response codes per second metrics
PubliccloudAPI GetSnapshot Get /instances/{instanceId}/snapshots/{snapshotId} Get snapshot detail
PubliccloudAPI GetSnapshotList Get /instances/{instanceId}/snapshots List snapshots
PubliccloudAPI GetTargetGroup Get /targetGroups/{targetGroupId} Get Target Group details
PubliccloudAPI GetTargetGroupList Get /targetGroups Get Target Group list
PubliccloudAPI GetTargetList Get /targetGroups/{targetGroupId}/targets Get Targets
PubliccloudAPI GetUpdateInstanceTypeList Get /instances/{instanceId}/instanceTypesUpdate List available instance types for update
PubliccloudAPI GetVPSCredential Get /vps/{vpsId}/credentials/{type}/{username} Get VPS credential by type and username.
PubliccloudAPI GetVPSCredentialList Get /vps/{vpsId}/credentials List credentials stored for a specific VPS
PubliccloudAPI GetVPSCredentialListByType Get /vps/{vpsId}/credentials/{type} Get credentials by type for a specific VPS
PubliccloudAPI GetVPSDataTrafficMetrics Get /vps/{vpsId}/metrics/datatraffic Get data traffic metrics for a specific VPS
PubliccloudAPI GetVPSIP Get /vps/{vpsId}/ips/{ip} Get IP details for a specific VPS
PubliccloudAPI GetVPSIPList Get /vps/{vpsId}/ips List IP addresses associated with a specific VPS
PubliccloudAPI GetVps Get /vps/{vpsId} Get VPS details
PubliccloudAPI GetVpsList Get /vps Get VPS list
PubliccloudAPI LaunchInstance Post /instances Launch instance
PubliccloudAPI LaunchLoadBalancer Post /loadBalancers Launch Load balancer
PubliccloudAPI NullRouteInstanceIP Post /instances/{instanceId}/ips/{ip}/null Null route IP address for a specific resource Instance
PubliccloudAPI NullRouteLoadBalancerIP Post /loadBalancers/{loadBalancerId}/ips/{ip}/null Null route IP address for a specific resource Load Balancer
PubliccloudAPI NullRouteVPSIP Post /vps/{vpsId}/ips/{ip}/null Null route IP address for a specific resource VPS
PubliccloudAPI RebootInstance Post /instances/{instanceId}/reboot Reboot a specific Instance
PubliccloudAPI RebootLoadBalancer Post /loadBalancers/{loadBalancerId}/reboot Reboot a specific Load Balancer
PubliccloudAPI RebootVPS Post /vps/{vpsId}/reboot Reboot a specific VPS
PubliccloudAPI RegisterAutoScalingGroupTargetGroup Post /autoScalingGroups/{autoScalingGroupId}/registerTargetGroup Register Target Group
PubliccloudAPI RegisterTargets Post /targetGroups/{targetGroupId}/registerTargets Register Targets
PubliccloudAPI ReinstallInstance Put /instances/{instanceId}/reinstall Reinstall an Instance
PubliccloudAPI ReinstallVPS Put /vps/{vpsId}/reinstall Reinstall a VPS
PubliccloudAPI RemoveFromPrivateNetwork Delete /instances/{instanceId}/removeFromPrivateNetwork Remove instance from Private Network
PubliccloudAPI RemoveInstanceIPNullRoute Post /instances/{instanceId}/ips/{ip}/unnull Remove an IP null route for a specific Instance
PubliccloudAPI RemoveLoadBalancerIPNullRoute Post /loadBalancers/{loadBalancerId}/ips/{ip}/unnull Remove an IP null route for a specific Load Balancer
PubliccloudAPI RemoveVPSIPNullRoute Post /vps/{vpsId}/ips/{ip}/unnull Remove an IP null route for a specific VPS
PubliccloudAPI ResetInstancePassword Post /instances/{instanceId}/resetPassword Reset the password for a specific Instance
PubliccloudAPI ResetVPSPassword Post /vps/{vpsId}/resetPassword Reset the password for a specific VPS
PubliccloudAPI RestoreSnapshot Put /instances/{instanceId}/snapshots/{snapshotId} Restore instance snapshot
PubliccloudAPI StartInstance Post /instances/{instanceId}/start Start a specific resource Instance
PubliccloudAPI StartLoadBalancer Post /loadBalancers/{loadBalancerId}/start Start a specific resource Load Balancer
PubliccloudAPI StartVPS Post /vps/{vpsId}/start Start a specific resource VPS
PubliccloudAPI StopInstance Post /instances/{instanceId}/stop Stop a specific Instance
PubliccloudAPI StopLoadBalancer Post /loadBalancers/{loadBalancerId}/stop Stop a specific Load Balancer
PubliccloudAPI StopVPS Post /vps/{vpsId}/stop Stop a specific VPS
PubliccloudAPI StoreInstanceCredential Post /instances/{instanceId}/credentials Store credentials for a specific Instance
PubliccloudAPI StoreVPSCredential Post /vps/{vpsId}/credentials Store credentials for a specific VPS
PubliccloudAPI TerminateInstance Delete /instances/{instanceId} Terminate instance
PubliccloudAPI TerminateLoadBalancer Delete /loadBalancers/{loadBalancerId} Delete load balancer
PubliccloudAPI UpdateAutoScalingGroup Put /autoScalingGroups/{autoScalingGroupId} Update Auto Scaling Group
PubliccloudAPI UpdateImage Put /images/{imageId} Update Custom Image
PubliccloudAPI UpdateInstance Put /instances/{instanceId} Update instance
PubliccloudAPI UpdateInstanceCredential Put /instances/{instanceId}/credentials/{type}/{username} Update credentials for a given type and username
PubliccloudAPI UpdateInstanceIP Put /instances/{instanceId}/ips/{ip} Update the IP address for a specific Instance
PubliccloudAPI UpdateLoadBalancer Put /loadBalancers/{loadBalancerId} Update load balancer
PubliccloudAPI UpdateLoadBalancerIP Put /loadBalancers/{loadBalancerId}/ips/{ip} Update the IP address for a specific Load Balancer
PubliccloudAPI UpdateLoadBalancerListener Put /loadBalancers/{loadBalancerId}/listeners/{listenerId} Update a listener
PubliccloudAPI UpdateTargetGroup Put /targetGroups/{targetGroupId} Update Target Group
PubliccloudAPI UpdateVPSIP Put /vps/{vpsId}/ips/{ip} Update the IP address for a specific VPS
PubliccloudAPI UpdateVpsCredential Put /vps/{vpsId}/credentials/{type}/{username} Update credentials for a given type and username

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

BearerAuth

  • Type: HTTP Bearer token authentication

Example

auth := context.WithValue(context.Background(), publiccloud.ContextAccessToken, "BEARER_TOKEN_STRING")
r, err := client.Service.Operation(auth, args)

X-LSW-Auth

  • Type: API key
  • API key parameter name: X-LSW-Auth
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: X-LSW-Auth and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		publiccloud.ContextAPIKeys,
		map[string]publiccloud.APIKey{
			"X-LSW-Auth": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author