oneandone

package module
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2018 License: Apache-2.0 Imports: 12 Imported by: 76

README

1&1 Cloudserver Go SDK

The 1&1 Go SDK is a Go library designed for interaction with the 1&1 cloud platform over the REST API.

This guide contains instructions on getting started with the library and automating various management tasks available through the 1&1 Cloud Panel UI. For more information on the 1&1 Cloudserver Go SDK see the 1&1 Community Portal.

Table of Contents

Overview

This SDK is a wrapper for the 1&1 REST API written in Go(lang). All operations against the API are performed over SSL and authenticated using your 1&1 token key. The Go library facilitates the access to the REST API either within an instance running on 1&1 platform or directly across the Internet from any HTTPS-enabled application.

For more information on the 1&1 Cloud Server SDK for Go, visit the Community Portal.

Getting Started

Before you begin you will need to have signed up for a 1&1 account. The credentials you create during sign-up will be used to authenticate against the API.

Install the Go language tools. Find the install package and instructions on the official Go website. Make sure that you have set up the GOPATH environment variable properly, as indicated in the instructions.

Installation

The official Go library is available from the 1&1 GitHub account found here.

Use the following Go command to download oneandone-cloudserver-sdk-go to your configured GOPATH:

go get github.com/1and1/oneandone-cloudserver-sdk-go

Import the library in your Go code:

import "github.com/1and1/oneandone-cloudserver-sdk-go"

Authentication

Set the authentication token and create the API client:

token := oneandone.SetToken("82ee732b8d47e451be5c6ad5b7b56c81")
api := oneandone.New(token, oneandone.BaseUrl)

Refer to the Examples and Operations sections for additional information.

Operations

Servers

List all servers:

servers, err := api.ListServers()

Alternatively, use the method with query parameters.

servers, err := api.ListServers(page, per_page, sort, query, fields)

To paginate the list of servers received in the response use page and per_page parameters. Set per_page to the number of servers that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of servers sorted in expected order pass a server property (e.g. "name") in sort parameter.

Use query parameter to search for a string in the response and return only the server instances that contain it.

To retrieve a collection of servers containing only the requested fields pass a list of comma separated properties (e.g. "id,name,description,hardware.ram") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single server:

server, err := api.GetServer(server_id)

List fixed-size server templates:

fiss, err := api.ListFixedInstanceSizes()

Retrieve information about a fixed-size server template:

fis, err := api.GetFixedInstanceSize(fis_id)

List bare metal models:

res, err := api.ListBaremetalModels()

Retrieve information about a bare metal model:

bmm, err := api.GetBaremetalModel(baremetalModelId)

Retrieve information about a server's hardware:

hardware, err := api.GetServerHardware(server_id)

List a server's HDDs:

hdds, err := api.ListServerHdds(server_id)

Retrieve a single server HDD:

hdd, err := api.GetServerHdd(server_id, hdd_id)

Retrieve information about a server's image:

image, err := api.GetServerImage(server_id)

List a server's IPs:

ips, err := api.ListServerIps(server_id)

Retrieve information about a single server IP:

ip, err := api.GetServerIp(server_id, ip_id)

Retrieve information about a server's firewall policy:

firewall, err := api.GetServerIpFirewallPolicy(server_id, ip_id)

List all load balancers assigned to a server IP:

lbs, err := api.ListServerIpLoadBalancers(server_id, ip_id)

Retrieve information about a server's status:

status, err := api.GetServerStatus(server_id)

Retrieve information about the DVD loaded into the virtual DVD unit of a server:

dvd, err := api.GetServerDvd(server_id)

List a server's private networks:

pns, err := api.ListServerPrivateNetworks(server_id)

Retrieve information about a server's private network:

pn, err := api.GetServerPrivateNetwork(server_id, pn_id)

Retrieve information about a server's snapshot:

snapshot, err := api.GetServerSnapshot(server_id)

Create a cloud server:

req := oneandone.ServerRequest {
    Name:        "Server Name",
    Description: "Server description.",
    ApplianceId: server_appliance_id,
    PowerOn:     true,
    ServerType:  "cloud",
    Hardware:    oneandone.Hardware {
      Vcores:            1,
      CoresPerProcessor: 1,
      Ram:               2,
      Hdds: []oneandone.Hdd {
        oneandone.Hdd {
            Size:   100,
            IsMain: true,
        },
      },
    },
  }

server_id, server, err := api.CreateServer(&req)

Create a bare metal server:

req := oneandone.ServerRequest {
    Name:        "Server Name",
    Description: "Server description.",
    ApplianceId: server_appliance_id,
    PowerOn:     true,
    ServerType:  "baremetal",
    Hardware:    oneandone.Hardware {
      BaremetalModelId: "baremetal_model_id"
      },
    },
  }

server_id, server, err := api.CreateServer(&req)

Create a fixed-size server and return back the server's IP address and first password:

req := oneandone.ServerRequest {
    Name:        server_name,
    ApplianceId: server_appliance_id,
    PowerOn:     true_or_false,
    Hardware:    oneandone.Hardware {
          FixedInsSizeId: fixed_instance_size_id,
      },
  }

ip_address, password, err := api.CreateServerEx(&req, timeout)

Update a server:

server, err := api.RenameServer(server_id, new_name, new_desc)

Delete a server:

server, err := api.DeleteServer(server_id, keep_ips)

Set keep_ips parameter to true for keeping server IPs after deleting a server.

Update a server's hardware:

hardware := oneandone.Hardware {
		Vcores: 2,
		CoresPerProcessor: 1,
		Ram: 2,
	}

server, err := api.UpdateServerHardware(server_id, &hardware)

Add new hard disk(s) to a server:

hdds := oneandone.ServerHdds {
    Hdds: []oneandone.Hdd {
        {
          Size: 50,
          IsMain: false,
      },
    },
  }

server, err := api.AddServerHdds(server_id, &hdds)

Resize a server's hard disk:

server, err := api.ResizeServerHdd(server_id, hdd_id, new_size)

Remove a server's hard disk:

server, err := api.DeleteServerHdd(server_id, hdd_id)

Load a DVD into the virtual DVD unit of a server:

server, err := api.LoadServerDvd(server_id, dvd_id)

Unload a DVD from the virtual DVD unit of a server:

server, err := api.EjectServerDvd(server_id)

Reinstall a new image into a server:

server, err := api.ReinstallServerImage(server_id, image_id, password, fp_id)

Assign a new IP to a server:

server, err := api.AssignServerIp(server_id, ip_type)

Release an IP and optionally remove it from a server:

server, err := api.DeleteServerIp(server_id, ip_id, keep_ip)

Set keep_ip to true for releasing the IP without removing it.

Assign a new firewall policy to a server's IP:

server, err := api.AssignServerIpFirewallPolicy(server_id, ip_id, fp_id)

Remove a firewall policy from a server's IP:

server, err := api.UnassignServerIpFirewallPolicy(server_id, ip_id)

Assign a new load balancer to a server's IP:

server, err := api.AssignServerIpLoadBalancer(server_id, ip_id, lb_id)

Remove a load balancer from a server's IP:

server, err := api.UnassignServerIpLoadBalancer(server_id, ip_id, lb_id)

Start a server:

server, err := api.StartServer(server_id)

Reboot a server:

server, err := api.RebootServer(server_id, is_hardware)

Set is_hardware to true for HARDWARE method of rebooting.

Set is_hardware to false for SOFTWARE method of rebooting.

Recovery Reboot a server:

server, err := api.RecoveryRebootServer(server_id, is_hardware, recovery_image_id)

Set is_hardware to true for HARDWARE method of rebooting.

Set is_hardware to false for SOFTWARE method of rebooting.

Shutdown a server:

server, err := api.ShutdownServer(server_id, is_hardware)

Set is_hardware to true for HARDWARE method of powering off.

Set is_hardware to false for SOFTWARE method of powering off.

Assign a private network to a server:

server, err := api.AssignServerPrivateNetwork(server_id, pn_id)

Remove a server's private network:

server, err := api.RemoveServerPrivateNetwork(server_id, pn_id)

Create a new server's snapshot:

server, err := api.CreateServerSnapshot(server_id)

Restore a server's snapshot:

server, err := api.RestoreServerSnapshot(server_id, snapshot_id)

Remove a server's snapshot:

server, err := api.DeleteServerSnapshot(server_id, snapshot_id);

Clone a server:

server, err := api.CloneServer(server_id, new_name)

Images

List all images:

images, err = api.ListImages()

Alternatively, use the method with query parameters.

images, err = api.ListImages(page, per_page, sort, query, fields)

To paginate the list of images received in the response use page and per_page parameters. set per_page to the number of images that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of images sorted in expected order pass an image property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the elements that contain it.

To retrieve a collection of images containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single image:

image, err = api.GetImage(image_id)

Create an image:

request := oneandone.ImageRequest {
    Name: image_name,
    Description: image_description,
    Source: 'server',
    ServerId: server_id, 
    Frequency: image_frequenct,
    NumImages: number_of_images,
    DatacenterId: datacenter_id,
  }

image_id, image, err = api.CreateImage(&request)

Description, Source and DatacenterId are optional fields when creating a server image. Frequency may be set to "ONCE", "DAILY" or "WEEKLY".

Use the same method to import an existing ISO image.

request := oneandone.ImageRequest {
    Name: image_name,
    Description: image_description,
    Source: 'iso',
    Url: image_url,
    Type: image_type,
    OsId: os_id,
    DatacenterId: datacenter_id,
  }

Type should be set to os or app. OsId is required if the image type is os.

To import a vdi, qcow, qcow2, vhd, vhdx or vmdk image, instantiate the image request as follows:

request := oneandone.ImageRequest {
    Name: image_name,
    Description: image_description,
    Source: 'image',
    Url: image_url,
    OsId: os_id,
    DatacenterId: datacenter_id,
  }

List image OSes:

imageOSes, err = api.ListImageOs()

Update an image:

image, err = api.UpdateImage(image_id, new_name, new_description, new_frequenct)

If any of the parameters new_name, new_description or new_frequenct is set to an empty string, it is ignored in the request. Frequency may be set to "ONCE", "DAILY" or "WEEKLY".

Delete an image:

image, err = api.DeleteImage(image_id)

Shared Storages

ss, err := api.ListSharedStorages()

Alternatively, use the method with query parameters.

ss, err := api.ListSharedStorages(page, per_page, sort, query, fields)

To paginate the list of shared storages received in the response use page and per_page parameters. Set per_page to the number of volumes that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of shared storages sorted in expected order pass a volume property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the volume instances that contain it.

To retrieve a collection of shared storages containing only the requested fields pass a list of comma separated properties (e.g. "id,name,size,size_used") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a shared storage:

ss, err := api.GetSharedStorage(ss_id)

Create a shared storage:

request := oneandone.SharedStorageRequest {
    Name: test_ss_name, 
    Description: test_ss_desc,
    Size: oneandone.Int2Pointer(size),
  }
  
ss_id, ss, err := api.CreateSharedStorage(&request)

Description is optional parameter.

Update a shared storage:

request := oneandone.SharedStorageRequest {
    Name: new_name, 
    Description: new_desc,
    Size: oneandone.Int2Pointer(new_size),
  }
  
ss, err := api.UpdateSharedStorage(ss_id, &request)

All request's parameters are optional.

Remove a shared storage:

ss, err := api.DeleteSharedStorage(ss_id)

List a shared storage servers:

ss_servers, err := api.ListSharedStorageServers(ss_id)

Retrieve a shared storage server:

ss_server, err := api.GetSharedStorageServer(ss_id, server_id)

Add servers to a shared storage:

servers := []oneandone.SharedStorageServer {
    {
      Id: server_id,
      Rights: permissions,
    } ,
  }
  
ss, err := api.AddSharedStorageServers(ss_id, servers)

Rights may be set to R or RW string.

Remove a server from a shared storage:

ss, err := api.DeleteSharedStorageServer(ss_id, server_id)

Retrieve the credentials for accessing the shared storages:

ss_credentials, err := api.GetSharedStorageCredentials()

Change the password for accessing the shared storages:

ss_credentials, err := api.UpdateSharedStorageCredentials(new_password)

Firewall Policies

List firewall policies:

firewalls, err := api.ListFirewallPolicies()

Alternatively, use the method with query parameters.

firewalls, err := api.ListFirewallPolicies(page, per_page, sort, query, fields)

To paginate the list of firewall policies received in the response use page and per_page parameters. Set per_page to the number of firewall policies that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of firewall policies sorted in expected order pass a firewall policy property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the firewall policy instances that contain it.

To retrieve a collection of firewall policies containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single firewall policy:

firewall, err := api.GetFirewallPolicy(fp_id)

Create a firewall policy:

request := oneandone.FirewallPolicyRequest {
    Name: fp_name, 
    Description: fp_desc,
    Rules: []oneandone.FirewallPolicyRule {
      {
        Protocol: protocol,
        Port: "80",
		Action: "allow",        
        SourceIp: source_ip,
      },
    },
  }
  
firewall_id, firewall, err := api.CreateFirewallPolicy(&request)

SourceIp and Description are optional parameters.

Update a firewall policy:

firewall, err := api.UpdateFirewallPolicy(fp_id, fp_new_name, fp_new_description)

Passing an empty string in fp_new_name or fp_new_description skips updating the firewall policy name or description respectively.

Delete a firewall policy:

firewall, err := api.DeleteFirewallPolicy(fp_id)

List servers/IPs attached to a firewall policy:

server_ips, err := api.ListFirewallPolicyServerIps(fp_id)

Retrieve information about a server/IP assigned to a firewall policy:

server_ip, err := api.GetFirewallPolicyServerIp(fp_id, ip_id)

Add servers/IPs to a firewall policy:

firewall, err := api.AddFirewallPolicyServerIps(fp_id, ip_ids)

ip_ids is a slice of IP ID's.

Remove a server/IP from a firewall policy:

firewall, err := api.DeleteFirewallPolicyServerIp(fp_id, ip_id)

List rules of a firewall policy:

fp_rules, err := api.ListFirewallPolicyRules(fp_id)

Retrieve information about a rule of a firewall policy:

fp_rule, err := api.GetFirewallPolicyRule(fp_id, rule_id)

Adds new rules to a firewall policy:

fp_rules := []oneandone.FirewallPolicyRule {
    {
      Protocol: protocol1,
      Port: "80",      
      SourceIp: source_ip,
    },
    {
      Protocol: protocol2,
      Port: "4000-5000",
	  Action: "allow",
    },
  }

firewall, err := api.AddFirewallPolicyRules(fp_id, fp_rules)

Remove a rule from a firewall policy:

firewall, err := api.DeleteFirewallPolicyRule(fp_id, rule_id)

Load Balancers

List load balancers:

loadbalancers, err := api.ListLoadBalancers()

Alternatively, use the method with query parameters.

loadbalancers, err := api.ListLoadBalancers(page, per_page, sort, query, fields)

To paginate the list of load balancers received in the response use page and per_page parameters. Set per_page to the number of load balancers that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of load balancers sorted in expected order pass a load balancer property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the load balancer instances that contain it.

To retrieve a collection of load balancers containing only the requested fields pass a list of comma separated properties (e.g. "ip,name,method") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single load balancer:

loadbalancer, err := api.GetLoadBalancer(lb_id)

Create a load balancer:

request := oneandone.LoadBalancerRequest {
    Name: lb_name, 
    Description: lb_description,
    Method: lb_method,
    Persistence: oneandone.Bool2Pointer(true_or_false),
    PersistenceTime: oneandone.Int2Pointer(seconds1),
    HealthCheckTest: protocol1,
    HealthCheckInterval: oneandone.Int2Pointer(seconds2),
    HealthCheckPath: health_check_path,
    HealthCheckPathParser: health_check_path_parser,
    Rules: []oneandone.LoadBalancerRule {
        {
          Protocol: protocol1,
          PortBalancer: lb_port,
          PortServer: server_port,
          Source: source_ip,
        },
    },
  }
  
loadbalancer_id, loadbalancer, err := api.CreateLoadBalancer(&request)

