github.com/1and1/oneandone-cloudserver-sdk-go@v1.4.1/README.md (about) 1 # 1&1 Cloudserver Go SDK 2 3 The 1&1 Go SDK is a Go library designed for interaction with the 1&1 cloud platform over the REST API. 4 5 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](https://www.1and1.com/cloud-community/). 6 7 ## Table of Contents 8 9 - [Overview](#overview) 10 - [Getting Started](#getting-started) 11 - [Installation](#installation) 12 - [Authentication](#authentication) 13 - [Operations](#operations) 14 - [Servers](#servers) 15 - [Images](#images) 16 - [Shared Storages](#shared-storages) 17 - [Firewall Policies](#firewall-policies) 18 - [Load Balancers](#load-balancers) 19 - [Public IPs](#public-ips) 20 - [Private Networks](#private-networks) 21 - [VPNs](#vpns) 22 - [Monitoring Center](#monitoring-center) 23 - [Monitoring Policies](#monitoring-policies) 24 - [Logs](#logs) 25 - [Users](#users) 26 - [Roles](#roles) 27 - [Usages](#usages) 28 - [Server Appliances](#server-appliances) 29 - [Recovery Images](#recovery-images) 30 - [DVD ISO](#dvd-iso) 31 - [Ping](#ping) 32 - [Pricing](#pricing) 33 - [Data Centers](#data-centers) 34 - [Block Storages](#block-storages) 35 - [SSH Keys](#ssh-keys) 36 - [Examples](#examples) 37 - [Index](#index) 38 39 ## Overview 40 41 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. 42 43 For more information on the 1&1 Cloud Server SDK for Go, visit the [Community Portal](https://www.1and1.com/cloud-community/). 44 45 ## Getting Started 46 47 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. 48 49 Install the Go language tools. Find the install package and instructions on the official <a href='https://golang.org/doc/install'>Go website</a>. Make sure that you have set up the `GOPATH` environment variable properly, as indicated in the instructions. 50 51 ### Installation 52 53 The official Go library is available from the 1&1 GitHub account found <a href='https://github.com/1and1/oneandone-cloudserver-sdk-go'>here</a>. 54 55 Use the following Go command to download oneandone-cloudserver-sdk-go to your configured GOPATH: 56 57 `go get github.com/1and1/oneandone-cloudserver-sdk-go` 58 59 Import the library in your Go code: 60 61 `import "github.com/1and1/oneandone-cloudserver-sdk-go"` 62 63 ### Authentication 64 65 Set the authentication token and create the API client: 66 67 ``` 68 token := oneandone.SetToken("82ee732b8d47e451be5c6ad5b7b56c81") 69 api := oneandone.New(token, oneandone.BaseUrl) 70 ``` 71 72 Refer to the [Examples](#examples) and [Operations](#operations) sections for additional information. 73 74 ## Operations 75 76 ### Servers 77 78 **List all servers:** 79 80 `servers, err := api.ListServers()` 81 82 Alternatively, use the method with query parameters. 83 84 `servers, err := api.ListServers(page, per_page, sort, query, fields)` 85 86 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. 87 88 To receive the list of servers sorted in expected order pass a server property (e.g. `"name"`) in `sort` parameter. 89 90 Use `query` parameter to search for a string in the response and return only the server instances that contain it. 91 92 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. 93 94 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 95 96 **Retrieve a single server:** 97 98 `server, err := api.GetServer(server_id)` 99 100 **List fixed-size server templates:** 101 102 `fiss, err := api.ListFixedInstanceSizes()` 103 104 **Retrieve information about a fixed-size server template:** 105 106 `fis, err := api.GetFixedInstanceSize(fis_id)` 107 108 **List bare metal models:** 109 110 `res, err := api.ListBaremetalModels()` 111 112 **Retrieve information about a bare metal model:** 113 114 `bmm, err := api.GetBaremetalModel(baremetalModelId)` 115 116 **Retrieve information about a server's hardware:** 117 118 `hardware, err := api.GetServerHardware(server_id)` 119 120 **List a server's HDDs:** 121 122 `hdds, err := api.ListServerHdds(server_id)` 123 124 **Retrieve a single server HDD:** 125 126 `hdd, err := api.GetServerHdd(server_id, hdd_id)` 127 128 **Retrieve information about a server's image:** 129 130 `image, err := api.GetServerImage(server_id)` 131 132 **List a server's IPs:** 133 134 `ips, err := api.ListServerIps(server_id)` 135 136 **Retrieve information about a single server IP:** 137 138 `ip, err := api.GetServerIp(server_id, ip_id)` 139 140 **Retrieve information about a server's firewall policy:** 141 142 `firewall, err := api.GetServerIpFirewallPolicy(server_id, ip_id)` 143 144 **List all load balancers assigned to a server IP:** 145 146 `lbs, err := api.ListServerIpLoadBalancers(server_id, ip_id)` 147 148 **Retrieve information about a server's status:** 149 150 `status, err := api.GetServerStatus(server_id)` 151 152 **Retrieve information about the DVD loaded into the virtual DVD unit of a server:** 153 154 `dvd, err := api.GetServerDvd(server_id)` 155 156 **List a server's private networks:** 157 158 `pns, err := api.ListServerPrivateNetworks(server_id)` 159 160 **Retrieve information about a server's private network:** 161 162 `pn, err := api.GetServerPrivateNetwork(server_id, pn_id)` 163 164 **Retrieve information about a server's snapshot:** 165 166 `snapshot, err := api.GetServerSnapshot(server_id)` 167 168 **Create a cloud server:** 169 170 ``` 171 req := oneandone.ServerRequest { 172 Name: "Server Name", 173 Description: "Server description.", 174 ApplianceId: server_appliance_id, 175 PowerOn: true, 176 ServerType: "cloud", 177 Hardware: oneandone.Hardware { 178 Vcores: 1, 179 CoresPerProcessor: 1, 180 Ram: 2, 181 Hdds: []oneandone.Hdd { 182 oneandone.Hdd { 183 Size: 100, 184 IsMain: true, 185 }, 186 }, 187 }, 188 } 189 190 server_id, server, err := api.CreateServer(&req) 191 ``` 192 193 **Create a bare metal server:** 194 195 ``` 196 req := oneandone.ServerRequest { 197 Name: "Server Name", 198 Description: "Server description.", 199 ApplianceId: server_appliance_id, 200 PowerOn: true, 201 ServerType: "baremetal", 202 Hardware: oneandone.Hardware { 203 BaremetalModelId: "baremetal_model_id" 204 }, 205 }, 206 } 207 208 server_id, server, err := api.CreateServer(&req) 209 ``` 210 211 **Create a fixed-size server and return back the server's IP address and first password:** 212 213 ``` 214 req := oneandone.ServerRequest { 215 Name: server_name, 216 ApplianceId: server_appliance_id, 217 PowerOn: true_or_false, 218 Hardware: oneandone.Hardware { 219 FixedInsSizeId: fixed_instance_size_id, 220 }, 221 } 222 223 ip_address, password, err := api.CreateServerEx(&req, timeout) 224 ``` 225 226 **Update a server:** 227 228 `server, err := api.RenameServer(server_id, new_name, new_desc)` 229 230 **Delete a server:** 231 232 `server, err := api.DeleteServer(server_id, keep_ips)` 233 234 Set `keep_ips` parameter to `true` for keeping server IPs after deleting a server. 235 236 **Update a server's hardware:** 237 238 ``` 239 hardware := oneandone.Hardware { 240 Vcores: 2, 241 CoresPerProcessor: 1, 242 Ram: 2, 243 } 244 245 server, err := api.UpdateServerHardware(server_id, &hardware) 246 ``` 247 248 **Add new hard disk(s) to a server:** 249 250 ``` 251 hdds := oneandone.ServerHdds { 252 Hdds: []oneandone.Hdd { 253 { 254 Size: 50, 255 IsMain: false, 256 }, 257 }, 258 } 259 260 server, err := api.AddServerHdds(server_id, &hdds) 261 ``` 262 263 **Resize a server's hard disk:** 264 265 `server, err := api.ResizeServerHdd(server_id, hdd_id, new_size)` 266 267 **Remove a server's hard disk:** 268 269 `server, err := api.DeleteServerHdd(server_id, hdd_id)` 270 271 **Load a DVD into the virtual DVD unit of a server:** 272 273 `server, err := api.LoadServerDvd(server_id, dvd_id)` 274 275 **Unload a DVD from the virtual DVD unit of a server:** 276 277 `server, err := api.EjectServerDvd(server_id)` 278 279 **Reinstall a new image into a server:** 280 281 `server, err := api.ReinstallServerImage(server_id, image_id, password, fp_id)` 282 283 **Assign a new IP to a server:** 284 285 `server, err := api.AssignServerIp(server_id, ip_type)` 286 287 **Release an IP and optionally remove it from a server:** 288 289 `server, err := api.DeleteServerIp(server_id, ip_id, keep_ip)` 290 291 Set `keep_ip` to true for releasing the IP without removing it. 292 293 **Assign a new firewall policy to a server's IP:** 294 295 `server, err := api.AssignServerIpFirewallPolicy(server_id, ip_id, fp_id)` 296 297 **Remove a firewall policy from a server's IP:** 298 299 `server, err := api.UnassignServerIpFirewallPolicy(server_id, ip_id)` 300 301 **Assign a new load balancer to a server's IP:** 302 303 `server, err := api.AssignServerIpLoadBalancer(server_id, ip_id, lb_id)` 304 305 **Remove a load balancer from a server's IP:** 306 307 `server, err := api.UnassignServerIpLoadBalancer(server_id, ip_id, lb_id)` 308 309 **Start a server:** 310 311 `server, err := api.StartServer(server_id)` 312 313 **Reboot a server:** 314 315 `server, err := api.RebootServer(server_id, is_hardware)` 316 317 Set `is_hardware` to true for HARDWARE method of rebooting. 318 319 Set `is_hardware` to false for SOFTWARE method of rebooting. 320 321 **Recovery Reboot a server:** 322 323 `server, err := api.RecoveryRebootServer(server_id, is_hardware, recovery_image_id)` 324 325 Set `is_hardware` to true for HARDWARE method of rebooting. 326 327 Set `is_hardware` to false for SOFTWARE method of rebooting. 328 329 **Shutdown a server:** 330 331 `server, err := api.ShutdownServer(server_id, is_hardware)` 332 333 Set `is_hardware` to true for HARDWARE method of powering off. 334 335 Set `is_hardware` to false for SOFTWARE method of powering off. 336 337 **Assign a private network to a server:** 338 339 `server, err := api.AssignServerPrivateNetwork(server_id, pn_id)` 340 341 **Remove a server's private network:** 342 343 `server, err := api.RemoveServerPrivateNetwork(server_id, pn_id)` 344 345 **Create a new server's snapshot:** 346 347 `server, err := api.CreateServerSnapshot(server_id)` 348 349 **Restore a server's snapshot:** 350 351 `server, err := api.RestoreServerSnapshot(server_id, snapshot_id)` 352 353 **Remove a server's snapshot:** 354 355 `server, err := api.DeleteServerSnapshot(server_id, snapshot_id);` 356 357 **Clone a server:** 358 359 `server, err := api.CloneServer(server_id, new_name)` 360 361 362 ### Images 363 364 **List all images:** 365 366 `images, err = api.ListImages()` 367 368 Alternatively, use the method with query parameters. 369 370 `images, err = api.ListImages(page, per_page, sort, query, fields)` 371 372 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. 373 374 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. 375 376 Use `query` parameter to search for a string in the response and return only the elements that contain it. 377 378 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. 379 380 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 381 382 **Retrieve a single image:** 383 384 `image, err = api.GetImage(image_id)` 385 386 387 **Create an image:** 388 389 ``` 390 request := oneandone.ImageRequest { 391 Name: image_name, 392 Description: image_description, 393 Source: 'server', 394 ServerId: server_id, 395 Frequency: image_frequenct, 396 NumImages: number_of_images, 397 DatacenterId: datacenter_id, 398 } 399 400 image_id, image, err = api.CreateImage(&request) 401 ``` 402 `Description`, `Source` and `DatacenterId` are optional fields when creating a server image. `Frequency` may be set to `"ONCE"`, `"DAILY"` or `"WEEKLY"`. 403 404 Use the same method to import an existing ISO image. 405 406 ``` 407 request := oneandone.ImageRequest { 408 Name: image_name, 409 Description: image_description, 410 Source: 'iso', 411 Url: image_url, 412 Type: image_type, 413 OsId: os_id, 414 DatacenterId: datacenter_id, 415 } 416 ``` 417 `Type` should be set to `os` or `app`. `OsId` is required if the image type is `os`. 418 419 To import a `vdi`, `qcow`, `qcow2`, `vhd`, `vhdx` or `vmdk` image, instantiate the image request as follows: 420 421 ``` 422 request := oneandone.ImageRequest { 423 Name: image_name, 424 Description: image_description, 425 Source: 'image', 426 Url: image_url, 427 OsId: os_id, 428 DatacenterId: datacenter_id, 429 } 430 ``` 431 432 433 **List image OSes:** 434 435 `imageOSes, err = api.ListImageOs()` 436 437 438 **Update an image:** 439 440 441 `image, err = api.UpdateImage(image_id, new_name, new_description, new_frequenct)` 442 443 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"`. 444 445 **Delete an image:** 446 447 `image, err = api.DeleteImage(image_id)` 448 449 ### Shared Storages 450 451 `ss, err := api.ListSharedStorages()` 452 453 Alternatively, use the method with query parameters. 454 455 `ss, err := api.ListSharedStorages(page, per_page, sort, query, fields)` 456 457 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. 458 459 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. 460 461 Use `query` parameter to search for a string in the response and return only the volume instances that contain it. 462 463 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. 464 465 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 466 467 **Retrieve a shared storage:** 468 469 `ss, err := api.GetSharedStorage(ss_id)` 470 471 472 **Create a shared storage:** 473 474 ``` 475 request := oneandone.SharedStorageRequest { 476 Name: test_ss_name, 477 Description: test_ss_desc, 478 Size: oneandone.Int2Pointer(size), 479 } 480 481 ss_id, ss, err := api.CreateSharedStorage(&request) 482 483 ``` 484 `Description` is optional parameter. 485 486 487 **Update a shared storage:** 488 489 ``` 490 request := oneandone.SharedStorageRequest { 491 Name: new_name, 492 Description: new_desc, 493 Size: oneandone.Int2Pointer(new_size), 494 } 495 496 ss, err := api.UpdateSharedStorage(ss_id, &request) 497 ``` 498 All request's parameters are optional. 499 500 501 **Remove a shared storage:** 502 503 `ss, err := api.DeleteSharedStorage(ss_id)` 504 505 506 **List a shared storage servers:** 507 508 `ss_servers, err := api.ListSharedStorageServers(ss_id)` 509 510 511 **Retrieve a shared storage server:** 512 513 `ss_server, err := api.GetSharedStorageServer(ss_id, server_id)` 514 515 516 **Add servers to a shared storage:** 517 518 ``` 519 servers := []oneandone.SharedStorageServer { 520 { 521 Id: server_id, 522 Rights: permissions, 523 } , 524 } 525 526 ss, err := api.AddSharedStorageServers(ss_id, servers) 527 ``` 528 `Rights` may be set to `R` or `RW` string. 529 530 531 **Remove a server from a shared storage:** 532 533 `ss, err := api.DeleteSharedStorageServer(ss_id, server_id)` 534 535 536 **Retrieve the credentials for accessing the shared storages:** 537 538 `ss_credentials, err := api.GetSharedStorageCredentials()` 539 540 541 **Change the password for accessing the shared storages:** 542 543 `ss_credentials, err := api.UpdateSharedStorageCredentials(new_password)` 544 545 546 ### Firewall Policies 547 548 **List firewall policies:** 549 550 `firewalls, err := api.ListFirewallPolicies()` 551 552 Alternatively, use the method with query parameters. 553 554 `firewalls, err := api.ListFirewallPolicies(page, per_page, sort, query, fields)` 555 556 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. 557 558 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. 559 560 Use `query` parameter to search for a string in the response and return only the firewall policy instances that contain it. 561 562 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. 563 564 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 565 566 **Retrieve a single firewall policy:** 567 568 `firewall, err := api.GetFirewallPolicy(fp_id)` 569 570 571 **Create a firewall policy:** 572 573 ``` 574 request := oneandone.FirewallPolicyRequest { 575 Name: fp_name, 576 Description: fp_desc, 577 Rules: []oneandone.FirewallPolicyRule { 578 { 579 Protocol: protocol, 580 Port: "80", 581 Action: "allow", 582 SourceIp: source_ip, 583 }, 584 }, 585 } 586 587 firewall_id, firewall, err := api.CreateFirewallPolicy(&request) 588 ``` 589 `SourceIp` and `Description` are optional parameters. 590 591 592 **Update a firewall policy:** 593 594 `firewall, err := api.UpdateFirewallPolicy(fp_id, fp_new_name, fp_new_description)` 595 596 Passing an empty string in `fp_new_name` or `fp_new_description` skips updating the firewall policy name or description respectively. 597 598 599 **Delete a firewall policy:** 600 601 `firewall, err := api.DeleteFirewallPolicy(fp_id)` 602 603 604 **List servers/IPs attached to a firewall policy:** 605 606 `server_ips, err := api.ListFirewallPolicyServerIps(fp_id)` 607 608 609 **Retrieve information about a server/IP assigned to a firewall policy:** 610 611 `server_ip, err := api.GetFirewallPolicyServerIp(fp_id, ip_id)` 612 613 614 **Add servers/IPs to a firewall policy:** 615 616 `firewall, err := api.AddFirewallPolicyServerIps(fp_id, ip_ids)` 617 618 `ip_ids` is a slice of IP ID's. 619 620 621 **Remove a server/IP from a firewall policy:** 622 623 `firewall, err := api.DeleteFirewallPolicyServerIp(fp_id, ip_id)` 624 625 626 **List rules of a firewall policy:** 627 628 `fp_rules, err := api.ListFirewallPolicyRules(fp_id)` 629 630 631 **Retrieve information about a rule of a firewall policy:** 632 633 `fp_rule, err := api.GetFirewallPolicyRule(fp_id, rule_id)` 634 635 636 **Adds new rules to a firewall policy:** 637 638 ``` 639 fp_rules := []oneandone.FirewallPolicyRule { 640 { 641 Protocol: protocol1, 642 Port: "80", 643 SourceIp: source_ip, 644 }, 645 { 646 Protocol: protocol2, 647 Port: "4000-5000", 648 Action: "allow", 649 }, 650 } 651 652 firewall, err := api.AddFirewallPolicyRules(fp_id, fp_rules) 653 ``` 654 655 **Remove a rule from a firewall policy:** 656 657 `firewall, err := api.DeleteFirewallPolicyRule(fp_id, rule_id)` 658 659 660 ### Load Balancers 661 662 **List load balancers:** 663 664 `loadbalancers, err := api.ListLoadBalancers()` 665 666 Alternatively, use the method with query parameters. 667 668 `loadbalancers, err := api.ListLoadBalancers(page, per_page, sort, query, fields)` 669 670 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. 671 672 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. 673 674 Use `query` parameter to search for a string in the response and return only the load balancer instances that contain it. 675 676 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. 677 678 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 679 680 **Retrieve a single load balancer:** 681 682 `loadbalancer, err := api.GetLoadBalancer(lb_id)` 683 684 685 **Create a load balancer:** 686 687 ``` 688 request := oneandone.LoadBalancerRequest { 689 Name: lb_name, 690 Description: lb_description, 691 Method: lb_method, 692 Persistence: oneandone.Bool2Pointer(true_or_false), 693 PersistenceTime: oneandone.Int2Pointer(seconds1), 694 HealthCheckTest: protocol1, 695 HealthCheckInterval: oneandone.Int2Pointer(seconds2), 696 HealthCheckPath: health_check_path, 697 HealthCheckPathParser: health_check_path_parser, 698 Rules: []oneandone.LoadBalancerRule { 699 { 700 Protocol: protocol1, 701 PortBalancer: lb_port, 702 PortServer: server_port, 703 Source: source_ip, 704 }, 705 }, 706 } 707 708 loadbalancer_id, loadbalancer, err := api.CreateLoadBalancer(&request) 709 ``` 710 Optional parameters are `HealthCheckPath`, `HealthCheckPathParser`, `Source` and `Description`. Load balancer `Method` must be set to `"ROUND_ROBIN"` or `"LEAST_CONNECTIONS"`. 711 712 **Update a load balancer:** 713 ``` 714 request := oneandone.LoadBalancerRequest { 715 Name: new_name, 716 Description: new_description, 717 Persistence: oneandone.Bool2Pointer(true_or_false), 718 PersistenceTime: oneandone.Int2Pointer(new_seconds1), 719 HealthCheckTest: new_protocol, 720 HealthCheckInterval: oneandone.Int2Pointer(new_seconds2), 721 HealthCheckPath: new_path, 722 HealthCheckPathParser: new_parser, 723 Method: new_lb_method, 724 } 725 726 loadbalancer, err := api.UpdateLoadBalancer(lb_id, &request) 727 ``` 728 All updatable fields are optional. 729 730 731 **Delete a load balancer:** 732 733 `loadbalancer, err := api.DeleteLoadBalancer(lb_id)` 734 735 736 **List servers/IPs attached to a load balancer:** 737 738 `server_ips, err := api.ListLoadBalancerServerIps(lb_id)` 739 740 741 **Retrieve information about a server/IP assigned to a load balancer:** 742 743 `server_ip, err := api.GetLoadBalancerServerIp(lb_id, ip_id)` 744 745 746 **Add servers/IPs to a load balancer:** 747 748 `loadbalancer, err := api.AddLoadBalancerServerIps(lb_id, ip_ids)` 749 750 `ip_ids` is a slice of IP ID's. 751 752 753 **Remove a server/IP from a load balancer:** 754 755 `loadbalancer, err := api.DeleteLoadBalancerServerIp(lb_id, ip_id)` 756 757 758 **List rules of a load balancer:** 759 760 `lb_rules, err := api.ListLoadBalancerRules(lb_id)` 761 762 763 **Retrieve information about a rule of a load balancer:** 764 765 `lb_rule, err := api.GetLoadBalancerRule(lb_id, rule_id)` 766 767 768 **Adds new rules to a load balancer:** 769 770 ``` 771 lb_rules := []oneandone.LoadBalancerRule { 772 { 773 Protocol: protocol1, 774 PortBalancer: lb_port1, 775 PortServer: server_port1, 776 Source: source_ip, 777 }, 778 { 779 Protocol: protocol2, 780 PortBalancer: lb_port2, 781 PortServer: server_port2, 782 }, 783 } 784 785 loadbalancer, err := api.AddLoadBalancerRules(lb_id, lb_rules) 786 ``` 787 788 **Remove a rule from a load balancer:** 789 790 `loadbalancer, err := api.DeleteLoadBalancerRule(lb_id, rule_id)` 791 792 793 ### Public IPs 794 795 **Retrieve a list of your public IPs:** 796 797 `public_ips, err := api.ListPublicIps()` 798 799 Alternatively, use the method with query parameters. 800 801 `public_ips, err := api.ListPublicIps(page, per_page, sort, query, fields)` 802 803 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. 804 805 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. 806 807 Use `query` parameter to search for a string in the response and return only the public IP instances that contain it. 808 809 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. 810 811 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 812 813 814 **Retrieve a single public IP:** 815 816 `public_ip, err := api.GetPublicIp(ip_id)` 817 818 819 **Create a public IP:** 820 821 `ip_id, public_ip, err := api.CreatePublicIp(ip_type, reverse_dns)` 822 823 Both parameters are optional and may be left blank. `ip_type` may be set to `"IPV4"` or `"IPV6"`. Presently, only IPV4 is supported. 824 825 **Update the reverse DNS of a public IP:** 826 827 `public_ip, err := api.UpdatePublicIp(ip_id, reverse_dns)` 828 829 If an empty string is passed in `reverse_dns,` it removes previous reverse dns of the public IP. 830 831 **Remove a public IP:** 832 833 `public_ip, err := api.DeletePublicIp(ip_id)` 834 835 836 ### Private Networks 837 838 **List all private networks:** 839 840 `private_nets, err := api.ListPrivateNetworks()` 841 842 Alternatively, use the method with query parameters. 843 844 `private_nets, err := api.ListPrivateNetworks(page, per_page, sort, query, fields)` 845 846 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. 847 848 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. 849 850 Use `query` parameter to search for a string in the response and return only the private network instances that contain it. 851 852 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. 853 854 If any of the parameters `sort`, `query` or `fields` is blank, it is ignored in the request. 855 856 **Retrieve information about a private network:** 857 858 `private_net, err := api.GetPrivateNetwork(pn_id)` 859 860 **Create a new private network:** 861 862 ``` 863 request := oneandone.PrivateNetworkRequest { 864 Name: pn_name, 865 Description: pn_description, 866 NetworkAddress: network_address, 867 SubnetMask: subnet_mask, 868 } 869 870 pnet_id, private_net, err := api.CreatePrivateNetwork(&request) 871 ``` 872 Private network `Name` is required parameter. 873 874 875 **Modify a private network:** 876 877 ``` 878 request := oneandone.PrivateNetworkRequest { 879 Name: new_pn_name, 880 Description: new_pn_description, 881 NetworkAddress: new_network_address, 882 SubnetMask: new_subnet_mask, 883 } 884 885 private_net, err := api.UpdatePrivateNetwork(pn_id, &request) 886 ``` 887 All parameters in the request are optional. 888 889 890 **Delete a private network:** 891 892 `private_net, err := api.DeletePrivateNetwork(pn_id)` 893 894 895 **List all servers attached to a private network:** 896 897 `servers, err = := api.ListPrivateNetworkServers(pn_id)` 898 899 900 **Retrieve a server attached to a private network:** 901 902 `server, err = := api.GetPrivateNetworkServer(pn_id, server_id)` 903 904 905 **Attach servers to a private network:** 906 907 `private_net, err := api.AttachPrivateNetworkServers(pn_id, server_ids)` 908 909 `server_ids` is a slice of server ID's. 910 911 *Note:* Servers cannot be attached to a private network if they currently have a snapshot. 912 913 914 **Remove a server from a private network:** 915 916 `private_net, err := api.DetachPrivateNetworkServer(pn_id, server_id)` 917 918 *Note:* The server cannot be removed from a private network if it currently has a snapshot or it is powered on. 919 920 921 ### VPNs 922 923 **List all VPNs:** 924 925 `vpns, err := api.ListVPNs()` 926 927 Alternatively, use the method with query parameters. 928 929 `vpns, err := api.ListVPNs(page, per_page, sort, query, fields)` 930 931 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. 932 933 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. 934 935 Use `query` parameter to search for a string in the response and return only the VPN instances that contain it. 936 937 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. 938 939 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 940 941 **Retrieve information about a VPN:** 942 943 `vpn, err := api.GetVPN(vpn_id)` 944 945 **Create a VPN:** 946 947 `vpn, err := api.CreateVPN(vpn_name, vpn_description, datacenter_id)` 948 949 **Modify a VPN:** 950 951 `vpn, err := api.ModifyVPN(vpn_id, new_name, new_description)` 952 953 **Delete a VPN:** 954 955 `vpn, err := api.DeleteVPN(vpn_id)` 956 957 **Retrieve a VPN's configuration file:** 958 959 `base64_encoded_string, err := api.GetVPNConfigFile(vpn_id)` 960 961 962 ### Monitoring Center 963 964 **List all usages and alerts of monitoring servers:** 965 966 `server_usages, err := api.ListMonitoringServersUsages()` 967 968 Alternatively, use the method with query parameters. 969 970 `server_usages, err := api.ListMonitoringServersUsages(page, per_page, sort, query, fields)` 971 972 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. 973 974 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. 975 976 Use `query` parameter to search for a string in the response and return only the usage instances that contain it. 977 978 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. 979 980 If any of the parameters `sort`, `query` or `fields` is blank, it is ignored in the request. 981 982 **Retrieve the usages and alerts for a monitoring server:** 983 984 `server_usage, err := api.GetMonitoringServerUsage(server_id, period)` 985 986 `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`). 987 988 `server_usage, err := api.GetMonitoringServerUsage(server_id, period, start_date, end_date)` 989 990 ### Monitoring Policies 991 992 **List all monitoring policies:** 993 994 `mon_policies, err := api.ListMonitoringPolicies()` 995 996 Alternatively, use the method with query parameters. 997 998 `mon_policies, err := api.ListMonitoringPolicies(page, per_page, sort, query, fields)` 999 1000 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. 1001 1002 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. 1003 1004 Use `query` parameter to search for a string in the response and return only the monitoring policy instances that contain it. 1005 1006 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. 1007 1008 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1009 1010 **Retrieve a single monitoring policy:** 1011 1012 `mon_policy, err := api.GetMonitoringPolicy(mp_id)` 1013 1014 1015 **Create a monitoring policy:** 1016 1017 ``` 1018 request := oneandone.MonitoringPolicy { 1019 Name: mp_name, 1020 Description: mp_desc, 1021 Email: mp_mail, 1022 Agent: true_or_false, 1023 Thresholds: &oneandone.MonitoringThreshold { 1024 Cpu: &oneandone.MonitoringLevel { 1025 Warning: &oneandone.MonitoringValue { 1026 Value: threshold_value, 1027 Alert: true_or_false, 1028 }, 1029 Critical: &oneandone.MonitoringValue { 1030 Value: threshold_value, 1031 Alert: true_or_false, 1032 }, 1033 }, 1034 Ram: &oneandone.MonitoringLevel { 1035 Warning: &oneandone.MonitoringValue { 1036 Value: threshold_value, 1037 Alert: true_or_false, 1038 }, 1039 Critical: &oneandone.MonitoringValue { 1040 Value: threshold_value, 1041 Alert: true_or_false, 1042 }, 1043 }, 1044 Disk: &oneandone.MonitoringLevel { 1045 Warning: &oneandone.MonitoringValue { 1046 Value: threshold_value, 1047 Alert: true_or_false, 1048 }, 1049 Critical: &oneandone.MonitoringValue { 1050 Value: threshold_value, 1051 Alert: true_or_false, 1052 }, 1053 }, 1054 Transfer: &oneandone.MonitoringLevel { 1055 Warning: &oneandone.MonitoringValue { 1056 Value: threshold_value, 1057 Alert: true_or_false, 1058 }, 1059 Critical: &oneandone.MonitoringValue { 1060 Value: threshold_value, 1061 Alert: true_or_false, 1062 }, 1063 }, 1064 InternalPing: &oneandone.MonitoringLevel { 1065 Warning: &oneandone.MonitoringValue { 1066 Value: threshold_value, 1067 Alert: true_or_false, 1068 }, 1069 Critical: &oneandone.MonitoringValue { 1070 Value: threshold_value, 1071 Alert: true_or_false, 1072 }, 1073 }, 1074 }, 1075 Ports: []oneandone.MonitoringPort { 1076 { 1077 Protocol: protocol, 1078 Port: port, 1079 AlertIf: responding_or_not_responding, 1080 EmailNotification: true_or_false, 1081 }, 1082 }, 1083 Processes: []oneandone.MonitoringProcess { 1084 { 1085 Process: process_name, 1086 AlertIf: running_or_not_running, 1087 EmailNotification: true_or_false, 1088 }, 1089 }, 1090 } 1091 1092 mpolicy_id, mon_policy, err := api.CreateMonitoringPolicy(&request) 1093 ``` 1094 All fields, except `Description`, are required. `AlertIf` property accepts values `"RESPONDING"`/`"NOT_RESPONDING"` for ports, and `"RUNNING"`/`"NOT_RUNNING"` for processes. 1095 1096 1097 **Update a monitoring policy:** 1098 1099 ``` 1100 request := oneandone.MonitoringPolicy { 1101 Name: new_mp_name, 1102 Description: new_mp_desc, 1103 Email: new_mp_mail, 1104 Thresholds: &oneandone.MonitoringThreshold { 1105 Cpu: &oneandone.MonitoringLevel { 1106 Warning: &oneandone.MonitoringValue { 1107 Value: new_threshold_value, 1108 Alert: true_or_false, 1109 }, 1110 Critical: &oneandone.MonitoringValue { 1111 Value: new_threshold_value, 1112 Alert: true_or_false, 1113 }, 1114 }, 1115 Ram: &oneandone.MonitoringLevel { 1116 Warning: &oneandone.MonitoringValue { 1117 Value: new_threshold_value, 1118 Alert: true_or_false, 1119 }, 1120 Critical: &oneandone.MonitoringValue { 1121 Value: new_threshold_value, 1122 Alert: true_or_false, 1123 }, 1124 }, 1125 Disk: &oneandone.MonitoringLevel { 1126 Warning: &oneandone.MonitoringValue { 1127 Value: new_threshold_value, 1128 Alert: true_or_false, 1129 }, 1130 Critical: &oneandone.MonitoringValue { 1131 Value: new_threshold_value, 1132 Alert: true_or_false, 1133 }, 1134 }, 1135 Transfer: &oneandone.MonitoringLevel { 1136 Warning: &oneandone.MonitoringValue { 1137 Value: new_threshold_value, 1138 Alert: true_or_false, 1139 }, 1140 Critical: &oneandone.MonitoringValue { 1141 Value: new_threshold_value, 1142 Alert: true_or_false, 1143 }, 1144 }, 1145 InternalPing: &oneandone.MonitoringLevel { 1146 Warning: &oneandone.MonitoringValue { 1147 Value: new_threshold_value, 1148 Alert: true_or_false, 1149 }, 1150 Critical: &oneandone.MonitoringValue { 1151 Value: new_threshold_value, 1152 Alert: true_or_false, 1153 }, 1154 }, 1155 }, 1156 } 1157 1158 mon_policy, err := api.UpdateMonitoringPolicy(mp_id, &request) 1159 ``` 1160 All fields of the request are optional. When a threshold is specified in the request, the threshold fields are required. 1161 1162 **Delete a monitoring policy:** 1163 1164 `mon_policy, err := api.DeleteMonitoringPolicy(mp_id)` 1165 1166 1167 **List all ports of a monitoring policy:** 1168 1169 `mp_ports, err := api.ListMonitoringPolicyPorts(mp_id)` 1170 1171 1172 **Retrieve information about a port of a monitoring policy:** 1173 1174 `mp_port, err := api.GetMonitoringPolicyPort(mp_id, port_id)` 1175 1176 1177 **Add new ports to a monitoring policy:** 1178 1179 ``` 1180 mp_ports := []oneandone.MonitoringPort { 1181 { 1182 Protocol: protocol1, 1183 Port: port1, 1184 AlertIf: responding_or_not_responding, 1185 EmailNotification: true_or_false, 1186 }, 1187 { 1188 Protocol: protocol2, 1189 Port: port2, 1190 AlertIf: responding_or_not_responding, 1191 EmailNotification: true_or_false, 1192 }, 1193 } 1194 1195 mon_policy, err := api.AddMonitoringPolicyPorts(mp_id, mp_ports) 1196 ``` 1197 Port properties are mandatory. 1198 1199 1200 **Modify a port of a monitoring policy:** 1201 1202 ``` 1203 mp_port := oneandone.MonitoringPort { 1204 Protocol: protocol, 1205 Port: port, 1206 AlertIf: responding_or_not_responding, 1207 EmailNotification: true_or_false, 1208 } 1209 1210 mon_policy, err := api.ModifyMonitoringPolicyPort(mp_id, port_id, &mp_port) 1211 ``` 1212 *Note:* `Protocol` and `Port` cannot be changed. 1213 1214 1215 **Remove a port from a monitoring policy:** 1216 1217 `mon_policy, err := api.DeleteMonitoringPolicyPort(mp_id, port_id)` 1218 1219 1220 **List the processes of a monitoring policy:** 1221 1222 `mp_processes, err := api.ListMonitoringPolicyProcesses(mp_id)` 1223 1224 1225 **Retrieve information about a process of a monitoring policy:** 1226 1227 `mp_process, err := api.GetMonitoringPolicyProcess(mp_id, process_id)` 1228 1229 1230 **Add new processes to a monitoring policy:** 1231 1232 ``` 1233 processes := []oneandone.MonitoringProcess { 1234 { 1235 Process: process_name1, 1236 AlertIf: running_or_not_running, 1237 EmailNotification: true_or_false, 1238 }, 1239 { 1240 Process: process_name2, 1241 AlertIf: running_or_not_running, 1242 EmailNotification: true_or_false, 1243 }, 1244 } 1245 1246 mon_policy, err := api.AddMonitoringPolicyProcesses(mp_id, processes) 1247 ``` 1248 All properties of the `MonitoringProcess` instance are required. 1249 1250 1251 **Modify a process of a monitoring policy:** 1252 1253 ``` 1254 process := oneandone.MonitoringProcess { 1255 Process: process_name, 1256 AlertIf: running_or_not_running, 1257 EmailNotification: true_or_false, 1258 } 1259 1260 mon_policy, err := api.ModifyMonitoringPolicyProcess(mp_id, process_id, &process) 1261 ``` 1262 1263 *Note:* Process name cannot be changed. 1264 1265 **Remove a process from a monitoring policy:** 1266 1267 `mon_policy, err := api.DeleteMonitoringPolicyProcess(mp_id, process_id)` 1268 1269 **List all servers attached to a monitoring policy:** 1270 1271 `mp_servers, err := api.ListMonitoringPolicyServers(mp_id)` 1272 1273 **Retrieve information about a server attached to a monitoring policy:** 1274 1275 `mp_server, err := api.GetMonitoringPolicyServer(mp_id, server_id)` 1276 1277 **Attach servers to a monitoring policy:** 1278 1279 `mon_policy, err := api.AttachMonitoringPolicyServers(mp_id, server_ids)` 1280 1281 `server_ids` is a slice of server ID's. 1282 1283 **Remove a server from a monitoring policy:** 1284 1285 `mon_policy, err := api.RemoveMonitoringPolicyServer(mp_id, server_id)` 1286 1287 1288 ### Logs 1289 1290 **List all logs:** 1291 1292 `logs, err := api.ListLogs(period, nil, nil)` 1293 1294 `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`). 1295 1296 `logs, err := api.ListLogs(period, start_date, end_date)` 1297 1298 Additional query parameters can be used. 1299 1300 `logs, err := api.ListLogs(period, start_date, end_date, page, per_page, sort, query, fields)` 1301 1302 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. 1303 1304 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. 1305 1306 Use `query` parameter to search for a string in the response and return only the logs instances that contain it. 1307 1308 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. 1309 1310 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1311 1312 **Retrieve a single log:** 1313 1314 `log, err := api.GetLog(log_id)` 1315 1316 1317 ### Users 1318 1319 **List all users:** 1320 1321 `users, err := api.ListUsers()` 1322 1323 Alternatively, use the method with query parameters. 1324 1325 `users, err := api.ListUsers(page, per_page, sort, query, fields)` 1326 1327 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. 1328 1329 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. 1330 1331 Use `query` parameter to search for a string in the response and return only the user instances that contain it. 1332 1333 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. 1334 1335 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1336 1337 **Retrieve information about a user:** 1338 1339 `user, err := api.GetUser(user_id)` 1340 1341 **Create a user:** 1342 1343 ``` 1344 request := oneandone.UserRequest { 1345 Name: username, 1346 Description: user_description, 1347 Password: password, 1348 Email: user_email, 1349 } 1350 1351 user_id, user, err := api.CreateUser(&request) 1352 ``` 1353 1354 `Name` and `Password` are required parameters. The password must contain at least 8 characters using uppercase letters, numbers and other special symbols. 1355 1356 **Modify a user:** 1357 1358 ``` 1359 request := oneandone.UserRequest { 1360 Description: new_desc, 1361 Email: new_mail, 1362 Password: new_pass, 1363 State: state, 1364 } 1365 1366 user, err := api.ModifyUser(user_id, &request) 1367 ``` 1368 1369 All listed fields in the request are optional. `State` can be set to `"ACTIVE"` or `"DISABLED"`. 1370 1371 **Delete a user:** 1372 1373 `user, err := api.DeleteUser(user_id)` 1374 1375 **Retrieve information about a user's API privileges:** 1376 1377 `api_info, err := api.GetUserApi(user_id)` 1378 1379 **Retrieve a user's API key:** 1380 1381 `api_key, err := api.GetUserApiKey(user_id)` 1382 1383 **List IP's from which API access is allowed for a user:** 1384 1385 `allowed_ips, err := api.ListUserApiAllowedIps(user_id)` 1386 1387 **Add new IP's to a user:** 1388 1389 ``` 1390 user_ips := []string{ my_public_ip, "192.168.7.77", "10.81.12.101" } 1391 user, err := api.AddUserApiAlowedIps(user_id, user_ips) 1392 ``` 1393 1394 **Remove an IP and forbid API access from it:** 1395 1396 `user, err := api.RemoveUserApiAllowedIp(user_id, ip)` 1397 1398 **Modify a user's API privileges:** 1399 1400 `user, err := api.ModifyUserApi(user_id, is_active)` 1401 1402 **Renew a user's API key:** 1403 1404 `user, err := api.RenewUserApiKey(user_id)` 1405 1406 **Retrieve current user permissions:** 1407 1408 `permissions, err := api.GetCurrentUserPermissions()` 1409 1410 1411 ### Roles 1412 1413 **List all roles:** 1414 1415 `roles, err := api.ListRoles()` 1416 1417 Alternatively, use the method with query parameters. 1418 1419 `roles, err := api.ListRoles(page, per_page, sort, query, fields)` 1420 1421 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. 1422 1423 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. 1424 1425 Use `query` parameter to search for a string in the response and return only the role instances that contain it. 1426 1427 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. 1428 1429 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1430 1431 **Retrieve information about a role:** 1432 1433 `role, err := api.GetRole(role_id)` 1434 1435 **Create a role:** 1436 1437 `role, err := api.CreateRole(role_name)` 1438 1439 **Clone a role:** 1440 1441 `role, err := api.CloneRole(role_id, new_role_name)` 1442 1443 **Modify a role:** 1444 1445 `role, err := api.ModifyRole(role_id, new_name, new_description, new_state)` 1446 1447 `ACTIVE` and `DISABLE` are valid values for the state. 1448 1449 **Delete a role:** 1450 1451 `role, err := api.DeleteRole(role_id)` 1452 1453 **Retrieve information about a role's permissions:** 1454 1455 `permissions, err := api.GetRolePermissions(role_id)` 1456 1457 **Modify a role's permissions:** 1458 1459 `role, err := api.ModifyRolePermissions(role_id, permissions)` 1460 1461 **Assign users to a role:** 1462 1463 `role, err := api.AssignRoleUsers(role_id, user_ids)` 1464 1465 `user_ids` is a slice of user ID's. 1466 1467 **List a role's users:** 1468 1469 `users, err := api.ListRoleUsers(role_id)` 1470 1471 **Retrieve information about a role's user:** 1472 1473 `user, err := api.GetRoleUser(role_id, user_id)` 1474 1475 **Remove a role's user:** 1476 1477 `role, err := api.RemoveRoleUser(role_id, user_id)` 1478 1479 1480 ### Usages 1481 1482 **List your usages:** 1483 1484 `usages, err := api.ListUsages(period, nil, nil)` 1485 1486 `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`). 1487 1488 `usages, err := api.ListUsages(period, start_date, end_date)` 1489 1490 Additional query parameters can be used. 1491 1492 `usages, err := api.ListUsages(period, start_date, end_date, page, per_page, sort, query, fields)` 1493 1494 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. 1495 1496 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. 1497 1498 Use `query` parameter to search for a string in the response and return only the usages instances that contain it. 1499 1500 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. 1501 1502 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1503 1504 1505 ### Server Appliances 1506 1507 **List all the appliances that you can use to create a server:** 1508 1509 `server_appliances, err := api.ListServerAppliances()` 1510 1511 Alternatively, use the method with query parameters. 1512 1513 `server_appliances, err := api.ListServerAppliances(page, per_page, sort, query, fields)` 1514 1515 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. 1516 1517 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. 1518 1519 Use `query` parameter to search for a string in the response and return only the server appliance instances that contain it. 1520 1521 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. 1522 1523 If any of the parameters `sort`, `query` or `fields` is blank, it is ignored in the request. 1524 1525 **Retrieve information about specific appliance:** 1526 1527 `server_appliance, err := api.GetServerAppliance(appliance_id)` 1528 1529 ### Recovery Images 1530 1531 **List all the recovery images that you can use to recovery reboot into:** 1532 1533 `res, err := api.ListRecoveryAppliances()` 1534 1535 Alternatively, use the method with query parameters. 1536 1537 `res, err := api.ListRecoveryAppliances(page, per_page, sort, query, fields)` 1538 1539 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. 1540 1541 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. 1542 1543 Use `query` parameter to search for a string in the response and return only the server appliance instances that contain it. 1544 1545 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. 1546 1547 If any of the parameters `sort`, `query` or `fields` is blank, it is ignored in the request. 1548 1549 **Retrieve information about specific recovery image:** 1550 1551 `ra, err := api.GetRecoveryAppliance(image_id)` 1552 1553 1554 1555 ### DVD ISO 1556 1557 **List all operative systems and tools that you can load into your virtual DVD unit:** 1558 1559 `dvd_isos, err := api.ListDvdIsos()` 1560 1561 Alternatively, use the method with query parameters. 1562 1563 `dvd_isos, err := api.ListDvdIsos(page, per_page, sort, query, fields)` 1564 1565 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. 1566 1567 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. 1568 1569 Use `query` parameter to search for a string in the response and return only the ISO DVD instances that contain it. 1570 1571 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. 1572 1573 If any of the parameters `sort`, `query` or `fields` is blank, it is ignored in the request. 1574 1575 **Retrieve a specific ISO image:** 1576 1577 `dvd_iso, err := api.GetDvdIso(dvd_id)` 1578 1579 1580 ### Ping 1581 1582 **Check if 1&1 REST API is running:** 1583 1584 `response, err := api.Ping()` 1585 1586 If the API is running, the response is a single-element slice `["PONG"]`. 1587 1588 **Validate if 1&1 REST API is running and the authorization token is valid:** 1589 1590 `response, err := api.PingAuth()` 1591 1592 The response should be a single-element slice `["PONG"]` if the API is running and the token is valid. 1593 1594 1595 ### Pricing 1596 1597 **Show prices for all available resources in the Cloud Panel:** 1598 1599 `pricing, err := api.GetPricing()` 1600 1601 1602 ### Data Centers 1603 1604 **List all 1&1 Cloud Server data centers:** 1605 1606 `datacenters, err := api.ListDatacenters()` 1607 1608 Here is another example of an alternative form of the list function that includes query parameters. 1609 1610 `datacenters, err := api.ListDatacenters(0, 0, "country_code", "DE", "id,country_code")` 1611 1612 **Retrieve a specific data center:** 1613 1614 `datacenter, err := api.GetDatacenter(datacenter_id)` 1615 1616 ### Block Storages 1617 1618 **List block storages:** 1619 1620 `blcs, err := api.ListBlockStorages()` 1621 1622 Alternatively, use the method with query parameters. 1623 1624 `blcs, err := api.ListBlockStorages(page, per_page, sort, query, fields)` 1625 1626 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. 1627 1628 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. 1629 1630 Use `query` parameter to search for a string in the response and return only the volume instances that contain it. 1631 1632 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. 1633 1634 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1635 1636 **Retrieve a block storage:** 1637 1638 `blcs, err := api.GetBlockStorage(blcs_id)` 1639 1640 1641 **Create a block storage:** 1642 1643 ``` 1644 request := oneandone.BlockStorageRequest { 1645 Name: test_blcs_name, 1646 Description: test_blcs_desc, 1647 Size: oneandone.Int2Pointer(size), 1648 DatacenterId: datacenter_id, 1649 ServerId: server_id 1650 } 1651 1652 blcs_id, blcs, err := api.CreateBlockStorage(&request) 1653 1654 ``` 1655 `Description` and `ServerId`are optional parameters. 1656 1657 1658 **Update a block storage:** 1659 1660 ``` 1661 request := oneandone.UpdateBlockStorageRequest { 1662 Name: new_name, 1663 Description: new_desc, 1664 } 1665 1666 blcs, err := api.UpdateBlockStorage(blcs_id, &request) 1667 ``` 1668 All request's parameters are optional. 1669 1670 1671 **Remove a block storage storage:** 1672 1673 `blcs, err := api.DeleteBlockStorage(blcs_id)` 1674 1675 1676 **Add a server to a block storage:** 1677 1678 `blcs, err := api.AddBlockStorageServer(blcs_id, server_id)` 1679 1680 1681 **Retrieve a block storage server:** 1682 1683 `blcs_server, err := api.GetBlockStorageServer(blcs_id)` 1684 1685 1686 **Remove a server from a block storage:** 1687 1688 `blcs, err := api.RemoveBlockStorageServer(blcs_id, server_id)` 1689 1690 ### SSH Keys 1691 1692 **List ssh keys:** 1693 1694 `sk, err := api.ListSSHKeys()` 1695 1696 Alternatively, use the method with query parameters. 1697 1698 `sk, err := api.ListSSHKeys(page, per_page, sort, query, fields)` 1699 1700 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. 1701 1702 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. 1703 1704 Use `query` parameter to search for a string in the response and return only the volume instances that contain it. 1705 1706 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. 1707 1708 If any of the parameters `sort`, `query` or `fields` is set to an empty string, it is ignored in the request. 1709 1710 **Retrieve an ssh key:** 1711 1712 `sk, err := api.GetSSHKey(sk_id)` 1713 1714 1715 **Create an ssh key:** 1716 1717 ``` 1718 request := oneandone.SSHKeyRequest { 1719 Name: test_sk_name, 1720 Description: test_sk_desc, 1721 PublicKey: pub_key 1722 } 1723 1724 sk_id, sk, err := api.CreateSSHKey(&request) 1725 1726 ``` 1727 1728 1729 **Rename an ssh key:** 1730 1731 `sk, err := oneandone.RenameSSHKey(sk_id, new_name, new_desc)` 1732 1733 1734 **Remove an ssh key:** 1735 1736 `sk, err := api.DeleteSSHKey(sk_id)` 1737 1738 1739 ## Examples 1740 1741 ```Go 1742 package main 1743 1744 import ( 1745 "fmt" 1746 "github.com/1and1/oneandone-cloudserver-sdk-go" 1747 "time" 1748 ) 1749 1750 func main() { 1751 //Set an authentication token 1752 token := oneandone.SetToken("82ee732b8d47e451be5c6ad5b7b56c81") 1753 //Create an API client 1754 api := oneandone.New(token, oneandone.BaseUrl) 1755 1756 // List server appliances 1757 saps, err := api.ListServerAppliances() 1758 1759 var sa oneandone.ServerAppliance 1760 for _, a := range saps { 1761 if a.Type == "IMAGE" { 1762 sa = a 1763 } 1764 } 1765 1766 // Create a server 1767 req := oneandone.ServerRequest{ 1768 Name: "Example Server", 1769 Description: "Example server description.", 1770 ApplianceId: sa.Id, 1771 PowerOn: True, 1772 ServerType: "cloud", 1773 Hardware: oneandone.Hardware{ 1774 Vcores: 1, 1775 CoresPerProcessor: 1, 1776 Ram: 2, 1777 Hdds: []oneandone.Hdd { 1778 oneandone.Hdd { 1779 Size: sa.MinHddSize, 1780 IsMain: true, 1781 }, 1782 }, 1783 }, 1784 } 1785 1786 server_id, server, err := api.CreateServer(&req) 1787 1788 if err == nil { 1789 // Wait until server is created and powered on for at most 60 x 10 seconds 1790 err = api.WaitForState(server, "POWERED_ON", 10, 60) 1791 } 1792 1793 // Get the server 1794 server, err = api.GetServer(server_id) 1795 1796 // Create a load balancer 1797 lbr := oneandone.LoadBalancerRequest { 1798 Name: "Load Balancer Example", 1799 Description: "API created load balancer.", 1800 Method: "ROUND_ROBIN", 1801 Persistence: oneandone.Bool2Pointer(true), 1802 PersistenceTime: oneandone.Int2Pointer(1200), 1803 HealthCheckTest: "TCP", 1804 HealthCheckInterval: oneandone.Int2Pointer(40), 1805 Rules: []oneandone.LoadBalancerRule { 1806 { 1807 Protocol: "TCP", 1808 PortBalancer: 80, 1809 PortServer: 80, 1810 Source: "0.0.0.0", 1811 }, 1812 }, 1813 } 1814 1815 var lb *oneandone.LoadBalancer 1816 var lb_id string 1817 1818 lb_id, lb, err = api.CreateLoadBalancer(&lbr) 1819 if err != nil { 1820 api.WaitForState(lb, "ACTIVE", 10, 30) 1821 } 1822 1823 // Get the load balancer 1824 lb, err = api.GetLoadBalancer(lb.Id) 1825 1826 // Assign the load balancer to server's IP 1827 server, err = api.AssignServerIpLoadBalancer(server.Id, server.Ips[0].Id, lb_id) 1828 1829 // Create a firewall policy 1830 fpr := oneandone.FirewallPolicyRequest{ 1831 Name: "Firewall Policy Example", 1832 Description: "API created firewall policy.", 1833 Rules: []oneandone.FirewallPolicyRule { 1834 { 1835 Protocol: "TCP", 1836 PortFrom: oneandone.Int2Pointer(80), 1837 PortTo: oneandone.Int2Pointer(80), 1838 }, 1839 }, 1840 } 1841 1842 var fp *oneandone.FirewallPolicy 1843 1844 fp_id, fp, err = api.CreateFirewallPolicy(&fpr) 1845 if err == nil { 1846 api.WaitForState(fp, "ACTIVE", 10, 30) 1847 } 1848 1849 // Get the firewall policy 1850 fp, err = api.GetFirewallPolicy(fp_id) 1851 1852 // Add servers IPs to the firewall policy. 1853 ips := []string{ server.Ips[0].Id } 1854 1855 fp, err = api.AddFirewallPolicyServerIps(fp.Id, ips) 1856 if err == nil { 1857 api.WaitForState(fp, "ACTIVE", 10, 60) 1858 } 1859 1860 //Shutdown the server using 'SOFTWARE' method 1861 server, err = api.ShutdownServer(server.Id, false) 1862 if err != nil { 1863 err = api.WaitForState(server, "POWERED_OFF", 5, 20) 1864 } 1865 1866 // Delete the load balancer 1867 lb, err = api.DeleteLoadBalancer(lb.Id) 1868 if err != nil { 1869 err = api.WaitUntilDeleted(lb) 1870 } 1871 1872 // Delete the firewall policy 1873 fp, err = api.DeleteFirewallPolicy(fp.Id) 1874 if err != nil { 1875 err = api.WaitUntilDeleted(fp) 1876 } 1877 1878 // List usages in last 24h 1879 var usages *oneandone.Usages 1880 usages, err = api.ListUsages("LAST_24H", nil, nil) 1881 1882 fmt.Println(usages.Servers) 1883 1884 // List usages in last 5 hours 1885 n := time.Now() 1886 ed := time.Date(n.Year(), n.Month(), n.Day(), n.Hour(), n.Minute(), n.Second(), 0, time.UTC) 1887 sd := ed.Add(-(time.Hour * 5)) 1888 1889 usages, err = api.ListUsages("CUSTOM", &sd, &ed) 1890 1891 //Create a shared storage 1892 ssr := oneandone.SharedStorageRequest { 1893 Name: "Shared Storage Example", 1894 Description: "API alocated 100 GB disk.", 1895 Size: oneandone.Int2Pointer(100), 1896 } 1897 1898 var ss *oneandone.SharedStorage 1899 var ss_id string 1900 1901 ss_id, ss, err = api.CreateSharedStorage(&ssr) 1902 if err != nil { 1903 api.WaitForState(ss, "ACTIVE", 10, 30) 1904 } 1905 1906 // List shared storages on page 1, 5 results per page and sort by 'name' field. 1907 // Include only 'name', 'size' and 'minimum_size_allowed' fields in the result. 1908 var shs []oneandone.SharedStorage 1909 shs, err = api.ListSharedStorages(1, 5, "name", "", "name,size,minimum_size_allowed") 1910 1911 // List all shared storages that contain 'example' string 1912 shs, err = api.ListSharedStorages(0, 0, "", "example", "") 1913 1914 // Delete the shared storage 1915 ss, err = api.DeleteSharedStorage(ss_id) 1916 if err == nil { 1917 err = api.WaitUntilDeleted(ss) 1918 } 1919 1920 // Delete the server 1921 server, err = api.DeleteServer(server.Id, false) 1922 if err == nil { 1923 err = api.WaitUntilDeleted(server) 1924 } 1925 } 1926 1927 ``` 1928 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. 1929 1930 ```Go 1931 package main 1932 1933 import "github.com/1and1/oneandone-cloudserver-sdk-go" 1934 1935 func main() { 1936 token := oneandone.SetToken("bde36026df9d548f699ea97e75a7e87f") 1937 client := oneandone.New(token, oneandone.BaseUrl) 1938 1939 // Create a new firewall policy 1940 fpr := oneandone.FirewallPolicyRequest{ 1941 Name: "HTTPS Traffic Policy", 1942 Rules: []oneandone.FirewallPolicyRule{ 1943 { 1944 Protocol: "TCP", 1945 PortFrom: oneandone.Int2Pointer(443), 1946 PortTo: oneandone.Int2Pointer(443), 1947 }, 1948 }, 1949 } 1950 1951 _, fp, err := client.CreateFirewallPolicy(&fpr) 1952 if fp != nil && err == nil { 1953 client.WaitForState(fp, "ACTIVE", 5, 60) 1954 1955 // Look for the TYPO3 application appliance 1956 saps, _ := client.ListServerAppliances(0, 0, "", "typo3", "") 1957 1958 var sa oneandone.ServerAppliance 1959 for _, a := range saps { 1960 if a.Type == "APPLICATION" { 1961 sa = a 1962 break 1963 } 1964 } 1965 1966 var fixed_flavours []oneandone.FixedInstanceInfo 1967 var fixed_size_id string 1968 1969 fixed_flavours, err = client.ListFixedInstanceSizes() 1970 for _, fl := range fixed_flavours { 1971 //look for 'M' size 1972 if fl.Name == "M" { 1973 fixed_size_id = fl.Id 1974 break 1975 } 1976 } 1977 1978 req := oneandone.ServerRequest{ 1979 Name: "TYPO3 Server", 1980 ApplianceId: sa.Id, 1981 PowerOn: true, 1982 Password: "ucr_kXW8,.2SdMU", 1983 Hardware: oneandone.Hardware{ 1984 FixedInsSizeId: fixed_size_id, 1985 }, 1986 FirewallPolicyId: fp.Id, 1987 } 1988 _, server, _ := client.CreateServer(&req) 1989 if server != nil { 1990 client.WaitForState(server, "POWERED_ON", 10, 90) 1991 } 1992 } 1993 } 1994 ``` 1995 1996 1997 ## Index 1998 1999 ```Go 2000 func New(token string, url string) *API 2001 ``` 2002 2003 ```Go 2004 func (api *API) AddFirewallPolicyRules(fp_id string, fp_rules []FirewallPolicyRule) (*FirewallPolicy, error) 2005 ``` 2006 2007 ```Go 2008 func (api *API) AddFirewallPolicyServerIps(fp_id string, ip_ids []string) (*FirewallPolicy, error) 2009 ``` 2010 2011 ```Go 2012 func (api *API) AddLoadBalancerRules(lb_id string, lb_rules []LoadBalancerRule) (*LoadBalancer, error) 2013 ``` 2014 2015 ```Go 2016 func (api *API) AddLoadBalancerServerIps(lb_id string, ip_ids []string) (*LoadBalancer, error) 2017 ``` 2018 2019 ```Go 2020 func (api *API) AddMonitoringPolicyPorts(mp_id string, mp_ports []MonitoringPort) (*MonitoringPolicy, error) 2021 ``` 2022 2023 ```Go 2024 func (api *API) AddMonitoringPolicyProcesses(mp_id string, mp_procs []MonitoringProcess) (*MonitoringPolicy, error) 2025 ``` 2026 2027 ```Go 2028 func (api *API) AddServerHdds(server_id string, hdds *ServerHdds) (*Server, error) 2029 ``` 2030 2031 ```Go 2032 func (api *API) AddSharedStorageServers(st_id string, servers []SharedStorageServer) (*SharedStorage, error) 2033 ``` 2034 2035 ```Go 2036 func (api *API) AddUserApiAlowedIps(user_id string, ips []string) (*User, error) 2037 ``` 2038 2039 ```Go 2040 func (api *API) AssignRoleUsers(role_id string, user_ids []string) (*Role, error) 2041 ``` 2042 2043 ```Go 2044 func (api *API) AssignServerIp(server_id string, ip_type string) (*Server, error) 2045 ``` 2046 2047 ```Go 2048 func (api *API) AssignServerIpFirewallPolicy(server_id string, ip_id string, fp_id string) (*Server, error) 2049 ``` 2050 2051 ```Go 2052 func (api *API) AssignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error) 2053 ``` 2054 2055 ```Go 2056 func (api *API) AssignServerPrivateNetwork(server_id string, pn_id string) (*Server, error) 2057 ``` 2058 2059 ```Go 2060 func (api *API) AttachMonitoringPolicyServers(mp_id string, sids []string) (*MonitoringPolicy, error) 2061 ``` 2062 2063 ```Go 2064 func (api *API) AttachPrivateNetworkServers(pn_id string, sids []string) (*PrivateNetwork, error) 2065 ``` 2066 2067 ```Go 2068 func (api *API) CloneRole(role_id string, name string) (*Role, error) 2069 ``` 2070 2071 ```Go 2072 func (api *API) CloneServer(server_id string, new_name string, datacenter_id string) (*Server, error) 2073 ``` 2074 2075 ```Go 2076 func (api *API) CreateFirewallPolicy(fp_data *FirewallPolicyRequest) (string, *FirewallPolicy, error) 2077 ``` 2078 2079 ```Go 2080 func (api *API) CreateImage(request *ImageRequest) (string, *Image, error) 2081 ``` 2082 2083 ```Go 2084 func (api *API) CreateLoadBalancer(request *LoadBalancerRequest) (string, *LoadBalancer, error) 2085 ``` 2086 2087 ```Go 2088 func (api *API) CreateMonitoringPolicy(mp *MonitoringPolicy) (string, *MonitoringPolicy, error) 2089 ``` 2090 2091 ```Go 2092 func (api *API) CreatePrivateNetwork(request *PrivateNetworkRequest) (string, *PrivateNetwork, error) 2093 ``` 2094 2095 ```Go 2096 func (api *API) CreatePublicIp(ip_type string, reverse_dns string, datacenter_id string) (string, *PublicIp, error) 2097 ``` 2098 2099 ```Go 2100 func (api *API) CreateRole(name string) (string, *Role, error) 2101 ``` 2102 2103 ```Go 2104 func (api *API) CreateServer(request *ServerRequest) (string, *Server, error) 2105 ``` 2106 2107 ```Go 2108 func (api *API) CreateServerEx(request *ServerRequest, timeout int) (string, string, error) 2109 ``` 2110 2111 ```Go 2112 func (api *API) CreateServerSnapshot(server_id string) (*Server, error) 2113 ``` 2114 2115 ```Go 2116 func (api *API) CreateSharedStorage(request *SharedStorageRequest) (string, *SharedStorage, error) 2117 ``` 2118 2119 ```Go 2120 func (api *API) CreateUser(user *UserRequest) (string, *User, error) 2121 ``` 2122 2123 ```Go 2124 func (api *API) CreateVPN(name string, description string, datacenter_id string) (string, *VPN, error) 2125 ``` 2126 2127 ```Go 2128 func (api *API) DeleteFirewallPolicy(fp_id string) (*FirewallPolicy, error) 2129 ``` 2130 2131 ```Go 2132 func (api *API) DeleteFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicy, error) 2133 ``` 2134 2135 ```Go 2136 func (api *API) DeleteFirewallPolicyServerIp(fp_id string, ip_id string) (*FirewallPolicy, error) 2137 ``` 2138 2139 ```Go 2140 func (api *API) DeleteImage(img_id string) (*Image, error) 2141 ``` 2142 2143 ```Go 2144 func (api *API) DeleteLoadBalancer(lb_id string) (*LoadBalancer, error) 2145 ``` 2146 2147 ```Go 2148 func (api *API) DeleteLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancer, error) 2149 ``` 2150 2151 ```Go 2152 func (api *API) DeleteLoadBalancerServerIp(lb_id string, ip_id string) (*LoadBalancer, error) 2153 ``` 2154 2155 ```Go 2156 func (api *API) DeleteMonitoringPolicy(mp_id string) (*MonitoringPolicy, error) 2157 ``` 2158 2159 ```Go 2160 func (api *API) DeleteMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPolicy, error) 2161 ``` 2162 2163 ```Go 2164 func (api *API) DeleteMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringPolicy, error) 2165 ``` 2166 2167 ```Go 2168 func (api *API) DeletePrivateNetwork(pn_id string) (*PrivateNetwork, error) 2169 ``` 2170 2171 ```Go 2172 func (api *API) DeletePublicIp(ip_id string) (*PublicIp, error) 2173 ``` 2174 2175 ```Go 2176 func (api *API) DeleteRole(role_id string) (*Role, error) 2177 ``` 2178 2179 ```Go 2180 func (api *API) DeleteServer(server_id string, keep_ips bool) (*Server, error) 2181 ``` 2182 2183 ```Go 2184 func (api *API) DeleteServerHdd(server_id string, hdd_id string) (*Server, error) 2185 ``` 2186 2187 ```Go 2188 func (api *API) DeleteServerIp(server_id string, ip_id string, keep_ip bool) (*Server, error) 2189 ``` 2190 2191 ```Go 2192 func (api *API) DeleteServerSnapshot(server_id string, snapshot_id string) (*Server, error) 2193 ``` 2194 2195 ```Go 2196 func (api *API) DeleteSharedStorage(ss_id string) (*SharedStorage, error) 2197 ``` 2198 2199 ```Go 2200 func (api *API) DeleteSharedStorageServer(st_id string, ser_id string) (*SharedStorage, error) 2201 ``` 2202 2203 ```Go 2204 func (api *API) DeleteUser(user_id string) (*User, error) 2205 ``` 2206 2207 ```Go 2208 func (api *API) DeleteVPN(vpn_id string) (*VPN, error) 2209 ``` 2210 2211 ```Go 2212 func (api *API) DetachPrivateNetworkServer(pn_id string, pns_id string) (*PrivateNetwork, error) 2213 ``` 2214 2215 ```Go 2216 func (api *API) EjectServerDvd(server_id string) (*Server, error) 2217 ``` 2218 2219 ```Go 2220 func (api *API) GetBaremetalModel(bm_id string) (*BaremetalModel, error) 2221 ``` 2222 2223 ```Go 2224 func (api *API) GetCurrentUserPermissions() (*Permissions, error) 2225 ``` 2226 2227 ```Go 2228 func (api *API) GetDatacenter(dc_id string) (*Datacenter, error) 2229 ``` 2230 2231 ```Go 2232 func (api *API) GetDvdIso(dvd_id string) (*DvdIso, error) 2233 ``` 2234 2235 ```Go 2236 func (api *API) GetFirewallPolicy(fp_id string) (*FirewallPolicy, error) 2237 ``` 2238 2239 ```Go 2240 func (api *API) GetFirewallPolicyRule(fp_id string, rule_id string) (*FirewallPolicyRule, error) 2241 ``` 2242 2243 ```Go 2244 func (api *API) GetFirewallPolicyServerIp(fp_id string, ip_id string) (*ServerIpInfo, error) 2245 ``` 2246 2247 ```Go 2248 func (api *API) GetFixedInstanceSize(fis_id string) (*FixedInstanceInfo, error) 2249 ``` 2250 2251 ```Go 2252 func (api *API) GetImage(img_id string) (*Image, error) 2253 ``` 2254 2255 ```Go 2256 func (api *API) GetLoadBalancer(lb_id string) (*LoadBalancer, error) 2257 ``` 2258 2259 ```Go 2260 func (api *API) GetLoadBalancerRule(lb_id string, rule_id string) (*LoadBalancerRule, error) 2261 ``` 2262 2263 ```Go 2264 func (api *API) GetLoadBalancerServerIp(lb_id string, ip_id string) (*ServerIpInfo, error) 2265 ``` 2266 2267 ```Go 2268 func (api *API) GetLog(log_id string) (*Log, error) 2269 ``` 2270 2271 ```Go 2272 func (api *API) GetMonitoringPolicy(mp_id string) (*MonitoringPolicy, error) 2273 ``` 2274 2275 ```Go 2276 func (api *API) GetMonitoringPolicyPort(mp_id string, port_id string) (*MonitoringPort, error) 2277 ``` 2278 2279 ```Go 2280 func (api *API) GetMonitoringPolicyProcess(mp_id string, proc_id string) (*MonitoringProcess, error) 2281 ``` 2282 2283 ```Go 2284 func (api *API) GetMonitoringPolicyServer(mp_id string, ser_id string) (*Identity, error) 2285 ``` 2286 2287 ```Go 2288 func (api *API) GetMonitoringServerUsage(ser_id string, period string, dates ...time.Time) (*MonServerUsageDetails, error) 2289 ``` 2290 2291 ```Go 2292 func (api *API) GetPricing() (*Pricing, error) 2293 ``` 2294 2295 ```Go 2296 func (api *API) GetPrivateNetwork(pn_id string) (*PrivateNetwork, error) 2297 ``` 2298 2299 ```Go 2300 func (api *API) GetPrivateNetworkServer(pn_id string, server_id string) (*Identity, error) 2301 ``` 2302 2303 ```Go 2304 func (api *API) GetPublicIp(ip_id string) (*PublicIp, error) 2305 ``` 2306 2307 ```Go 2308 func (api *API) GetRecoveryAppliance(ra_id string) (*SingleRecoveryAppliance, error) 2309 ``` 2310 2311 ```Go 2312 func (api *API) GetRole(role_id string) (*Role, error) 2313 ``` 2314 2315 ```Go 2316 func (api *API) GetRolePermissions(role_id string) (*Permissions, error) 2317 ``` 2318 2319 ```Go 2320 func (api *API) GetRoleUser(role_id string, user_id string) (*Identity, error) 2321 ``` 2322 2323 ```Go 2324 func (api *API) GetServer(server_id string) (*Server, error) 2325 ``` 2326 2327 ```Go 2328 func (api *API) GetServerAppliance(sa_id string) (*ServerAppliance, error) 2329 ``` 2330 2331 ```Go 2332 func (api *API) GetServerDvd(server_id string) (*Identity, error) 2333 ``` 2334 2335 ```Go 2336 func (api *API) GetServerHardware(server_id string) (*Hardware, error) 2337 ``` 2338 2339 ```Go 2340 func (api *API) GetServerHdd(server_id string, hdd_id string) (*Hdd, error) 2341 ``` 2342 2343 ```Go 2344 func (api *API) GetServerImage(server_id string) (*Identity, error) 2345 ``` 2346 2347 ```Go 2348 func (api *API) GetServerIp(server_id string, ip_id string) (*ServerIp, error) 2349 ``` 2350 2351 ```Go 2352 func (api *API) GetServerIpFirewallPolicy(server_id string, ip_id string) (*Identity, error) 2353 ``` 2354 2355 ```Go 2356 func (api *API) GetServerPrivateNetwork(server_id string, pn_id string) (*PrivateNetwork, error) 2357 ``` 2358 2359 ```Go 2360 func (api *API) GetServerSnapshot(server_id string) (*ServerSnapshot, error) 2361 ``` 2362 2363 ```Go 2364 func (api *API) GetServerStatus(server_id string) (*Status, error) 2365 ``` 2366 2367 ```Go 2368 func (api *API) GetSharedStorage(ss_id string) (*SharedStorage, error) 2369 ``` 2370 2371 ```Go 2372 func (api *API) GetSharedStorageCredentials() ([]SharedStorageAccess, error) 2373 ``` 2374 2375 ```Go 2376 func (api *API) GetSharedStorageServer(st_id string, ser_id string) (*SharedStorageServer, error) 2377 ``` 2378 2379 ```Go 2380 func (api *API) GetUser(user_id string) (*User, error) 2381 ``` 2382 2383 ```Go 2384 func (api *API) GetUserApi(user_id string) (*UserApi, error) 2385 ``` 2386 2387 ```Go 2388 func (api *API) GetUserApiKey(user_id string) (*UserApiKey, error) 2389 ``` 2390 2391 ```Go 2392 func (api *API) GetVPN(vpn_id string) (*VPN, error) 2393 ``` 2394 2395 ```Go 2396 func (api *API) GetVPNConfigFile(vpn_id string) (string, error) 2397 ``` 2398 2399 ```Go 2400 func (api *API) ListBaremetalModels() ([]BaremetalModel, error) 2401 ``` 2402 2403 ```Go 2404 func (api *API) ListDatacenters(args ...interface{}) ([]Datacenter, error) 2405 ``` 2406 2407 ```Go 2408 func (api *API) ListDvdIsos(args ...interface{}) ([]DvdIso, error) 2409 ``` 2410 2411 ```Go 2412 func (api *API) ListFirewallPolicies(args ...interface{}) ([]FirewallPolicy, error) 2413 ``` 2414 2415 ```Go 2416 func (api *API) ListFirewallPolicyRules(fp_id string) ([]FirewallPolicyRule, error) 2417 ``` 2418 2419 ```Go 2420 func (api *API) ListFirewallPolicyServerIps(fp_id string) ([]ServerIpInfo, error) 2421 ``` 2422 2423 ```Go 2424 func (api *API) ListFixedInstanceSizes() ([]FixedInstanceInfo, error) 2425 ``` 2426 2427 ```Go 2428 func (api *API) ListImageOs(args ...interface{}) ([]ImageOs, error) 2429 ``` 2430 2431 ```Go 2432 func (api *API) ListImages(args ...interface{}) ([]Image, error) 2433 ``` 2434 2435 ```Go 2436 func (api *API) ListLoadBalancerRules(lb_id string) ([]LoadBalancerRule, error) 2437 ``` 2438 2439 ```Go 2440 func (api *API) ListLoadBalancerServerIps(lb_id string) ([]ServerIpInfo, error) 2441 ``` 2442 2443 ```Go 2444 func (api *API) ListLoadBalancers(args ...interface{}) ([]LoadBalancer, error) 2445 ``` 2446 2447 ```Go 2448 func (api *API) ListLogs(period string, sd *time.Time, ed *time.Time, args ...interface{}) ([]Log, error) 2449 ``` 2450 2451 ```Go 2452 func (api *API) ListMonitoringPolicies(args ...interface{}) ([]MonitoringPolicy, error) 2453 ``` 2454 2455 ```Go 2456 func (api *API) ListMonitoringPolicyPorts(mp_id string) ([]MonitoringPort, error) 2457 ``` 2458 2459 ```Go 2460 func (api *API) ListMonitoringPolicyProcesses(mp_id string) ([]MonitoringProcess, error) 2461 ``` 2462 2463 ```Go 2464 func (api *API) ListMonitoringPolicyServers(mp_id string) ([]Identity, error) 2465 ``` 2466 2467 ```Go 2468 func (api *API) ListMonitoringServersUsages(args ...interface{}) ([]MonServerUsageSummary, error) 2469 ``` 2470 2471 ```Go 2472 func (api *API) ListPrivateNetworkServers(pn_id string) ([]Identity, error) 2473 ``` 2474 2475 ```Go 2476 func (api *API) ListPrivateNetworks(args ...interface{}) ([]PrivateNetwork, error) 2477 ``` 2478 2479 ```Go 2480 func (api *API) ListPublicIps(args ...interface{}) ([]PublicIp, error) 2481 ``` 2482 2483 ```Go 2484 func (api *API) ListRecoveryAppliances(args ...interface{}) ([]RecoveryAppliance, error) 2485 ``` 2486 2487 ```Go 2488 func (api *API) ListRoleUsers(role_id string) ([]Identity, error) 2489 ``` 2490 2491 ```Go 2492 func (api *API) ListRoles(args ...interface{}) ([]Role, error) 2493 ``` 2494 2495 ```Go 2496 func (api *API) ListServerAppliances(args ...interface{}) ([]ServerAppliance, error) 2497 ``` 2498 2499 ```Go 2500 func (api *API) ListServerHdds(server_id string) ([]Hdd, error) 2501 ``` 2502 2503 ```Go 2504 func (api *API) ListServerIpLoadBalancers(server_id string, ip_id string) ([]Identity, error) 2505 ``` 2506 2507 ```Go 2508 func (api *API) ListServerIps(server_id string) ([]ServerIp, error) 2509 ``` 2510 2511 ```Go 2512 func (api *API) ListServerPrivateNetworks(server_id string) ([]Identity, error) 2513 ``` 2514 2515 ```Go 2516 func (api *API) ListServers(args ...interface{}) ([]Server, error) 2517 ``` 2518 2519 ```Go 2520 func (api *API) ListSharedStorageServers(st_id string) ([]SharedStorageServer, error) 2521 ``` 2522 2523 ```Go 2524 func (api *API) ListSharedStorages(args ...interface{}) ([]SharedStorage, error) 2525 ``` 2526 2527 ```Go 2528 func (api *API) ListUsages(period string, sd *time.Time, ed *time.Time, args ...interface{}) (*Usages, error) 2529 ``` 2530 2531 ```Go 2532 func (api *API) ListUserApiAllowedIps(user_id string) ([]string, error) 2533 ``` 2534 2535 ```Go 2536 func (api *API) ListUsers(args ...interface{}) ([]User, error) 2537 ``` 2538 2539 ```Go 2540 func (api *API) ListVPNs(args ...interface{}) ([]VPN, error) 2541 ``` 2542 2543 ```Go 2544 func (api *API) LoadServerDvd(server_id string, dvd_id string) (*Server, error) 2545 ``` 2546 2547 ```Go 2548 func (api *API) ModifyMonitoringPolicyPort(mp_id string, port_id string, mp_port *MonitoringPort) (*MonitoringPolicy, error) 2549 ``` 2550 2551 ```Go 2552 func (api *API) ModifyMonitoringPolicyProcess(mp_id string, proc_id string, mp_proc *MonitoringProcess) (*MonitoringPolicy, error) 2553 ``` 2554 2555 ```Go 2556 func (api *API) ModifyRole(role_id string, name string, description string, state string) (*Role, error) 2557 ``` 2558 2559 ```Go 2560 func (api *API) ModifyRolePermissions(role_id string, perm *Permissions) (*Role, error) 2561 ``` 2562 2563 ```Go 2564 func (api *API) ModifyUser(user_id string, user *UserRequest) (*User, error) 2565 ``` 2566 2567 ```Go 2568 func (api *API) ModifyUserApi(user_id string, active bool) (*User, error) 2569 ``` 2570 2571 ```Go 2572 func (api *API) ModifyVPN(vpn_id string, name string, description string) (*VPN, error) 2573 ``` 2574 2575 ```Go 2576 func (api *API) Ping() ([]string, error) 2577 ``` 2578 2579 ```Go 2580 func (api *API) PingAuth() ([]string, error) 2581 ``` 2582 2583 ```Go 2584 func (api *API) RebootServer(server_id string, is_hardware bool) (*Server, error) 2585 ``` 2586 2587 ```Go 2588 func (api *API) RecoveryRebootServer(server_id string, is_hardware bool, recovery_image_id string) 2589 ``` 2590 2591 ```Go 2592 func (api *API) ReinstallServerImage(server_id string, image_id string, password string, fp_id string) (*Server, error) 2593 ``` 2594 2595 ```Go 2596 func (api *API) RemoveMonitoringPolicyServer(mp_id string, ser_id string) (*MonitoringPolicy, error) 2597 ``` 2598 2599 ```Go 2600 func (api *API) RemoveRoleUser(role_id string, user_id string) (*Role, error) 2601 ``` 2602 2603 ```Go 2604 func (api *API) RemoveServerPrivateNetwork(server_id string, pn_id string) (*Server, error) 2605 ``` 2606 2607 ```Go 2608 func (api *API) RemoveUserApiAllowedIp(user_id string, ip string) (*User, error) 2609 ``` 2610 2611 ```Go 2612 func (api *API) RenameServer(server_id string, new_name string, new_desc string) (*Server, error) 2613 ``` 2614 2615 ```Go 2616 func (api *API) RenewUserApiKey(user_id string) (*User, error) 2617 ``` 2618 2619 ```Go 2620 func (api *API) ResizeServerHdd(server_id string, hdd_id string, new_size int) (*Server, error) 2621 ``` 2622 2623 ```Go 2624 func (api *API) RestoreServerSnapshot(server_id string, snapshot_id string) (*Server, error) 2625 ``` 2626 2627 ```Go 2628 func (api *API) ShutdownServer(server_id string, is_hardware bool) (*Server, error) 2629 ``` 2630 2631 ```Go 2632 func (api *API) StartServer(server_id string) (*Server, error) 2633 ``` 2634 2635 ```Go 2636 func (api *API) UnassignServerIpFirewallPolicy(server_id string, ip_id string) (*Server, error) 2637 ``` 2638 2639 ```Go 2640 func (api *API) UnassignServerIpLoadBalancer(server_id string, ip_id string, lb_id string) (*Server, error) 2641 ``` 2642 2643 ```Go 2644 func (api *API) UpdateFirewallPolicy(fp_id string, fp_new_name string, fp_new_desc string) (*FirewallPolicy, error) 2645 ``` 2646 2647 ```Go 2648 func (api *API) UpdateImage(img_id string, new_name string, new_desc string, new_freq string) (*Image, error) 2649 ``` 2650 2651 ```Go 2652 func (api *API) UpdateLoadBalancer(lb_id string, request *LoadBalancerRequest) (*LoadBalancer, error) 2653 ``` 2654 2655 ```Go 2656 func (api *API) UpdateMonitoringPolicy(mp_id string, mp *MonitoringPolicy) (*MonitoringPolicy, error) 2657 ``` 2658 2659 ```Go 2660 func (api *API) UpdatePrivateNetwork(pn_id string, request *PrivateNetworkRequest) (*PrivateNetwork, error) 2661 ``` 2662 2663 ```Go 2664 func (api *API) UpdatePublicIp(ip_id string, reverse_dns string) (*PublicIp, error) 2665 ``` 2666 2667 ```Go 2668 func (api *API) UpdateServerHardware(server_id string, hardware *Hardware) (*Server, error) 2669 ``` 2670 2671 ```Go 2672 func (api *API) UpdateSharedStorage(ss_id string, request *SharedStorageRequest) (*SharedStorage, error) 2673 ``` 2674 2675 ```Go 2676 func (api *API) UpdateSharedStorageCredentials(new_pass string) ([]SharedStorageAccess, error) 2677 ``` 2678 2679 ```Go 2680 func (api *API) WaitForState(in ApiInstance, state string, sec time.Duration, count int) error 2681 ``` 2682 2683 ```Go 2684 func (api *API) WaitUntilDeleted(in ApiInstance) error 2685 ``` 2686 2687 ```Go 2688 func (fp *FirewallPolicy) GetState() (string, error) 2689 ``` 2690 2691 ```Go 2692 func (im *Image) GetState() (string, error) 2693 ``` 2694 2695 ```Go 2696 func (lb *LoadBalancer) GetState() (string, error) 2697 ``` 2698 2699 ```Go 2700 func (mp *MonitoringPolicy) GetState() (string, error) 2701 ``` 2702 2703 ```Go 2704 func (pn *PrivateNetwork) GetState() (string, error) 2705 ``` 2706 2707 ```Go 2708 func (ip *PublicIp) GetState() (string, error) 2709 ``` 2710 2711 ```Go 2712 func (role *Role) GetState() (string, error) 2713 ``` 2714 2715 ```Go 2716 func (s *Server) GetState() (string, error) 2717 ``` 2718 2719 ```Go 2720 func (ss *SharedStorage) GetState() (string, error) 2721 ``` 2722 2723 ```Go 2724 func (u *User) GetState() (string, error) 2725 ``` 2726 2727 ```Go 2728 func (u *User) GetState() (string, error) 2729 ``` 2730 2731 ```Go 2732 func (vpn *VPN) GetState() (string, error) 2733 ``` 2734 2735 ```Go 2736 func Bool2Pointer(input bool) *bool 2737 ``` 2738 2739 ```Go 2740 func Int2Pointer(input int) *int 2741 ``` 2742 2743 ```Go 2744 func (bp *BackupPerm) SetAll(value bool) 2745 ``` 2746 2747 ```Go 2748 func (fp *FirewallPerm) SetAll(value bool) 2749 ``` 2750 2751 ```Go 2752 func (imp *ImagePerm) SetAll(value bool) 2753 ``` 2754 2755 ```Go 2756 unc (inp *InvoicePerm) SetAll(value bool) 2757 ``` 2758 2759 ```Go 2760 func (ipp *IPPerm) SetAll(value bool) 2761 ``` 2762 2763 ```Go 2764 func (lbp *LoadBalancerPerm) SetAll(value bool) 2765 ``` 2766 2767 ```Go 2768 func (lp *LogPerm) SetAll(value bool) 2769 ``` 2770 2771 ```Go 2772 func (mcp *MonitorCenterPerm) SetAll(value bool) 2773 ``` 2774 2775 ```Go 2776 func (mpp *MonitorPolicyPerm) SetAll(value bool) 2777 ``` 2778 2779 ```Go 2780 func (p *Permissions) SetAll(v bool) 2781 ``` 2782 2783 ```Go 2784 func (pnp *PrivateNetworkPerm) SetAll(value bool) 2785 ``` 2786 2787 ```Go 2788 func (rp *RolePerm) SetAll(value bool) 2789 ``` 2790 2791 ```Go 2792 func (sp *ServerPerm) SetAll(value bool) 2793 ``` 2794 2795 ```Go 2796 func (ssp *SharedStoragePerm) SetAll(value bool) 2797 ``` 2798 2799 ```Go 2800 func (up *UsagePerm) SetAll(value bool) 2801 ``` 2802 2803 ```Go 2804 func (up *UserPerm) SetAll(value bool) 2805 ``` 2806 2807 ```Go 2808 func (vpnp *VPNPerm) SetAll(value bool) 2809 ``` 2810 2811 ```Go 2812 func SetBaseUrl(newbaseurl string) string 2813 ``` 2814 2815 ```Go 2816 func SetToken(newtoken string) string 2817 ``` 2818