Optional parameters are HealthCheckPath, HealthCheckPathParser, Source and Description. Load balancer Method must be set to "ROUND_ROBIN" or "LEAST_CONNECTIONS".

Update a load balancer:

request := oneandone.LoadBalancerRequest {
    Name: new_name,
    Description: new_description,
    Persistence: oneandone.Bool2Pointer(true_or_false),
    PersistenceTime: oneandone.Int2Pointer(new_seconds1),
    HealthCheckTest: new_protocol,
    HealthCheckInterval: oneandone.Int2Pointer(new_seconds2),
    HealthCheckPath: new_path,
    HealthCheckPathParser: new_parser,
    Method: new_lb_method,
  }
  
loadbalancer, err := api.UpdateLoadBalancer(lb_id, &request)

All updatable fields are optional.

Delete a load balancer:

loadbalancer, err := api.DeleteLoadBalancer(lb_id)

List servers/IPs attached to a load balancer:

server_ips, err := api.ListLoadBalancerServerIps(lb_id)

Retrieve information about a server/IP assigned to a load balancer:

server_ip, err := api.GetLoadBalancerServerIp(lb_id, ip_id)

Add servers/IPs to a load balancer:

loadbalancer, err := api.AddLoadBalancerServerIps(lb_id, ip_ids)

ip_ids is a slice of IP ID's.

Remove a server/IP from a load balancer:

loadbalancer, err := api.DeleteLoadBalancerServerIp(lb_id, ip_id)

List rules of a load balancer:

lb_rules, err := api.ListLoadBalancerRules(lb_id)

Retrieve information about a rule of a load balancer:

lb_rule, err := api.GetLoadBalancerRule(lb_id, rule_id)

Adds new rules to a load balancer:

lb_rules := []oneandone.LoadBalancerRule {
    {
      Protocol: protocol1,
      PortBalancer: lb_port1,
      PortServer: server_port1,
      Source: source_ip,
    },
    {
      Protocol: protocol2,
      PortBalancer: lb_port2,
      PortServer: server_port2,
    },
  }

loadbalancer, err := api.AddLoadBalancerRules(lb_id, lb_rules)

Remove a rule from a load balancer:

loadbalancer, err := api.DeleteLoadBalancerRule(lb_id, rule_id)

Public IPs

Retrieve a list of your public IPs:

public_ips, err := api.ListPublicIps()

Alternatively, use the method with query parameters.

public_ips, err := api.ListPublicIps(page, per_page, sort, query, fields)

To paginate the list of public IPs received in the response use page and per_page parameters. Set per_page to the number of public IPs that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of public IPs sorted in expected order pass a public IP property (e.g. "ip") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the public IP instances that contain it.

To retrieve a collection of public IPs containing only the requested fields pass a list of comma separated properties (e.g. "id,ip,reverse_dns") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single public IP:

public_ip, err := api.GetPublicIp(ip_id)

Create a public IP:

ip_id, public_ip, err := api.CreatePublicIp(ip_type, reverse_dns)

Both parameters are optional and may be left blank. ip_type may be set to "IPV4" or "IPV6". Presently, only IPV4 is supported.

Update the reverse DNS of a public IP:

public_ip, err := api.UpdatePublicIp(ip_id, reverse_dns)

If an empty string is passed in reverse_dns, it removes previous reverse dns of the public IP.

Remove a public IP:

public_ip, err := api.DeletePublicIp(ip_id)

Private Networks

List all private networks:

private_nets, err := api.ListPrivateNetworks()

Alternatively, use the method with query parameters.

private_nets, err := api.ListPrivateNetworks(page, per_page, sort, query, fields)

To paginate the list of private networks received in the response use page and per_page parameters. Set per_page to the number of private networks that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of private networks sorted in expected order pass a private network property (e.g. "-creation_date") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the private network instances that contain it.

To retrieve a collection of private networks containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is blank, it is ignored in the request.

Retrieve information about a private network:

private_net, err := api.GetPrivateNetwork(pn_id)

Create a new private network:

request := oneandone.PrivateNetworkRequest {
    Name: pn_name, 
    Description: pn_description,
    NetworkAddress: network_address,
    SubnetMask: subnet_mask,
  }

pnet_id, private_net, err := api.CreatePrivateNetwork(&request)

Private network Name is required parameter.

Modify a private network:

request := oneandone.PrivateNetworkRequest {
    Name: new_pn_name, 
    Description: new_pn_description,
    NetworkAddress: new_network_address,
    SubnetMask: new_subnet_mask,
  }

private_net, err := api.UpdatePrivateNetwork(pn_id, &request)

All parameters in the request are optional.

Delete a private network:

private_net, err := api.DeletePrivateNetwork(pn_id)

List all servers attached to a private network:

servers, err = := api.ListPrivateNetworkServers(pn_id)

Retrieve a server attached to a private network:

server, err = := api.GetPrivateNetworkServer(pn_id, server_id)

Attach servers to a private network:

private_net, err := api.AttachPrivateNetworkServers(pn_id, server_ids)

server_ids is a slice of server ID's.

Note: Servers cannot be attached to a private network if they currently have a snapshot.

Remove a server from a private network:

private_net, err := api.DetachPrivateNetworkServer(pn_id, server_id)

Note: The server cannot be removed from a private network if it currently has a snapshot or it is powered on.

VPNs

List all VPNs:

vpns, err := api.ListVPNs()

Alternatively, use the method with query parameters.

vpns, err := api.ListVPNs(page, per_page, sort, query, fields)

To paginate the list of VPNs received in the response use page and per_page parameters. Set per_page to the number of VPNs that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of VPNs sorted in expected order pass a VPN property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the VPN instances that contain it.

To retrieve a collection of VPNs containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve information about a VPN:

vpn, err := api.GetVPN(vpn_id)

Create a VPN:

vpn, err := api.CreateVPN(vpn_name, vpn_description, datacenter_id)

Modify a VPN:

vpn, err := api.ModifyVPN(vpn_id, new_name, new_description)

Delete a VPN:

vpn, err := api.DeleteVPN(vpn_id)

Retrieve a VPN's configuration file:

base64_encoded_string, err := api.GetVPNConfigFile(vpn_id)

Monitoring Center

List all usages and alerts of monitoring servers:

server_usages, err := api.ListMonitoringServersUsages()

Alternatively, use the method with query parameters.

server_usages, err := api.ListMonitoringServersUsages(page, per_page, sort, query, fields)

To paginate the list of server usages received in the response use page and per_page parameters. Set per_page to the number of server usages that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of server usages sorted in expected order pass a server usage property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the usage instances that contain it.

To retrieve a collection of server usages containing only the requested fields pass a list of comma separated properties (e.g. "id,name,status.state") in fields parameter.

If any of the parameters sort, query or fields is blank, it is ignored in the request.

Retrieve the usages and alerts for a monitoring server:

server_usage, err := api.GetMonitoringServerUsage(server_id, period)

period may be set to "LAST_HOUR", "LAST_24H", "LAST_7D", "LAST_30D", "LAST_365D" or "CUSTOM". If period is set to "CUSTOM", the start_date and end_date parameters are required to be set in RFC 3339 date/time format (e.g. 2015-13-12T00:01:00Z).

server_usage, err := api.GetMonitoringServerUsage(server_id, period, start_date, end_date)

Monitoring Policies

List all monitoring policies:

mon_policies, err := api.ListMonitoringPolicies()

Alternatively, use the method with query parameters.

mon_policies, err := api.ListMonitoringPolicies(page, per_page, sort, query, fields)

To paginate the list of monitoring policies received in the response use page and per_page parameters. Set per_page to the number of monitoring policies that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of monitoring policies sorted in expected order pass a monitoring policy property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the monitoring policy instances that contain it.

To retrieve a collection of monitoring policies containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single monitoring policy:

mon_policy, err := api.GetMonitoringPolicy(mp_id)

Create a monitoring policy:

request := oneandone.MonitoringPolicy {
    Name:  mp_name,
    Description: mp_desc,
    Email: mp_mail,
    Agent: true_or_false,
    Thresholds: &oneandone.MonitoringThreshold {
      Cpu: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
      },
      Ram: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
      },
      Disk: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
      },
      Transfer: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue  {
          Value: threshold_value,
          Alert: true_or_false,
        },
      },
      InternalPing: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: threshold_value,
          Alert: true_or_false,
        },
      },
    },
    Ports: []oneandone.MonitoringPort {
      {
        Protocol: protocol,
        Port: port,
        AlertIf: responding_or_not_responding,
        EmailNotification: true_or_false,
      },
    },
    Processes: []oneandone.MonitoringProcess {
      {
        Process: process_name,
        AlertIf: running_or_not_running,
        EmailNotification: true_or_false,
      },
    },
  }
  
mpolicy_id, mon_policy, err := api.CreateMonitoringPolicy(&request)

All fields, except Description, are required. AlertIf property accepts values "RESPONDING"/"NOT_RESPONDING" for ports, and "RUNNING"/"NOT_RUNNING" for processes.

Update a monitoring policy:

request := oneandone.MonitoringPolicy {
    Name:  new_mp_name,
    Description: new_mp_desc,
    Email: new_mp_mail,
    Thresholds: &oneandone.MonitoringThreshold {
      Cpu: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
      },
      Ram: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
      },
      Disk: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
      },
      Transfer: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue  {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
      },
      InternalPing: &oneandone.MonitoringLevel {
        Warning: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
        Critical: &oneandone.MonitoringValue {
          Value: new_threshold_value,
          Alert: true_or_false,
        },
      },
    },
  }
  
mon_policy, err := api.UpdateMonitoringPolicy(mp_id, &request)

All fields of the request are optional. When a threshold is specified in the request, the threshold fields are required.

Delete a monitoring policy:

mon_policy, err := api.DeleteMonitoringPolicy(mp_id)

List all ports of a monitoring policy:

mp_ports, err := api.ListMonitoringPolicyPorts(mp_id)

Retrieve information about a port of a monitoring policy:

mp_port, err := api.GetMonitoringPolicyPort(mp_id, port_id)

Add new ports to a monitoring policy:

mp_ports := []oneandone.MonitoringPort {
    {
      Protocol: protocol1,
      Port: port1,
      AlertIf: responding_or_not_responding,
      EmailNotification: true_or_false,
    },
    {
      Protocol: protocol2,
      Port: port2,
      AlertIf: responding_or_not_responding,
      EmailNotification: true_or_false,
    },
  }

mon_policy, err := api.AddMonitoringPolicyPorts(mp_id, mp_ports)

Port properties are mandatory.

Modify a port of a monitoring policy:

mp_port := oneandone.MonitoringPort {
    Protocol: protocol,
    Port: port,
    AlertIf: responding_or_not_responding,
    EmailNotification: true_or_false,
  }
  
mon_policy, err := api.ModifyMonitoringPolicyPort(mp_id, port_id, &mp_port)

Note: Protocol and Port cannot be changed.

Remove a port from a monitoring policy:

mon_policy, err := api.DeleteMonitoringPolicyPort(mp_id, port_id)

List the processes of a monitoring policy:

mp_processes, err := api.ListMonitoringPolicyProcesses(mp_id)

Retrieve information about a process of a monitoring policy:

mp_process, err := api.GetMonitoringPolicyProcess(mp_id, process_id)

Add new processes to a monitoring policy:

processes := []oneandone.MonitoringProcess {
    {
      Process: process_name1,
      AlertIf: running_or_not_running,
      EmailNotification: true_or_false,
    },
    {
      Process: process_name2,
      AlertIf: running_or_not_running,
      EmailNotification: true_or_false,
    },
  }

mon_policy, err := api.AddMonitoringPolicyProcesses(mp_id, processes)

All properties of the MonitoringProcess instance are required.

Modify a process of a monitoring policy:

process := oneandone.MonitoringProcess {
    Process: process_name,
    AlertIf: running_or_not_running,
    EmailNotification: true_or_false,
  }

mon_policy, err := api.ModifyMonitoringPolicyProcess(mp_id, process_id, &process)

Note: Process name cannot be changed.

Remove a process from a monitoring policy:

mon_policy, err := api.DeleteMonitoringPolicyProcess(mp_id, process_id)

List all servers attached to a monitoring policy:

mp_servers, err := api.ListMonitoringPolicyServers(mp_id)

Retrieve information about a server attached to a monitoring policy:

mp_server, err := api.GetMonitoringPolicyServer(mp_id, server_id)

Attach servers to a monitoring policy:

mon_policy, err := api.AttachMonitoringPolicyServers(mp_id, server_ids)

server_ids is a slice of server ID's.

Remove a server from a monitoring policy:

mon_policy, err := api.RemoveMonitoringPolicyServer(mp_id, server_id)

Logs

List all logs:

logs, err := api.ListLogs(period, nil, nil)

period can be set to "LAST_HOUR", "LAST_24H", "LAST_7D", "LAST_30D", "LAST_365D" or "CUSTOM". If period is set to "CUSTOM", the start_date and end_date parameters are required to be set in RFC 3339 date/time format (e.g. 2015-13-12T00:01:00Z).

logs, err := api.ListLogs(period, start_date, end_date)

Additional query parameters can be used.

logs, err := api.ListLogs(period, start_date, end_date, page, per_page, sort, query, fields)

To paginate the list of logs received in the response use page and per_page parameters. Set per_page to the number of logs that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of logs sorted in expected order pass a logs property (e.g. "action") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the logs instances that contain it.

To retrieve a collection of logs containing only the requested fields pass a list of comma separated properties (e.g. "id,action,type") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a single log:

log, err := api.GetLog(log_id)

Users

List all users:

users, err := api.ListUsers()

Alternatively, use the method with query parameters.

users, err := api.ListUsers(page, per_page, sort, query, fields)

To paginate the list of users received in the response use page and per_page parameters. Set per_page to the number of users that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of users sorted in expected order pass a user property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the user instances that contain it.

To retrieve a collection of users containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date,email") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve information about a user:

user, err := api.GetUser(user_id)

Create a user:

request := oneandone.UserRequest {
    Name: username, 
    Description: user_description,
    Password: password,
    Email: user_email,
  }

user_id, user, err := api.CreateUser(&request)

Name and Password are required parameters. The password must contain at least 8 characters using uppercase letters, numbers and other special symbols.

Modify a user:

request := oneandone.UserRequest {
    Description: new_desc,
    Email: new_mail,
    Password: new_pass,
    State: state,
  }

user, err := api.ModifyUser(user_id, &request)

All listed fields in the request are optional. State can be set to "ACTIVE" or "DISABLED".

Delete a user:

user, err := api.DeleteUser(user_id)

Retrieve information about a user's API privileges:

api_info, err := api.GetUserApi(user_id)

Retrieve a user's API key:

api_key, err := api.GetUserApiKey(user_id)

List IP's from which API access is allowed for a user:

allowed_ips, err := api.ListUserApiAllowedIps(user_id)

Add new IP's to a user:

user_ips := []string{ my_public_ip, "192.168.7.77", "10.81.12.101" }
user, err := api.AddUserApiAlowedIps(user_id, user_ips)

Remove an IP and forbid API access from it:

user, err := api.RemoveUserApiAllowedIp(user_id, ip)

Modify a user's API privileges:

user, err := api.ModifyUserApi(user_id, is_active)

Renew a user's API key:

user, err := api.RenewUserApiKey(user_id)

Retrieve current user permissions:

permissions, err := api.GetCurrentUserPermissions()

Roles

List all roles:

roles, err := api.ListRoles()

Alternatively, use the method with query parameters.

roles, err := api.ListRoles(page, per_page, sort, query, fields)

To paginate the list of roles received in the response use page and per_page parameters. Set per_page to the number of roles that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of roles sorted in expected order pass a role property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the role instances that contain it.

To retrieve a collection of roles containing only the requested fields pass a list of comma separated properties (e.g. "id,name,creation_date") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve information about a role:

role, err := api.GetRole(role_id)

Create a role:

role, err := api.CreateRole(role_name)

Clone a role:

role, err := api.CloneRole(role_id, new_role_name)

Modify a role:

role, err := api.ModifyRole(role_id, new_name, new_description, new_state)

ACTIVE and DISABLE are valid values for the state.

Delete a role:

role, err := api.DeleteRole(role_id)

Retrieve information about a role's permissions:

permissions, err := api.GetRolePermissions(role_id)

Modify a role's permissions:

role, err := api.ModifyRolePermissions(role_id, permissions)

Assign users to a role:

role, err := api.AssignRoleUsers(role_id, user_ids)

user_ids is a slice of user ID's.

List a role's users:

users, err := api.ListRoleUsers(role_id)

Retrieve information about a role's user:

user, err := api.GetRoleUser(role_id, user_id)

Remove a role's user:

role, err := api.RemoveRoleUser(role_id, user_id)

Usages

List your usages:

usages, err := api.ListUsages(period, nil, nil)

period can be set to "LAST_HOUR", "LAST_24H", "LAST_7D", "LAST_30D", "LAST_365D" or "CUSTOM". If period is set to "CUSTOM", the start_date and end_date parameters are required to be set in RFC 3339 date/time format (e.g. 2015-13-12T00:01:00Z).

usages, err := api.ListUsages(period, start_date, end_date)

Additional query parameters can be used.

usages, err := api.ListUsages(period, start_date, end_date, page, per_page, sort, query, fields)

To paginate the list of usages received in the response use page and per_page parameters. Set per_page to the number of usages that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of usages sorted in expected order pass a usages property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the usages instances that contain it.

To retrieve a collection of usages containing only the requested fields pass a list of comma separated properties (e.g. "id,name") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Server Appliances

List all the appliances that you can use to create a server:

server_appliances, err := api.ListServerAppliances()

Alternatively, use the method with query parameters.

server_appliances, err := api.ListServerAppliances(page, per_page, sort, query, fields)

To paginate the list of server appliances received in the response use page and per_page parameters. Set per_page to the number of server appliances that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of server appliances sorted in expected order pass a server appliance property (e.g. "os") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the server appliance instances that contain it.

To retrieve a collection of server appliances containing only the requested fields pass a list of comma separated properties (e.g. "id,os,architecture") in fields parameter.

If any of the parameters sort, query or fields is blank, it is ignored in the request.

Retrieve information about specific appliance:

server_appliance, err := api.GetServerAppliance(appliance_id)

Recovery Images

List all the recovery images that you can use to recovery reboot into:

res, err := api.ListRecoveryAppliances()

Alternatively, use the method with query parameters.

res, err := api.ListRecoveryAppliances(page, per_page, sort, query, fields)

To paginate the list of server appliances received in the response use page and per_page parameters. Set per_page to the number of server appliances that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of server appliances sorted in expected order pass a server appliance property (e.g. "os") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the server appliance instances that contain it.

To retrieve a collection of server appliances containing only the requested fields pass a list of comma separated properties (e.g. "id,os,architecture") in fields parameter.

If any of the parameters sort, query or fields is blank, it is ignored in the request.

Retrieve information about specific recovery image:

ra, err := api.GetRecoveryAppliance(image_id)

DVD ISO

List all operative systems and tools that you can load into your virtual DVD unit:

dvd_isos, err := api.ListDvdIsos()

Alternatively, use the method with query parameters.

dvd_isos, err := api.ListDvdIsos(page, per_page, sort, query, fields)

To paginate the list of ISO DVDs received in the response use page and per_page parameters. Set per_page to the number of ISO DVDs that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of ISO DVDs sorted in expected order pass a ISO DVD property (e.g. "type") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the ISO DVD instances that contain it.

To retrieve a collection of ISO DVDs containing only the requested fields pass a list of comma separated properties (e.g. "id,name,type") in fields parameter.

If any of the parameters sort, query or fields is blank, it is ignored in the request.

Retrieve a specific ISO image:

dvd_iso, err := api.GetDvdIso(dvd_id)

Ping

Check if 1&1 REST API is running:

response, err := api.Ping()

If the API is running, the response is a single-element slice ["PONG"].

Validate if 1&1 REST API is running and the authorization token is valid:

response, err := api.PingAuth()

The response should be a single-element slice ["PONG"] if the API is running and the token is valid.

Pricing

Show prices for all available resources in the Cloud Panel:

pricing, err := api.GetPricing()

Data Centers

List all 1&1 Cloud Server data centers:

datacenters, err := api.ListDatacenters()

Here is another example of an alternative form of the list function that includes query parameters.

datacenters, err := api.ListDatacenters(0, 0, "country_code", "DE", "id,country_code")

Retrieve a specific data center:

datacenter, err := api.GetDatacenter(datacenter_id)

Block Storages

List block storages:

blcs, err := api.ListBlockStorages()

Alternatively, use the method with query parameters.

blcs, err := api.ListBlockStorages(page, per_page, sort, query, fields)

To paginate the list of block storages received in the response use page and per_page parameters. Set per_page to the number of block storages that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of block storages sorted in expected order pass a volume property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the volume instances that contain it.

To retrieve a collection of block storages containing only the requested fields pass a list of comma separated properties (e.g. "id,name,size") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve a block storage:

blcs, err := api.GetBlockStorage(blcs_id)

Create a block storage:

request := oneandone.BlockStorageRequest {
    Name: test_blcs_name, 
    Description: test_blcs_desc,
    Size: oneandone.Int2Pointer(size),
    DatacenterId: datacenter_id,
    ServerId: server_id
  }
  
blcs_id, blcs, err := api.CreateBlockStorage(&request)

Description and ServerIdare optional parameters.

Update a block storage:

request := oneandone.UpdateBlockStorageRequest {
    Name: new_name, 
    Description: new_desc,
  }
  
blcs, err := api.UpdateBlockStorage(blcs_id, &request)

All request's parameters are optional.

Remove a block storage storage:

blcs, err := api.DeleteBlockStorage(blcs_id)

Add a server to a block storage:

blcs, err := api.AddBlockStorageServer(blcs_id, server_id)

Retrieve a block storage server:

blcs_server, err := api.GetBlockStorageServer(blcs_id)

Remove a server from a block storage:

blcs, err := api.RemoveBlockStorageServer(blcs_id, server_id)

SSH Keys

List ssh keys:

sk, err := api.ListSSHKeys()

Alternatively, use the method with query parameters.

sk, err := api.ListSSHKeys(page, per_page, sort, query, fields)

To paginate the list of ssh keys received in the response use page and per_page parameters. Set per_page to the number of ssh keys that will be shown in each page. page indicates the current page. When set to an integer value that is less or equal to zero, the parameters are ignored by the framework.

To receive the list of ssh keys sorted in expected order pass a volume property (e.g. "name") in sort parameter. Prefix the sorting attribute with - sign for sorting in descending order.

Use query parameter to search for a string in the response and return only the volume instances that contain it.

To retrieve a collection of ssh keys containing only the requested fields pass a list of comma separated properties (e.g. "state,md5") in fields parameter.

If any of the parameters sort, query or fields is set to an empty string, it is ignored in the request.

Retrieve an ssh key:

sk, err := api.GetSSHKey(sk_id)

Create an ssh key:

request := oneandone.SSHKeyRequest {
    Name: test_sk_name, 
    Description: test_sk_desc,
    PublicKey: pub_key
  }
  
sk_id, sk, err := api.CreateSSHKey(&request)

Rename an ssh key:

sk, err := oneandone.RenameSSHKey(sk_id, new_name, new_desc)

Remove an ssh key:

sk, err := api.DeleteSSHKey(sk_id)

Examples

package main

import (
	"fmt"
	"github.com/1and1/oneandone-cloudserver-sdk-go"
	"time"
)

func main() {
	//Set an authentication token
	token := oneandone.SetToken("82ee732b8d47e451be5c6ad5b7b56c81")
	//Create an API client
	api := oneandone.New(token, oneandone.BaseUrl)

	// List server appliances
	saps, err := api.ListServerAppliances()

	var sa oneandone.ServerAppliance
	for _, a := range saps {
		if a.Type == "IMAGE" {
			sa = a
		}
	}

	// Create a server
	req := oneandone.ServerRequest{
		Name:        "Example Server",
		Description: "Example server description.",
		ApplianceId: sa.Id,
		PowerOn:     True,
		ServerType:  "cloud",
		Hardware:    oneandone.Hardware{
			Vcores:            1,
			CoresPerProcessor: 1,
			Ram:               2,
			Hdds: []oneandone.Hdd {
				oneandone.Hdd {
						Size:   sa.MinHddSize,
						IsMain: true,
				},
			},
		},
	}

	server_id, server, err := api.CreateServer(&req)

	if err == nil {
		// Wait until server is created and powered on for at most 60 x 10 seconds
		err = api.WaitForState(server, "POWERED_ON", 10, 60)
	}

	// Get the server
	server, err = api.GetServer(server_id)

	// Create a load balancer
	lbr := oneandone.LoadBalancerRequest {
		Name: "Load Balancer Example", 
		Description: "API created load balancer.",
		Method: "ROUND_ROBIN",
		Persistence: oneandone.Bool2Pointer(true),
		PersistenceTime: oneandone.Int2Pointer(1200),
		HealthCheckTest: "TCP",
		HealthCheckInterval: oneandone.Int2Pointer(40),
		Rules: []oneandone.LoadBalancerRule {
				{
					Protocol: "TCP",
					PortBalancer: 80,
					PortServer: 80,
					Source: "0.0.0.0",
				},
		},
	}

	var lb *oneandone.LoadBalancer
	var lb_id string

	lb_id, lb, err = api.CreateLoadBalancer(&lbr)
	if err != nil {
		api.WaitForState(lb, "ACTIVE", 10, 30)
	}

	// Get the load balancer
	lb, err = api.GetLoadBalancer(lb.Id)

	// Assign the load balancer to server's IP
	server, err = api.AssignServerIpLoadBalancer(server.Id, server.Ips[0].Id, lb_id)

	// Create a firewall policy
	fpr := oneandone.FirewallPolicyRequest{
		Name: "Firewall Policy Example", 
		Description: "API created firewall policy.",
		Rules: []oneandone.FirewallPolicyRule {
			{
				Protocol: "TCP",
				PortFrom: oneandone.Int2Pointer(80),
				PortTo: oneandone.Int2Pointer(80),
			},
		},
	}

	var fp *oneandone.FirewallPolicy

	fp_id, fp, err = api.CreateFirewallPolicy(&fpr)
	if err == nil {
		api.WaitForState(fp, "ACTIVE", 10, 30)
	}

	// Get the firewall policy
	fp, err = api.GetFirewallPolicy(fp_id)

	// Add servers IPs to the firewall policy.
	ips := []string{ server.Ips[0].Id }

	fp, err = api.AddFirewallPolicyServerIps(fp.Id, ips)
	if err == nil {
		api.WaitForState(fp, "ACTIVE", 10, 60)
	}

	//Shutdown the server using 'SOFTWARE' method
	server, err = api.ShutdownServer(server.Id, false)
	if err != nil {
		err = api.WaitForState(server, "POWERED_OFF", 5, 20)
	}

	// Delete the load balancer
	lb, err = api.DeleteLoadBalancer(lb.Id)
	if err != nil {
		err = api.WaitUntilDeleted(lb)
	}

	// Delete the firewall policy
	fp, err = api.DeleteFirewallPolicy(fp.Id)
	if err != nil {
		err = api.WaitUntilDeleted(fp)
	}

	// List usages in last 24h
	var usages *oneandone.Usages
	usages, err = api.ListUsages("LAST_24H", nil, nil)

	fmt.Println(usages.Servers)

	// List usages in last 5 hours
	n := time.Now()
	ed := time.Date(n.Year(), n.Month(), n.Day(), n.Hour(), n.Minute(), n.Second(), 0, time.UTC)
	sd := ed.Add(-(time.Hour * 5))

	usages, err = api.ListUsages("CUSTOM", &sd, &ed)

	//Create a shared storage
	ssr := oneandone.SharedStorageRequest {
		Name: "Shared Storage Example", 
		Description: "API alocated 100 GB disk.",
		Size: oneandone.Int2Pointer(100),
	}

	var ss *oneandone.SharedStorage
	var ss_id string

	ss_id, ss, err = api.CreateSharedStorage(&ssr)
	if err != nil {
		api.WaitForState(ss, "ACTIVE", 10, 30)
	}

	// List shared storages on page 1, 5 results per page and sort by 'name' field.
	// Include only 'name', 'size' and 'minimum_size_allowed' fields in the result.
	var shs []oneandone.SharedStorage
	shs, err = api.ListSharedStorages(1, 5, "name", "", "name,size,minimum_size_allowed")

	// List all shared storages that contain 'example' string
	shs, err = api.ListSharedStorages(0, 0, "", "example", "")

	// Delete the shared storage
	ss, err = api.DeleteSharedStorage(ss_id)
	if err == nil {
		err = api.WaitUntilDeleted(ss)
	}

	// Delete the server
	server, err = api.DeleteServer(server.Id, false)
	if err == nil {
		err = api.WaitUntilDeleted(server)
	}
}

The next example illustrates how to create a TYPO3 application server of a fixed size with an initial password and a firewall policy that has just been created.

package main

import "github.com/1and1/oneandone-cloudserver-sdk-go"

func main() {
	token := oneandone.SetToken("bde36026df9d548f699ea97e75a7e87f")
	client := oneandone.New(token, oneandone.BaseUrl)

	// Create a new firewall policy
	fpr := oneandone.FirewallPolicyRequest{
		Name: "HTTPS Traffic Policy",
		Rules: []oneandone.FirewallPolicyRule{
			{
				Protocol: "TCP",
				PortFrom: oneandone.Int2Pointer(443),
				PortTo:   oneandone.Int2Pointer(443),
			},
		},
	}

	_, fp, err := client.CreateFirewallPolicy(&fpr)
	if fp != nil && err == nil {
		client.WaitForState(fp, "ACTIVE", 5, 60)

		// Look for the TYPO3 application appliance
		saps, _ := client.ListServerAppliances(0, 0, "", "typo3", "")

		var sa oneandone.ServerAppliance
		for _, a := range saps {
			if a.Type == "APPLICATION" {
				sa = a
				break
			}
		}

		var fixed_flavours []oneandone.FixedInstanceInfo
		var fixed_size_id string

		fixed_flavours, err = client.ListFixedInstanceSizes()
		for _, fl := range fixed_flavours {
			//look for 'M' size
			if fl.Name == "M" {
				fixed_size_id = fl.Id
				break
			}
		}

		req := oneandone.ServerRequest{
			Name:        "TYPO3 Server",
			ApplianceId: sa.Id,
			PowerOn:     true,
			Password:    "ucr_kXW8,.2SdMU",
			Hardware: oneandone.Hardware{
				FixedInsSizeId: fixed_size_id,
			},
			FirewallPolicyId: fp.Id,
		}
		_, server, _ := client.CreateServer(&req)
		if server != nil {
			client.WaitForState(server, "POWERED_ON", 10, 90)
		}
	}
}

Index

func New(token string, url string) *API
func (api *API) AddFirewallPolicyRules(fp_id string, fp_rules []FirewallPolicyRule) (*FirewallPolicy, error)
func (api *API) AddFirewallPolicyServerIps(fp_id string, ip_ids []string) (*FirewallPolicy, error)
func (api *API) AddLoadBalancerRules(lb_id string, lb_rules []LoadBalancerRule) (*LoadBalancer, error)
func (api *API) AddLoadBalancerServerIps(lb_id string, ip_ids []string) (*LoadBalancer, error)
func (api *API) AddMonitoringPolicyPorts(mp_id string, mp_ports []MonitoringPort) (*MonitoringPolicy, error)
func (api *API) AddMonitoringPolicyProcesses(mp_id string, mp_procs []MonitoringProcess) (*MonitoringPolicy, error)
func (api *API) AddServerHdds(server_id string, hdds *ServerHdds) (*Server, error)
func (api *API) AddSharedStorageServers(st_id string, servers []SharedStorageServer) (*SharedStorage, error)
func (api *API) AddUserApiAlowedIps(user_id string, ips []string) (*User, error)
func (api *API) AssignRoleUsers(role_id string, user_ids []string) (*Role, error)
func (api *API) AssignServerIp(server_id string, ip_type string) (*Server, error)
func (api *API) AssignServerIpFirewallPolicy(server_id string, ip_id string, fp_id string) (*Server, error)
func (api *API) AssignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error)
func (api *API) AssignServerPrivateNetwork(server_id string, pn_id string) (*Server, error)
func (api *API) AttachMonitoringPolicyServers(mp_id string, sids []string) (*MonitoringPolicy, error)
func (api *API) AttachPrivateNetworkServers(pn_id string, sids []string) (*PrivateNetwork, error)
func (api *API) CloneRole(role_id string, name string) (*Role, error)
func (api *API) CloneServer(server_id string, new_name string, datacenter_id string) (*Server, error)
func (api *API) CreateFirewallPolicy(fp_data *FirewallPolicyRequest) (string, *FirewallPolicy, error)
func (api *API) CreateImage(request *ImageRequest) (string, *Image, error)
func (api *API) CreateLoadBalancer(request *LoadBalancerRequest) (string, *LoadBalancer, error)
func (api *API) CreateMonitoringPolicy(mp *MonitoringPolicy) (string, *MonitoringPolicy, error)
func (api *API) CreatePrivateNetwork(request *PrivateNetworkRequest) (string, *PrivateNetwork, error)
func (api *API) CreatePublicIp(ip_type string, reverse_dns string, datacenter_id string) (string, *PublicIp, error)
func (api *API) CreateRole(name string) (string, *Role, error)
func (api *API) CreateServer(request *ServerRequest) (string, *Server, error)
func (api *API) CreateServerEx(request *ServerRequest, timeout int) (string, string, error)
func (api *API) CreateServerSnapshot(server_id string) (*Server, error)
func (api *API) CreateSharedStorage(request *SharedStorageRequest) (string, *SharedStorage, error)
func (api *API) CreateUser(user *UserRequest) (string, *User, error)
func (api *API) CreateVPN(name string, description string, datacenter_id string) (string, *VPN, error)
func (api *API) DeleteFirewallPolicy(fp_id string) (*FirewallPolicy, error)
func (api *API) DeleteFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicy, error)
func (api *API) DeleteFirewallPolicyServerIp(fp_id string, ip_id string) (*FirewallPolicy, error)
func (api *API) DeleteImage(img_id string) (*Image, error)
func (api *API) DeleteLoadBalancer(lb_id string) (*LoadBalancer, error)
func (api *API) DeleteLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancer, error)
func (api *API) DeleteLoadBalancerServerIp(lb_id string, ip_id string) (*LoadBalancer, error)
func (api *API) DeleteMonitoringPolicy(mp_id string) (*MonitoringPolicy, error)
func (api *API) DeleteMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPolicy, error)
func (api *API) DeleteMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringPolicy, error)
func (api *API) DeletePrivateNetwork(pn_id string) (*PrivateNetwork, error)
func (api *API) DeletePublicIp(ip_id string) (*PublicIp, error)
func (api *API) DeleteRole(role_id string) (*Role, error)
func (api *API) DeleteServer(server_id string, keep_ips bool) (*Server, error)
func (api *API) DeleteServerHdd(server_id string, hdd_id string) (*Server, error)
func (api *API) DeleteServerIp(server_id string, ip_id string, keep_ip bool) (*Server, error)
func (api *API) DeleteServerSnapshot(server_id string, snapshot_id string) (*Server, error)
func (api *API) DeleteSharedStorage(ss_id string) (*SharedStorage, error)
func (api *API) DeleteSharedStorageServer(st_id string, ser_id string) (*SharedStorage, error)
func (api *API) DeleteUser(user_id string) (*User, error)
func (api *API) DeleteVPN(vpn_id string) (*VPN, error)
func (api *API) DetachPrivateNetworkServer(pn_id string, pns_id string) (*PrivateNetwork, error)
func (api *API) EjectServerDvd(server_id string) (*Server, error)
func (api *API) GetBaremetalModel(bm_id string) (*BaremetalModel, error)
func (api *API) GetCurrentUserPermissions() (*Permissions, error)
func (api *API) GetDatacenter(dc_id string) (*Datacenter, error)
func (api *API) GetDvdIso(dvd_id string) (*DvdIso, error)
func (api *API) GetFirewallPolicy(fp_id string) (*FirewallPolicy, error)
func (api *API) GetFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicyRule, error)
func (api *API) GetFirewallPolicyServerIp(fp_id string, ip_id string) (*ServerIpInfo, error)
func (api *API) GetFixedInstanceSize(fis_id string) (*FixedInstanceInfo, error)
func (api *API) GetImage(img_id string) (*Image, error)
func (api *API) GetLoadBalancer(lb_id string) (*LoadBalancer, error)
func (api *API) GetLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancerRule, error)
func (api *API) GetLoadBalancerServerIp(lb_id string, ip_id string) (*ServerIpInfo, error)
func (api *API) GetLog(log_id string) (*Log, error)
func (api *API) GetMonitoringPolicy(mp_id string) (*MonitoringPolicy, error)
func (api *API) GetMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPort, error)
func (api *API) GetMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringProcess, error)
func (api *API) GetMonitoringPolicyServer(mp_id string, ser_id string) (*Identity, error)
func (api *API) GetMonitoringServerUsage(ser_id string, period string, dates ...time.Time) (*MonServerUsageDetails, error)
func (api *API) GetPricing() (*Pricing, error)
func (api *API) GetPrivateNetwork(pn_id string) (*PrivateNetwork, error)
func (api *API) GetPrivateNetworkServer(pn_id string, server_id string) (*Identity, error)
func (api *API) GetPublicIp(ip_id string) (*PublicIp, error)
func (api *API) GetRecoveryAppliance(ra_id string) (*SingleRecoveryAppliance, error)
func (api *API) GetRole(role_id string) (*Role, error)
func (api *API) GetRolePermissions(role_id string) (*Permissions, error)
func (api *API) GetRoleUser(role_id string, user_id string) (*Identity, error)
func (api *API) GetServer(server_id string) (*Server, error)
func (api *API) GetServerAppliance(sa_id string) (*ServerAppliance, error)
func (api *API) GetServerDvd(server_id string) (*Identity, error)
func (api *API) GetServerHardware(server_id string) (*Hardware, error)
func (api *API) GetServerHdd(server_id string, hdd_id string) (*Hdd, error)
func (api *API) GetServerImage(server_id string) (*Identity, error)
func (api *API) GetServerIp(server_id string, ip_id string) (*ServerIp, error)
func (api *API) GetServerIpFirewallPolicy(server_id string, ip_id string) (*Identity, error)
func (api *API) GetServerPrivateNetwork(server_id string, pn_id string) (*PrivateNetwork, error)
func (api *API) GetServerSnapshot(server_id string) (*ServerSnapshot, error)
func (api *API) GetServerStatus(server_id string) (*Status, error)
func (api *API) GetSharedStorage(ss_id string) (*SharedStorage, error)
func (api *API) GetSharedStorageCredentials() ([]SharedStorageAccess, error)
func (api *API) GetSharedStorageServer(st_id string, ser_id string) (*SharedStorageServer, error)
func (api *API) GetUser(user_id string) (*User, error)
func (api *API) GetUserApi(user_id string) (*UserApi, error)
func (api *API) GetUserApiKey(user_id string) (*UserApiKey, error)
func (api *API) GetVPN(vpn_id string) (*VPN, error)
func (api *API) GetVPNConfigFile(vpn_id string) (string, error)
func (api *API) ListBaremetalModels() ([]BaremetalModel, error)
func (api *API) ListDatacenters(args ...interface{}) ([]Datacenter, error)
func (api *API) ListDvdIsos(args ...interface{}) ([]DvdIso, error)
func (api *API) ListFirewallPolicies(args ...interface{}) ([]FirewallPolicy, error)
func (api *API) ListFirewallPolicyRules(fp_id string) ([]FirewallPolicyRule, error)
func (api *API) ListFirewallPolicyServerIps(fp_id string) ([]ServerIpInfo, error)
func (api *API) ListFixedInstanceSizes() ([]FixedInstanceInfo, error)
func (api *API) ListImageOs(args ...interface{}) ([]ImageOs, error)
func (api *API) ListImages(args ...interface{}) ([]Image, error)
func (api *API) ListLoadBalancerRules(lb_id string) ([]LoadBalancerRule, error)
func (api *API) ListLoadBalancerServerIps(lb_id string) ([]ServerIpInfo, error)
func (api *API) ListLoadBalancers(args ...interface{}) ([]LoadBalancer, error)
func (api *API) ListLogs(period string, sd *time.Time, ed *time.Time, args ...interface{}) ([]Log, error)
func (api *API) ListMonitoringPolicies(args ...interface{}) ([]MonitoringPolicy, error)
func (api *API) ListMonitoringPolicyPorts(mp_id string) ([]MonitoringPort, error)
func (api *API) ListMonitoringPolicyProcesses(mp_id string) ([]MonitoringProcess, error)
func (api *API) ListMonitoringPolicyServers(mp_id string) ([]Identity, error)
func (api *API) ListMonitoringServersUsages(args ...interface{}) ([]MonServerUsageSummary, error)
func (api *API) ListPrivateNetworkServers(pn_id string) ([]Identity, error)
func (api *API) ListPrivateNetworks(args ...interface{}) ([]PrivateNetwork, error)
func (api *API) ListPublicIps(args ...interface{}) ([]PublicIp, error)
func (api *API) ListRecoveryAppliances(args ...interface{}) ([]RecoveryAppliance, error)
func (api *API) ListRoleUsers(role_id string) ([]Identity, error)
func (api *API) ListRoles(args ...interface{}) ([]Role, error)
func (api *API) ListServerAppliances(args ...interface{}) ([]ServerAppliance, error)
func (api *API) ListServerHdds(server_id string) ([]Hdd, error)
func (api *API) ListServerIpLoadBalancers(server_id string, ip_id string) ([]Identity, error)
func (api *API) ListServerIps(server_id string) ([]ServerIp, error)
func (api *API) ListServerPrivateNetworks(server_id string) ([]Identity, error)
func (api *API) ListServers(args ...interface{}) ([]Server, error)
func (api *API) ListSharedStorageServers(st_id string) ([]SharedStorageServer, error)
func (api *API) ListSharedStorages(args ...interface{}) ([]SharedStorage, error)
func (api *API) ListUsages(period string, sd *time.Time, ed *time.Time, args ...interface{}) (*Usages, error)
func (api *API) ListUserApiAllowedIps(user_id string) ([]string, error)
func (api *API) ListUsers(args ...interface{}) ([]User, error)
func (api *API) ListVPNs(args ...interface{}) ([]VPN, error)
func (api *API) LoadServerDvd(server_id string, dvd_id string) (*Server, error)
func (api *API) ModifyMonitoringPolicyPort(mp_id string, port_id string, mp_port *MonitoringPort) (*MonitoringPolicy, error)
func (api *API) ModifyMonitoringPolicyProcess(mp_id string, proc_id string, mp_proc *MonitoringProcess) (*MonitoringPolicy, error)
func (api *API) ModifyRole(role_id string, name string, description string, state string) (*Role, error)
func (api *API) ModifyRolePermissions(role_id string, perm *Permissions) (*Role, error)
func (api *API) ModifyUser(user_id string, user *UserRequest) (*User, error)
func (api *API) ModifyUserApi(user_id string, active bool) (*User, error)
func (api *API) ModifyVPN(vpn_id string, name string, description string) (*VPN, error)
func (api *API) Ping() ([]string, error)
func (api *API) PingAuth() ([]string, error)
func (api *API) RebootServer(server_id string, is_hardware bool) (*Server, error)
func (api *API) RecoveryRebootServer(server_id string, is_hardware bool, recovery_image_id string)
func (api *API) ReinstallServerImage(server_id string, image_id string, password string, fp_id string) (*Server, error)
func (api *API) RemoveMonitoringPolicyServer(mp_id string, ser_id string) (*MonitoringPolicy, error)
func (api *API) RemoveRoleUser(role_id string, user_id string) (*Role, error)
func (api *API) RemoveServerPrivateNetwork(server_id string, pn_id string) (*Server, error)
func (api *API) RemoveUserApiAllowedIp(user_id string, ip string) (*User, error)
func (api *API) RenameServer(server_id string, new_name string, new_desc string) (*Server, error)
func (api *API) RenewUserApiKey(user_id string) (*User, error)
func (api *API) ResizeServerHdd(server_id string, hdd_id string, new_size int) (*Server, error)
func (api *API) RestoreServerSnapshot(server_id string, snapshot_id string) (*Server, error)
func (api *API) ShutdownServer(server_id string, is_hardware bool) (*Server, error)
func (api *API) StartServer(server_id string) (*Server, error)
func (api *API) UnassignServerIpFirewallPolicy(server_id string, ip_id string) (*Server, error)
func (api *API) UnassignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error)
func (api *API) UpdateFirewallPolicy(fp_id string, fp_new_name string, fp_new_desc string) (*FirewallPolicy, error)
func (api *API) UpdateImage(img_id string, new_name string, new_desc string, new_freq string) (*Image, error)
func (api *API) UpdateLoadBalancer(lb_id string, request *LoadBalancerRequest) (*LoadBalancer, error)
func (api *API) UpdateMonitoringPolicy(mp_id string, mp *MonitoringPolicy) (*MonitoringPolicy, error)
func (api *API) UpdatePrivateNetwork(pn_id string, request *PrivateNetworkRequest) (*PrivateNetwork, error)
func (api *API) UpdatePublicIp(ip_id string, reverse_dns string) (*PublicIp, error)
func (api *API) UpdateServerHardware(server_id string, hardware *Hardware) (*Server, error)
func (api *API) UpdateSharedStorage(ss_id string, request *SharedStorageRequest) (*SharedStorage, error)
func (api *API) UpdateSharedStorageCredentials(new_pass string) ([]SharedStorageAccess, error)
func (api *API) WaitForState(in ApiInstance, state string, sec time.Duration, count int) error
func (api *API) WaitUntilDeleted(in ApiInstance) error
func (fp *FirewallPolicy) GetState() (string, error)
func (im *Image) GetState() (string, error)
func (lb *LoadBalancer) GetState() (string, error)
func (mp *MonitoringPolicy) GetState() (string, error)
func (pn *PrivateNetwork) GetState() (string, error)
func (ip *PublicIp) GetState() (string, error)
func (role *Role) GetState() (string, error)
func (s *Server) GetState() (string, error)
func (ss *SharedStorage) GetState() (string, error)
func (u *User) GetState() (string, error)
func (u *User) GetState() (string, error)
func (vpn *VPN) GetState() (string, error)
func Bool2Pointer(input bool) *bool
func Int2Pointer(input int) *int
func (bp *BackupPerm) SetAll(value bool)
func (fp *FirewallPerm) SetAll(value bool)
func (imp *ImagePerm) SetAll(value bool)
unc (inp *InvoicePerm) SetAll(value bool)
func (ipp *IPPerm) SetAll(value bool)
func (lbp *LoadBalancerPerm) SetAll(value bool)
func (lp *LogPerm) SetAll(value bool)
func (mcp *MonitorCenterPerm) SetAll(value bool)
func (mpp *MonitorPolicyPerm) SetAll(value bool)
func (p *Permissions) SetAll(v bool)
func (pnp *PrivateNetworkPerm) SetAll(value bool)
func (rp *RolePerm) SetAll(value bool)
func (sp *ServerPerm) SetAll(value bool)
func (ssp *SharedStoragePerm) SetAll(value bool)
func (up *UsagePerm) SetAll(value bool)
func (up *UserPerm) SetAll(value bool)
func (vpnp *VPNPerm) SetAll(value bool)
func SetBaseUrl(newbaseurl string) string
func SetToken(newtoken string) string

Documentation

Index

Constants

View Source
const (
	IpTypeV4 = "IPV4"
	IpTypeV6 = "IPV6"
)

Variables

View Source
var BaseUrl = "https://cloudpanel-api.1and1.com/v1"

The base url for 1&1 Cloud Server REST API.

View Source
var Token string

Authentication token

Functions

func Bool2Pointer

func Bool2Pointer(input bool) *bool

Converts a given boolean value into a pointer of the same type.

func Int2Pointer

func Int2Pointer(input int) *int

Converts a given integer value into a pointer of the same type.

func SetBaseUrl

func SetBaseUrl(newbaseurl string) string

SetBaseUrl is intended to set the REST base url. BaseUrl is declared in setup.go

func SetToken

func SetToken(newtoken string) string

SetToken is used to set authentication Token for the REST service. Token is declared in setup.go

Types

type API

type API struct {
	Endpoint string
	Client   *restClient
}

Struct to hold the required information for accessing the API.

Instances of this type contain the URL of the endpoint to access the API as well as the API access token to be used. They offer also all methods that allow to access the various objects that are returned by top level resources of the API.

func New

func New(token string, url string) *API

Creates a new API instance.

Explanations about given token and url information can be found online under the following url TODO add url!

func (*API) AddBlockStorageServer added in v1.2.0

func (api *API) AddBlockStorageServer(blockStorageId string, serverId string) (*BlockStorage, error)

func (*API) AddFirewallPolicyRules

func (api *API) AddFirewallPolicyRules(fp_id string, fp_rules []FirewallPolicyRule) (*FirewallPolicy, error)

POST /firewall_policies/{id}/rules

func (*API) AddFirewallPolicyServerIps

func (api *API) AddFirewallPolicyServerIps(fp_id string, ip_ids []string) (*FirewallPolicy, error)

POST /firewall_policies/{id}/server_ips

func (*API) AddLoadBalancerRules

func (api *API) AddLoadBalancerRules(lb_id string, lb_rules []LoadBalancerRule) (*LoadBalancer, error)

POST /load_balancers/{load_balancer_id}/rules

func (*API) AddLoadBalancerServerIps

func (api *API) AddLoadBalancerServerIps(lb_id string, ip_ids []string) (*LoadBalancer, error)

POST /load_balancers/{id}/server_ips

func (*API) AddMonitoringPolicyPorts

func (api *API) AddMonitoringPolicyPorts(mp_id string, mp_ports []MonitoringPort) (*MonitoringPolicy, error)

POST /monitoring_policies/{id}/ports

func (*API) AddMonitoringPolicyProcesses

func (api *API) AddMonitoringPolicyProcesses(mp_id string, mp_procs []MonitoringProcess) (*MonitoringPolicy, error)

POST /monitoring_policies/{id}/processes

func (*API) AddServerHdds

func (api *API) AddServerHdds(server_id string, hdds *ServerHdds) (*Server, error)

POST /servers/{id}/hardware/hdds

func (*API) AddSharedStorageServers

func (api *API) AddSharedStorageServers(st_id string, servers []SharedStorageServer) (*SharedStorage, error)

POST /shared_storages/{id}/servers

func (*API) AddUserApiAlowedIps

func (api *API) AddUserApiAlowedIps(user_id string, ips []string) (*User, error)

POST /users/{id}/api/ips

func (*API) AssignRoleUsers

func (api *API) AssignRoleUsers(role_id string, user_ids []string) (*Role, error)

POST /roles/{role_id}/users

func (*API) AssignServerIp

func (api *API) AssignServerIp(server_id string, ip_type string) (*Server, error)

POST /servers/{id}/ips

func (*API) AssignServerIpFirewallPolicy

func (api *API) AssignServerIpFirewallPolicy(server_id string, ip_id string, fp_id string) (*Server, error)

PUT /servers/{server_id}/ips/{ip_id}/firewall_policy

func (*API) AssignServerIpLoadBalancer

func (api *API) AssignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error)

POST /servers/{server_id}/ips/{ip_id}/load_balancers

func (*API) AssignServerPrivateNetwork

func (api *API) AssignServerPrivateNetwork(server_id string, pn_id string) (*Server, error)

POST /servers/{id}/private_networks

func (*API) AttachMonitoringPolicyServers

func (api *API) AttachMonitoringPolicyServers(mp_id string, sids []string) (*MonitoringPolicy, error)

POST /monitoring_policies/{id}/servers

func (*API) AttachPrivateNetworkServers

func (api *API) AttachPrivateNetworkServers(pn_id string, sids []string) (*PrivateNetwork, error)

POST /private_networks/{id}/servers

func (*API) CloneRole

func (api *API) CloneRole(role_id string, name string) (*Role, error)

POST /roles/{role_id}/clone

func (*API) CloneServer

func (api *API) CloneServer(server_id string, new_name string, datacenter_id string) (*Server, error)

POST /servers/{server_id}/clone

func (*API) CreateBlockStorage added in v1.2.0

func (api *API) CreateBlockStorage(request *BlockStorageRequest) (string, *BlockStorage, error)

func (*API) CreateFirewallPolicy

func (api *API) CreateFirewallPolicy(fp_data *FirewallPolicyRequest) (string, *FirewallPolicy, error)

POST /firewall_policies

func (*API) CreateImage

func (api *API) CreateImage(request *ImageRequest) (string, *Image, error)

POST /images

func (*API) CreateLoadBalancer

func (api *API) CreateLoadBalancer(request *LoadBalancerRequest) (string, *LoadBalancer, error)

POST /load_balancers

func (*API) CreateMonitoringPolicy

func (api *API) CreateMonitoringPolicy(mp *MonitoringPolicy) (string, *MonitoringPolicy, error)

POST /monitoring_policies

func (*API) CreatePrivateNetwork

func (api *API) CreatePrivateNetwork(request *PrivateNetworkRequest) (string, *PrivateNetwork, error)

POST /private_networks

func (*API) CreatePublicIp

func (api *API) CreatePublicIp(ip_type string, reverse_dns string, datacenter_id string) (string, *PublicIp, error)

POST /public_ips

func (*API) CreateRole

func (api *API) CreateRole(name string) (string, *Role, error)

POST /roles

func (*API) CreateSSHKey added in v1.2.0

func (api *API) CreateSSHKey(request *SSHKeyRequest) (string, *SSHKey, error)

func (*API) CreateServer

func (api *API) CreateServer(request *ServerRequest) (string, *Server, error)

POST /servers

func (*API) CreateServerEx

func (api *API) CreateServerEx(request *ServerRequest, timeout int) (string, string, error)

This is a wrapper function for `CreateServer` that returns the server's IP address and first password. The function waits at most `timeout` seconds for the server to be created. The initial `POST /servers` response does not contain the IP address, so we need to wait until the server is created.

func (*API) CreateServerSnapshot

func (api *API) CreateServerSnapshot(server_id string) (*Server, error)

POST /servers/{id}/snapshots

func (*API) CreateSharedStorage

func (api *API) CreateSharedStorage(request *SharedStorageRequest) (string, *SharedStorage, error)

POST /shared_storages

func (*API) CreateUser

func (api *API) CreateUser(user *UserRequest) (string, *User, error)

POST /users

func (*API) CreateVPN

func (api *API) CreateVPN(name string, description string, datacenter_id string) (string, *VPN, error)

POST /vpns

func (*API) DeleteBlockStorage added in v1.2.0

func (api *API) DeleteBlockStorage(id string) (*BlockStorage, error)

func (*API) DeleteFirewallPolicy

func (api *API) DeleteFirewallPolicy(fp_id string) (*FirewallPolicy, error)

DELETE /firewall_policies/{id}

func (*API) DeleteFirewallPolicyRule

func (api *API) DeleteFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicy, error)

DELETE /firewall_policies/{id}/rules/{id}

func (*API) DeleteImage

func (api *API) DeleteImage(img_id string) (*Image, error)

DELETE /images/{id}

func (*API) DeleteLoadBalancer

func (api *API) DeleteLoadBalancer(lb_id string) (*LoadBalancer, error)

DELETE /load_balancers/{id}

func (*API) DeleteLoadBalancerRule

func (api *API) DeleteLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancer, error)

DELETE /load_balancers/{load_balancer_id}/rules/{rule_id}

func (*API) DeleteLoadBalancerServerIp

func (api *API) DeleteLoadBalancerServerIp(lb_id string, ip_id string) (*LoadBalancer, error)

DELETE /load_balancers/{id}/server_ips/{id}

func (*API) DeleteMonitoringPolicy

func (api *API) DeleteMonitoringPolicy(mp_id string) (*MonitoringPolicy, error)

DELETE /monitoring_policies/{id}

func (*API) DeleteMonitoringPolicyPort

func (api *API) DeleteMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPolicy, error)

DELETE /monitoring_policies/{id}/ports/{id}

func (*API) DeleteMonitoringPolicyProcess

func (api *API) DeleteMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringPolicy, error)

DELETE /monitoring_policies/{id}/processes/{id}

func (*API) DeletePrivateNetwork

func (api *API) DeletePrivateNetwork(pn_id string) (*PrivateNetwork, error)

DELETE /private_networks/{id}

func (*API) DeletePublicIp

func (api *API) DeletePublicIp(ip_id string) (*PublicIp, error)

DELETE /public_ips/{id}

func (*API) DeleteRole

func (api *API) DeleteRole(role_id string) (*Role, error)

DELETE /roles/{role_id}

func (*API) DeleteSSHKey added in v1.2.0

func (api *API) DeleteSSHKey(id string) (*SSHKey, error)

func (*API) DeleteServer

func (api *API) DeleteServer(server_id string, args ...interface{}) (*Server, error)

DELETE /servers/{id}

func (*API) DeleteServerHdd

func (api *API) DeleteServerHdd(server_id string, hdd_id string) (*Server, error)

DELETE /servers/{id}/hardware/hdds/{id}

func (*API) DeleteServerIp

func (api *API) DeleteServerIp(server_id string, ip_id string, keep_ip bool) (*Server, error)

DELETE /servers/{id}/ips/{id}

func (*API) DeleteServerSnapshot

func (api *API) DeleteServerSnapshot(server_id string, snapshot_id string) (*Server, error)

DELETE /servers/{server_id}/snapshots/{snapshot_id}

func (*API) DeleteSharedStorage

func (api *API) DeleteSharedStorage(ss_id string) (*SharedStorage, error)

DELETE /shared_storages/{id}

func (*API) DeleteSharedStorageServer

func (api *API) DeleteSharedStorageServer(st_id string, ser_id string) (*SharedStorage, error)

DELETE /shared_storages/{id}/servers/{id}

func (*API) DeleteUser

func (api *API) DeleteUser(user_id string) (*User, error)

DELETE /users/{id}

func (*API) DeleteVPN

func (api *API) DeleteVPN(vpn_id string) (*VPN, error)

DELETE /vpns/{vpn_id}

func (*API) DetachPrivateNetworkServer

func (api *API) DetachPrivateNetworkServer(pn_id string, pns_id string) (*PrivateNetwork, error)

DELETE /private_networks/{id}/servers/{id}

func (*API) EjectServerDvd

func (api *API) EjectServerDvd(server_id string) (*Server, error)

DELETE /servers/{id}/dvd

func (*API) GetBaremetalModel added in v1.2.1

func (api *API) GetBaremetalModel(bm_id string) (*BaremetalModel, error)

GET /servers/baremetal_models/{id}

func (*API) GetBlockStorage added in v1.2.0

func (api *API) GetBlockStorage(id string) (*BlockStorage, error)

func (*API) GetBlockStorageServer added in v1.2.0

func (api *API) GetBlockStorageServer(id string) (*BlockStorageServer, error)

func (*API) GetCurrentUserPermissions

func (api *API) GetCurrentUserPermissions() (*Permissions, error)

GET /users/{id}/api/ips

func (*API) GetDatacenter

func (api *API) GetDatacenter(dc_id string) (*Datacenter, error)

GET /datacenters/{datacenter_id}

func (*API) GetDvdIso

func (api *API) GetDvdIso(dvd_id string) (*DvdIso, error)

GET /dvd_isos/{id}

func (*API) GetFirewallPolicy

func (api *API) GetFirewallPolicy(fp_id string) (*FirewallPolicy, error)

GET /firewall_policies/{id}

func (*API) GetFirewallPolicyRule

func (api *API) GetFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicyRule, error)

GET /firewall_policies/{id}/rules/{id}

func (*API) GetFirewallPolicyServerIp

func (api *API) GetFirewallPolicyServerIp(fp_id string, ip_id string) (*ServerIpInfo, error)

GET /firewall_policies/{id}/server_ips/{id}

func (*API) GetFixedInstanceSize

func (api *API) GetFixedInstanceSize(fis_id string) (*FixedInstanceInfo, error)

GET /servers/fixed_instance_sizes/{fixed_instance_size_id}

func (*API) GetImage

func (api *API) GetImage(img_id string) (*Image, error)

GET /images/{id}

func (*API) GetLoadBalancer

func (api *API) GetLoadBalancer(lb_id string) (*LoadBalancer, error)

GET /load_balancers/{id}

func (*API) GetLoadBalancerRule

func (api *API) GetLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancerRule, error)

GET /load_balancers/{load_balancer_id}/rules/{rule_id}

func (*API) GetLoadBalancerServerIp

func (api *API) GetLoadBalancerServerIp(lb_id string, ip_id string) (*ServerIpInfo, error)

GET /load_balancers/{id}/server_ips/{id}

func (*API) GetLog

func (api *API) GetLog(log_id string) (*Log, error)

GET /logs/{id}

func (*API) GetMonitoringPolicy

func (api *API) GetMonitoringPolicy(mp_id string) (*MonitoringPolicy, error)

GET /monitoring_policies/{id}

func (*API) GetMonitoringPolicyPort

func (api *API) GetMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPort, error)

GET /monitoring_policies/{id}/ports/{id}

func (*API) GetMonitoringPolicyProcess

func (api *API) GetMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringProcess, error)

GET /monitoring_policies/{id}/processes/{id}

func (*API) GetMonitoringPolicyServer

func (api *API) GetMonitoringPolicyServer(mp_id string, ser_id string) (*Identity, error)

GET /monitoring_policies/{id}/servers/{id}

func (*API) GetMonitoringServerUsage

func (api *API) GetMonitoringServerUsage(ser_id string, period string, dates ...time.Time) (*MonServerUsageDetails, error)

GET /monitoring_center/{server_id}

func (*API) GetPricing

func (api *API) GetPricing() (*Pricing, error)

GET /pricing

func (*API) GetPrivateNetwork

func (api *API) GetPrivateNetwork(pn_id string) (*PrivateNetwork, error)

GET /private_networks/{id}

func (*API) GetPrivateNetworkServer

func (api *API) GetPrivateNetworkServer(pn_id string, server_id string) (*Identity, error)

GET /private_networks/{id}/servers/{id}

func (*API) GetPublicIp

func (api *API) GetPublicIp(ip_id string) (*PublicIp, error)

GET /public_ips/{id}

func (*API) GetRecoveryAppliance added in v1.2.1

func (api *API) GetRecoveryAppliance(ra_id string) (*SingleRecoveryAppliance, error)

GET /server_appliances/{id}

func (*API) GetRole

func (api *API) GetRole(role_id string) (*Role, error)

GET /roles/{role_id}

func (*API) GetRolePermissions

func (api *API) GetRolePermissions(role_id string) (*Permissions, error)

GET /roles/{role_id}/permissions

func (*API) GetRoleUser

func (api *API) GetRoleUser(role_id string, user_id string) (*Identity, error)

GET /roles/{role_id}/users/{user_id}

func (*API) GetSSHKey added in v1.2.0

func (api *API) GetSSHKey(id string) (*SSHKey, error)

func (*API) GetServer

func (api *API) GetServer(server_id string) (*Server, error)

GET /servers/{id}

func (*API) GetServerAppliance

func (api *API) GetServerAppliance(sa_id string) (*ServerAppliance, error)

GET /server_appliances/{id}

func (*API) GetServerDvd

func (api *API) GetServerDvd(server_id string) (*Identity, error)

GET /servers/{id}/dvd

func (*API) GetServerHardware

func (api *API) GetServerHardware(server_id string) (*Hardware, error)

GET /servers/{server_id}/hardware

func (*API) GetServerHdd

func (api *API) GetServerHdd(server_id string, hdd_id string) (*Hdd, error)

GET /servers/{id}/hardware/hdds/{id}

func (*API) GetServerImage

func (api *API) GetServerImage(server_id string) (*Identity, error)

GET /servers/{id}/image

func (*API) GetServerIp

func (api *API) GetServerIp(server_id string, ip_id string) (*ServerIp, error)

GET /servers/{id}/ips/{id}

func (*API) GetServerIpFirewallPolicy

func (api *API) GetServerIpFirewallPolicy(server_id string, ip_id string) (*Identity, error)

GET /servers/{server_id}/ips/{ip_id}/firewall_policy

func (*API) GetServerPrivateNetwork

func (api *API) GetServerPrivateNetwork(server_id string, pn_id string) (*PrivateNetwork, error)

GET /servers/{id}/private_networks/{id}

func (*API) GetServerSnapshot

func (api *API) GetServerSnapshot(server_id string) (*ServerSnapshot, error)

GET /servers/{id}/snapshots

func (*API) GetServerStatus

func (api *API) GetServerStatus(server_id string) (*Status, error)

GET /servers/{id}/status

func (*API) GetSharedStorage

func (api *API) GetSharedStorage(ss_id string) (*SharedStorage, error)

GET /shared_storages/{id}

func (*API) GetSharedStorageCredentials

func (api *API) GetSharedStorageCredentials() ([]SharedStorageAccess, error)

GET /shared_storages/access

func (*API) GetSharedStorageServer

func (api *API) GetSharedStorageServer(st_id string, ser_id string) (*SharedStorageServer, error)

GET /shared_storages/{id}/servers/{id}

func (*API) GetUser

func (api *API) GetUser(user_id string) (*User, error)

GET /users/{id}

func (*API) GetUserApi

func (api *API) GetUserApi(user_id string) (*UserApi, error)

GET /users/{id}/api

func (*API) GetUserApiKey

func (api *API) GetUserApiKey(user_id string) (*UserApiKey, error)

GET /users/{id}/api/key

func (*API) GetVPN

func (api *API) GetVPN(vpn_id string) (*VPN, error)

GET /vpns/{vpn_id}

func (*API) GetVPNConfigFile

func (api *API) GetVPNConfigFile(filepath string, vpn_id string) (string, error)

GET /vpns/{vpn_id}/configuration_file Returns VPN configuration files (in a zip arhive) as a base64 encoded string

func (*API) ListBaremetalModels added in v1.2.1

func (api *API) ListBaremetalModels() ([]BaremetalModel, error)

GET /servers/baremetal_models

func (*API) ListBlockStorages added in v1.2.0

func (api *API) ListBlockStorages(args ...interface{}) ([]BlockStorage, error)

func (*API) ListDatacenters

func (api *API) ListDatacenters(args ...interface{}) ([]Datacenter, error)

GET /datacenters

func (*API) ListDvdIsos

func (api *API) ListDvdIsos(args ...interface{}) ([]DvdIso, error)

GET /dvd_isos

func (*API) ListFirewallPolicies

func (api *API) ListFirewallPolicies(args ...interface{}) ([]FirewallPolicy, error)

GET /firewall_policies

func (*API) ListFirewallPolicyRules

func (api *API) ListFirewallPolicyRules(fp_id string) ([]FirewallPolicyRule, error)

GET /firewall_policies/{id}/rules

func (*API) ListFirewallPolicyServerIps

func (api *API) ListFirewallPolicyServerIps(fp_id string) ([]ServerIpInfo, error)

GET /firewall_policies/{id}/server_ips

func (*API) ListFixedInstanceSizes

func (api *API) ListFixedInstanceSizes() ([]FixedInstanceInfo, error)

GET /servers/fixed_instance_sizes

func (*API) ListImageOs added in v1.1.0

func (api *API) ListImageOs(args ...interface{}) ([]ImageOs, error)

GET /images/os

func (*API) ListImages

func (api *API) ListImages(args ...interface{}) ([]Image, error)

GET /images

func (*API) ListLoadBalancerRules

func (api *API) ListLoadBalancerRules(lb_id string) ([]LoadBalancerRule, error)

GET /load_balancers/{load_balancer_id}/rules

func (*API) ListLoadBalancerServerIps

func (api *API) ListLoadBalancerServerIps(lb_id string) ([]ServerIpInfo, error)

GET /load_balancers/{id}/server_ips

func (*API) ListLoadBalancers

func (api *API) ListLoadBalancers(args ...interface{}) ([]LoadBalancer, error)

GET /load_balancers

func (*API) ListLogs

func (api *API) ListLogs(period string, sd *time.Time, ed *time.Time, args ...interface{}) ([]Log, error)

GET /logs

func (*API) ListMonitoringPolicies

func (api *API) ListMonitoringPolicies(args ...interface{}) ([]MonitoringPolicy, error)

GET /monitoring_policies

func (*API) ListMonitoringPolicyPorts

func (api *API) ListMonitoringPolicyPorts(mp_id string) ([]MonitoringPort, error)

GET /monitoring_policies/{id}/ports

func (*API) ListMonitoringPolicyProcesses

func (api *API) ListMonitoringPolicyProcesses(mp_id string) ([]MonitoringProcess, error)

GET /monitoring_policies/{id}/processes

func (*API) ListMonitoringPolicyServers

func (api *API) ListMonitoringPolicyServers(mp_id string) ([]Identity, error)

GET /monitoring_policies/{id}/servers

func (*API) ListMonitoringServersUsages

func (api *API) ListMonitoringServersUsages(args ...interface{}) ([]MonServerUsageSummary, error)

GET /monitoring_center

func (*API) ListPrivateNetworkServers

func (api *API) ListPrivateNetworkServers(pn_id string) ([]Identity, error)

GET /private_networks/{id}/servers

func (*API) ListPrivateNetworks

func (api *API) ListPrivateNetworks(args ...interface{}) ([]PrivateNetwork, error)

GET /private_networks

func (*API) ListPublicIps

func (api *API) ListPublicIps(args ...interface{}) ([]PublicIp, error)

GET /public_ips

func (*API) ListRecoveryAppliances added in v1.2.1

func (api *API) ListRecoveryAppliances(args ...interface{}) ([]RecoveryAppliance, error)

GET /recovery_appliances

func (*API) ListRoleUsers

func (api *API) ListRoleUsers(role_id string) ([]Identity, error)

GET /roles/{role_id}/users

func (*API) ListRoles

func (api *API) ListRoles(args ...interface{}) ([]Role, error)

GET /roles

func (*API) ListSSHKeys added in v1.2.0

func (api *API) ListSSHKeys(args ...interface{}) ([]SSHKey, error)

func (*API) ListServerAppliances

func (api *API) ListServerAppliances(args ...interface{}) ([]ServerAppliance, error)

GET /server_appliances

func (*API) ListServerHdds

func (api *API) ListServerHdds(server_id string) ([]Hdd, error)

GET /servers/{id}/hardware/hdds

func (*API) ListServerIpLoadBalancers

func (api *API) ListServerIpLoadBalancers(server_id string, ip_id string) ([]Identity, error)

GET /servers/{server_id}/ips/{ip_id}/load_balancers

func (*API) ListServerIps

func (api *API) ListServerIps(server_id string) ([]ServerIp, error)

GET /servers/{id}/ips

func (*API) ListServerPrivateNetworks

func (api *API) ListServerPrivateNetworks(server_id string) ([]Identity, error)

GET /servers/{id}/private_networks

func (*API) ListServers

func (api *API) ListServers(args ...interface{}) ([]Server, error)

GET /servers

func (*API) ListSharedStorageServers

func (api *API) ListSharedStorageServers(st_id string) ([]SharedStorageServer, error)

GET /shared_storages/{id}/servers

func (*API) ListSharedStorages

func (api *API) ListSharedStorages(args ...interface{}) ([]SharedStorage, error)

GET /shared_storages

func (*API) ListUsages

func (api *API) ListUsages(period string, sd *time.Time, ed *time.Time, args ...interface{}) (*Usages, error)

GET /usages

func (*API) ListUserApiAllowedIps

func (api *API) ListUserApiAllowedIps(user_id string) ([]string, error)

GET /users/{id}/api/ips

func (*API) ListUsers

func (api *API) ListUsers(args ...interface{}) ([]User, error)

GET /users

func (*API) ListVPNs

func (api *API) ListVPNs(args ...interface{}) ([]VPN, error)

GET /vpns

func (*API) LoadServerDvd

func (api *API) LoadServerDvd(server_id string, dvd_id string) (*Server, error)

PUT /servers/{id}/dvd

func (*API) ModifyMonitoringPolicyPort

func (api *API) ModifyMonitoringPolicyPort(mp_id string, port_id string, mp_port *MonitoringPort) (*MonitoringPolicy, error)

PUT /monitoring_policies/{id}/ports/{id}

func (*API) ModifyMonitoringPolicyProcess

func (api *API) ModifyMonitoringPolicyProcess(mp_id string, proc_id string, mp_proc *MonitoringProcess) (*MonitoringPolicy, error)

PUT /monitoring_policies/{id}/processes/{id}

func (*API) ModifyRole

func (api *API) ModifyRole(role_id string, name string, description string, state string) (*Role, error)

PUT /roles/{role_id}

func (*API) ModifyRolePermissions

func (api *API) ModifyRolePermissions(role_id string, perm *Permissions) (*Role, error)

PUT /roles/{role_id}/permissions

func (*API) ModifyUser

func (api *API) ModifyUser(user_id string, user *UserRequest) (*User, error)

PUT /users/{id}

func (*API) ModifyUserApi

func (api *API) ModifyUserApi(user_id string, active bool) (*User, error)

PUT /users/{id}/api

func (*API) ModifyVPN

func (api *API) ModifyVPN(vpn_id string, name string, description string) (*VPN, error)

PUT /vpns/{vpn_id}

func (*API) Ping

func (api *API) Ping() ([]string, error)

GET /ping Returns "PONG" if API is running

func (*API) PingAuth

func (api *API) PingAuth() ([]string, error)

GET /ping_auth Returns "PONG" if the API is running and the authentication token is valid

func (*API) RebootServer

func (api *API) RebootServer(server_id string, is_hardware bool) (*Server, error)

PUT /servers/{id}/status/action (action = REBOOT)

func (*API) RecoveryRebootServer added in v1.2.1

func (api *API) RecoveryRebootServer(server_id string, is_hardware bool, recovery_image_id string) (*Server, error)

PUT /servers/{id}/status/action (action = REBOOT)

func (*API) ReinstallServerImage

func (api *API) ReinstallServerImage(server_id string, image_id string, password string, fp_id string) (*Server, error)

PUT /servers/{id}/image

func (*API) RemoveBlockStorageServer added in v1.2.0

func (api *API) RemoveBlockStorageServer(blockStorageId string, serverId string) (*BlockStorage, error)

func (*API) RemoveMonitoringPolicyServer

func (api *API) RemoveMonitoringPolicyServer(mp_id string, ser_id string) (*MonitoringPolicy, error)

DELETE /monitoring_policies/{id}/servers/{id}

func (*API) RemoveRoleUser

func (api *API) RemoveRoleUser(role_id string, user_id string) (*Role, error)

DELETE /roles/{role_id}/users/{user_id}

func (*API) RemoveServerPrivateNetwork

func (api *API) RemoveServerPrivateNetwork(server_id string, pn_id string) (*Server, error)

DELETE /servers/{id}/private_networks/{id}

func (*API) RemoveUserApiAllowedIp

func (api *API) RemoveUserApiAllowedIp(user_id string, ip string) (*User, error)

DELETE /users/{id}/api/ips/{ip}

func (*API) RenameSSHKey added in v1.2.0

func (api *API) RenameSSHKey(id string, new_name string, new_desc string) (*SSHKey, error)

func (*API) RenameServer

func (api *API) RenameServer(server_id string, new_name string, new_desc string) (*Server, error)

PUT /servers/{id}

func (*API) RenewUserApiKey

func (api *API) RenewUserApiKey(user_id string) (*User, error)

PUT /users/{id}/api/key

func (*API) ResizeServerHdd

func (api *API) ResizeServerHdd(server_id string, hdd_id string, new_size int) (*Server, error)

PUT /servers/{id}/hardware/hdds/{id}

func (*API) RestoreServerSnapshot

func (api *API) RestoreServerSnapshot(server_id string, snapshot_id string) (*Server, error)

PUT /servers/{server_id}/snapshots/{snapshot_id}

func (*API) ShutdownServer

func (api *API) ShutdownServer(server_id string, is_hardware bool) (*Server, error)

PUT /servers/{id}/status/action (action = POWER_OFF)

func (*API) StartServer

func (api *API) StartServer(server_id string) (*Server, error)

PUT /servers/{id}/status/action (action = POWER_ON)

func (*API) UnassignServerIpLoadBalancer

func (api *API) UnassignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error)

DELETE /servers/{server_id}/ips/{ip_id}/load_balancers

func (*API) UpdateBlockStorage added in v1.3.5

func (api *API) UpdateBlockStorage(id string, request *UpdateBlockStorageRequest) (*BlockStorage, error)

func (*API) UpdateFirewallPolicy

func (api *API) UpdateFirewallPolicy(fp_id string, fp_new_name string, fp_new_desc string) (*FirewallPolicy, error)

PUT /firewall_policies/{id}

func (*API) UpdateImage

func (api *API) UpdateImage(img_id string, request *UpdateImageRequest) (*Image, error)

PUT /images/{id}

func (*API) UpdateLoadBalancer

func (api *API) UpdateLoadBalancer(lb_id string, request *LoadBalancerRequest) (*LoadBalancer, error)

PUT /load_balancers/{id}

func (*API) UpdateMonitoringPolicy

func (api *API) UpdateMonitoringPolicy(mp_id string, mp *MonitoringPolicy) (*MonitoringPolicy, error)

PUT /monitoring_policies/{id}

func (*API) UpdatePrivateNetwork

func (api *API) UpdatePrivateNetwork(pn_id string, request *PrivateNetworkRequest) (*PrivateNetwork, error)

PUT /private_networks/{id}

func (*API) UpdatePublicIp

func (api *API) UpdatePublicIp(ip_id string, reverse_dns string) (*PublicIp, error)

PUT /public_ips/{id}

func (*API) UpdateServerHardware

func (api *API) UpdateServerHardware(server_id string, hardware *Hardware) (*Server, error)

PUT /servers/{server_id}/hardware

func (*API) UpdateSharedStorage

func (api *API) UpdateSharedStorage(ss_id string, request *SharedStorageRequest) (*SharedStorage, error)

PUT /shared_storages/{id}

func (*API) UpdateSharedStorageCredentials

func (api *API) UpdateSharedStorageCredentials(new_pass string) ([]SharedStorageAccess, error)

PUT /shared_storages/access

func (*API) WaitForState

func (api *API) WaitForState(in ApiInstance, state string, sec time.Duration, count int) error

Performs busy-waiting for types that implement ApiInstance interface.

func (*API) WaitUntilDeleted

func (api *API) WaitUntilDeleted(in ApiInstance) error

Waits until instance is deleted for types that implement ApiInstance interface.

type ApiError added in v1.3.6

type ApiError struct {
	// contains filtered or unexported fields
}

func (ApiError) Error added in v1.3.6

func (e ApiError) Error() string

func (*ApiError) HttpStatusCode added in v1.3.6

func (e *ApiError) HttpStatusCode() int

func (*ApiError) Message added in v1.3.6

func (e *ApiError) Message() string

type ApiInstance

type ApiInstance interface {
	GetState() (string, error)
}

type ApiPtr

type ApiPtr struct {
	// contains filtered or unexported fields
}

type BackupPerm

type BackupPerm struct {
	Create bool `json:"create"`
	Delete bool `json:"delete"`
	Show   bool `json:"show"`
}

func (*BackupPerm) SetAll

func (bp *BackupPerm) SetAll(value bool)

Sets all backups' permissions

type BaremetalHardware added in v1.2.1

type BaremetalHardware struct {
	Cores             int     `json:"core,omitempty"`
	CoresPerProcessor int     `json:"cores_per_processor"`
	Ram               float32 `json:"ram"`
	Unit              string  `json:"unit,omitempty"`
	Hdds              []Hdd   `json:"hdds,omitempty"`
	ApiPtr
}

type BaremetalModel added in v1.2.1

type BaremetalModel struct {
	ApiPtr
	Identity

	Hardware *BaremetalHardware `json:"hardware,omitempty"`
	// contains filtered or unexported fields
}

type BlockStorage added in v1.2.0

type BlockStorage struct {
	Identity

	Size  int    `json:"size"`
	State string `json:"state,omitempty"`
	// Name         string              `json:"name,omitempty"`
	CreationDate time.Time           `json:"creation_date,omitempty"`
	Datacenter   *Datacenter         `json:"datacenter,omitempty"`
	Server       *BlockStorageServer `json:"server,omitempty"`
	DiskID       string              `json:"disk_id,omitemtpy"`
	UUID         string              `json:"uuid,omitemtpy"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*BlockStorage) GetState added in v1.2.0

func (bs *BlockStorage) GetState() (string, error)

type BlockStorageRequest added in v1.2.0

type BlockStorageRequest struct {
	Name           string `json:"name"`
	Description    string `json:"description,omitempty"`
	Size           *int   `json:"size"`
	ServerId       string `json:"server,omitempty"`
	DatacenterId   string `json:"datacenter_id,omitempty"`
	ExecutionGroup string `json:"execution_group,omitempty"`
}

type BlockStorageServer added in v1.2.0

type BlockStorageServer struct {
	Id       string `json:"id,omitempty"`
	ServerId string `json:"server,omitempty"`
	Name     string `json:"name,omitempty"`
}

type Datacenter

type Datacenter struct {
	CountryCode string `json:"country_code,omitempty"`
	Location    string `json:"location,omitempty"`
	// contains filtered or unexported fields
}

type DvdIso

type DvdIso struct {
	Identity
	OsFamily             string      `json:"os_family,omitempty"`
	Os                   string      `json:"os,omitempty"`
	OsVersion            string      `json:"os_version,omitempty"`
	Type                 string      `json:"type,omitempty"`
	AvailableDatacenters []string    `json:"available_datacenters,omitempty"`
	Architecture         interface{} `json:"os_architecture,omitempty"`
	ApiPtr
}

Struct to describe a ISO image that can be used to boot a server.

Values of this type describe ISO images that can be inserted into the servers virtual DVD drive.

type FirewallPerm

type FirewallPerm struct {
	Clone                   bool `json:"clone"`
	Create                  bool `json:"create"`
	Delete                  bool `json:"delete"`
	ManageAttachedServerIPs bool `json:"manage_attached_server_ips"`
	ManageRules             bool `json:"manage_rules"`
	SetDescription          bool `json:"set_description"`
	SetName                 bool `json:"set_name"`
	Show                    bool `json:"show"`
}

func (*FirewallPerm) SetAll

func (fp *FirewallPerm) SetAll(value bool)

Sets all firewall policies' permissions

type FirewallPolicy

type FirewallPolicy struct {
	Identity

	DefaultPolicy uint8                `json:"default"`
	CreationDate  string               `json:"creation_date,omitempty"`
	State         string               `json:"state,omitempty"`
	Rules         []FirewallPolicyRule `json:"rules,omitempty"`
	ServerIps     []ServerIpInfo       `json:"server_ips,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*FirewallPolicy) GetState

func (fp *FirewallPolicy) GetState() (string, error)

type FirewallPolicyRequest

type FirewallPolicyRequest struct {
	Name        string               `json:"name,omitempty"`
	Description string               `json:"description,omitempty"`
	Rules       []FirewallPolicyRule `json:"rules,omitempty"`
}

type FirewallPolicyRule

type FirewallPolicyRule struct {
	Protocol    string `json:"protocol,omitempty"`
	PortFrom    *int   `json:"port_from,omitempty"`
	PortTo      *int   `json:"port_to,omitempty"`
	Port        string `json:"port,omitempty"`
	Action      string `json:"action,omitempty"`
	Description string `json:"description,omitempty"`
	SourceIp    string `json:"source,omitempty"`
	// contains filtered or unexported fields
}

type FixedInstanceInfo

type FixedInstanceInfo struct {
	Identity
	Hardware *Hardware `json:"hardware,omitempty"`
	ApiPtr
}

type Hardware

type Hardware struct {
	Vcores            int         `json:"vcore,omitempty"`
	CoresPerProcessor int         `json:"cores_per_processor"`
	Ram               float32     `json:"ram"`
	Hdds              []Hdd       `json:"hdds,omitempty"`
	FixedInsSizeId    string      `json:"fixed_instance_size_id,omitempty"`
	BaremetalModelId  interface{} `json:"baremetal_model_id,omitempty"`
	ApiPtr
}

type Hdd

type Hdd struct {
	Size   int    `json:"size,omitempty"`
	IsMain bool   `json:"is_main"`
	Unit   string `json:"unit,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

type IPPerm

type IPPerm struct {
	Create        bool `json:"create"`
	Delete        bool `json:"delete"`
	Release       bool `json:"release"`
	SetReverseDNS bool `json:"set_reverse_dns"`
	Show          bool `json:"show"`
}

func (*IPPerm) SetAll

func (ipp *IPPerm) SetAll(value bool)

Sets all IPs' permissions

type Identity

type Identity struct {
	// contains filtered or unexported fields
}

type Image

type Image struct {
	MinHddSize   int         `json:"min_hdd_size"`
	Architecture *int        `json:"architecture,omitempty"`
	NumImages    *int        `json:"num_images,omitempty"`
	Frequency    string      `json:"frequency,omitempty"`
	ServerId     string      `json:"server_id,omitempty"`
	CreationDate string      `json:"creation_date,omitempty"`
	State        string      `json:"state,omitempty"`
	OsImageType  string      `json:"os_image_type,omitempty"`
	Os           string      `json:"os,omitempty"`
	OsFamily     string      `json:"os_family,omitempty"`
	OsVersion    string      `json:"os_version,omitempty"`
	Type         string      `json:"type,omitempty"`
	Licenses     []License   `json:"licenses,omitempty"`
	Hdds         []Hdd       `json:"hdds,omitempty"`
	Datacenter   *Datacenter `json:"datacenter,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*Image) GetState

func (im *Image) GetState() (string, error)

type ImageOs added in v1.1.0

type ImageOs struct {
	Architecture *int   `json:"architecture,omitempty"`
	Os           string `json:"os,omitempty"`
	OsFamily     string `json:"os_family,omitempty"`
	OsVersion    string `json:"os_version,omitempty"`
	// contains filtered or unexported fields
}

type ImagePerm

type ImagePerm struct {
	Create            bool `json:"create"`
	Delete            bool `json:"delete"`
	DisableAutoCreate bool `json:"disable_automatic_creation"`
	SetDescription    bool `json:"set_description"`
	SetName           bool `json:"set_name"`
	Show              bool `json:"show"`
}

func (*ImagePerm) SetAll

func (imp *ImagePerm) SetAll(value bool)

Sets all images' permissions

type ImageRequest added in v1.1.0

type ImageRequest struct {
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Frequency    string `json:"frequency,omitempty"`
	ServerId     string `json:"server_id,omitempty"`
	DatacenterId string `json:"datacenter_id,omitempty"`
	Source       string `json:"source,omitempty"`
	Url          string `json:"url,omitempty"`
	OsId         string `json:"os_id,omitempty"`
	Type         string `json:"type,omitempty"`
	NumImages    *int   `json:"num_images,omitempty"`
}

type InvoicePerm

type InvoicePerm struct {
	Show bool `json:"show"`
}

func (*InvoicePerm) SetAll

func (inp *InvoicePerm) SetAll(value bool)

Sets all invoice's permissions

type License

type License struct {
	// contains filtered or unexported fields
}

type LoadBalancer

type LoadBalancer struct {
	ApiPtr

	Name                  string             `json:"name,omitempty"`
	Description           string             `json:"description,omitempty"`
	State                 string             `json:"state,omitempty"`
	CreationDate          string             `json:"creation_date,omitempty"`
	Ip                    string             `json:"ip,omitempty"`
	HealthCheckTest       string             `json:"health_check_test,omitempty"`
	HealthCheckInterval   int                `json:"health_check_interval"`
	HealthCheckPath       string             `json:"health_check_path,omitempty"`
	HealthCheckPathParser string             `json:"health_check_path_parser,omitempty"`
	Persistence           bool               `json:"persistence"`
	PersistenceTime       int                `json:"persistence_time"`
	Method                string             `json:"method,omitempty"`
	Rules                 []LoadBalancerRule `json:"rules,omitempty"`
	ServerIps             []ServerIpInfo     `json:"server_ips,omitempty"`
	Datacenter            *Datacenter        `json:"datacenter,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadBalancer) GetState

func (lb *LoadBalancer) GetState() (string, error)

type LoadBalancerPerm

type LoadBalancerPerm struct {
	Create                  bool `json:"create"`
	Delete                  bool `json:"delete"`
	ManageAttachedServerIPs bool `json:"manage_attached_server_ips"`
	ManageRules             bool `json:"manage_rules"`
	Modify                  bool `json:"modify"`
	SetDescription          bool `json:"set_description"`
	SetName                 bool `json:"set_name"`
	Show                    bool `json:"show"`
}

func (*LoadBalancerPerm) SetAll

func (lbp *LoadBalancerPerm) SetAll(value bool)

Sets all load balancers' permissions

type LoadBalancerRequest

type LoadBalancerRequest struct {
	Name                  string             `json:"name,omitempty"`
	Description           string             `json:"description,omitempty"`
	DatacenterId          string             `json:"datacenter_id,omitempty"`
	HealthCheckTest       string             `json:"health_check_test,omitempty"`
	HealthCheckInterval   *int               `json:"health_check_interval"`
	HealthCheckPath       string             `json:"health_check_path,omitempty"`
	HealthCheckPathParser string             `json:"health_check_path_parser,omitempty"`
	Persistence           *bool              `json:"persistence"`
	PersistenceTime       *int               `json:"persistence_time"`
	Method                string             `json:"method,omitempty"`
	Rules                 []LoadBalancerRule `json:"rules,omitempty"`
}

type LoadBalancerRule

type LoadBalancerRule struct {
	Protocol     string `json:"protocol,omitempty"`
	PortBalancer uint16 `json:"port_balancer"`
	PortServer   uint16 `json:"port_server"`
	Source       string `json:"source,omitempty"`
	// contains filtered or unexported fields
}

type Log

type Log struct {
	ApiPtr

	SiteId    string    `json:"site_id,omitempty"`
	StartDate string    `json:"start_date,omitempty"`
	EndDate   string    `json:"end_date,omitempty"`
	Action    string    `json:"action,omitempty"`
	Duration  int       `json:"duration"`
	Status    *Status   `json:"Status,omitempty"`
	Resource  *Identity `json:"resource,omitempty"`
	User      *Identity `json:"user,omitempty"`
	// contains filtered or unexported fields
}

type LogPerm

type LogPerm struct {
	Show bool `json:"show"`
}

func (*LogPerm) SetAll

func (lp *LogPerm) SetAll(value bool)

Sets all logs' permissions

type MonServerUsageDetails

type MonServerUsageDetails struct {
	Identity
	Status         *statusState       `json:"status,omitempty"`
	Agent          *monitoringAgent   `json:"agent,omitempty"`
	Alerts         *monitoringAlerts  `json:"alerts,omitempty"`
	CpuStatus      *utilizationStatus `json:"cpu,omitempty"`
	DiskStatus     *utilizationStatus `json:"disk,omitempty"`
	RamStatus      *utilizationStatus `json:"ram,omitempty"`
	PingStatus     *pingStatus        `json:"internal_ping,omitempty"`
	TransferStatus *transferStatus    `json:"transfer,omitempty"`
	ApiPtr
}

type MonServerUsageSummary

type MonServerUsageSummary struct {
	Identity
	Agent  *monitoringAgent  `json:"agent,omitempty"`
	Alerts *monitoringAlerts `json:"alerts,omitempty"`
	Status *monitoringStatus `json:"status,omitempty"`
	ApiPtr
}

type MonitorCenterPerm

type MonitorCenterPerm struct {
	Show bool `json:"show"`
}

func (*MonitorCenterPerm) SetAll

func (mcp *MonitorCenterPerm) SetAll(value bool)

Sets all monitoring center's permissions

type MonitorPolicyPerm

type MonitorPolicyPerm struct {
	Clone                 bool `json:"clone"`
	Create                bool `json:"create"`
	Delete                bool `json:"delete"`
	ManageAttachedServers bool `json:"manage_attached_servers"`
	ManagePorts           bool `json:"manage_ports"`
	ManageProcesses       bool `json:"manage_processes"`
	ModifyResources       bool `json:"modify_resources"`
	SetDescription        bool `json:"set_description"`
	SetEmail              bool `json:"set_email"`
	SetName               bool `json:"set_name"`
	Show                  bool `json:"show"`
}

func (*MonitorPolicyPerm) SetAll

func (mpp *MonitorPolicyPerm) SetAll(value bool)

Sets all monitoring policies' permissions

type MonitoringLevel

type MonitoringLevel struct {
	Warning  *MonitoringValue `json:"warning,omitempty"`
	Critical *MonitoringValue `json:"critical,omitempty"`
}

type MonitoringPolicy

type MonitoringPolicy struct {
	ApiPtr

	Name         string               `json:"name,omitempty"`
	Description  string               `json:"description,omitempty"`
	State        string               `json:"state,omitempty"`
	Default      *int                 `json:"default,omitempty"`
	CreationDate string               `json:"creation_date,omitempty"`
	Email        string               `json:"email,omitempty"`
	Agent        bool                 `json:"agent"`
	Servers      []Identity           `json:"servers,omitempty"`
	Thresholds   *MonitoringThreshold `json:"thresholds,omitempty"`
	Ports        []MonitoringPort     `json:"ports,omitempty"`
	Processes    []MonitoringProcess  `json:"processes,omitempty"`
	// contains filtered or unexported fields
}

func (*MonitoringPolicy) GetState

func (mp *MonitoringPolicy) GetState() (string, error)

type MonitoringPort

type MonitoringPort struct {
	Protocol          string `json:"protocol,omitempty"`
	Port              int    `json:"port"`
	AlertIf           string `json:"alert_if,omitempty"`
	EmailNotification bool   `json:"email_notification"`
	// contains filtered or unexported fields
}

type MonitoringProcess

type MonitoringProcess struct {
	Process           string `json:"process,omitempty"`
	AlertIf           string `json:"alert_if,omitempty"`
	EmailNotification bool   `json:"email_notification"`
	// contains filtered or unexported fields
}

type MonitoringThreshold

type MonitoringThreshold struct {
	Cpu          *MonitoringLevel `json:"cpu,omitempty"`
	Ram          *MonitoringLevel `json:"ram,omitempty"`
	Disk         *MonitoringLevel `json:"disk,omitempty"`
	Transfer     *MonitoringLevel `json:"transfer,omitempty"`
	InternalPing *MonitoringLevel `json:"internal_ping,omitempty"`
}

type MonitoringValue

type MonitoringValue struct {
	Value int  `json:"value"`
	Alert bool `json:"alert"`
}

type Os added in v1.2.1

type Os struct {
	Architecture int    `json:"architecture,omitempty"`
	Family       string `json:"family,omitempty"`
	SubFamily    string `json:"subfamily,omitempty"`
	Name         string `json:"name,omitempty"`
}

type Permissions

type Permissions struct {
	Backups         *BackupPerm         `json:"backups,omitempty"`
	Firewalls       *FirewallPerm       `json:"firewall_policies,omitempty"`
	Images          *ImagePerm          `json:"images,omitempty"`
	Invoice         *InvoicePerm        `json:"interactive_invoices,omitempty"`
	IPs             *IPPerm             `json:"public_ips,omitempty"`
	LoadBalancers   *LoadBalancerPerm   `json:"load_balancers,omitempty"`
	Logs            *LogPerm            `json:"logs,omitempty"`
	MonitorCenter   *MonitorCenterPerm  `json:"monitoring_center,omitempty"`
	MonitorPolicies *MonitorPolicyPerm  `json:"monitoring_policies,omitempty"`
	PrivateNetworks *PrivateNetworkPerm `json:"private_networks,omitempty"`
	Roles           *RolePerm           `json:"roles,omitempty"`
	Servers         *ServerPerm         `json:"servers,omitempty"`
	SharedStorage   *SharedStoragePerm  `json:"shared_storages,omitempty"`
	Usages          *UsagePerm          `json:"usages,omitempty"`
	Users           *UserPerm           `json:"users,omitempty"`
	VPNs            *VPNPerm            `json:"vpn,omitempty"`
}

func (*Permissions) SetAll

func (p *Permissions) SetAll(v bool)

Sets all available permissions

type Pricing

type Pricing struct {
	Currency string       `json:"currency,omitempty"`
	Plan     *pricingPlan `json:"pricing_plans,omitempty"`
}

type PrivateNetwork

type PrivateNetwork struct {
	Identity

	NetworkAddress string      `json:"network_address,omitempty"`
	SubnetMask     string      `json:"subnet_mask,omitempty"`
	State          string      `json:"state,omitempty"`
	SiteId         string      `json:"site_id,omitempty"`
	CreationDate   string      `json:"creation_date,omitempty"`
	Servers        []Identity  `json:"servers,omitempty"`
	Datacenter     *Datacenter `json:"datacenter,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*PrivateNetwork) GetState

func (pn *PrivateNetwork) GetState() (string, error)

type PrivateNetworkPerm

type PrivateNetworkPerm struct {
	Create                bool `json:"create"`
	Delete                bool `json:"delete"`
	ManageAttachedServers bool `json:"manage_attached_servers"`
	SetDescription        bool `json:"set_description"`
	SetName               bool `json:"set_name"`
	SetNetworkInfo        bool `json:"set_network_info"`
	Show                  bool `json:"show"`
}

func (*PrivateNetworkPerm) SetAll

func (pnp *PrivateNetworkPerm) SetAll(value bool)

Sets all private networks' permissions

type PrivateNetworkRequest

type PrivateNetworkRequest struct {
	Name           string `json:"name,omitempty"`
	Description    string `json:"description,omitempty"`
	DatacenterId   string `json:"datacenter_id,omitempty"`
	NetworkAddress string `json:"network_address,omitempty"`
	SubnetMask     string `json:"subnet_mask,omitempty"`
}

type PublicIp

type PublicIp struct {
	IpAddress    string      `json:"ip,omitempty"`
	AssignedTo   *assignedTo `json:"assigned_to,omitempty"`
	ReverseDns   string      `json:"reverse_dns,omitempty"`
	IsDhcp       *bool       `json:"is_dhcp,omitempty"`
	State        string      `json:"state,omitempty"`
	SiteId       string      `json:"site_id,omitempty"`
	CreationDate string      `json:"creation_date,omitempty"`
	Datacenter   *Datacenter `json:"datacenter,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*PublicIp) GetState

func (ip *PublicIp) GetState() (string, error)

type RecoveryAppliance added in v1.2.1

type RecoveryAppliance struct {
	Identity
	Os                   Os       `json:"os,omitempty"`
	AvailableDatacenters []string `json:"available_datacenters,omitempty"`
	ApiPtr
}

type Role

type Role struct {
	Identity

	CreationDate string       `json:"creation_date,omitempty"`
	State        string       `json:"state,omitempty"`
	Default      *int         `json:"default,omitempty"`
	Permissions  *Permissions `json:"permissions,omitempty"`
	Users        []Identity   `json:"users,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*Role) GetState

func (role *Role) GetState() (string, error)

type RolePerm

type RolePerm struct {
	Clone          bool `json:"clone"`
	Create         bool `json:"create"`
	Delete         bool `json:"delete"`
	ManageUsers    bool `json:"manage_users"`
	Modify         bool `json:"modify"`
	SetDescription bool `json:"set_description"`
	SetName        bool `json:"set_name"`
	Show           bool `json:"show"`
}

func (*RolePerm) SetAll

func (rp *RolePerm) SetAll(value bool)

Sets all roles' permissions

type SSHKey added in v1.2.0

type SSHKey struct {
	Identity

	State        string       `json:"state,omitempty"`
	Servers      *[]SSHServer `json:"servers,omitempty"`
	Md5          string       `json:"md5,omitempty"`
	PublicKey    string       `json:"public_key,omitempty"`
	CreationDate string       `json:"creation_date,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

type SSHKeyRequest added in v1.2.0

type SSHKeyRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	PublicKey   string `json:"public_key,omitempty"`
}

type SSHServer added in v1.2.0

type SSHServer struct {
	Id   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type Server

type Server struct {
	ApiPtr
	Identity

	CreationDate  string                 `json:"creation_date,omitempty"`
	FirstPassword string                 `json:"first_password,omitempty"`
	ServerType    string                 `json:"server_type,omitempty"`
	Ipv6Range     string                 `json:"ipv6_range,omitempty"`
	Hostname      string                 `json:"hostname,omitempty"`
	Datacenter    *Datacenter            `json:"datacenter,omitempty"`
	Status        *Status                `json:"status,omitempty"`
	Hardware      *Hardware              `json:"hardware,omitempty"`
	Image         *Identity              `json:"image,omitempty"`
	Dvd           *Identity              `json:"dvd,omitempty"`
	MonPolicy     *Identity              `json:"monitoring_policy,omitempty"`
	Snapshot      *ServerSnapshot        `json:"snapshot,omitempty"`
	Ips           []ServerIp             `json:"ips,omitempty"`
	PrivateNets   []ServerPrivateNetwork `json:"private_networks,omitempty"`
	Alerts        *ServerAlerts          `json:"-"`
	AlertsRaw     *json.RawMessage       `json:"alerts,omitempty"`
	// contains filtered or unexported fields
}

func (*Server) GetState

func (s *Server) GetState() (string, error)

type ServerAction

type ServerAction struct {
	Action          string  `json:"action,omitempty"`
	Method          string  `json:"method,omitempty"`
	RecoveryMode    *bool   `json:"recovery_mode,omitempty"`
	RecoveryImageId *string `json:"recovery_image_id,omitempty"`
}

type ServerAlert

type ServerAlert struct {
	Date string `json:"date"`
	// contains filtered or unexported fields
}

type ServerAlerts

type ServerAlerts struct {
	AlertSummary []serverAlertSummary
	AlertDetails *serverAlertDetails
}

type ServerAppliance

type ServerAppliance struct {
	Identity

	OsInstallBase           string      `json:"os_installation_base,omitempty"`
	OsFamily                string      `json:"os_family,omitempty"`
	Os                      string      `json:"os,omitempty"`
	OsVersion               string      `json:"os_version,omitempty"`
	Version                 string      `json:"version,omitempty"`
	ServerTypeCompatibility []string    `json:"server_type_compatibility,omitempty"`
	MinHddSize              int         `json:"min_hdd_size"`
	Architecture            interface{} `json:"os_architecture"`
	Licenses                interface{} `json:"licenses,omitempty"`
	Categories              []string    `json:"categories,omitempty"`
	//	AvailableDatacenters []string  `json:"available_datacenters,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

type ServerHdds

type ServerHdds struct {
	Hdds []Hdd `json:"hdds,omitempty"`
}

type ServerIp

type ServerIp struct {
	Ip            string     `json:"ip,omitempty"`
	ReverseDns    string     `json:"reverse_dns,omitempty"`
	Firewall      *Identity  `json:"firewall_policy,omitempty"`
	LoadBalancers []Identity `json:"load_balancers,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

type ServerIpInfo

type ServerIpInfo struct {
	Ip         string `json:"ip,omitempty"`
	ServerName string `json:"server_name,omitempty"`
	// contains filtered or unexported fields
}

type ServerPerm

type ServerPerm struct {
	AccessKVMConsole bool `json:"access_kvm_console"`
	AssignIP         bool `json:"assign_ip"`
	Clone            bool `json:"clone"`
	Create           bool `json:"create"`
	Delete           bool `json:"delete"`
	ManageDVD        bool `json:"manage_dvd"`
	ManageSnapshot   bool `json:"manage_snapshot"`
	Reinstall        bool `json:"reinstall"`
	Resize           bool `json:"resize"`
	Restart          bool `json:"restart"`
	SetDescription   bool `json:"set_description"`
	SetName          bool `json:"set_name"`
	Show             bool `json:"show"`
	Shutdown         bool `json:"shutdown"`
	Start            bool `json:"start"`
}

func (*ServerPerm) SetAll

func (sp *ServerPerm) SetAll(value bool)

Sets all servers' permissions

type ServerPrivateNetwork added in v1.3.6

type ServerPrivateNetwork struct {
	Identity
	ServerIP string `json:"server_ip,omitempty"`
}

type ServerRequest

type ServerRequest struct {
	Name               string   `json:"name,omitempty"`
	Description        string   `json:"description,omitempty"`
	Hardware           Hardware `json:"hardware"`
	ApplianceId        string   `json:"appliance_id,omitempty"`
	Password           string   `json:"password,omitempty"`
	ServerType         string   `json:"server_type,omitempty"`
	Ipv6Range          string   `json:"ipv6_range,omitempty"`
	Hostname           string   `json:"hostname,omitempty"`
	PowerOn            bool     `json:"power_on"`
	FirewallPolicyId   string   `json:"firewall_policy_id,omitempty"`
	IpId               string   `json:"ip_id,omitempty"`
	LoadBalancerId     string   `json:"load_balancer_id,omitempty"`
	MonitoringPolicyId string   `json:"monitoring_policy_id,omitempty"`
	DatacenterId       string   `json:"datacenter_id,omitempty"`
	SSHKey             string   `json:"rsa_key,omitempty"`
	SSHPassword        *bool    `json:"ssh_password,omitempty"`
	PublicKey          []string `json:"public_key,omitempty"`
	PrivateNetworkId   string   `json:"private_network_id,omitempty"`
}

type ServerSnapshot

type ServerSnapshot struct {
	CreationDate string `json:"creation_date,omitempty"`
	DeletionDate string `json:"deletion_date,omitempty"`
	// contains filtered or unexported fields
}

type SharedStorage

type SharedStorage struct {
	Identity

	Size           int                   `json:"size"`
	MinSizeAllowed int                   `json:"minimum_size_allowed"`
	SizeUsed       string                `json:"size_used,omitempty"`
	State          string                `json:"state,omitempty"`
	SiteId         string                `json:"site_id,omitempty"`
	CifsPath       string                `json:"cifs_path,omitempty"`
	NfsPath        string                `json:"nfs_path,omitempty"`
	CreationDate   string                `json:"creation_date,omitempty"`
	Servers        []SharedStorageServer `json:"servers,omitempty"`
	Datacenter     *Datacenter           `json:"datacenter,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*SharedStorage) GetState

func (ss *SharedStorage) GetState() (string, error)

type SharedStorageAccess

type SharedStorageAccess struct {
	State               string `json:"state,omitempty"`
	KerberosContentFile string `json:"kerberos_content_file,omitempty"`
	UserDomain          string `json:"user_domain,omitempty"`
	SiteId              string `json:"site_id,omitempty"`
	NeedsPasswordReset  int    `json:"needs_password_reset"`
}

type SharedStoragePerm

type SharedStoragePerm struct {
	Access                bool `json:"access"`
	Create                bool `json:"create"`
	Delete                bool `json:"delete"`
	ManageAttachedServers bool `json:"manage_attached_servers"`
	Resize                bool `json:"resize"`
	SetDescription        bool `json:"set_description"`
	SetName               bool `json:"set_name"`
	Show                  bool `json:"show"`
}

func (*SharedStoragePerm) SetAll

func (ssp *SharedStoragePerm) SetAll(value bool)

Sets all shared storages' permissions

type SharedStorageRequest

type SharedStorageRequest struct {
	DatacenterId string `json:"datacenter_id,omitempty"`
	Name         string `json:"name,omitempty"`
	Description  string `json:"description,omitempty"`
	Size         *int   `json:"size"`
}

type SharedStorageServer

type SharedStorageServer struct {
	Id     string `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	Rights string `json:"rights,omitempty"`
}

type SingleRecoveryAppliance added in v1.2.1

type SingleRecoveryAppliance struct {
	Identity
	Os                   string   `json:"os,omitempty"`
	OsFamily             string   `json:"os_family,omitempty"`
	OsVersion            string   `json:"os_version,omitempty"`
	AvailableDatacenters []string `json:"available_datacenters,omitempty"`
	ApiPtr
}

type Status

type Status struct {
	State   string `json:"state"`
	Percent int    `json:"percent"`
}

Struct to hold the status of an API object.

Values of this type are used to represent the status of API objects like servers, firewall policies and the like.

The value of the "State" field can represent fixed states like "ACTIVE" or "POWERED_ON" but also transitional states like "POWERING_ON" or "CONFIGURING".

For fixed states the "Percent" field is empty where as for transitional states it contains the progress of the transition in percent.

type UpdateBlockStorageRequest added in v1.3.5

type UpdateBlockStorageRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type UpdateImageRequest added in v1.3.4

type UpdateImageRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Frequency   string `json:"frequency,omitempty"`
}

type UsagePerm

type UsagePerm struct {
	Show bool `json:"show"`
}

func (*UsagePerm) SetAll

func (up *UsagePerm) SetAll(value bool)

Sets all usages' permissions

type Usages

type Usages struct {
	Images         []usage `json:"IMAGES,omitempty"`
	LoadBalancers  []usage `json:"LOAD BALANCERS,omitempty"`
	PublicIPs      []usage `json:"PUBLIC IP,omitempty"`
	Servers        []usage `json:"SERVERS,omitempty"`
	SharedStorages []usage `json:"SHARED STORAGE,omitempty"`
	ApiPtr
}

type User

type User struct {
	Identity

	CreationDate string    `json:"creation_date,omitempty"`
	Email        string    `json:"email,omitempty"`
	State        string    `json:"state,omitempty"`
	Role         *Identity `json:"role,omitempty"`
	Api          *UserApi  `json:"api,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*User) GetState

func (u *User) GetState() (string, error)

type UserApi

type UserApi struct {
	Active     bool     `json:"active"`
	AllowedIps []string `json:"allowed_ips,omitempty"`
	UserApiKey
	ApiPtr
}

type UserApiKey

type UserApiKey struct {
	Key string `json:"key,omitempty"`
}

type UserPerm

type UserPerm struct {
	ChangeRole     bool `json:"change_role"`
	Create         bool `json:"create"`
	Delete         bool `json:"delete"`
	Disable        bool `json:"disable"`
	Enable         bool `json:"enable"`
	ManageAPI      bool `json:"manage_api"`
	SetDescription bool `json:"set_description"`
	SetEmail       bool `json:"set_email"`
	SetPassword    bool `json:"set_password"`
	Show           bool `json:"show"`
}

func (*UserPerm) SetAll

func (up *UserPerm) SetAll(value bool)

Sets all users' permissions

type UserRequest

type UserRequest struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Password    string `json:"password,omitempty"`
	Email       string `json:"email,omitempty"`
	State       string `json:"state,omitempty"`
}

type VPN

type VPN struct {
	Identity

	CreationDate string      `json:"creation_date,omitempty"`
	State        string      `json:"state,omitempty"`
	IPs          []string    `json:"ips,omitempty"`
	Datacenter   *Datacenter `json:"datacenter,omitempty"`
	ApiPtr
	// contains filtered or unexported fields
}

func (*VPN) GetState

func (vpn *VPN) GetState() (string, error)

type VPNPerm

type VPNPerm struct {
	Create         bool `json:"create"`
	Delete         bool `json:"delete"`
	DownloadFile   bool `json:"download_file"`
	SetDescription bool `json:"set_description"`
	SetName        bool `json:"set_name"`
	Show           bool `json:"show"`
}

func (*VPNPerm) SetAll

func (vpnp *VPNPerm) SetAll(value bool)

Sets all VPNs' permissions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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