diff --git a/go.mod b/go.mod
index 77ce739a3..22b8e654c 100644
--- a/go.mod
+++ b/go.mod
@@ -22,10 +22,11 @@ require (
github.com/mitchellh/mapstructure v1.3.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/posener/complete v1.2.3 // indirect
- github.com/profitbricks/profitbricks-sdk-go/v5 v5.0.32
github.com/spf13/afero v1.3.1 // indirect
+ github.com/stretchr/testify v1.6.1 // indirect
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c // indirect
google.golang.org/appengine v1.6.7 // indirect
+ gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
)
diff --git a/go.sum b/go.sum
index e431b758c..2ec109fbf 100644
--- a/go.sum
+++ b/go.sum
@@ -100,8 +100,6 @@ github.com/go-git/go-git/v5 v5.1.0/go.mod h1:ZKfuPUoY1ZqIG4QG9BDBh3G4gLM5zvPuSJA
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
-github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So=
-github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU=
github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/go-test/deep v1.0.6 h1:UHSEyLZUwX9Qoi99vVwvewiMC8mM2bf7XEM2nqvzEn8=
github.com/go-test/deep v1.0.6/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
@@ -228,8 +226,6 @@ github.com/imdario/mergo v0.3.9 h1:UauaLniWCFHWd+Jp9oCEkTBj8VO/9DKg3PV3VCNMDIg=
github.com/imdario/mergo v0.3.9/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA=
github.com/ionos-cloud/sdk-go/v5 v5.1.0 h1:q6KWvirQ2td8f+w3sltWzQ7w1Sl9TbiSOcFRdarfSPo=
github.com/ionos-cloud/sdk-go/v5 v5.1.0/go.mod h1:dU3BVZgiBDAKyo41hFk7D5KWHfqyp4YL4rePIAi2JyM=
-github.com/jarcoal/httpmock v1.0.5 h1:cHtVEcTxRSX4J0je7mWPfc9BpDpqzXSJ5HbymZmyHck=
-github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
@@ -314,8 +310,6 @@ github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndr
github.com/posener/complete v1.2.1/go.mod h1:6gapUrK/U1TAN7ciCoNRIdVC5sbdBTUh1DKN0g6uH7E=
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
-github.com/profitbricks/profitbricks-sdk-go/v5 v5.0.32 h1:WhV4paOBZWuIONDyCeOS7Brz8JkcktFEDKeijh0zB7k=
-github.com/profitbricks/profitbricks-sdk-go/v5 v5.0.32/go.mod h1:x/4Vomth5nMhzd81Fqji+HfoE8S7cEulROLWFmx/U20=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo=
diff --git a/ionoscloud/data_source_datacenter.go b/ionoscloud/data_source_datacenter.go
index 6600c8765..07ac53e3c 100644
--- a/ionoscloud/data_source_datacenter.go
+++ b/ionoscloud/data_source_datacenter.go
@@ -47,6 +47,7 @@ func getDatacenter(client *ionoscloud.APIClient, d *schema.ResourceData) (*ionos
if locationOk {
location = t.(string)
}
+
if !idOk && !nameOk && !locationOk {
return nil, fmt.Errorf("either id, location or name must be set")
}
diff --git a/ionoscloud/data_source_k8s_cluster.go b/ionoscloud/data_source_k8s_cluster.go
index 0ad74d57b..d0a9950b2 100644
--- a/ionoscloud/data_source_k8s_cluster.go
+++ b/ionoscloud/data_source_k8s_cluster.go
@@ -135,6 +135,7 @@ func dataSourceK8sReadCluster(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("an error occurred while fetching k8s clusters: %s", err.Error())
}
+ found := false
if clusters.Items != nil {
for _, c := range *clusters.Items {
tmpCluster, _, err := client.KubernetesApi.K8sFindByClusterId(ctx, *c.Id).Execute()
@@ -144,18 +145,18 @@ func dataSourceK8sReadCluster(d *schema.ResourceData, meta interface{}) error {
if tmpCluster.Properties.Name != nil && *tmpCluster.Properties.Name == name.(string) {
/* lan found */
cluster = tmpCluster
+ found = true
break
}
}
}
+ if !found {
+ return errors.New("k8s cluster not found")
+ }
}
- if &cluster == nil {
- return errors.New("k8s cluster not found")
- }
-
if err = setK8sClusterData(d, &cluster, client); err != nil {
return err
}
diff --git a/ionoscloud/data_source_k8s_cluster_test.go b/ionoscloud/data_source_k8s_cluster_test.go
index 600fc9d8a..0e8034ded 100644
--- a/ionoscloud/data_source_k8s_cluster_test.go
+++ b/ionoscloud/data_source_k8s_cluster_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
@@ -77,6 +79,6 @@ resource "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" {
}
data "ionoscloud_k8s_cluster" "test_ds_k8s_cluster" {
- name = "test_"
+ name = "test_cluster"
}
`
diff --git a/ionoscloud/data_source_k8s_node_pool.go b/ionoscloud/data_source_k8s_node_pool.go
index 826206893..b649d85b3 100644
--- a/ionoscloud/data_source_k8s_node_pool.go
+++ b/ionoscloud/data_source_k8s_node_pool.go
@@ -196,6 +196,7 @@ func dataSourceK8sReadNodePool(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("an error occurred while fetching k8s nodepools: %s", err.Error())
}
+ found := false
if clusters.Items != nil {
for _, c := range *clusters.Items {
tmpNodePool, _, err := client.KubernetesApi.K8sNodepoolsFindById(ctx, clusterId.(string), *c.Id).Execute()
@@ -205,15 +206,17 @@ func dataSourceK8sReadNodePool(d *schema.ResourceData, meta interface{}) error {
if tmpNodePool.Properties.Name != nil && *tmpNodePool.Properties.Name == name.(string) {
/* lan found */
nodePool = tmpNodePool
+ found = true
break
}
}
}
- }
+ if !found {
+ return errors.New("k8s nodePool not found")
+ }
+
- if &nodePool == nil {
- return errors.New("k8s nodePool not found")
}
if err = setK8sNodePoolData(d, &nodePool); err != nil {
diff --git a/ionoscloud/data_source_k8s_node_pool_test.go b/ionoscloud/data_source_k8s_node_pool_test.go
index 0c613bdf1..1f401d37a 100644
--- a/ionoscloud/data_source_k8s_node_pool_test.go
+++ b/ionoscloud/data_source_k8s_node_pool_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
@@ -143,6 +145,6 @@ resource "ionoscloud_k8s_node_pool" "test_ds_k8s_node_pool" {
data "ionoscloud_k8s_node_pool" "test_ds_k8s_node_pool" {
k8s_cluster_id = ionoscloud_k8s_cluster.test_ds_k8s_cluster.id
- name = "_nodepool"
+ name = "test_nodepool"
}
`
diff --git a/ionoscloud/data_source_lan.go b/ionoscloud/data_source_lan.go
index a95f966e9..cef3cccd3 100644
--- a/ionoscloud/data_source_lan.go
+++ b/ionoscloud/data_source_lan.go
@@ -142,6 +142,7 @@ func dataSourceLanRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("an error occurred while fetching lans: %s", err.Error())
}
+ found := false
if lans.Items != nil {
for _, l := range *lans.Items {
if l.Properties.Name != nil && *l.Properties.Name == name.(string) {
@@ -150,14 +151,15 @@ func dataSourceLanRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return fmt.Errorf("an error occurred while fetching lan %s: %s", *l.Id, err)
}
+ found = true
break
}
}
}
- }
- if &lan == nil {
- return errors.New("lan not found")
+ if !found {
+ return fmt.Errorf("lan not found")
+ }
}
if err = setLanData(d, &lan); err != nil {
diff --git a/ionoscloud/data_source_lan_test.go b/ionoscloud/data_source_lan_test.go
index f0d737e8c..522c21496 100644
--- a/ionoscloud/data_source_lan_test.go
+++ b/ionoscloud/data_source_lan_test.go
@@ -97,6 +97,6 @@ resource "ionoscloud_lan" "test_ds_lan" {
data "ionoscloud_lan" "test_lan" {
datacenter_id = ionoscloud_datacenter.test_ds_lan.id
- name = "test_ds_"
+ name = "test_ds_lan"
}
`
diff --git a/ionoscloud/data_source_private_crossconnect.go b/ionoscloud/data_source_private_crossconnect.go
index 60ee515c1..0ccf9cd3e 100644
--- a/ionoscloud/data_source_private_crossconnect.go
+++ b/ionoscloud/data_source_private_crossconnect.go
@@ -198,6 +198,7 @@ func dataSourcePccRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("an error occurred while fetching pccs: %s", err.Error())
}
+ found := false
if pccs.Items != nil {
for _, p := range *pccs.Items {
if p.Properties.Name != nil && *p.Properties.Name == name.(string) {
@@ -206,14 +207,15 @@ func dataSourcePccRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return fmt.Errorf("an error occurred while fetching the pcc with ID %s: %s", *p.Id, err)
}
+ found = true
break
}
}
}
- }
+ if !found {
+ return errors.New("pcc not found")
+ }
- if &pcc == nil {
- return errors.New("pcc not found")
}
if err = setPccDataSource(d, &pcc); err != nil {
diff --git a/ionoscloud/data_source_private_crossconnect_test.go b/ionoscloud/data_source_private_crossconnect_test.go
index 1ed6e3cf8..9fd5cb56d 100644
--- a/ionoscloud/data_source_private_crossconnect_test.go
+++ b/ionoscloud/data_source_private_crossconnect_test.go
@@ -72,6 +72,6 @@ resource "ionoscloud_private_crossconnect" "test_ds_pcc" {
description = "test_ds_pcc description"
}
data "ionoscloud_private_crossconnect" "test_pcc" {
- name = "test_ds_"
+ name = "test_ds_pcc"
}
`
diff --git a/ionoscloud/data_source_server.go b/ionoscloud/data_source_server.go
index cf7b715e8..013a0491d 100644
--- a/ionoscloud/data_source_server.go
+++ b/ionoscloud/data_source_server.go
@@ -575,6 +575,7 @@ func dataSourceServerRead(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("an error occurred while fetching servers: %s", err.Error())
}
+ found := false
if servers.Items != nil {
for _, s := range *servers.Items {
if s.Properties.Name != nil && *s.Properties.Name == name.(string) {
@@ -583,14 +584,16 @@ func dataSourceServerRead(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return fmt.Errorf("an error occurred while fetching the server with ID %s: %s", *s.Id, err)
}
+ found = true
break
}
}
}
- }
- if &server == nil {
- return errors.New("server not found")
+ if !found {
+ return errors.New("server not found")
+ }
+
}
if err = setServerData(d, &server); err != nil {
diff --git a/ionoscloud/data_source_server_test.go b/ionoscloud/data_source_server_test.go
index 3a148e074..5d4168845 100644
--- a/ionoscloud/data_source_server_test.go
+++ b/ionoscloud/data_source_server_test.go
@@ -143,6 +143,6 @@ resource "ionoscloud_server" "test_datasource_server" {
data "ionoscloud_server" "test_server" {
datacenter_id = ionoscloud_datacenter.test_datasource_server.id
- name = "test_datasource_"
+ name = "test_datasource_server"
}
`
diff --git a/ionoscloud/import_k8s_cluster_test.go b/ionoscloud/import_k8s_cluster_test.go
index cba13a8f1..ebd9ba73e 100644
--- a/ionoscloud/import_k8s_cluster_test.go
+++ b/ionoscloud/import_k8s_cluster_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
diff --git a/ionoscloud/import_k8s_node_pool_test.go b/ionoscloud/import_k8s_node_pool_test.go
index 72f2988f2..9360e38ca 100644
--- a/ionoscloud/import_k8s_node_pool_test.go
+++ b/ionoscloud/import_k8s_node_pool_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
@@ -14,10 +16,12 @@ func TestAcck8sNodepool_ImportBasic(t *testing.T) {
publicIp1 := os.Getenv("TF_ACC_IONOS_PUBLIC_IP_1")
if publicIp1 == "" {
t.Errorf("TF_ACC_IONOS_PUBLIC_1 not set; please set it to a valid public IP for the us/las zone")
+ t.FailNow()
}
publicIp2 := os.Getenv("TF_ACC_IONOS_PUBLIC_IP_2")
if publicIp2 == "" {
t.Errorf("TF_ACC_IONOS_PUBLIC_2 not set; please set it to a valid public IP for the us/las zone")
+ t.FailNow()
}
resource.Test(t, resource.TestCase{
diff --git a/ionoscloud/resource_k8s_cluster_test.go b/ionoscloud/resource_k8s_cluster_test.go
index bebfca37f..5b014b870 100644
--- a/ionoscloud/resource_k8s_cluster_test.go
+++ b/ionoscloud/resource_k8s_cluster_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
diff --git a/ionoscloud/resource_k8s_node_pool_test.go b/ionoscloud/resource_k8s_node_pool_test.go
index 2ad76945a..7c874266d 100644
--- a/ionoscloud/resource_k8s_node_pool_test.go
+++ b/ionoscloud/resource_k8s_node_pool_test.go
@@ -1,3 +1,5 @@
+// +build k8s
+
package ionoscloud
import (
@@ -19,14 +21,17 @@ func TestAcck8sNodepool_Basic(t *testing.T) {
publicIp1 := os.Getenv("TF_ACC_IONOS_PUBLIC_IP_1")
if publicIp1 == "" {
t.Errorf("TF_ACC_IONOS_PUBLIC_1 not set; please set it to a valid public IP for the us/las zone")
+ t.FailNow()
}
publicIp2 := os.Getenv("TF_ACC_IONOS_PUBLIC_IP_2")
if publicIp2 == "" {
t.Errorf("TF_ACC_IONOS_PUBLIC_2 not set; please set it to a valid public IP for the us/las zone")
+ t.FailNow()
}
publicIp3 := os.Getenv("TF_ACC_IONOS_PUBLIC_IP_3")
if publicIp3 == "" {
t.Errorf("TF_ACC_IONOS_PUBLIC_3 not set; please set it to a valid public IP for the us/las zone")
+ t.FailNow()
}
resource.Test(t, resource.TestCase{
diff --git a/vendor/github.com/go-resty/resty/v2/.gitignore b/vendor/github.com/go-resty/resty/v2/.gitignore
deleted file mode 100644
index 54910a04a..000000000
--- a/vendor/github.com/go-resty/resty/v2/.gitignore
+++ /dev/null
@@ -1,31 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-
-coverage.out
-coverage.txt
-go.sum
-
-# Exclude intellij IDE folders
-.idea/*
\ No newline at end of file
diff --git a/vendor/github.com/go-resty/resty/v2/.travis.yml b/vendor/github.com/go-resty/resty/v2/.travis.yml
deleted file mode 100644
index fa1ce907d..000000000
--- a/vendor/github.com/go-resty/resty/v2/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-language: go
-
-sudo: false
-
-go: # use travis ci resource effectively, keep always latest 2 versions and tip :)
- - 1.14.x
- - 1.13.x
- - tip
-
-install:
- - go get -v -t ./...
-
-script:
- - go test ./... -race -coverprofile=coverage.txt -covermode=atomic
-
-after_success:
- - bash <(curl -s https://codecov.io/bash)
-
-matrix:
- allow_failures:
- - go: tip
diff --git a/vendor/github.com/go-resty/resty/v2/BUILD.bazel b/vendor/github.com/go-resty/resty/v2/BUILD.bazel
deleted file mode 100644
index 6c47cbbbf..000000000
--- a/vendor/github.com/go-resty/resty/v2/BUILD.bazel
+++ /dev/null
@@ -1,36 +0,0 @@
-package(default_visibility = ["//visibility:private"])
-
-load("@bazel_gazelle//:def.bzl", "gazelle")
-load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
-
-gazelle(
- name = "gazelle",
- command = "fix",
- prefix = "github.com/go-resty/resty/v2",
-)
-
-go_library(
- name = "go_default_library",
- srcs = glob(
- ["*.go"],
- exclude = ["*_test.go"],
- ),
- importpath = "github.com/go-resty/resty/v2",
- visibility = ["//visibility:public"],
- deps = ["@org_golang_x_net//publicsuffix:go_default_library"],
-)
-
-go_test(
- name = "go_default_test",
- srcs =
- glob(
- ["*_test.go"],
- exclude = ["example_test.go"],
- ),
- data = glob([".testdata/*"]),
- embed = [":go_default_library"],
- importpath = "github.com/go-resty/resty/v2",
- deps = [
- "@org_golang_x_net//proxy:go_default_library",
- ],
-)
diff --git a/vendor/github.com/go-resty/resty/v2/LICENSE b/vendor/github.com/go-resty/resty/v2/LICENSE
deleted file mode 100644
index c9ae93e39..000000000
--- a/vendor/github.com/go-resty/resty/v2/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2015-2020 Jeevanandam M., https://myjeeva.com
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
diff --git a/vendor/github.com/go-resty/resty/v2/README.md b/vendor/github.com/go-resty/resty/v2/README.md
deleted file mode 100644
index 4d2199150..000000000
--- a/vendor/github.com/go-resty/resty/v2/README.md
+++ /dev/null
@@ -1,850 +0,0 @@
-
-
Resty
-Simple HTTP and REST client library for Go (inspired by Ruby rest-client)
-Features section describes in detail about Resty capabilities
-
-
-
-
-
-
Resty Communication Channels
-
-
-
-## News
-
- * v2.3.0 [released](https://github.com/go-resty/resty/releases/tag/v2.3.0) and tagged on May 20, 2020.
- * v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019.
- * v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019.
- * v1.0 released and tagged on Sep 25, 2017. - Resty's first version was released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years since first release. I'm very thankful to Resty users and its [contributors](https://github.com/go-resty/resty/graphs/contributors).
-
-## Features
-
- * GET, POST, PUT, DELETE, HEAD, PATCH, OPTIONS, etc.
- * Simple and chainable methods for settings and request
- * [Request](https://godoc.org/github.com/go-resty/resty#Request) Body can be `string`, `[]byte`, `struct`, `map`, `slice` and `io.Reader` too
- * Auto detects `Content-Type`
- * Buffer less processing for `io.Reader`
- * Request Body can be read multiple times via `Request.RawRequest.GetBody()`
- * [Response](https://godoc.org/github.com/go-resty/resty#Response) object gives you more possibility
- * Access as `[]byte` array - `response.Body()` OR Access as `string` - `response.String()`
- * Know your `response.Time()` and when we `response.ReceivedAt()`
- * Automatic marshal and unmarshal for `JSON` and `XML` content type
- * Default is `JSON`, if you supply `struct/map` without header `Content-Type`
- * For auto-unmarshal, refer to -
- - Success scenario [Request.SetResult()](https://godoc.org/github.com/go-resty/resty#Request.SetResult) and [Response.Result()](https://godoc.org/github.com/go-resty/resty#Response.Result).
- - Error scenario [Request.SetError()](https://godoc.org/github.com/go-resty/resty#Request.SetError) and [Response.Error()](https://godoc.org/github.com/go-resty/resty#Response.Error).
- - Supports [RFC7807](https://tools.ietf.org/html/rfc7807) - `application/problem+json` & `application/problem+xml`
- * Easy to upload one or more file(s) via `multipart/form-data`
- * Auto detects file content type
- * Request URL [Path Params (aka URI Params)](https://godoc.org/github.com/go-resty/resty#Request.SetPathParams)
- * Backoff Retry Mechanism with retry condition function [reference](retry_test.go)
- * Resty client HTTP & REST [Request](https://godoc.org/github.com/go-resty/resty#Client.OnBeforeRequest) and [Response](https://godoc.org/github.com/go-resty/resty#Client.OnAfterResponse) middlewares
- * `Request.SetContext` supported
- * Authorization option of `BasicAuth` and `Bearer` token
- * Set request `ContentLength` value for all request or particular request
- * Custom [Root Certificates](https://godoc.org/github.com/go-resty/resty#Client.SetRootCertificate) and Client [Certificates](https://godoc.org/github.com/go-resty/resty#Client.SetCertificates)
- * Download/Save HTTP response directly into File, like `curl -o` flag. See [SetOutputDirectory](https://godoc.org/github.com/go-resty/resty#Client.SetOutputDirectory) & [SetOutput](https://godoc.org/github.com/go-resty/resty#Request.SetOutput).
- * Cookies for your request and CookieJar support
- * SRV Record based request instead of Host URL
- * Client settings like `Timeout`, `RedirectPolicy`, `Proxy`, `TLSClientConfig`, `Transport`, etc.
- * Optionally allows GET request with payload, see [SetAllowGetMethodPayload](https://godoc.org/github.com/go-resty/resty#Client.SetAllowGetMethodPayload)
- * Supports registering external JSON library into resty, see [how to use](https://github.com/go-resty/resty/issues/76#issuecomment-314015250)
- * Exposes Response reader without reading response (no auto-unmarshaling) if need be, see [how to use](https://github.com/go-resty/resty/issues/87#issuecomment-322100604)
- * Option to specify expected `Content-Type` when response `Content-Type` header missing. Refer to [#92](https://github.com/go-resty/resty/issues/92)
- * Resty design
- * Have client level settings & options and also override at Request level if you want to
- * Request and Response middlewares
- * Create Multiple clients if you want to `resty.New()`
- * Supports `http.RoundTripper` implementation, see [SetTransport](https://godoc.org/github.com/go-resty/resty#Client.SetTransport)
- * goroutine concurrent safe
- * Resty Client trace, see [Client.EnableTrace](https://godoc.org/github.com/go-resty/resty#Client.EnableTrace) and [Request.EnableTrace](https://godoc.org/github.com/go-resty/resty#Request.EnableTrace)
- * Debug mode - clean and informative logging presentation
- * Gzip - Go does it automatically also resty has fallback handling too
- * Works fine with `HTTP/2` and `HTTP/1.1`
- * [Bazel support](#bazel-support)
- * Easily mock Resty for testing, [for e.g.](#mocking-http-requests-using-httpmock-library)
- * Well tested client library
-
-### Included Batteries
-
- * Redirect Policies - see [how to use](#redirect-policy)
- * NoRedirectPolicy
- * FlexibleRedirectPolicy
- * DomainCheckRedirectPolicy
- * etc. [more info](redirect.go)
- * Retry Mechanism [how to use](#retries)
- * Backoff Retry
- * Conditional Retry
- * SRV Record based request instead of Host URL [how to use](resty_test.go#L1412)
- * etc (upcoming - throw your idea's [here](https://github.com/go-resty/resty/issues)).
-
-
-#### Supported Go Versions
-
-Initially Resty started supporting `go modules` since `v1.10.0` release.
-
-Starting Resty v2 and higher versions, it fully embraces [go modules](https://github.com/golang/go/wiki/Modules) package release. It requires a Go version capable of understanding `/vN` suffixed imports:
-
-- 1.9.7+
-- 1.10.3+
-- 1.11+
-
-
-## It might be beneficial for your project :smile:
-
-Resty author also published following projects for Go Community.
-
- * [aah framework](https://aahframework.org) - A secure, flexible, rapid Go web framework.
- * [THUMBAI](https://thumbai.app) - Go Mod Repository, Go Vanity Service and Simple Proxy Server.
- * [go-model](https://github.com/jeevatkm/go-model) - Robust & Easy to use model mapper and utility methods for Go `struct`.
-
-
-## Installation
-
-```bash
-# Go Modules
-require github.com/go-resty/resty/v2 v2.3.0
-```
-
-## Usage
-
-The following samples will assist you to become as comfortable as possible with resty library.
-
-```go
-// Import resty into your code and refer it as `resty`.
-import "github.com/go-resty/resty/v2"
-```
-
-#### Simple GET
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-resp, err := client.R().
- EnableTrace().
- Get("https://httpbin.org/get")
-
-// Explore response object
-fmt.Println("Response Info:")
-fmt.Println("Error :", err)
-fmt.Println("Status Code:", resp.StatusCode())
-fmt.Println("Status :", resp.Status())
-fmt.Println("Proto :", resp.Proto())
-fmt.Println("Time :", resp.Time())
-fmt.Println("Received At:", resp.ReceivedAt())
-fmt.Println("Body :\n", resp)
-fmt.Println()
-
-// Explore trace info
-fmt.Println("Request Trace Info:")
-ti := resp.Request.TraceInfo()
-fmt.Println("DNSLookup :", ti.DNSLookup)
-fmt.Println("ConnTime :", ti.ConnTime)
-fmt.Println("TCPConnTime :", ti.TCPConnTime)
-fmt.Println("TLSHandshake :", ti.TLSHandshake)
-fmt.Println("ServerTime :", ti.ServerTime)
-fmt.Println("ResponseTime :", ti.ResponseTime)
-fmt.Println("TotalTime :", ti.TotalTime)
-fmt.Println("IsConnReused :", ti.IsConnReused)
-fmt.Println("IsConnWasIdle:", ti.IsConnWasIdle)
-fmt.Println("ConnIdleTime :", ti.ConnIdleTime)
-
-/* Output
-Response Info:
-Error :
-Status Code: 200
-Status : 200 OK
-Proto : HTTP/2.0
-Time : 475.611189ms
-Received At: 2020-05-19 00:11:06.828188 -0700 PDT m=+0.476510773
-Body :
- {
- "args": {},
- "headers": {
- "Accept-Encoding": "gzip",
- "Host": "httpbin.org",
- "User-Agent": "go-resty/2.3.0 (https://github.com/go-resty/resty)"
- },
- "origin": "0.0.0.0",
- "url": "https://httpbin.org/get"
-}
-
-Request Trace Info:
-DNSLookup : 4.870246ms
-ConnTime : 393.95373ms
-TCPConnTime : 78.360432ms
-TLSHandshake : 310.032859ms
-ServerTime : 81.648284ms
-ResponseTime : 124.266µs
-TotalTime : 475.611189ms
-IsConnReused : false
-IsConnWasIdle: false
-ConnIdleTime : 0s
-*/
-```
-
-#### Enhanced GET
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-resp, err := client.R().
- SetQueryParams(map[string]string{
- "page_no": "1",
- "limit": "20",
- "sort":"name",
- "order": "asc",
- "random":strconv.FormatInt(time.Now().Unix(), 10),
- }).
- SetHeader("Accept", "application/json").
- SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F").
- Get("/search_result")
-
-
-// Sample of using Request.SetQueryString method
-resp, err := client.R().
- SetQueryString("productId=232&template=fresh-sample&cat=resty&source=google&kw=buy a lot more").
- SetHeader("Accept", "application/json").
- SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F").
- Get("/show_product")
-```
-
-#### Various POST method combinations
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// POST JSON string
-// No need to set content type, if you have client level setting
-resp, err := client.R().
- SetHeader("Content-Type", "application/json").
- SetBody(`{"username":"testuser", "password":"testpass"}`).
- SetResult(&AuthSuccess{}). // or SetResult(AuthSuccess{}).
- Post("https://myapp.com/login")
-
-// POST []byte array
-// No need to set content type, if you have client level setting
-resp, err := client.R().
- SetHeader("Content-Type", "application/json").
- SetBody([]byte(`{"username":"testuser", "password":"testpass"}`)).
- SetResult(&AuthSuccess{}). // or SetResult(AuthSuccess{}).
- Post("https://myapp.com/login")
-
-// POST Struct, default is JSON content type. No need to set one
-resp, err := client.R().
- SetBody(User{Username: "testuser", Password: "testpass"}).
- SetResult(&AuthSuccess{}). // or SetResult(AuthSuccess{}).
- SetError(&AuthError{}). // or SetError(AuthError{}).
- Post("https://myapp.com/login")
-
-// POST Map, default is JSON content type. No need to set one
-resp, err := client.R().
- SetBody(map[string]interface{}{"username": "testuser", "password": "testpass"}).
- SetResult(&AuthSuccess{}). // or SetResult(AuthSuccess{}).
- SetError(&AuthError{}). // or SetError(AuthError{}).
- Post("https://myapp.com/login")
-
-// POST of raw bytes for file upload. For example: upload file to Dropbox
-fileBytes, _ := ioutil.ReadFile("/Users/jeeva/mydocument.pdf")
-
-// See we are not setting content-type header, since go-resty automatically detects Content-Type for you
-resp, err := client.R().
- SetBody(fileBytes).
- SetContentLength(true). // Dropbox expects this value
- SetAuthToken("").
- SetError(&DropboxError{}). // or SetError(DropboxError{}).
- Post("https://content.dropboxapi.com/1/files_put/auto/resty/mydocument.pdf") // for upload Dropbox supports PUT too
-
-// Note: resty detects Content-Type for request body/payload if content type header is not set.
-// * For struct and map data type defaults to 'application/json'
-// * Fallback is plain text content type
-```
-
-#### Sample PUT
-
-You can use various combinations of `PUT` method call like demonstrated for `POST`.
-
-```go
-// Note: This is one sample of PUT method usage, refer POST for more combination
-
-// Create a Resty Client
-client := resty.New()
-
-// Request goes as JSON content type
-// No need to set auth token, error, if you have client level settings
-resp, err := client.R().
- SetBody(Article{
- Title: "go-resty",
- Content: "This is my article content, oh ya!",
- Author: "Jeevanandam M",
- Tags: []string{"article", "sample", "resty"},
- }).
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- SetError(&Error{}). // or SetError(Error{}).
- Put("https://myapp.com/article/1234")
-```
-
-#### Sample PATCH
-
-You can use various combinations of `PATCH` method call like demonstrated for `POST`.
-
-```go
-// Note: This is one sample of PUT method usage, refer POST for more combination
-
-// Create a Resty Client
-client := resty.New()
-
-// Request goes as JSON content type
-// No need to set auth token, error, if you have client level settings
-resp, err := client.R().
- SetBody(Article{
- Tags: []string{"new tag1", "new tag2"},
- }).
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- SetError(&Error{}). // or SetError(Error{}).
- Patch("https://myapp.com/articles/1234")
-```
-
-#### Sample DELETE, HEAD, OPTIONS
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// DELETE a article
-// No need to set auth token, error, if you have client level settings
-resp, err := client.R().
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- SetError(&Error{}). // or SetError(Error{}).
- Delete("https://myapp.com/articles/1234")
-
-// DELETE a articles with payload/body as a JSON string
-// No need to set auth token, error, if you have client level settings
-resp, err := client.R().
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- SetError(&Error{}). // or SetError(Error{}).
- SetHeader("Content-Type", "application/json").
- SetBody(`{article_ids: [1002, 1006, 1007, 87683, 45432] }`).
- Delete("https://myapp.com/articles")
-
-// HEAD of resource
-// No need to set auth token, if you have client level settings
-resp, err := client.R().
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- Head("https://myapp.com/videos/hi-res-video")
-
-// OPTIONS of resource
-// No need to set auth token, if you have client level settings
-resp, err := client.R().
- SetAuthToken("C6A79608-782F-4ED0-A11D-BD82FAD829CD").
- Options("https://myapp.com/servers/nyc-dc-01")
-```
-
-### Multipart File(s) upload
-
-#### Using io.Reader
-
-```go
-profileImgBytes, _ := ioutil.ReadFile("/Users/jeeva/test-img.png")
-notesBytes, _ := ioutil.ReadFile("/Users/jeeva/text-file.txt")
-
-// Create a Resty Client
-client := resty.New()
-
-resp, err := client.R().
- SetFileReader("profile_img", "test-img.png", bytes.NewReader(profileImgBytes)).
- SetFileReader("notes", "text-file.txt", bytes.NewReader(notesBytes)).
- SetFormData(map[string]string{
- "first_name": "Jeevanandam",
- "last_name": "M",
- }).
- Post("http://myapp.com/upload")
-```
-
-#### Using File directly from Path
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Single file scenario
-resp, err := client.R().
- SetFile("profile_img", "/Users/jeeva/test-img.png").
- Post("http://myapp.com/upload")
-
-// Multiple files scenario
-resp, err := client.R().
- SetFiles(map[string]string{
- "profile_img": "/Users/jeeva/test-img.png",
- "notes": "/Users/jeeva/text-file.txt",
- }).
- Post("http://myapp.com/upload")
-
-// Multipart of form fields and files
-resp, err := client.R().
- SetFiles(map[string]string{
- "profile_img": "/Users/jeeva/test-img.png",
- "notes": "/Users/jeeva/text-file.txt",
- }).
- SetFormData(map[string]string{
- "first_name": "Jeevanandam",
- "last_name": "M",
- "zip_code": "00001",
- "city": "my city",
- "access_token": "C6A79608-782F-4ED0-A11D-BD82FAD829CD",
- }).
- Post("http://myapp.com/profile")
-```
-
-#### Sample Form submission
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// just mentioning about POST as an example with simple flow
-// User Login
-resp, err := client.R().
- SetFormData(map[string]string{
- "username": "jeeva",
- "password": "mypass",
- }).
- Post("http://myapp.com/login")
-
-// Followed by profile update
-resp, err := client.R().
- SetFormData(map[string]string{
- "first_name": "Jeevanandam",
- "last_name": "M",
- "zip_code": "00001",
- "city": "new city update",
- }).
- Post("http://myapp.com/profile")
-
-// Multi value form data
-criteria := url.Values{
- "search_criteria": []string{"book", "glass", "pencil"},
-}
-resp, err := client.R().
- SetFormDataFromValues(criteria).
- Post("http://myapp.com/search")
-```
-
-#### Save HTTP Response into File
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Setting output directory path, If directory not exists then resty creates one!
-// This is optional one, if you're planning using absoule path in
-// `Request.SetOutput` and can used together.
-client.SetOutputDirectory("/Users/jeeva/Downloads")
-
-// HTTP response gets saved into file, similar to curl -o flag
-_, err := client.R().
- SetOutput("plugin/ReplyWithHeader-v5.1-beta.zip").
- Get("http://bit.ly/1LouEKr")
-
-// OR using absolute path
-// Note: output directory path is not used for absolute path
-_, err := client.R().
- SetOutput("/MyDownloads/plugin/ReplyWithHeader-v5.1-beta.zip").
- Get("http://bit.ly/1LouEKr")
-```
-
-#### Request URL Path Params
-
-Resty provides easy to use dynamic request URL path params. Params can be set at client and request level. Client level params value can be overridden at request level.
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-client.R().SetPathParams(map[string]string{
- "userId": "sample@sample.com",
- "subAccountId": "100002",
-}).
-Get("/v1/users/{userId}/{subAccountId}/details")
-
-// Result:
-// Composed URL - /v1/users/sample@sample.com/100002/details
-```
-
-#### Request and Response Middleware
-
-Resty provides middleware ability to manipulate for Request and Response. It is more flexible than callback approach.
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Registering Request Middleware
-client.OnBeforeRequest(func(c *resty.Client, req *resty.Request) error {
- // Now you have access to Client and current Request object
- // manipulate it as per your need
-
- return nil // if its success otherwise return error
- })
-
-// Registering Response Middleware
-client.OnAfterResponse(func(c *resty.Client, resp *resty.Response) error {
- // Now you have access to Client and current Response object
- // manipulate it as per your need
-
- return nil // if its success otherwise return error
- })
-```
-
-#### Redirect Policy
-
-Resty provides few ready to use redirect policy(s) also it supports multiple policies together.
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Assign Client Redirect Policy. Create one as per you need
-client.SetRedirectPolicy(resty.FlexibleRedirectPolicy(15))
-
-// Wanna multiple policies such as redirect count, domain name check, etc
-client.SetRedirectPolicy(resty.FlexibleRedirectPolicy(20),
- resty.DomainCheckRedirectPolicy("host1.com", "host2.org", "host3.net"))
-```
-
-##### Custom Redirect Policy
-
-Implement [RedirectPolicy](redirect.go#L20) interface and register it with resty client. Have a look [redirect.go](redirect.go) for more information.
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Using raw func into resty.SetRedirectPolicy
-client.SetRedirectPolicy(resty.RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
- // Implement your logic here
-
- // return nil for continue redirect otherwise return error to stop/prevent redirect
- return nil
-}))
-
-//---------------------------------------------------
-
-// Using struct create more flexible redirect policy
-type CustomRedirectPolicy struct {
- // variables goes here
-}
-
-func (c *CustomRedirectPolicy) Apply(req *http.Request, via []*http.Request) error {
- // Implement your logic here
-
- // return nil for continue redirect otherwise return error to stop/prevent redirect
- return nil
-}
-
-// Registering in resty
-client.SetRedirectPolicy(CustomRedirectPolicy{/* initialize variables */})
-```
-
-#### Custom Root Certificates and Client Certificates
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Custom Root certificates, just supply .pem file.
-// you can add one or more root certificates, its get appended
-client.SetRootCertificate("/path/to/root/pemFile1.pem")
-client.SetRootCertificate("/path/to/root/pemFile2.pem")
-// ... and so on!
-
-// Adding Client Certificates, you add one or more certificates
-// Sample for creating certificate object
-// Parsing public/private key pair from a pair of files. The files must contain PEM encoded data.
-cert1, err := tls.LoadX509KeyPair("certs/client.pem", "certs/client.key")
-if err != nil {
- log.Fatalf("ERROR client certificate: %s", err)
-}
-// ...
-
-// You add one or more certificates
-client.SetCertificates(cert1, cert2, cert3)
-```
-
-#### Custom Root Certificates and Client Certificates from string
-
-```go
-// Custom Root certificates from string
-// You can pass you certificates throught env variables as strings
-// you can add one or more root certificates, its get appended
-client.SetRootCertificateFromString("-----BEGIN CERTIFICATE-----content-----END CERTIFICATE-----")
-client.SetRootCertificateFromString("-----BEGIN CERTIFICATE-----content-----END CERTIFICATE-----")
-// ... and so on!
-
-// Adding Client Certificates, you add one or more certificates
-// Sample for creating certificate object
-// Parsing public/private key pair from a pair of files. The files must contain PEM encoded data.
-cert1, err := tls.X509KeyPair([]byte("-----BEGIN CERTIFICATE-----content-----END CERTIFICATE-----"), []byte("-----BEGIN CERTIFICATE-----content-----END CERTIFICATE-----"))
-if err != nil {
- log.Fatalf("ERROR client certificate: %s", err)
-}
-// ...
-
-// You add one or more certificates
-client.SetCertificates(cert1, cert2, cert3)
-```
-
-#### Proxy Settings - Client as well as at Request Level
-
-Default `Go` supports Proxy via environment variable `HTTP_PROXY`. Resty provides support via `SetProxy` & `RemoveProxy`.
-Choose as per your need.
-
-**Client Level Proxy** settings applied to all the request
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Setting a Proxy URL and Port
-client.SetProxy("http://proxyserver:8888")
-
-// Want to remove proxy setting
-client.RemoveProxy()
-```
-
-#### Retries
-
-Resty uses [backoff](http://www.awsarchitectureblog.com/2015/03/backoff.html)
-to increase retry intervals after each attempt.
-
-Usage example:
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Retries are configured per client
-client.
- // Set retry count to non zero to enable retries
- SetRetryCount(3).
- // You can override initial retry wait time.
- // Default is 100 milliseconds.
- SetRetryWaitTime(5 * time.Second).
- // MaxWaitTime can be overridden as well.
- // Default is 2 seconds.
- SetRetryMaxWaitTime(20 * time.Second).
- // SetRetryAfter sets callback to calculate wait time between retries.
- // Default (nil) implies exponential backoff with jitter
- SetRetryAfter(func(client *Client, resp *Response) (time.Duration, error) {
- return 0, errors.New("quota exceeded")
- })
-```
-
-Above setup will result in resty retrying requests returned non nil error up to
-3 times with delay increased after each attempt.
-
-You can optionally provide client with custom retry conditions:
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-client.AddRetryCondition(
- // RetryConditionFunc type is for retry condition function
- // input: non-nil Response OR request execution error
- func(r *resty.Response, err error) bool {
- return r.StatusCode() == http.StatusTooManyRequests
- },
-)
-```
-
-Above example will make resty retry requests ended with `429 Too Many Requests`
-status code.
-
-Multiple retry conditions can be added.
-
-It is also possible to use `resty.Backoff(...)` to get arbitrary retry scenarios
-implemented. [Reference](retry_test.go).
-
-#### Allow GET request with Payload
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Allow GET request with Payload. This is disabled by default.
-client.SetAllowGetMethodPayload(true)
-```
-
-#### Wanna Multiple Clients
-
-```go
-// Here you go!
-// Client 1
-client1 := resty.New()
-client1.R().Get("http://httpbin.org")
-// ...
-
-// Client 2
-client2 := resty.New()
-client2.R().Head("http://httpbin.org")
-// ...
-
-// Bend it as per your need!!!
-```
-
-#### Remaining Client Settings & its Options
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Unique settings at Client level
-//--------------------------------
-// Enable debug mode
-client.SetDebug(true)
-
-// Assign Client TLSClientConfig
-// One can set custom root-certificate. Refer: http://golang.org/pkg/crypto/tls/#example_Dial
-client.SetTLSClientConfig(&tls.Config{ RootCAs: roots })
-
-// or One can disable security check (https)
-client.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true })
-
-// Set client timeout as per your need
-client.SetTimeout(1 * time.Minute)
-
-
-// You can override all below settings and options at request level if you want to
-//--------------------------------------------------------------------------------
-// Host URL for all request. So you can use relative URL in the request
-client.SetHostURL("http://httpbin.org")
-
-// Headers for all request
-client.SetHeader("Accept", "application/json")
-client.SetHeaders(map[string]string{
- "Content-Type": "application/json",
- "User-Agent": "My custom User Agent String",
- })
-
-// Cookies for all request
-client.SetCookie(&http.Cookie{
- Name:"go-resty",
- Value:"This is cookie value",
- Path: "/",
- Domain: "sample.com",
- MaxAge: 36000,
- HttpOnly: true,
- Secure: false,
- })
-client.SetCookies(cookies)
-
-// URL query parameters for all request
-client.SetQueryParam("user_id", "00001")
-client.SetQueryParams(map[string]string{ // sample of those who use this manner
- "api_key": "api-key-here",
- "api_secert": "api-secert",
- })
-client.R().SetQueryString("productId=232&template=fresh-sample&cat=resty&source=google&kw=buy a lot more")
-
-// Form data for all request. Typically used with POST and PUT
-client.SetFormData(map[string]string{
- "access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F",
- })
-
-// Basic Auth for all request
-client.SetBasicAuth("myuser", "mypass")
-
-// Bearer Auth Token for all request
-client.SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F")
-
-// Enabling Content length value for all request
-client.SetContentLength(true)
-
-// Registering global Error object structure for JSON/XML request
-client.SetError(&Error{}) // or resty.SetError(Error{})
-```
-
-#### Unix Socket
-
-```go
-unixSocket := "/var/run/my_socket.sock"
-
-// Create a Go's http.Transport so we can set it in resty.
-transport := http.Transport{
- Dial: func(_, _ string) (net.Conn, error) {
- return net.Dial("unix", unixSocket)
- },
-}
-
-// Create a Resty Client
-client := resty.New()
-
-// Set the previous transport that we created, set the scheme of the communication to the
-// socket and set the unixSocket as the HostURL.
-client.SetTransport(&transport).SetScheme("http").SetHostURL(unixSocket)
-
-// No need to write the host's URL on the request, just the path.
-client.R().Get("/index.html")
-```
-
-#### Bazel support
-
-Resty can be built, tested and depended upon via [Bazel](https://bazel.build).
-For example, to run all tests:
-
-```shell
-bazel test :go_default_test
-```
-
-#### Mocking http requests using [httpmock](https://github.com/jarcoal/httpmock) library
-
-In order to mock the http requests when testing your application you
-could use the `httpmock` library.
-
-When using the default resty client, you should pass the client to the library as follow:
-
-```go
-// Create a Resty Client
-client := resty.New()
-
-// Get the underlying HTTP Client and set it to Mock
-httpmock.ActivateNonDefault(client.GetClient())
-```
-
-More detailed example of mocking resty http requests using ginko could be found [here](https://github.com/jarcoal/httpmock#ginkgo--resty-example).
-
-## Versioning
-
-Resty releases versions according to [Semantic Versioning](http://semver.org)
-
- * Resty v2 does not use `gopkg.in` service for library versioning.
- * Resty fully adapted to `go mod` capabilities since `v1.10.0` release.
- * Resty v1 series was using `gopkg.in` to provide versioning. `gopkg.in/resty.vX` points to appropriate tagged versions; `X` denotes version series number and it's a stable release for production use. For e.g. `gopkg.in/resty.v0`.
- * Development takes place at the master branch. Although the code in master should always compile and test successfully, it might break API's. I aim to maintain backwards compatibility, but sometimes API's and behavior might be changed to fix a bug.
-
-## Contribution
-
-I would welcome your contribution! If you find any improvement or issue you want to fix, feel free to send a pull request, I like pull requests that include test cases for fix/enhancement. I have done my best to bring pretty good code coverage. Feel free to write tests.
-
-BTW, I'd like to know what you think about `Resty`. Kindly open an issue or send me an email; it'd mean a lot to me.
-
-## Creator
-
-[Jeevanandam M.](https://github.com/jeevatkm) (jeeva@myjeeva.com)
-
-## Core Team
-
-Have a look on [Members](https://github.com/orgs/go-resty/teams/core/members) page.
-
-## Contributors
-
-Have a look on [Contributors](https://github.com/go-resty/resty/graphs/contributors) page.
-
-## License
-
-Resty released under MIT license, refer [LICENSE](LICENSE) file.
diff --git a/vendor/github.com/go-resty/resty/v2/WORKSPACE b/vendor/github.com/go-resty/resty/v2/WORKSPACE
deleted file mode 100644
index 5459d6321..000000000
--- a/vendor/github.com/go-resty/resty/v2/WORKSPACE
+++ /dev/null
@@ -1,27 +0,0 @@
-workspace(name = "resty")
-
-git_repository(
- name = "io_bazel_rules_go",
- remote = "https://github.com/bazelbuild/rules_go.git",
- tag = "0.13.0",
-)
-
-git_repository(
- name = "bazel_gazelle",
- remote = "https://github.com/bazelbuild/bazel-gazelle.git",
- tag = "0.13.0",
-)
-
-load(
- "@io_bazel_rules_go//go:def.bzl",
- "go_rules_dependencies",
- "go_register_toolchains",
-)
-
-go_rules_dependencies()
-
-go_register_toolchains()
-
-load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
-
-gazelle_dependencies()
diff --git a/vendor/github.com/go-resty/resty/v2/client.go b/vendor/github.com/go-resty/resty/v2/client.go
deleted file mode 100644
index 7b51657d2..000000000
--- a/vendor/github.com/go-resty/resty/v2/client.go
+++ /dev/null
@@ -1,978 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "bytes"
- "compress/gzip"
- "crypto/tls"
- "crypto/x509"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "math"
- "net/http"
- "net/url"
- "reflect"
- "regexp"
- "strings"
- "sync"
- "time"
-)
-
-const (
- // MethodGet HTTP method
- MethodGet = "GET"
-
- // MethodPost HTTP method
- MethodPost = "POST"
-
- // MethodPut HTTP method
- MethodPut = "PUT"
-
- // MethodDelete HTTP method
- MethodDelete = "DELETE"
-
- // MethodPatch HTTP method
- MethodPatch = "PATCH"
-
- // MethodHead HTTP method
- MethodHead = "HEAD"
-
- // MethodOptions HTTP method
- MethodOptions = "OPTIONS"
-)
-
-var (
- hdrUserAgentKey = http.CanonicalHeaderKey("User-Agent")
- hdrAcceptKey = http.CanonicalHeaderKey("Accept")
- hdrContentTypeKey = http.CanonicalHeaderKey("Content-Type")
- hdrContentLengthKey = http.CanonicalHeaderKey("Content-Length")
- hdrContentEncodingKey = http.CanonicalHeaderKey("Content-Encoding")
- hdrAuthorizationKey = http.CanonicalHeaderKey("Authorization")
-
- plainTextType = "text/plain; charset=utf-8"
- jsonContentType = "application/json"
- formContentType = "application/x-www-form-urlencoded"
-
- jsonCheck = regexp.MustCompile(`(?i:(application|text)/(json|.*\+json|json\-.*)(;|$))`)
- xmlCheck = regexp.MustCompile(`(?i:(application|text)/(xml|.*\+xml)(;|$))`)
-
- hdrUserAgentValue = "go-resty/" + Version + " (https://github.com/go-resty/resty)"
- bufPool = &sync.Pool{New: func() interface{} { return &bytes.Buffer{} }}
-)
-
-type (
- // RequestMiddleware type is for request middleware, called before a request is sent
- RequestMiddleware func(*Client, *Request) error
-
- // ResponseMiddleware type is for response middleware, called after a response has been received
- ResponseMiddleware func(*Client, *Response) error
-
- // PreRequestHook type is for the request hook, called right before the request is sent
- PreRequestHook func(*Client, *http.Request) error
-
- // RequestLogCallback type is for request logs, called before the request is logged
- RequestLogCallback func(*RequestLog) error
-
- // ResponseLogCallback type is for response logs, called before the response is logged
- ResponseLogCallback func(*ResponseLog) error
-)
-
-// Client struct is used to create Resty client with client level settings,
-// these settings are applicable to all the request raised from the client.
-//
-// Resty also provides an options to override most of the client settings
-// at request level.
-type Client struct {
- HostURL string
- QueryParam url.Values
- FormData url.Values
- Header http.Header
- UserInfo *User
- Token string
- AuthScheme string
- Cookies []*http.Cookie
- Error reflect.Type
- Debug bool
- DisableWarn bool
- AllowGetMethodPayload bool
- RetryCount int
- RetryWaitTime time.Duration
- RetryMaxWaitTime time.Duration
- RetryConditions []RetryConditionFunc
- RetryAfter RetryAfterFunc
- JSONMarshal func(v interface{}) ([]byte, error)
- JSONUnmarshal func(data []byte, v interface{}) error
-
- jsonEscapeHTML bool
- setContentLength bool
- closeConnection bool
- notParseResponse bool
- trace bool
- debugBodySizeLimit int64
- outputDirectory string
- scheme string
- pathParams map[string]string
- log Logger
- httpClient *http.Client
- proxyURL *url.URL
- beforeRequest []RequestMiddleware
- udBeforeRequest []RequestMiddleware
- preReqHook PreRequestHook
- afterResponse []ResponseMiddleware
- requestLog RequestLogCallback
- responseLog ResponseLogCallback
-}
-
-// User type is to hold an username and password information
-type User struct {
- Username, Password string
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Client methods
-//___________________________________
-
-// SetHostURL method is to set Host URL in the client instance. It will be used with request
-// raised from this client with relative URL
-// // Setting HTTP address
-// client.SetHostURL("http://myjeeva.com")
-//
-// // Setting HTTPS address
-// client.SetHostURL("https://myjeeva.com")
-func (c *Client) SetHostURL(url string) *Client {
- c.HostURL = strings.TrimRight(url, "/")
- return c
-}
-
-// SetHeader method sets a single header field and its value in the client instance.
-// These headers will be applied to all requests raised from this client instance.
-// Also it can be overridden at request level header options.
-//
-// See `Request.SetHeader` or `Request.SetHeaders`.
-//
-// For Example: To set `Content-Type` and `Accept` as `application/json`
-//
-// client.
-// SetHeader("Content-Type", "application/json").
-// SetHeader("Accept", "application/json")
-func (c *Client) SetHeader(header, value string) *Client {
- c.Header.Set(header, value)
- return c
-}
-
-// SetHeaders method sets multiple headers field and its values at one go in the client instance.
-// These headers will be applied to all requests raised from this client instance. Also it can be
-// overridden at request level headers options.
-//
-// See `Request.SetHeaders` or `Request.SetHeader`.
-//
-// For Example: To set `Content-Type` and `Accept` as `application/json`
-//
-// client.SetHeaders(map[string]string{
-// "Content-Type": "application/json",
-// "Accept": "application/json",
-// })
-func (c *Client) SetHeaders(headers map[string]string) *Client {
- for h, v := range headers {
- c.Header.Set(h, v)
- }
- return c
-}
-
-// SetCookieJar method sets custom http.CookieJar in the resty client. Its way to override default.
-//
-// For Example: sometimes we don't want to save cookies in api contacting, we can remove the default
-// CookieJar in resty client.
-//
-// client.SetCookieJar(nil)
-func (c *Client) SetCookieJar(jar http.CookieJar) *Client {
- c.httpClient.Jar = jar
- return c
-}
-
-// SetCookie method appends a single cookie in the client instance.
-// These cookies will be added to all the request raised from this client instance.
-// client.SetCookie(&http.Cookie{
-// Name:"go-resty",
-// Value:"This is cookie value",
-// })
-func (c *Client) SetCookie(hc *http.Cookie) *Client {
- c.Cookies = append(c.Cookies, hc)
- return c
-}
-
-// SetCookies method sets an array of cookies in the client instance.
-// These cookies will be added to all the request raised from this client instance.
-// cookies := []*http.Cookie{
-// &http.Cookie{
-// Name:"go-resty-1",
-// Value:"This is cookie 1 value",
-// },
-// &http.Cookie{
-// Name:"go-resty-2",
-// Value:"This is cookie 2 value",
-// },
-// }
-//
-// // Setting a cookies into resty
-// client.SetCookies(cookies)
-func (c *Client) SetCookies(cs []*http.Cookie) *Client {
- c.Cookies = append(c.Cookies, cs...)
- return c
-}
-
-// SetQueryParam method sets single parameter and its value in the client instance.
-// It will be formed as query string for the request.
-//
-// For Example: `search=kitchen%20papers&size=large`
-// in the URL after `?` mark. These query params will be added to all the request raised from
-// this client instance. Also it can be overridden at request level Query Param options.
-//
-// See `Request.SetQueryParam` or `Request.SetQueryParams`.
-// client.
-// SetQueryParam("search", "kitchen papers").
-// SetQueryParam("size", "large")
-func (c *Client) SetQueryParam(param, value string) *Client {
- c.QueryParam.Set(param, value)
- return c
-}
-
-// SetQueryParams method sets multiple parameters and their values at one go in the client instance.
-// It will be formed as query string for the request.
-//
-// For Example: `search=kitchen%20papers&size=large`
-// in the URL after `?` mark. These query params will be added to all the request raised from this
-// client instance. Also it can be overridden at request level Query Param options.
-//
-// See `Request.SetQueryParams` or `Request.SetQueryParam`.
-// client.SetQueryParams(map[string]string{
-// "search": "kitchen papers",
-// "size": "large",
-// })
-func (c *Client) SetQueryParams(params map[string]string) *Client {
- for p, v := range params {
- c.SetQueryParam(p, v)
- }
- return c
-}
-
-// SetFormData method sets Form parameters and their values in the client instance.
-// It's applicable only HTTP method `POST` and `PUT` and requets content type would be set as
-// `application/x-www-form-urlencoded`. These form data will be added to all the request raised from
-// this client instance. Also it can be overridden at request level form data.
-//
-// See `Request.SetFormData`.
-// client.SetFormData(map[string]string{
-// "access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F",
-// "user_id": "3455454545",
-// })
-func (c *Client) SetFormData(data map[string]string) *Client {
- for k, v := range data {
- c.FormData.Set(k, v)
- }
- return c
-}
-
-// SetBasicAuth method sets the basic authentication header in the HTTP request. For Example:
-// Authorization: Basic
-//
-// For Example: To set the header for username "go-resty" and password "welcome"
-// client.SetBasicAuth("go-resty", "welcome")
-//
-// This basic auth information gets added to all the request rasied from this client instance.
-// Also it can be overridden or set one at the request level is supported.
-//
-// See `Request.SetBasicAuth`.
-func (c *Client) SetBasicAuth(username, password string) *Client {
- c.UserInfo = &User{Username: username, Password: password}
- return c
-}
-
-// SetAuthToken method sets the auth token of the `Authorization` header for all HTTP requests.
-// The default auth scheme is `Bearer`, it can be customized with the method `SetAuthScheme`. For Example:
-// Authorization:
-//
-// For Example: To set auth token BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F
-//
-// client.SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F")
-//
-// This auth token gets added to all the requests rasied from this client instance.
-// Also it can be overridden or set one at the request level is supported.
-//
-// See `Request.SetAuthToken`.
-func (c *Client) SetAuthToken(token string) *Client {
- c.Token = token
- return c
-}
-
-// SetAuthScheme method sets the auth scheme type in the HTTP request. For Example:
-// Authorization:
-//
-// For Example: To set the scheme to use OAuth
-//
-// client.SetAuthScheme("OAuth")
-//
-// This auth scheme gets added to all the requests rasied from this client instance.
-// Also it can be overridden or set one at the request level is supported.
-//
-// Information about auth schemes can be found in RFC7235 which is linked to below
-// along with the page containing the currently defined official authentication schemes:
-// https://tools.ietf.org/html/rfc7235
-// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes
-//
-// See `Request.SetAuthToken`.
-func (c *Client) SetAuthScheme(scheme string) *Client {
- c.AuthScheme = scheme
- return c
-}
-
-// R method creates a new request instance, its used for Get, Post, Put, Delete, Patch, Head, Options, etc.
-func (c *Client) R() *Request {
- r := &Request{
- QueryParam: url.Values{},
- FormData: url.Values{},
- Header: http.Header{},
- Cookies: make([]*http.Cookie, 0),
-
- client: c,
- multipartFiles: []*File{},
- multipartFields: []*MultipartField{},
- pathParams: map[string]string{},
- jsonEscapeHTML: true,
- }
- return r
-}
-
-// NewRequest is an alias for method `R()`. Creates a new request instance, its used for
-// Get, Post, Put, Delete, Patch, Head, Options, etc.
-func (c *Client) NewRequest() *Request {
- return c.R()
-}
-
-// OnBeforeRequest method appends request middleware into the before request chain.
-// Its gets applied after default Resty request middlewares and before request
-// been sent from Resty to host server.
-// client.OnBeforeRequest(func(c *resty.Client, r *resty.Request) error {
-// // Now you have access to Client and Request instance
-// // manipulate it as per your need
-//
-// return nil // if its success otherwise return error
-// })
-func (c *Client) OnBeforeRequest(m RequestMiddleware) *Client {
- c.udBeforeRequest = append(c.udBeforeRequest, m)
- return c
-}
-
-// OnAfterResponse method appends response middleware into the after response chain.
-// Once we receive response from host server, default Resty response middleware
-// gets applied and then user assigened response middlewares applied.
-// client.OnAfterResponse(func(c *resty.Client, r *resty.Response) error {
-// // Now you have access to Client and Response instance
-// // manipulate it as per your need
-//
-// return nil // if its success otherwise return error
-// })
-func (c *Client) OnAfterResponse(m ResponseMiddleware) *Client {
- c.afterResponse = append(c.afterResponse, m)
- return c
-}
-
-// SetPreRequestHook method sets the given pre-request function into resty client.
-// It is called right before the request is fired.
-//
-// Note: Only one pre-request hook can be registered. Use `client.OnBeforeRequest` for mutilple.
-func (c *Client) SetPreRequestHook(h PreRequestHook) *Client {
- if c.preReqHook != nil {
- c.log.Warnf("Overwriting an existing pre-request hook: %s", functionName(h))
- }
- c.preReqHook = h
- return c
-}
-
-// SetDebug method enables the debug mode on Resty client. Client logs details of every request and response.
-// For `Request` it logs information such as HTTP verb, Relative URL path, Host, Headers, Body if it has one.
-// For `Response` it logs information such as Status, Response Time, Headers, Body if it has one.
-// client.SetDebug(true)
-func (c *Client) SetDebug(d bool) *Client {
- c.Debug = d
- return c
-}
-
-// SetDebugBodyLimit sets the maximum size for which the response and request body will be logged in debug mode.
-// client.SetDebugBodyLimit(1000000)
-func (c *Client) SetDebugBodyLimit(sl int64) *Client {
- c.debugBodySizeLimit = sl
- return c
-}
-
-// OnRequestLog method used to set request log callback into Resty. Registered callback gets
-// called before the resty actually logs the information.
-func (c *Client) OnRequestLog(rl RequestLogCallback) *Client {
- if c.requestLog != nil {
- c.log.Warnf("Overwriting an existing on-request-log callback from=%s to=%s",
- functionName(c.requestLog), functionName(rl))
- }
- c.requestLog = rl
- return c
-}
-
-// OnResponseLog method used to set response log callback into Resty. Registered callback gets
-// called before the resty actually logs the information.
-func (c *Client) OnResponseLog(rl ResponseLogCallback) *Client {
- if c.responseLog != nil {
- c.log.Warnf("Overwriting an existing on-response-log callback from=%s to=%s",
- functionName(c.responseLog), functionName(rl))
- }
- c.responseLog = rl
- return c
-}
-
-// SetDisableWarn method disables the warning message on Resty client.
-//
-// For Example: Resty warns the user when BasicAuth used on non-TLS mode.
-// client.SetDisableWarn(true)
-func (c *Client) SetDisableWarn(d bool) *Client {
- c.DisableWarn = d
- return c
-}
-
-// SetAllowGetMethodPayload method allows the GET method with payload on Resty client.
-//
-// For Example: Resty allows the user sends request with a payload on HTTP GET method.
-// client.SetAllowGetMethodPayload(true)
-func (c *Client) SetAllowGetMethodPayload(a bool) *Client {
- c.AllowGetMethodPayload = a
- return c
-}
-
-// SetLogger method sets given writer for logging Resty request and response details.
-//
-// Compliant to interface `resty.Logger`.
-func (c *Client) SetLogger(l Logger) *Client {
- c.log = l
- return c
-}
-
-// SetContentLength method enables the HTTP header `Content-Length` value for every request.
-// By default Resty won't set `Content-Length`.
-// client.SetContentLength(true)
-//
-// Also you have an option to enable for particular request. See `Request.SetContentLength`
-func (c *Client) SetContentLength(l bool) *Client {
- c.setContentLength = l
- return c
-}
-
-// SetTimeout method sets timeout for request raised from client.
-// client.SetTimeout(time.Duration(1 * time.Minute))
-func (c *Client) SetTimeout(timeout time.Duration) *Client {
- c.httpClient.Timeout = timeout
- return c
-}
-
-// SetError method is to register the global or client common `Error` object into Resty.
-// It is used for automatic unmarshalling if response status code is greater than 399 and
-// content type either JSON or XML. Can be pointer or non-pointer.
-// client.SetError(&Error{})
-// // OR
-// client.SetError(Error{})
-func (c *Client) SetError(err interface{}) *Client {
- c.Error = typeOf(err)
- return c
-}
-
-// SetRedirectPolicy method sets the client redirect poilicy. Resty provides ready to use
-// redirect policies. Wanna create one for yourself refer to `redirect.go`.
-//
-// client.SetRedirectPolicy(FlexibleRedirectPolicy(20))
-//
-// // Need multiple redirect policies together
-// client.SetRedirectPolicy(FlexibleRedirectPolicy(20), DomainCheckRedirectPolicy("host1.com", "host2.net"))
-func (c *Client) SetRedirectPolicy(policies ...interface{}) *Client {
- for _, p := range policies {
- if _, ok := p.(RedirectPolicy); !ok {
- c.log.Errorf("%v does not implement resty.RedirectPolicy (missing Apply method)",
- functionName(p))
- }
- }
-
- c.httpClient.CheckRedirect = func(req *http.Request, via []*http.Request) error {
- for _, p := range policies {
- if err := p.(RedirectPolicy).Apply(req, via); err != nil {
- return err
- }
- }
- return nil // looks good, go ahead
- }
-
- return c
-}
-
-// SetRetryCount method enables retry on Resty client and allows you
-// to set no. of retry count. Resty uses a Backoff mechanism.
-func (c *Client) SetRetryCount(count int) *Client {
- c.RetryCount = count
- return c
-}
-
-// SetRetryWaitTime method sets default wait time to sleep before retrying
-// request.
-//
-// Default is 100 milliseconds.
-func (c *Client) SetRetryWaitTime(waitTime time.Duration) *Client {
- c.RetryWaitTime = waitTime
- return c
-}
-
-// SetRetryMaxWaitTime method sets max wait time to sleep before retrying
-// request.
-//
-// Default is 2 seconds.
-func (c *Client) SetRetryMaxWaitTime(maxWaitTime time.Duration) *Client {
- c.RetryMaxWaitTime = maxWaitTime
- return c
-}
-
-// SetRetryAfter sets callback to calculate wait time between retries.
-// Default (nil) implies exponential backoff with jitter
-func (c *Client) SetRetryAfter(callback RetryAfterFunc) *Client {
- c.RetryAfter = callback
- return c
-}
-
-// AddRetryCondition method adds a retry condition function to array of functions
-// that are checked to determine if the request is retried. The request will
-// retry if any of the functions return true and error is nil.
-func (c *Client) AddRetryCondition(condition RetryConditionFunc) *Client {
- c.RetryConditions = append(c.RetryConditions, condition)
- return c
-}
-
-// SetTLSClientConfig method sets TLSClientConfig for underling client Transport.
-//
-// For Example:
-// // One can set custom root-certificate. Refer: http://golang.org/pkg/crypto/tls/#example_Dial
-// client.SetTLSClientConfig(&tls.Config{ RootCAs: roots })
-//
-// // or One can disable security check (https)
-// client.SetTLSClientConfig(&tls.Config{ InsecureSkipVerify: true })
-//
-// Note: This method overwrites existing `TLSClientConfig`.
-func (c *Client) SetTLSClientConfig(config *tls.Config) *Client {
- transport, err := c.transport()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
- transport.TLSClientConfig = config
- return c
-}
-
-// SetProxy method sets the Proxy URL and Port for Resty client.
-// client.SetProxy("http://proxyserver:8888")
-//
-// OR Without this `SetProxy` method, you could also set Proxy via environment variable.
-//
-// Refer to godoc `http.ProxyFromEnvironment`.
-func (c *Client) SetProxy(proxyURL string) *Client {
- transport, err := c.transport()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
-
- pURL, err := url.Parse(proxyURL)
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
-
- c.proxyURL = pURL
- transport.Proxy = http.ProxyURL(c.proxyURL)
- return c
-}
-
-// RemoveProxy method removes the proxy configuration from Resty client
-// client.RemoveProxy()
-func (c *Client) RemoveProxy() *Client {
- transport, err := c.transport()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
- c.proxyURL = nil
- transport.Proxy = nil
- return c
-}
-
-// SetCertificates method helps to set client certificates into Resty conveniently.
-func (c *Client) SetCertificates(certs ...tls.Certificate) *Client {
- config, err := c.tlsConfig()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
- config.Certificates = append(config.Certificates, certs...)
- return c
-}
-
-// SetRootCertificate method helps to add one or more root certificates into Resty client
-// client.SetRootCertificate("/path/to/root/pemFile.pem")
-func (c *Client) SetRootCertificate(pemFilePath string) *Client {
- rootPemData, err := ioutil.ReadFile(pemFilePath)
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
-
- config, err := c.tlsConfig()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
- if config.RootCAs == nil {
- config.RootCAs = x509.NewCertPool()
- }
-
- config.RootCAs.AppendCertsFromPEM(rootPemData)
- return c
-}
-
-// SetRootCertificateFromString method helps to add one or more root certificates into Resty client
-// client.SetRootCertificateFromString("pem file content")
-func (c *Client) SetRootCertificateFromString(pemContent string) *Client {
- config, err := c.tlsConfig()
- if err != nil {
- c.log.Errorf("%v", err)
- return c
- }
- if config.RootCAs == nil {
- config.RootCAs = x509.NewCertPool()
- }
-
- config.RootCAs.AppendCertsFromPEM([]byte(pemContent))
- return c
-}
-
-// SetOutputDirectory method sets output directory for saving HTTP response into file.
-// If the output directory not exists then resty creates one. This setting is optional one,
-// if you're planning using absolute path in `Request.SetOutput` and can used together.
-// client.SetOutputDirectory("/save/http/response/here")
-func (c *Client) SetOutputDirectory(dirPath string) *Client {
- c.outputDirectory = dirPath
- return c
-}
-
-// SetTransport method sets custom `*http.Transport` or any `http.RoundTripper`
-// compatible interface implementation in the resty client.
-//
-// Note:
-//
-// - If transport is not type of `*http.Transport` then you may not be able to
-// take advantage of some of the Resty client settings.
-//
-// - It overwrites the Resty client transport instance and it's configurations.
-//
-// transport := &http.Transport{
-// // somthing like Proxying to httptest.Server, etc...
-// Proxy: func(req *http.Request) (*url.URL, error) {
-// return url.Parse(server.URL)
-// },
-// }
-//
-// client.SetTransport(transport)
-func (c *Client) SetTransport(transport http.RoundTripper) *Client {
- if transport != nil {
- c.httpClient.Transport = transport
- }
- return c
-}
-
-// SetScheme method sets custom scheme in the Resty client. It's way to override default.
-// client.SetScheme("http")
-func (c *Client) SetScheme(scheme string) *Client {
- if !IsStringEmpty(scheme) {
- c.scheme = scheme
- }
- return c
-}
-
-// SetCloseConnection method sets variable `Close` in http request struct with the given
-// value. More info: https://golang.org/src/net/http/request.go
-func (c *Client) SetCloseConnection(close bool) *Client {
- c.closeConnection = close
- return c
-}
-
-// SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically.
-// Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body,
-// otherwise you might get into connection leaks, no connection reuse.
-//
-// Note: Response middlewares are not applicable, if you use this option. Basically you have
-// taken over the control of response parsing from `Resty`.
-func (c *Client) SetDoNotParseResponse(parse bool) *Client {
- c.notParseResponse = parse
- return c
-}
-
-// SetPathParams method sets multiple URL path key-value pairs at one go in the
-// Resty client instance.
-// client.SetPathParams(map[string]string{
-// "userId": "sample@sample.com",
-// "subAccountId": "100002",
-// })
-//
-// Result:
-// URL - /v1/users/{userId}/{subAccountId}/details
-// Composed URL - /v1/users/sample@sample.com/100002/details
-// It replace the value of the key while composing request URL. Also it can be
-// overridden at request level Path Params options, see `Request.SetPathParams`.
-func (c *Client) SetPathParams(params map[string]string) *Client {
- for p, v := range params {
- c.pathParams[p] = v
- }
- return c
-}
-
-// SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal.
-//
-// Note: This option only applicable to standard JSON Marshaller.
-func (c *Client) SetJSONEscapeHTML(b bool) *Client {
- c.jsonEscapeHTML = b
- return c
-}
-
-// EnableTrace method enables the Resty client trace for the requests fired from
-// the client using `httptrace.ClientTrace` and provides insights.
-//
-// client := resty.New().EnableTrace()
-//
-// resp, err := client.R().Get("https://httpbin.org/get")
-// fmt.Println("Error:", err)
-// fmt.Println("Trace Info:", resp.Request.TraceInfo())
-//
-// Also `Request.EnableTrace` available too to get trace info for single request.
-//
-// Since v2.0.0
-func (c *Client) EnableTrace() *Client {
- c.trace = true
- return c
-}
-
-// DisableTrace method disables the Resty client trace. Refer to `Client.EnableTrace`.
-//
-// Since v2.0.0
-func (c *Client) DisableTrace() *Client {
- c.trace = false
- return c
-}
-
-// IsProxySet method returns the true is proxy is set from resty client otherwise
-// false. By default proxy is set from environment, refer to `http.ProxyFromEnvironment`.
-func (c *Client) IsProxySet() bool {
- return c.proxyURL != nil
-}
-
-// GetClient method returns the current `http.Client` used by the resty client.
-func (c *Client) GetClient() *http.Client {
- return c.httpClient
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Client Unexported methods
-//_______________________________________________________________________
-
-// Executes method executes the given `Request` object and returns response
-// error.
-func (c *Client) execute(req *Request) (*Response, error) {
- defer releaseBuffer(req.bodyBuf)
- // Apply Request middleware
- var err error
-
- // user defined on before request methods
- // to modify the *resty.Request object
- for _, f := range c.udBeforeRequest {
- if err = f(c, req); err != nil {
- return nil, wrapNoRetryErr(err)
- }
- }
-
- // resty middlewares
- for _, f := range c.beforeRequest {
- if err = f(c, req); err != nil {
- return nil, wrapNoRetryErr(err)
- }
- }
-
- if hostHeader := req.Header.Get("Host"); hostHeader != "" {
- req.RawRequest.Host = hostHeader
- }
-
- // call pre-request if defined
- if c.preReqHook != nil {
- if err = c.preReqHook(c, req.RawRequest); err != nil {
- return nil, wrapNoRetryErr(err)
- }
- }
-
- if err = requestLogger(c, req); err != nil {
- return nil, wrapNoRetryErr(err)
- }
-
- req.Time = time.Now()
- resp, err := c.httpClient.Do(req.RawRequest)
-
- response := &Response{
- Request: req,
- RawResponse: resp,
- }
-
- if err != nil || req.notParseResponse || c.notParseResponse {
- response.setReceivedAt()
- return response, err
- }
-
- if !req.isSaveResponse {
- defer closeq(resp.Body)
- body := resp.Body
-
- // GitHub #142 & #187
- if strings.EqualFold(resp.Header.Get(hdrContentEncodingKey), "gzip") && resp.ContentLength != 0 {
- if _, ok := body.(*gzip.Reader); !ok {
- body, err = gzip.NewReader(body)
- if err != nil {
- response.setReceivedAt()
- return response, err
- }
- defer closeq(body)
- }
- }
-
- if response.body, err = ioutil.ReadAll(body); err != nil {
- response.setReceivedAt()
- return response, err
- }
-
- response.setReceivedAt() // after we read the body
- response.size = int64(len(response.body))
- }
-
- // Apply Response middleware
- for _, f := range c.afterResponse {
- if err = f(c, response); err != nil {
- break
- }
- }
-
- return response, wrapNoRetryErr(err)
-}
-
-// getting TLS client config if not exists then create one
-func (c *Client) tlsConfig() (*tls.Config, error) {
- transport, err := c.transport()
- if err != nil {
- return nil, err
- }
- if transport.TLSClientConfig == nil {
- transport.TLSClientConfig = &tls.Config{}
- }
- return transport.TLSClientConfig, nil
-}
-
-// Transport method returns `*http.Transport` currently in use or error
-// in case currently used `transport` is not a `*http.Transport`.
-func (c *Client) transport() (*http.Transport, error) {
- if transport, ok := c.httpClient.Transport.(*http.Transport); ok {
- return transport, nil
- }
- return nil, errors.New("current transport is not an *http.Transport instance")
-}
-
-// just an internal helper method
-func (c *Client) outputLogTo(w io.Writer) *Client {
- c.log.(*logger).l.SetOutput(w)
- return c
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// File struct and its methods
-//_______________________________________________________________________
-
-// File struct represent file information for multipart request
-type File struct {
- Name string
- ParamName string
- io.Reader
-}
-
-// String returns string value of current file details
-func (f *File) String() string {
- return fmt.Sprintf("ParamName: %v; FileName: %v", f.ParamName, f.Name)
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// MultipartField struct
-//_______________________________________________________________________
-
-// MultipartField struct represent custom data part for multipart request
-type MultipartField struct {
- Param string
- FileName string
- ContentType string
- io.Reader
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Unexported package methods
-//_______________________________________________________________________
-
-func createClient(hc *http.Client) *Client {
- if hc.Transport == nil {
- hc.Transport = createTransport(nil)
- }
-
- c := &Client{ // not setting lang default values
- QueryParam: url.Values{},
- FormData: url.Values{},
- Header: http.Header{},
- Cookies: make([]*http.Cookie, 0),
- RetryWaitTime: defaultWaitTime,
- RetryMaxWaitTime: defaultMaxWaitTime,
- JSONMarshal: json.Marshal,
- JSONUnmarshal: json.Unmarshal,
- jsonEscapeHTML: true,
- httpClient: hc,
- debugBodySizeLimit: math.MaxInt32,
- pathParams: make(map[string]string),
- }
-
- // Logger
- c.SetLogger(createLogger())
-
- // default before request middlewares
- c.beforeRequest = []RequestMiddleware{
- parseRequestURL,
- parseRequestHeader,
- parseRequestBody,
- createHTTPRequest,
- addCredentials,
- }
-
- // user defined request middlewares
- c.udBeforeRequest = []RequestMiddleware{}
-
- // default after response middlewares
- c.afterResponse = []ResponseMiddleware{
- responseLogger,
- parseResponseBody,
- saveResponseIntoFile,
- }
-
- return c
-}
diff --git a/vendor/github.com/go-resty/resty/v2/go.mod b/vendor/github.com/go-resty/resty/v2/go.mod
deleted file mode 100644
index f1faf5f1b..000000000
--- a/vendor/github.com/go-resty/resty/v2/go.mod
+++ /dev/null
@@ -1,5 +0,0 @@
-module github.com/go-resty/resty/v2
-
-require golang.org/x/net v0.0.0-20200513185701-a91f0712d120
-
-go 1.11
diff --git a/vendor/github.com/go-resty/resty/v2/middleware.go b/vendor/github.com/go-resty/resty/v2/middleware.go
deleted file mode 100644
index 703f07c60..000000000
--- a/vendor/github.com/go-resty/resty/v2/middleware.go
+++ /dev/null
@@ -1,526 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "bytes"
- "encoding/xml"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "mime/multipart"
- "net/http"
- "net/url"
- "os"
- "path/filepath"
- "reflect"
- "strings"
- "time"
-)
-
-const debugRequestLogKey = "__restyDebugRequestLog"
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Request Middleware(s)
-//_______________________________________________________________________
-
-func parseRequestURL(c *Client, r *Request) error {
- // GitHub #103 Path Params
- if len(r.pathParams) > 0 {
- for p, v := range r.pathParams {
- r.URL = strings.Replace(r.URL, "{"+p+"}", url.PathEscape(v), -1)
- }
- }
- if len(c.pathParams) > 0 {
- for p, v := range c.pathParams {
- r.URL = strings.Replace(r.URL, "{"+p+"}", url.PathEscape(v), -1)
- }
- }
-
- // Parsing request URL
- reqURL, err := url.Parse(r.URL)
- if err != nil {
- return err
- }
-
- // If Request.URL is relative path then added c.HostURL into
- // the request URL otherwise Request.URL will be used as-is
- if !reqURL.IsAbs() {
- r.URL = reqURL.String()
- if len(r.URL) > 0 && r.URL[0] != '/' {
- r.URL = "/" + r.URL
- }
-
- reqURL, err = url.Parse(c.HostURL + r.URL)
- if err != nil {
- return err
- }
- }
-
- // Adding Query Param
- query := make(url.Values)
- for k, v := range c.QueryParam {
- for _, iv := range v {
- query.Add(k, iv)
- }
- }
-
- for k, v := range r.QueryParam {
- // remove query param from client level by key
- // since overrides happens for that key in the request
- query.Del(k)
-
- for _, iv := range v {
- query.Add(k, iv)
- }
- }
-
- // GitHub #123 Preserve query string order partially.
- // Since not feasible in `SetQuery*` resty methods, because
- // standard package `url.Encode(...)` sorts the query params
- // alphabetically
- if len(query) > 0 {
- if IsStringEmpty(reqURL.RawQuery) {
- reqURL.RawQuery = query.Encode()
- } else {
- reqURL.RawQuery = reqURL.RawQuery + "&" + query.Encode()
- }
- }
-
- r.URL = reqURL.String()
-
- return nil
-}
-
-func parseRequestHeader(c *Client, r *Request) error {
- hdr := make(http.Header)
- for k := range c.Header {
- hdr[k] = append(hdr[k], c.Header[k]...)
- }
-
- for k := range r.Header {
- hdr.Del(k)
- hdr[k] = append(hdr[k], r.Header[k]...)
- }
-
- if IsStringEmpty(hdr.Get(hdrUserAgentKey)) {
- hdr.Set(hdrUserAgentKey, hdrUserAgentValue)
- }
-
- ct := hdr.Get(hdrContentTypeKey)
- if IsStringEmpty(hdr.Get(hdrAcceptKey)) && !IsStringEmpty(ct) &&
- (IsJSONType(ct) || IsXMLType(ct)) {
- hdr.Set(hdrAcceptKey, hdr.Get(hdrContentTypeKey))
- }
-
- r.Header = hdr
-
- return nil
-}
-
-func parseRequestBody(c *Client, r *Request) (err error) {
- if isPayloadSupported(r.Method, c.AllowGetMethodPayload) {
- // Handling Multipart
- if r.isMultiPart && !(r.Method == MethodPatch) {
- if err = handleMultipart(c, r); err != nil {
- return
- }
-
- goto CL
- }
-
- // Handling Form Data
- if len(c.FormData) > 0 || len(r.FormData) > 0 {
- handleFormData(c, r)
-
- goto CL
- }
-
- // Handling Request body
- if r.Body != nil {
- handleContentType(c, r)
-
- if err = handleRequestBody(c, r); err != nil {
- return
- }
- }
- }
-
-CL:
- // by default resty won't set content length, you can if you want to :)
- if (c.setContentLength || r.setContentLength) && r.bodyBuf != nil {
- r.Header.Set(hdrContentLengthKey, fmt.Sprintf("%d", r.bodyBuf.Len()))
- }
-
- return
-}
-
-func createHTTPRequest(c *Client, r *Request) (err error) {
- if r.bodyBuf == nil {
- if reader, ok := r.Body.(io.Reader); ok {
- r.RawRequest, err = http.NewRequest(r.Method, r.URL, reader)
- } else {
- r.RawRequest, err = http.NewRequest(r.Method, r.URL, nil)
- }
- } else {
- r.RawRequest, err = http.NewRequest(r.Method, r.URL, r.bodyBuf)
- }
-
- if err != nil {
- return
- }
-
- // Assign close connection option
- r.RawRequest.Close = c.closeConnection
-
- // Add headers into http request
- r.RawRequest.Header = r.Header
-
- // Add cookies from client instance into http request
- for _, cookie := range c.Cookies {
- r.RawRequest.AddCookie(cookie)
- }
-
- // Add cookies from request instance into http request
- for _, cookie := range r.Cookies {
- r.RawRequest.AddCookie(cookie)
- }
-
- // it's for non-http scheme option
- if r.RawRequest.URL != nil && r.RawRequest.URL.Scheme == "" {
- r.RawRequest.URL.Scheme = c.scheme
- r.RawRequest.URL.Host = r.URL
- }
-
- // Enable trace
- if c.trace || r.trace {
- r.clientTrace = &clientTrace{}
- r.ctx = r.clientTrace.createContext(r.Context())
- }
-
- // Use context if it was specified
- if r.ctx != nil {
- r.RawRequest = r.RawRequest.WithContext(r.ctx)
- }
-
- // assign get body func for the underlying raw request instance
- r.RawRequest.GetBody = func() (io.ReadCloser, error) {
- // If r.bodyBuf present, return the copy
- if r.bodyBuf != nil {
- return ioutil.NopCloser(bytes.NewReader(r.bodyBuf.Bytes())), nil
- }
-
- // Maybe body is `io.Reader`.
- // Note: Resty user have to watchout for large body size of `io.Reader`
- if r.RawRequest.Body != nil {
- b, err := ioutil.ReadAll(r.RawRequest.Body)
- if err != nil {
- return nil, err
- }
-
- // Restore the Body
- closeq(r.RawRequest.Body)
- r.RawRequest.Body = ioutil.NopCloser(bytes.NewBuffer(b))
-
- // Return the Body bytes
- return ioutil.NopCloser(bytes.NewBuffer(b)), nil
- }
-
- return nil, nil
- }
-
- return
-}
-
-func addCredentials(c *Client, r *Request) error {
- var isBasicAuth bool
- // Basic Auth
- if r.UserInfo != nil { // takes precedence
- r.RawRequest.SetBasicAuth(r.UserInfo.Username, r.UserInfo.Password)
- isBasicAuth = true
- } else if c.UserInfo != nil {
- r.RawRequest.SetBasicAuth(c.UserInfo.Username, c.UserInfo.Password)
- isBasicAuth = true
- }
-
- if !c.DisableWarn {
- if isBasicAuth && !strings.HasPrefix(r.URL, "https") {
- c.log.Warnf("Using Basic Auth in HTTP mode is not secure, use HTTPS")
- }
- }
-
- // Set the Authorization Header Scheme
- var authScheme string
- if !IsStringEmpty(r.AuthScheme) {
- authScheme = r.AuthScheme
- } else if !IsStringEmpty(c.AuthScheme) {
- authScheme = c.AuthScheme
- } else {
- authScheme = "Bearer"
- }
-
- // Build the Token Auth header
- if !IsStringEmpty(r.Token) { // takes precedence
- r.RawRequest.Header.Set(hdrAuthorizationKey, authScheme+" "+r.Token)
- } else if !IsStringEmpty(c.Token) {
- r.RawRequest.Header.Set(hdrAuthorizationKey, authScheme+" "+c.Token)
- }
-
- return nil
-}
-
-func requestLogger(c *Client, r *Request) error {
- if c.Debug {
- rr := r.RawRequest
- rl := &RequestLog{Header: copyHeaders(rr.Header), Body: r.fmtBodyString(c.debugBodySizeLimit)}
- if c.requestLog != nil {
- if err := c.requestLog(rl); err != nil {
- return err
- }
- }
- // fmt.Sprintf("COOKIES:\n%s\n", composeCookies(c.GetClient().Jar, *rr.URL)) +
-
- reqLog := "\n==============================================================================\n" +
- "~~~ REQUEST ~~~\n" +
- fmt.Sprintf("%s %s %s\n", r.Method, rr.URL.RequestURI(), rr.Proto) +
- fmt.Sprintf("HOST : %s\n", rr.URL.Host) +
- fmt.Sprintf("HEADERS:\n%s\n", composeHeaders(c, r, rl.Header)) +
- fmt.Sprintf("BODY :\n%v\n", rl.Body) +
- "------------------------------------------------------------------------------\n"
-
- r.initValuesMap()
- r.values[debugRequestLogKey] = reqLog
- }
-
- return nil
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Response Middleware(s)
-//_______________________________________________________________________
-
-func responseLogger(c *Client, res *Response) error {
- if c.Debug {
- rl := &ResponseLog{Header: copyHeaders(res.Header()), Body: res.fmtBodyString(c.debugBodySizeLimit)}
- if c.responseLog != nil {
- if err := c.responseLog(rl); err != nil {
- return err
- }
- }
-
- debugLog := res.Request.values[debugRequestLogKey].(string)
- debugLog += "~~~ RESPONSE ~~~\n" +
- fmt.Sprintf("STATUS : %s\n", res.Status()) +
- fmt.Sprintf("PROTO : %s\n", res.RawResponse.Proto) +
- fmt.Sprintf("RECEIVED AT : %v\n", res.ReceivedAt().Format(time.RFC3339Nano)) +
- fmt.Sprintf("TIME DURATION: %v\n", res.Time()) +
- "HEADERS :\n" +
- composeHeaders(c, res.Request, rl.Header) + "\n"
- if res.Request.isSaveResponse {
- debugLog += fmt.Sprintf("BODY :\n***** RESPONSE WRITTEN INTO FILE *****\n")
- } else {
- debugLog += fmt.Sprintf("BODY :\n%v\n", rl.Body)
- }
- debugLog += "==============================================================================\n"
-
- c.log.Debugf("%s", debugLog)
- }
-
- return nil
-}
-
-func parseResponseBody(c *Client, res *Response) (err error) {
- if res.StatusCode() == http.StatusNoContent {
- return
- }
- // Handles only JSON or XML content type
- ct := firstNonEmpty(res.Request.forceContentType, res.Header().Get(hdrContentTypeKey), res.Request.fallbackContentType)
- if IsJSONType(ct) || IsXMLType(ct) {
- // HTTP status code > 199 and < 300, considered as Result
- if res.IsSuccess() {
- res.Request.Error = nil
- if res.Request.Result != nil {
- err = Unmarshalc(c, ct, res.body, res.Request.Result)
- return
- }
- }
-
- // HTTP status code > 399, considered as Error
- if res.IsError() {
- // global error interface
- if res.Request.Error == nil && c.Error != nil {
- res.Request.Error = reflect.New(c.Error).Interface()
- }
-
- if res.Request.Error != nil {
- err = Unmarshalc(c, ct, res.body, res.Request.Error)
- }
- }
- }
-
- return
-}
-
-func handleMultipart(c *Client, r *Request) (err error) {
- r.bodyBuf = acquireBuffer()
- w := multipart.NewWriter(r.bodyBuf)
-
- for k, v := range c.FormData {
- for _, iv := range v {
- if err = w.WriteField(k, iv); err != nil {
- return err
- }
- }
- }
-
- for k, v := range r.FormData {
- for _, iv := range v {
- if strings.HasPrefix(k, "@") { // file
- err = addFile(w, k[1:], iv)
- if err != nil {
- return
- }
- } else { // form value
- if err = w.WriteField(k, iv); err != nil {
- return err
- }
- }
- }
- }
-
- // #21 - adding io.Reader support
- if len(r.multipartFiles) > 0 {
- for _, f := range r.multipartFiles {
- err = addFileReader(w, f)
- if err != nil {
- return
- }
- }
- }
-
- // GitHub #130 adding multipart field support with content type
- if len(r.multipartFields) > 0 {
- for _, mf := range r.multipartFields {
- if err = addMultipartFormField(w, mf); err != nil {
- return
- }
- }
- }
-
- r.Header.Set(hdrContentTypeKey, w.FormDataContentType())
- err = w.Close()
-
- return
-}
-
-func handleFormData(c *Client, r *Request) {
- formData := url.Values{}
-
- for k, v := range c.FormData {
- for _, iv := range v {
- formData.Add(k, iv)
- }
- }
-
- for k, v := range r.FormData {
- // remove form data field from client level by key
- // since overrides happens for that key in the request
- formData.Del(k)
-
- for _, iv := range v {
- formData.Add(k, iv)
- }
- }
-
- r.bodyBuf = bytes.NewBuffer([]byte(formData.Encode()))
- r.Header.Set(hdrContentTypeKey, formContentType)
- r.isFormData = true
-}
-
-func handleContentType(c *Client, r *Request) {
- contentType := r.Header.Get(hdrContentTypeKey)
- if IsStringEmpty(contentType) {
- contentType = DetectContentType(r.Body)
- r.Header.Set(hdrContentTypeKey, contentType)
- }
-}
-
-func handleRequestBody(c *Client, r *Request) (err error) {
- var bodyBytes []byte
- contentType := r.Header.Get(hdrContentTypeKey)
- kind := kindOf(r.Body)
- r.bodyBuf = nil
-
- if reader, ok := r.Body.(io.Reader); ok {
- if c.setContentLength || r.setContentLength { // keep backward compatibility
- r.bodyBuf = acquireBuffer()
- _, err = r.bodyBuf.ReadFrom(reader)
- r.Body = nil
- } else {
- // Otherwise buffer less processing for `io.Reader`, sounds good.
- return
- }
- } else if b, ok := r.Body.([]byte); ok {
- bodyBytes = b
- } else if s, ok := r.Body.(string); ok {
- bodyBytes = []byte(s)
- } else if IsJSONType(contentType) &&
- (kind == reflect.Struct || kind == reflect.Map || kind == reflect.Slice) {
- bodyBytes, err = jsonMarshal(c, r, r.Body)
- } else if IsXMLType(contentType) && (kind == reflect.Struct) {
- bodyBytes, err = xml.Marshal(r.Body)
- }
-
- if bodyBytes == nil && r.bodyBuf == nil {
- err = errors.New("unsupported 'Body' type/value")
- }
-
- // if any errors during body bytes handling, return it
- if err != nil {
- return
- }
-
- // []byte into Buffer
- if bodyBytes != nil && r.bodyBuf == nil {
- r.bodyBuf = acquireBuffer()
- _, _ = r.bodyBuf.Write(bodyBytes)
- }
-
- return
-}
-
-func saveResponseIntoFile(c *Client, res *Response) error {
- if res.Request.isSaveResponse {
- file := ""
-
- if len(c.outputDirectory) > 0 && !filepath.IsAbs(res.Request.outputFile) {
- file += c.outputDirectory + string(filepath.Separator)
- }
-
- file = filepath.Clean(file + res.Request.outputFile)
- if err := createDirectory(filepath.Dir(file)); err != nil {
- return err
- }
-
- outFile, err := os.Create(file)
- if err != nil {
- return err
- }
- defer closeq(outFile)
-
- // io.Copy reads maximum 32kb size, it is perfect for large file download too
- defer closeq(res.RawResponse.Body)
-
- written, err := io.Copy(outFile, res.RawResponse.Body)
- if err != nil {
- return err
- }
-
- res.size = written
- }
-
- return nil
-}
diff --git a/vendor/github.com/go-resty/resty/v2/redirect.go b/vendor/github.com/go-resty/resty/v2/redirect.go
deleted file mode 100644
index 2976b7c5a..000000000
--- a/vendor/github.com/go-resty/resty/v2/redirect.go
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "errors"
- "fmt"
- "net"
- "net/http"
- "strings"
-)
-
-type (
- // RedirectPolicy to regulate the redirects in the resty client.
- // Objects implementing the RedirectPolicy interface can be registered as
- //
- // Apply function should return nil to continue the redirect jounery, otherwise
- // return error to stop the redirect.
- RedirectPolicy interface {
- Apply(req *http.Request, via []*http.Request) error
- }
-
- // The RedirectPolicyFunc type is an adapter to allow the use of ordinary functions as RedirectPolicy.
- // If f is a function with the appropriate signature, RedirectPolicyFunc(f) is a RedirectPolicy object that calls f.
- RedirectPolicyFunc func(*http.Request, []*http.Request) error
-)
-
-// Apply calls f(req, via).
-func (f RedirectPolicyFunc) Apply(req *http.Request, via []*http.Request) error {
- return f(req, via)
-}
-
-// NoRedirectPolicy is used to disable redirects in the HTTP client
-// resty.SetRedirectPolicy(NoRedirectPolicy())
-func NoRedirectPolicy() RedirectPolicy {
- return RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
- return errors.New("auto redirect is disabled")
- })
-}
-
-// FlexibleRedirectPolicy is convenient method to create No of redirect policy for HTTP client.
-// resty.SetRedirectPolicy(FlexibleRedirectPolicy(20))
-func FlexibleRedirectPolicy(noOfRedirect int) RedirectPolicy {
- return RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
- if len(via) >= noOfRedirect {
- return fmt.Errorf("stopped after %d redirects", noOfRedirect)
- }
- checkHostAndAddHeaders(req, via[0])
- return nil
- })
-}
-
-// DomainCheckRedirectPolicy is convenient method to define domain name redirect rule in resty client.
-// Redirect is allowed for only mentioned host in the policy.
-// resty.SetRedirectPolicy(DomainCheckRedirectPolicy("host1.com", "host2.org", "host3.net"))
-func DomainCheckRedirectPolicy(hostnames ...string) RedirectPolicy {
- hosts := make(map[string]bool)
- for _, h := range hostnames {
- hosts[strings.ToLower(h)] = true
- }
-
- fn := RedirectPolicyFunc(func(req *http.Request, via []*http.Request) error {
- if ok := hosts[getHostname(req.URL.Host)]; !ok {
- return errors.New("redirect is not allowed as per DomainCheckRedirectPolicy")
- }
-
- return nil
- })
-
- return fn
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Package Unexported methods
-//_______________________________________________________________________
-
-func getHostname(host string) (hostname string) {
- if strings.Index(host, ":") > 0 {
- host, _, _ = net.SplitHostPort(host)
- }
- hostname = strings.ToLower(host)
- return
-}
-
-// By default Golang will not redirect request headers
-// after go throughing various discussion comments from thread
-// https://github.com/golang/go/issues/4800
-// Resty will add all the headers during a redirect for the same host
-func checkHostAndAddHeaders(cur *http.Request, pre *http.Request) {
- curHostname := getHostname(cur.URL.Host)
- preHostname := getHostname(pre.URL.Host)
- if strings.EqualFold(curHostname, preHostname) {
- for key, val := range pre.Header {
- cur.Header[key] = val
- }
- } else { // only library User-Agent header is added
- cur.Header.Set(hdrUserAgentKey, hdrUserAgentValue)
- }
-}
diff --git a/vendor/github.com/go-resty/resty/v2/request.go b/vendor/github.com/go-resty/resty/v2/request.go
deleted file mode 100644
index 3bf236fd9..000000000
--- a/vendor/github.com/go-resty/resty/v2/request.go
+++ /dev/null
@@ -1,809 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "encoding/xml"
- "fmt"
- "io"
- "net"
- "net/http"
- "net/url"
- "reflect"
- "strings"
- "time"
-)
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Request struct and methods
-//_______________________________________________________________________
-
-// Request struct is used to compose and fire individual request from
-// resty client. Request provides an options to override client level
-// settings and also an options for the request composition.
-type Request struct {
- URL string
- Method string
- Token string
- AuthScheme string
- QueryParam url.Values
- FormData url.Values
- Header http.Header
- Time time.Time
- Body interface{}
- Result interface{}
- Error interface{}
- RawRequest *http.Request
- SRV *SRVRecord
- UserInfo *User
- Cookies []*http.Cookie
-
- isMultiPart bool
- isFormData bool
- setContentLength bool
- isSaveResponse bool
- notParseResponse bool
- jsonEscapeHTML bool
- trace bool
- outputFile string
- fallbackContentType string
- forceContentType string
- ctx context.Context
- pathParams map[string]string
- values map[string]interface{}
- client *Client
- bodyBuf *bytes.Buffer
- clientTrace *clientTrace
- multipartFiles []*File
- multipartFields []*MultipartField
-}
-
-// Context method returns the Context if its already set in request
-// otherwise it creates new one using `context.Background()`.
-func (r *Request) Context() context.Context {
- if r.ctx == nil {
- return context.Background()
- }
- return r.ctx
-}
-
-// SetContext method sets the context.Context for current Request. It allows
-// to interrupt the request execution if ctx.Done() channel is closed.
-// See https://blog.golang.org/context article and the "context" package
-// documentation.
-func (r *Request) SetContext(ctx context.Context) *Request {
- r.ctx = ctx
- return r
-}
-
-// SetHeader method is to set a single header field and its value in the current request.
-//
-// For Example: To set `Content-Type` and `Accept` as `application/json`.
-// client.R().
-// SetHeader("Content-Type", "application/json").
-// SetHeader("Accept", "application/json")
-//
-// Also you can override header value, which was set at client instance level.
-func (r *Request) SetHeader(header, value string) *Request {
- r.Header.Set(header, value)
- return r
-}
-
-// SetHeaders method sets multiple headers field and its values at one go in the current request.
-//
-// For Example: To set `Content-Type` and `Accept` as `application/json`
-//
-// client.R().
-// SetHeaders(map[string]string{
-// "Content-Type": "application/json",
-// "Accept": "application/json",
-// })
-// Also you can override header value, which was set at client instance level.
-func (r *Request) SetHeaders(headers map[string]string) *Request {
- for h, v := range headers {
- r.SetHeader(h, v)
- }
- return r
-}
-
-// SetQueryParam method sets single parameter and its value in the current request.
-// It will be formed as query string for the request.
-//
-// For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark.
-// client.R().
-// SetQueryParam("search", "kitchen papers").
-// SetQueryParam("size", "large")
-// Also you can override query params value, which was set at client instance level.
-func (r *Request) SetQueryParam(param, value string) *Request {
- r.QueryParam.Set(param, value)
- return r
-}
-
-// SetQueryParams method sets multiple parameters and its values at one go in the current request.
-// It will be formed as query string for the request.
-//
-// For Example: `search=kitchen%20papers&size=large` in the URL after `?` mark.
-// client.R().
-// SetQueryParams(map[string]string{
-// "search": "kitchen papers",
-// "size": "large",
-// })
-// Also you can override query params value, which was set at client instance level.
-func (r *Request) SetQueryParams(params map[string]string) *Request {
- for p, v := range params {
- r.SetQueryParam(p, v)
- }
- return r
-}
-
-// SetQueryParamsFromValues method appends multiple parameters with multi-value
-// (`url.Values`) at one go in the current request. It will be formed as
-// query string for the request.
-//
-// For Example: `status=pending&status=approved&status=open` in the URL after `?` mark.
-// client.R().
-// SetQueryParamsFromValues(url.Values{
-// "status": []string{"pending", "approved", "open"},
-// })
-// Also you can override query params value, which was set at client instance level.
-func (r *Request) SetQueryParamsFromValues(params url.Values) *Request {
- for p, v := range params {
- for _, pv := range v {
- r.QueryParam.Add(p, pv)
- }
- }
- return r
-}
-
-// SetQueryString method provides ability to use string as an input to set URL query string for the request.
-//
-// Using String as an input
-// client.R().
-// SetQueryString("productId=232&template=fresh-sample&cat=resty&source=google&kw=buy a lot more")
-func (r *Request) SetQueryString(query string) *Request {
- params, err := url.ParseQuery(strings.TrimSpace(query))
- if err == nil {
- for p, v := range params {
- for _, pv := range v {
- r.QueryParam.Add(p, pv)
- }
- }
- } else {
- r.client.log.Errorf("%v", err)
- }
- return r
-}
-
-// SetFormData method sets Form parameters and their values in the current request.
-// It's applicable only HTTP method `POST` and `PUT` and requests content type would be set as
-// `application/x-www-form-urlencoded`.
-// client.R().
-// SetFormData(map[string]string{
-// "access_token": "BC594900-518B-4F7E-AC75-BD37F019E08F",
-// "user_id": "3455454545",
-// })
-// Also you can override form data value, which was set at client instance level.
-func (r *Request) SetFormData(data map[string]string) *Request {
- for k, v := range data {
- r.FormData.Set(k, v)
- }
- return r
-}
-
-// SetFormDataFromValues method appends multiple form parameters with multi-value
-// (`url.Values`) at one go in the current request.
-// client.R().
-// SetFormDataFromValues(url.Values{
-// "search_criteria": []string{"book", "glass", "pencil"},
-// })
-// Also you can override form data value, which was set at client instance level.
-func (r *Request) SetFormDataFromValues(data url.Values) *Request {
- for k, v := range data {
- for _, kv := range v {
- r.FormData.Add(k, kv)
- }
- }
- return r
-}
-
-// SetBody method sets the request body for the request. It supports various realtime needs as easy.
-// We can say its quite handy or powerful. Supported request body data types is `string`,
-// `[]byte`, `struct`, `map`, `slice` and `io.Reader`. Body value can be pointer or non-pointer.
-// Automatic marshalling for JSON and XML content type, if it is `struct`, `map`, or `slice`.
-//
-// Note: `io.Reader` is processed as bufferless mode while sending request.
-//
-// For Example: Struct as a body input, based on content type, it will be marshalled.
-// client.R().
-// SetBody(User{
-// Username: "jeeva@myjeeva.com",
-// Password: "welcome2resty",
-// })
-//
-// Map as a body input, based on content type, it will be marshalled.
-// client.R().
-// SetBody(map[string]interface{}{
-// "username": "jeeva@myjeeva.com",
-// "password": "welcome2resty",
-// "address": &Address{
-// Address1: "1111 This is my street",
-// Address2: "Apt 201",
-// City: "My City",
-// State: "My State",
-// ZipCode: 00000,
-// },
-// })
-//
-// String as a body input. Suitable for any need as a string input.
-// client.R().
-// SetBody(`{
-// "username": "jeeva@getrightcare.com",
-// "password": "admin"
-// }`)
-//
-// []byte as a body input. Suitable for raw request such as file upload, serialize & deserialize, etc.
-// client.R().
-// SetBody([]byte("This is my raw request, sent as-is"))
-func (r *Request) SetBody(body interface{}) *Request {
- r.Body = body
- return r
-}
-
-// SetResult method is to register the response `Result` object for automatic unmarshalling for the request,
-// if response status code is between 200 and 299 and content type either JSON or XML.
-//
-// Note: Result object can be pointer or non-pointer.
-// client.R().SetResult(&AuthToken{})
-// // OR
-// client.R().SetResult(AuthToken{})
-//
-// Accessing a result value from response instance.
-// response.Result().(*AuthToken)
-func (r *Request) SetResult(res interface{}) *Request {
- r.Result = getPointer(res)
- return r
-}
-
-// SetError method is to register the request `Error` object for automatic unmarshalling for the request,
-// if response status code is greater than 399 and content type either JSON or XML.
-//
-// Note: Error object can be pointer or non-pointer.
-// client.R().SetError(&AuthError{})
-// // OR
-// client.R().SetError(AuthError{})
-//
-// Accessing a error value from response instance.
-// response.Error().(*AuthError)
-func (r *Request) SetError(err interface{}) *Request {
- r.Error = getPointer(err)
- return r
-}
-
-// SetFile method is to set single file field name and its path for multipart upload.
-// client.R().
-// SetFile("my_file", "/Users/jeeva/Gas Bill - Sep.pdf")
-func (r *Request) SetFile(param, filePath string) *Request {
- r.isMultiPart = true
- r.FormData.Set("@"+param, filePath)
- return r
-}
-
-// SetFiles method is to set multiple file field name and its path for multipart upload.
-// client.R().
-// SetFiles(map[string]string{
-// "my_file1": "/Users/jeeva/Gas Bill - Sep.pdf",
-// "my_file2": "/Users/jeeva/Electricity Bill - Sep.pdf",
-// "my_file3": "/Users/jeeva/Water Bill - Sep.pdf",
-// })
-func (r *Request) SetFiles(files map[string]string) *Request {
- r.isMultiPart = true
- for f, fp := range files {
- r.FormData.Set("@"+f, fp)
- }
- return r
-}
-
-// SetFileReader method is to set single file using io.Reader for multipart upload.
-// client.R().
-// SetFileReader("profile_img", "my-profile-img.png", bytes.NewReader(profileImgBytes)).
-// SetFileReader("notes", "user-notes.txt", bytes.NewReader(notesBytes))
-func (r *Request) SetFileReader(param, fileName string, reader io.Reader) *Request {
- r.isMultiPart = true
- r.multipartFiles = append(r.multipartFiles, &File{
- Name: fileName,
- ParamName: param,
- Reader: reader,
- })
- return r
-}
-
-// SetMultipartFormData method allows simple form data to be attached to the request as `multipart:form-data`
-func (r *Request) SetMultipartFormData(data map[string]string) *Request {
- for k, v := range data {
- r = r.SetMultipartField(k, "", "", strings.NewReader(v))
- }
-
- return r
-}
-
-// SetMultipartField method is to set custom data using io.Reader for multipart upload.
-func (r *Request) SetMultipartField(param, fileName, contentType string, reader io.Reader) *Request {
- r.isMultiPart = true
- r.multipartFields = append(r.multipartFields, &MultipartField{
- Param: param,
- FileName: fileName,
- ContentType: contentType,
- Reader: reader,
- })
- return r
-}
-
-// SetMultipartFields method is to set multiple data fields using io.Reader for multipart upload.
-//
-// For Example:
-// client.R().SetMultipartFields(
-// &resty.MultipartField{
-// Param: "uploadManifest1",
-// FileName: "upload-file-1.json",
-// ContentType: "application/json",
-// Reader: strings.NewReader(`{"input": {"name": "Uploaded document 1", "_filename" : ["file1.txt"]}}`),
-// },
-// &resty.MultipartField{
-// Param: "uploadManifest2",
-// FileName: "upload-file-2.json",
-// ContentType: "application/json",
-// Reader: strings.NewReader(`{"input": {"name": "Uploaded document 2", "_filename" : ["file2.txt"]}}`),
-// })
-//
-// If you have slice already, then simply call-
-// client.R().SetMultipartFields(fields...)
-func (r *Request) SetMultipartFields(fields ...*MultipartField) *Request {
- r.isMultiPart = true
- r.multipartFields = append(r.multipartFields, fields...)
- return r
-}
-
-// SetContentLength method sets the HTTP header `Content-Length` value for current request.
-// By default Resty won't set `Content-Length`. Also you have an option to enable for every
-// request.
-//
-// See `Client.SetContentLength`
-// client.R().SetContentLength(true)
-func (r *Request) SetContentLength(l bool) *Request {
- r.setContentLength = true
- return r
-}
-
-// SetBasicAuth method sets the basic authentication header in the current HTTP request.
-//
-// For Example:
-// Authorization: Basic
-//
-// To set the header for username "go-resty" and password "welcome"
-// client.R().SetBasicAuth("go-resty", "welcome")
-//
-// This method overrides the credentials set by method `Client.SetBasicAuth`.
-func (r *Request) SetBasicAuth(username, password string) *Request {
- r.UserInfo = &User{Username: username, Password: password}
- return r
-}
-
-// SetAuthToken method sets the auth token header(Default Scheme: Bearer) in the current HTTP request. Header example:
-// Authorization: Bearer
-//
-// For Example: To set auth token BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F
-//
-// client.R().SetAuthToken("BC594900518B4F7EAC75BD37F019E08FBC594900518B4F7EAC75BD37F019E08F")
-//
-// This method overrides the Auth token set by method `Client.SetAuthToken`.
-func (r *Request) SetAuthToken(token string) *Request {
- r.Token = token
- return r
-}
-
-// SetAuthScheme method sets the auth token scheme type in the HTTP request. For Example:
-// Authorization:
-//
-// For Example: To set the scheme to use OAuth
-//
-// client.R().SetAuthScheme("OAuth")
-//
-// This auth header scheme gets added to all the request rasied from this client instance.
-// Also it can be overridden or set one at the request level is supported.
-//
-// Information about Auth schemes can be found in RFC7235 which is linked to below along with the page containing
-// the currently defined official authentication schemes:
-// https://tools.ietf.org/html/rfc7235
-// https://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml#authschemes
-//
-// This method overrides the Authorization scheme set by method `Client.SetAuthScheme`.
-func (r *Request) SetAuthScheme(scheme string) *Request {
- r.AuthScheme = scheme
- return r
-}
-
-// SetOutput method sets the output file for current HTTP request. Current HTTP response will be
-// saved into given file. It is similar to `curl -o` flag. Absolute path or relative path can be used.
-// If is it relative path then output file goes under the output directory, as mentioned
-// in the `Client.SetOutputDirectory`.
-// client.R().
-// SetOutput("/Users/jeeva/Downloads/ReplyWithHeader-v5.1-beta.zip").
-// Get("http://bit.ly/1LouEKr")
-//
-// Note: In this scenario `Response.Body` might be nil.
-func (r *Request) SetOutput(file string) *Request {
- r.outputFile = file
- r.isSaveResponse = true
- return r
-}
-
-// SetSRV method sets the details to query the service SRV record and execute the
-// request.
-// client.R().
-// SetSRV(SRVRecord{"web", "testservice.com"}).
-// Get("/get")
-func (r *Request) SetSRV(srv *SRVRecord) *Request {
- r.SRV = srv
- return r
-}
-
-// SetDoNotParseResponse method instructs `Resty` not to parse the response body automatically.
-// Resty exposes the raw response body as `io.ReadCloser`. Also do not forget to close the body,
-// otherwise you might get into connection leaks, no connection reuse.
-//
-// Note: Response middlewares are not applicable, if you use this option. Basically you have
-// taken over the control of response parsing from `Resty`.
-func (r *Request) SetDoNotParseResponse(parse bool) *Request {
- r.notParseResponse = parse
- return r
-}
-
-// SetPathParams method sets multiple URL path key-value pairs at one go in the
-// Resty current request instance.
-// client.R().SetPathParams(map[string]string{
-// "userId": "sample@sample.com",
-// "subAccountId": "100002",
-// })
-//
-// Result:
-// URL - /v1/users/{userId}/{subAccountId}/details
-// Composed URL - /v1/users/sample@sample.com/100002/details
-// It replace the value of the key while composing request URL. Also you can
-// override Path Params value, which was set at client instance level.
-func (r *Request) SetPathParams(params map[string]string) *Request {
- for p, v := range params {
- r.pathParams[p] = v
- }
- return r
-}
-
-// ExpectContentType method allows to provide fallback `Content-Type` for automatic unmarshalling
-// when `Content-Type` response header is unavailable.
-func (r *Request) ExpectContentType(contentType string) *Request {
- r.fallbackContentType = contentType
- return r
-}
-
-// ForceContentType method provides a strong sense of response `Content-Type` for automatic unmarshalling.
-// Resty will respect it with higher priority; even response `Content-Type` response header value is available.
-func (r *Request) ForceContentType(contentType string) *Request {
- r.forceContentType = contentType
- return r
-}
-
-// SetJSONEscapeHTML method is to enable/disable the HTML escape on JSON marshal.
-//
-// Note: This option only applicable to standard JSON Marshaller.
-func (r *Request) SetJSONEscapeHTML(b bool) *Request {
- r.jsonEscapeHTML = b
- return r
-}
-
-// SetCookie method appends a single cookie in the current request instance.
-// client.R().SetCookie(&http.Cookie{
-// Name:"go-resty",
-// Value:"This is cookie value",
-// })
-//
-// Note: Method appends the Cookie value into existing Cookie if already existing.
-//
-// Since v2.1.0
-func (r *Request) SetCookie(hc *http.Cookie) *Request {
- r.Cookies = append(r.Cookies, hc)
- return r
-}
-
-// SetCookies method sets an array of cookies in the current request instance.
-// cookies := []*http.Cookie{
-// &http.Cookie{
-// Name:"go-resty-1",
-// Value:"This is cookie 1 value",
-// },
-// &http.Cookie{
-// Name:"go-resty-2",
-// Value:"This is cookie 2 value",
-// },
-// }
-//
-// // Setting a cookies into resty's current request
-// client.R().SetCookies(cookies)
-//
-// Note: Method appends the Cookie value into existing Cookie if already existing.
-//
-// Since v2.1.0
-func (r *Request) SetCookies(rs []*http.Cookie) *Request {
- r.Cookies = append(r.Cookies, rs...)
- return r
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// HTTP request tracing
-//_______________________________________________________________________
-
-// EnableTrace method enables trace for the current request
-// using `httptrace.ClientTrace` and provides insights.
-//
-// client := resty.New()
-//
-// resp, err := client.R().EnableTrace().Get("https://httpbin.org/get")
-// fmt.Println("Error:", err)
-// fmt.Println("Trace Info:", resp.Request.TraceInfo())
-//
-// See `Client.EnableTrace` available too to get trace info for all requests.
-//
-// Since v2.0.0
-func (r *Request) EnableTrace() *Request {
- r.trace = true
- return r
-}
-
-// TraceInfo method returns the trace info for the request.
-// If either the Client or Request EnableTrace function has not been called
-// prior to the request being made, an empty TraceInfo object will be returned.
-//
-// Since v2.0.0
-func (r *Request) TraceInfo() TraceInfo {
- ct := r.clientTrace
-
- if ct == nil {
- return TraceInfo{}
- }
-
- ti := TraceInfo{
- DNSLookup: ct.dnsDone.Sub(ct.dnsStart),
- TLSHandshake: ct.tlsHandshakeDone.Sub(ct.tlsHandshakeStart),
- ServerTime: ct.gotFirstResponseByte.Sub(ct.gotConn),
- TotalTime: ct.endTime.Sub(ct.dnsStart),
- IsConnReused: ct.gotConnInfo.Reused,
- IsConnWasIdle: ct.gotConnInfo.WasIdle,
- ConnIdleTime: ct.gotConnInfo.IdleTime,
- }
-
- // Only calcuate on successful connections
- if !ct.connectDone.IsZero() {
- ti.TCPConnTime = ct.connectDone.Sub(ct.dnsDone)
- }
-
- // Only calcuate on successful connections
- if !ct.gotConn.IsZero() {
- ti.ConnTime = ct.gotConn.Sub(ct.getConn)
- }
-
- // Only calcuate on successful connections
- if !ct.gotFirstResponseByte.IsZero() {
- ti.ResponseTime = ct.endTime.Sub(ct.gotFirstResponseByte)
- }
-
- return ti
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// HTTP verb method starts here
-//_______________________________________________________________________
-
-// Get method does GET HTTP request. It's defined in section 4.3.1 of RFC7231.
-func (r *Request) Get(url string) (*Response, error) {
- return r.Execute(MethodGet, url)
-}
-
-// Head method does HEAD HTTP request. It's defined in section 4.3.2 of RFC7231.
-func (r *Request) Head(url string) (*Response, error) {
- return r.Execute(MethodHead, url)
-}
-
-// Post method does POST HTTP request. It's defined in section 4.3.3 of RFC7231.
-func (r *Request) Post(url string) (*Response, error) {
- return r.Execute(MethodPost, url)
-}
-
-// Put method does PUT HTTP request. It's defined in section 4.3.4 of RFC7231.
-func (r *Request) Put(url string) (*Response, error) {
- return r.Execute(MethodPut, url)
-}
-
-// Delete method does DELETE HTTP request. It's defined in section 4.3.5 of RFC7231.
-func (r *Request) Delete(url string) (*Response, error) {
- return r.Execute(MethodDelete, url)
-}
-
-// Options method does OPTIONS HTTP request. It's defined in section 4.3.7 of RFC7231.
-func (r *Request) Options(url string) (*Response, error) {
- return r.Execute(MethodOptions, url)
-}
-
-// Patch method does PATCH HTTP request. It's defined in section 2 of RFC5789.
-func (r *Request) Patch(url string) (*Response, error) {
- return r.Execute(MethodPatch, url)
-}
-
-// Send method performs the HTTP request using the method and URL already defined
-// for current `Request`.
-// req := client.R()
-// req.Method = resty.GET
-// req.URL = "http://httpbin.org/get"
-// resp, err := client.R().Send()
-func (r *Request) Send() (*Response, error) {
- return r.Execute(r.Method, r.URL)
-}
-
-// Execute method performs the HTTP request with given HTTP method and URL
-// for current `Request`.
-// resp, err := client.R().Execute(resty.GET, "http://httpbin.org/get")
-func (r *Request) Execute(method, url string) (*Response, error) {
- var addrs []*net.SRV
- var resp *Response
- var err error
-
- if r.isMultiPart && !(method == MethodPost || method == MethodPut || method == MethodPatch) {
- return nil, fmt.Errorf("multipart content is not allowed in HTTP verb [%v]", method)
- }
-
- if r.SRV != nil {
- _, addrs, err = net.LookupSRV(r.SRV.Service, "tcp", r.SRV.Domain)
- if err != nil {
- return nil, err
- }
- }
-
- r.Method = method
- r.URL = r.selectAddr(addrs, url, 0)
-
- if r.client.RetryCount == 0 {
- resp, err = r.client.execute(r)
- return resp, unwrapNoRetryErr(err)
- }
-
- attempt := 0
- err = Backoff(
- func() (*Response, error) {
- attempt++
-
- r.URL = r.selectAddr(addrs, url, attempt)
-
- resp, err = r.client.execute(r)
- if err != nil {
- r.client.log.Errorf("%v, Attempt %v", err, attempt)
- }
-
- return resp, err
- },
- Retries(r.client.RetryCount),
- WaitTime(r.client.RetryWaitTime),
- MaxWaitTime(r.client.RetryMaxWaitTime),
- RetryConditions(r.client.RetryConditions),
- )
-
- return resp, unwrapNoRetryErr(err)
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// SRVRecord struct
-//_______________________________________________________________________
-
-// SRVRecord struct holds the data to query the SRV record for the
-// following service.
-type SRVRecord struct {
- Service string
- Domain string
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Request Unexported methods
-//_______________________________________________________________________
-
-func (r *Request) fmtBodyString(sl int64) (body string) {
- body = "***** NO CONTENT *****"
- if !isPayloadSupported(r.Method, r.client.AllowGetMethodPayload) {
- return
- }
-
- if _, ok := r.Body.(io.Reader); ok {
- body = "***** BODY IS io.Reader *****"
- return
- }
-
- // multipart or form-data
- if r.isMultiPart || r.isFormData {
- bodySize := int64(r.bodyBuf.Len())
- if bodySize > sl {
- body = fmt.Sprintf("***** REQUEST TOO LARGE (size - %d) *****", bodySize)
- return
- }
- body = r.bodyBuf.String()
- return
- }
-
- // request body data
- if r.Body == nil {
- return
- }
- var prtBodyBytes []byte
- var err error
-
- contentType := r.Header.Get(hdrContentTypeKey)
- kind := kindOf(r.Body)
- if canJSONMarshal(contentType, kind) {
- prtBodyBytes, err = json.MarshalIndent(&r.Body, "", " ")
- } else if IsXMLType(contentType) && (kind == reflect.Struct) {
- prtBodyBytes, err = xml.MarshalIndent(&r.Body, "", " ")
- } else if b, ok := r.Body.(string); ok {
- if IsJSONType(contentType) {
- bodyBytes := []byte(b)
- out := acquireBuffer()
- defer releaseBuffer(out)
- if err = json.Indent(out, bodyBytes, "", " "); err == nil {
- prtBodyBytes = out.Bytes()
- }
- } else {
- body = b
- }
- } else if b, ok := r.Body.([]byte); ok {
- body = fmt.Sprintf("***** BODY IS byte(s) (size - %d) *****", len(b))
- return
- }
-
- if prtBodyBytes != nil && err == nil {
- body = string(prtBodyBytes)
- }
-
- if len(body) > 0 {
- bodySize := int64(len([]byte(body)))
- if bodySize > sl {
- body = fmt.Sprintf("***** REQUEST TOO LARGE (size - %d) *****", bodySize)
- }
- }
-
- return
-}
-
-func (r *Request) selectAddr(addrs []*net.SRV, path string, attempt int) string {
- if addrs == nil {
- return path
- }
-
- idx := attempt % len(addrs)
- domain := strings.TrimRight(addrs[idx].Target, ".")
- path = strings.TrimLeft(path, "/")
-
- return fmt.Sprintf("%s://%s:%d/%s", r.client.scheme, domain, addrs[idx].Port, path)
-}
-
-func (r *Request) initValuesMap() {
- if r.values == nil {
- r.values = make(map[string]interface{})
- }
-}
-
-var noescapeJSONMarshal = func(v interface{}) ([]byte, error) {
- buf := acquireBuffer()
- defer releaseBuffer(buf)
- encoder := json.NewEncoder(buf)
- encoder.SetEscapeHTML(false)
- err := encoder.Encode(v)
- return buf.Bytes(), err
-}
diff --git a/vendor/github.com/go-resty/resty/v2/response.go b/vendor/github.com/go-resty/resty/v2/response.go
deleted file mode 100644
index b82bce448..000000000
--- a/vendor/github.com/go-resty/resty/v2/response.go
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "net/http"
- "strings"
- "time"
-)
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Response struct and methods
-//_______________________________________________________________________
-
-// Response struct holds response values of executed request.
-type Response struct {
- Request *Request
- RawResponse *http.Response
-
- body []byte
- size int64
- receivedAt time.Time
-}
-
-// Body method returns HTTP response as []byte array for the executed request.
-//
-// Note: `Response.Body` might be nil, if `Request.SetOutput` is used.
-func (r *Response) Body() []byte {
- if r.RawResponse == nil {
- return []byte{}
- }
- return r.body
-}
-
-// Status method returns the HTTP status string for the executed request.
-// Example: 200 OK
-func (r *Response) Status() string {
- if r.RawResponse == nil {
- return ""
- }
- return r.RawResponse.Status
-}
-
-// StatusCode method returns the HTTP status code for the executed request.
-// Example: 200
-func (r *Response) StatusCode() int {
- if r.RawResponse == nil {
- return 0
- }
- return r.RawResponse.StatusCode
-}
-
-// Proto method returns the HTTP response protocol used for the request.
-func (r *Response) Proto() string {
- if r.RawResponse == nil {
- return ""
- }
- return r.RawResponse.Proto
-}
-
-// Result method returns the response value as an object if it has one
-func (r *Response) Result() interface{} {
- return r.Request.Result
-}
-
-// Error method returns the error object if it has one
-func (r *Response) Error() interface{} {
- return r.Request.Error
-}
-
-// Header method returns the response headers
-func (r *Response) Header() http.Header {
- if r.RawResponse == nil {
- return http.Header{}
- }
- return r.RawResponse.Header
-}
-
-// Cookies method to access all the response cookies
-func (r *Response) Cookies() []*http.Cookie {
- if r.RawResponse == nil {
- return make([]*http.Cookie, 0)
- }
- return r.RawResponse.Cookies()
-}
-
-// String method returns the body of the server response as String.
-func (r *Response) String() string {
- if r.body == nil {
- return ""
- }
- return strings.TrimSpace(string(r.body))
-}
-
-// Time method returns the time of HTTP response time that from request we sent and received a request.
-//
-// See `Response.ReceivedAt` to know when client recevied response and see `Response.Request.Time` to know
-// when client sent a request.
-func (r *Response) Time() time.Duration {
- if r.Request.clientTrace != nil {
- return r.Request.TraceInfo().TotalTime
- }
- return r.receivedAt.Sub(r.Request.Time)
-}
-
-// ReceivedAt method returns when response got recevied from server for the request.
-func (r *Response) ReceivedAt() time.Time {
- return r.receivedAt
-}
-
-// Size method returns the HTTP response size in bytes. Ya, you can relay on HTTP `Content-Length` header,
-// however it won't be good for chucked transfer/compressed response. Since Resty calculates response size
-// at the client end. You will get actual size of the http response.
-func (r *Response) Size() int64 {
- return r.size
-}
-
-// RawBody method exposes the HTTP raw response body. Use this method in-conjunction with `SetDoNotParseResponse`
-// option otherwise you get an error as `read err: http: read on closed response body`.
-//
-// Do not forget to close the body, otherwise you might get into connection leaks, no connection reuse.
-// Basically you have taken over the control of response parsing from `Resty`.
-func (r *Response) RawBody() io.ReadCloser {
- if r.RawResponse == nil {
- return nil
- }
- return r.RawResponse.Body
-}
-
-// IsSuccess method returns true if HTTP status `code >= 200 and <= 299` otherwise false.
-func (r *Response) IsSuccess() bool {
- return r.StatusCode() > 199 && r.StatusCode() < 300
-}
-
-// IsError method returns true if HTTP status `code >= 400` otherwise false.
-func (r *Response) IsError() bool {
- return r.StatusCode() > 399
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Response Unexported methods
-//_______________________________________________________________________
-
-func (r *Response) setReceivedAt() {
- r.receivedAt = time.Now()
- if r.Request.clientTrace != nil {
- r.Request.clientTrace.endTime = r.receivedAt
- }
-}
-
-func (r *Response) fmtBodyString(sl int64) string {
- if r.body != nil {
- if int64(len(r.body)) > sl {
- return fmt.Sprintf("***** RESPONSE TOO LARGE (size - %d) *****", len(r.body))
- }
- ct := r.Header().Get(hdrContentTypeKey)
- if IsJSONType(ct) {
- out := acquireBuffer()
- defer releaseBuffer(out)
- err := json.Indent(out, r.body, "", " ")
- if err != nil {
- return fmt.Sprintf("*** Error: Unable to format response body - \"%s\" ***\n\nLog Body as-is:\n%s", err, r.String())
- }
- return out.String()
- }
- return r.String()
- }
-
- return "***** NO CONTENT *****"
-}
diff --git a/vendor/github.com/go-resty/resty/v2/resty.go b/vendor/github.com/go-resty/resty/v2/resty.go
deleted file mode 100644
index 4685594b8..000000000
--- a/vendor/github.com/go-resty/resty/v2/resty.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-// Package resty provides Simple HTTP and REST client library for Go.
-package resty
-
-import (
- "net"
- "net/http"
- "net/http/cookiejar"
-
- "golang.org/x/net/publicsuffix"
-)
-
-// Version # of resty
-const Version = "2.3.0"
-
-// New method creates a new Resty client.
-func New() *Client {
- cookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
- return createClient(&http.Client{
- Jar: cookieJar,
- })
-}
-
-// NewWithClient method creates a new Resty client with given `http.Client`.
-func NewWithClient(hc *http.Client) *Client {
- return createClient(hc)
-}
-
-// NewWithLocalAddr method creates a new Resty client with given Local Address
-// to dial from.
-func NewWithLocalAddr(localAddr net.Addr) *Client {
- cookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
- return createClient(&http.Client{
- Jar: cookieJar,
- Transport: createTransport(localAddr),
- })
-}
diff --git a/vendor/github.com/go-resty/resty/v2/retry.go b/vendor/github.com/go-resty/resty/v2/retry.go
deleted file mode 100644
index 0b7c6ffe8..000000000
--- a/vendor/github.com/go-resty/resty/v2/retry.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "context"
- "math"
- "math/rand"
- "time"
-)
-
-const (
- defaultMaxRetries = 3
- defaultWaitTime = time.Duration(100) * time.Millisecond
- defaultMaxWaitTime = time.Duration(2000) * time.Millisecond
-)
-
-type (
- // Option is to create convenient retry options like wait time, max retries, etc.
- Option func(*Options)
-
- // RetryConditionFunc type is for retry condition function
- // input: non-nil Response OR request execution error
- RetryConditionFunc func(*Response, error) bool
-
- // RetryAfterFunc returns time to wait before retry
- // For example, it can parse HTTP Retry-After header
- // https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
- // Non-nil error is returned if it is found that request is not retryable
- // (0, nil) is a special result means 'use default algorithm'
- RetryAfterFunc func(*Client, *Response) (time.Duration, error)
-
- // Options struct is used to hold retry settings.
- Options struct {
- maxRetries int
- waitTime time.Duration
- maxWaitTime time.Duration
- retryConditions []RetryConditionFunc
- }
-)
-
-// Retries sets the max number of retries
-func Retries(value int) Option {
- return func(o *Options) {
- o.maxRetries = value
- }
-}
-
-// WaitTime sets the default wait time to sleep between requests
-func WaitTime(value time.Duration) Option {
- return func(o *Options) {
- o.waitTime = value
- }
-}
-
-// MaxWaitTime sets the max wait time to sleep between requests
-func MaxWaitTime(value time.Duration) Option {
- return func(o *Options) {
- o.maxWaitTime = value
- }
-}
-
-// RetryConditions sets the conditions that will be checked for retry.
-func RetryConditions(conditions []RetryConditionFunc) Option {
- return func(o *Options) {
- o.retryConditions = conditions
- }
-}
-
-// Backoff retries with increasing timeout duration up until X amount of retries
-// (Default is 3 attempts, Override with option Retries(n))
-func Backoff(operation func() (*Response, error), options ...Option) error {
- // Defaults
- opts := Options{
- maxRetries: defaultMaxRetries,
- waitTime: defaultWaitTime,
- maxWaitTime: defaultMaxWaitTime,
- retryConditions: []RetryConditionFunc{},
- }
-
- for _, o := range options {
- o(&opts)
- }
-
- var (
- resp *Response
- err error
- )
-
- for attempt := 0; attempt <= opts.maxRetries; attempt++ {
- resp, err = operation()
- ctx := context.Background()
- if resp != nil && resp.Request.ctx != nil {
- ctx = resp.Request.ctx
- }
- if ctx.Err() != nil {
- return err
- }
-
- err1 := unwrapNoRetryErr(err) // raw error, it used for return users callback.
- needsRetry := err != nil && err == err1 // retry on a few operation errors by default
-
- for _, condition := range opts.retryConditions {
- needsRetry = condition(resp, err1)
- if needsRetry {
- break
- }
- }
-
- if !needsRetry {
- return err
- }
-
- waitTime, err2 := sleepDuration(resp, opts.waitTime, opts.maxWaitTime, attempt)
- if err2 != nil {
- if err == nil {
- err = err2
- }
- return err
- }
-
- select {
- case <-time.After(waitTime):
- case <-ctx.Done():
- return ctx.Err()
- }
- }
-
- return err
-}
-
-func sleepDuration(resp *Response, min, max time.Duration, attempt int) (time.Duration, error) {
- const maxInt = 1<<31 - 1 // max int for arch 386
-
- if max < 0 {
- max = maxInt
- }
-
- if resp == nil {
- goto defaultCase
- }
-
- // 1. Check for custom callback
- if retryAfterFunc := resp.Request.client.RetryAfter; retryAfterFunc != nil {
- result, err := retryAfterFunc(resp.Request.client, resp)
- if err != nil {
- return 0, err // i.e. 'API quota exceeded'
- }
- if result == 0 {
- goto defaultCase
- }
- if result < 0 || max < result {
- result = max
- }
- if result < min {
- result = min
- }
- return result, nil
- }
-
- // 2. Return capped exponential backoff with jitter
- // http://www.awsarchitectureblog.com/2015/03/backoff.html
-defaultCase:
- base := float64(min)
- capLevel := float64(max)
-
- temp := math.Min(capLevel, base*math.Exp2(float64(attempt)))
- ri := int(temp / 2)
- if ri <= 0 {
- ri = maxInt // max int for arch 386
- }
- result := time.Duration(math.Abs(float64(ri + rand.Intn(ri))))
-
- if result < min {
- result = min
- }
-
- return result, nil
-}
diff --git a/vendor/github.com/go-resty/resty/v2/trace.go b/vendor/github.com/go-resty/resty/v2/trace.go
deleted file mode 100644
index 025b7d9b5..000000000
--- a/vendor/github.com/go-resty/resty/v2/trace.go
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "context"
- "crypto/tls"
- "net/http/httptrace"
- "time"
-)
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// TraceInfo struct
-//_______________________________________________________________________
-
-// TraceInfo struct is used provide request trace info such as DNS lookup
-// duration, Connection obtain duration, Server processing duration, etc.
-//
-// Since v2.0.0
-type TraceInfo struct {
- // DNSLookup is a duration that transport took to perform
- // DNS lookup.
- DNSLookup time.Duration
-
- // ConnTime is a duration that took to obtain a successful connection.
- ConnTime time.Duration
-
- // TCPConnTime is a duration that took to obtain the TCP connection.
- TCPConnTime time.Duration
-
- // TLSHandshake is a duration that TLS handshake took place.
- TLSHandshake time.Duration
-
- // ServerTime is a duration that server took to respond first byte.
- ServerTime time.Duration
-
- // ResponseTime is a duration since first response byte from server to
- // request completion.
- ResponseTime time.Duration
-
- // TotalTime is a duration that total request took end-to-end.
- TotalTime time.Duration
-
- // IsConnReused is whether this connection has been previously
- // used for another HTTP request.
- IsConnReused bool
-
- // IsConnWasIdle is whether this connection was obtained from an
- // idle pool.
- IsConnWasIdle bool
-
- // ConnIdleTime is a duration how long the connection was previously
- // idle, if IsConnWasIdle is true.
- ConnIdleTime time.Duration
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// CientTrace struct and its methods
-//_______________________________________________________________________
-
-// tracer struct maps the `httptrace.ClientTrace` hooks into Fields
-// with same naming for easy understanding. Plus additional insights
-// Request.
-type clientTrace struct {
- getConn time.Time
- dnsStart time.Time
- dnsDone time.Time
- connectDone time.Time
- tlsHandshakeStart time.Time
- tlsHandshakeDone time.Time
- gotConn time.Time
- gotFirstResponseByte time.Time
- endTime time.Time
- gotConnInfo httptrace.GotConnInfo
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Trace unexported methods
-//_______________________________________________________________________
-
-func (t *clientTrace) createContext(ctx context.Context) context.Context {
- return httptrace.WithClientTrace(
- ctx,
- &httptrace.ClientTrace{
- DNSStart: func(_ httptrace.DNSStartInfo) {
- t.dnsStart = time.Now()
- },
- DNSDone: func(_ httptrace.DNSDoneInfo) {
- t.dnsDone = time.Now()
- },
- ConnectStart: func(_, _ string) {
- if t.dnsDone.IsZero() {
- t.dnsDone = time.Now()
- }
- if t.dnsStart.IsZero() {
- t.dnsStart = t.dnsDone
- }
- },
- ConnectDone: func(net, addr string, err error) {
- t.connectDone = time.Now()
- },
- GetConn: func(_ string) {
- t.getConn = time.Now()
- },
- GotConn: func(ci httptrace.GotConnInfo) {
- t.gotConn = time.Now()
- t.gotConnInfo = ci
- },
- GotFirstResponseByte: func() {
- t.gotFirstResponseByte = time.Now()
- },
- TLSHandshakeStart: func() {
- t.tlsHandshakeStart = time.Now()
- },
- TLSHandshakeDone: func(_ tls.ConnectionState, _ error) {
- t.tlsHandshakeDone = time.Now()
- },
- },
- )
-}
diff --git a/vendor/github.com/go-resty/resty/v2/transport.go b/vendor/github.com/go-resty/resty/v2/transport.go
deleted file mode 100644
index 6cde29e8e..000000000
--- a/vendor/github.com/go-resty/resty/v2/transport.go
+++ /dev/null
@@ -1,35 +0,0 @@
-// +build go1.13
-
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "net"
- "net/http"
- "runtime"
- "time"
-)
-
-func createTransport(localAddr net.Addr) *http.Transport {
- dialer := &net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- DualStack: true,
- }
- if localAddr != nil {
- dialer.LocalAddr = localAddr
- }
- return &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- DialContext: dialer.DialContext,
- ForceAttemptHTTP2: true,
- MaxIdleConns: 100,
- IdleConnTimeout: 90 * time.Second,
- TLSHandshakeTimeout: 10 * time.Second,
- ExpectContinueTimeout: 1 * time.Second,
- MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1,
- }
-}
diff --git a/vendor/github.com/go-resty/resty/v2/transport112.go b/vendor/github.com/go-resty/resty/v2/transport112.go
deleted file mode 100644
index ff7c2770c..000000000
--- a/vendor/github.com/go-resty/resty/v2/transport112.go
+++ /dev/null
@@ -1,34 +0,0 @@
-// +build !go1.13
-
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "net"
- "net/http"
- "runtime"
- "time"
-)
-
-func createTransport(localAddr net.Addr) *http.Transport {
- dialer := &net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- DualStack: true,
- }
- if localAddr != nil {
- dialer.LocalAddr = localAddr
- }
- return &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- DialContext: dialer.DialContext,
- MaxIdleConns: 100,
- IdleConnTimeout: 90 * time.Second,
- TLSHandshakeTimeout: 10 * time.Second,
- ExpectContinueTimeout: 1 * time.Second,
- MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1,
- }
-}
diff --git a/vendor/github.com/go-resty/resty/v2/util.go b/vendor/github.com/go-resty/resty/v2/util.go
deleted file mode 100644
index aaa53c236..000000000
--- a/vendor/github.com/go-resty/resty/v2/util.go
+++ /dev/null
@@ -1,357 +0,0 @@
-// Copyright (c) 2015-2020 Jeevanandam M (jeeva@myjeeva.com), All rights reserved.
-// resty source code and usage is governed by a MIT style
-// license that can be found in the LICENSE file.
-
-package resty
-
-import (
- "bytes"
- "encoding/xml"
- "fmt"
- "io"
- "log"
- "mime/multipart"
- "net/http"
- "net/textproto"
- "os"
- "path/filepath"
- "reflect"
- "runtime"
- "sort"
- "strings"
-)
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Logger interface
-//_______________________________________________________________________
-
-// Logger interface is to abstract the logging from Resty. Gives control to
-// the Resty users, choice of the logger.
-type Logger interface {
- Errorf(format string, v ...interface{})
- Warnf(format string, v ...interface{})
- Debugf(format string, v ...interface{})
-}
-
-func createLogger() *logger {
- l := &logger{l: log.New(os.Stderr, "", log.Ldate|log.Lmicroseconds)}
- return l
-}
-
-var _ Logger = (*logger)(nil)
-
-type logger struct {
- l *log.Logger
-}
-
-func (l *logger) Errorf(format string, v ...interface{}) {
- l.output("ERROR RESTY "+format, v...)
-}
-
-func (l *logger) Warnf(format string, v ...interface{}) {
- l.output("WARN RESTY "+format, v...)
-}
-
-func (l *logger) Debugf(format string, v ...interface{}) {
- l.output("DEBUG RESTY "+format, v...)
-}
-
-func (l *logger) output(format string, v ...interface{}) {
- if len(v) == 0 {
- l.l.Print(format)
- return
- }
- l.l.Printf(format, v...)
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Package Helper methods
-//_______________________________________________________________________
-
-// IsStringEmpty method tells whether given string is empty or not
-func IsStringEmpty(str string) bool {
- return len(strings.TrimSpace(str)) == 0
-}
-
-// DetectContentType method is used to figure out `Request.Body` content type for request header
-func DetectContentType(body interface{}) string {
- contentType := plainTextType
- kind := kindOf(body)
- switch kind {
- case reflect.Struct, reflect.Map:
- contentType = jsonContentType
- case reflect.String:
- contentType = plainTextType
- default:
- if b, ok := body.([]byte); ok {
- contentType = http.DetectContentType(b)
- } else if kind == reflect.Slice {
- contentType = jsonContentType
- }
- }
-
- return contentType
-}
-
-// IsJSONType method is to check JSON content type or not
-func IsJSONType(ct string) bool {
- return jsonCheck.MatchString(ct)
-}
-
-// IsXMLType method is to check XML content type or not
-func IsXMLType(ct string) bool {
- return xmlCheck.MatchString(ct)
-}
-
-// Unmarshalc content into object from JSON or XML
-func Unmarshalc(c *Client, ct string, b []byte, d interface{}) (err error) {
- if IsJSONType(ct) {
- err = c.JSONUnmarshal(b, d)
- } else if IsXMLType(ct) {
- err = xml.Unmarshal(b, d)
- }
-
- return
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// RequestLog and ResponseLog type
-//_______________________________________________________________________
-
-// RequestLog struct is used to collected information from resty request
-// instance for debug logging. It sent to request log callback before resty
-// actually logs the information.
-type RequestLog struct {
- Header http.Header
- Body string
-}
-
-// ResponseLog struct is used to collected information from resty response
-// instance for debug logging. It sent to response log callback before resty
-// actually logs the information.
-type ResponseLog struct {
- Header http.Header
- Body string
-}
-
-//‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-// Package Unexported methods
-//_______________________________________________________________________
-
-// way to disable the HTML escape as opt-in
-func jsonMarshal(c *Client, r *Request, d interface{}) ([]byte, error) {
- if !r.jsonEscapeHTML {
- return noescapeJSONMarshal(d)
- } else if !c.jsonEscapeHTML {
- return noescapeJSONMarshal(d)
- }
- return c.JSONMarshal(d)
-}
-
-func firstNonEmpty(v ...string) string {
- for _, s := range v {
- if !IsStringEmpty(s) {
- return s
- }
- }
- return ""
-}
-
-var quoteEscaper = strings.NewReplacer("\\", "\\\\", `"`, "\\\"")
-
-func escapeQuotes(s string) string {
- return quoteEscaper.Replace(s)
-}
-
-func createMultipartHeader(param, fileName, contentType string) textproto.MIMEHeader {
- hdr := make(textproto.MIMEHeader)
-
- var contentDispositionValue string
- if IsStringEmpty(fileName) {
- contentDispositionValue = fmt.Sprintf(`form-data; name="%s"`, param)
- } else {
- contentDispositionValue = fmt.Sprintf(`form-data; name="%s"; filename="%s"`,
- param, escapeQuotes(fileName))
- }
- hdr.Set("Content-Disposition", contentDispositionValue)
-
- if !IsStringEmpty(contentType) {
- hdr.Set(hdrContentTypeKey, contentType)
- }
- return hdr
-}
-
-func addMultipartFormField(w *multipart.Writer, mf *MultipartField) error {
- partWriter, err := w.CreatePart(createMultipartHeader(mf.Param, mf.FileName, mf.ContentType))
- if err != nil {
- return err
- }
-
- _, err = io.Copy(partWriter, mf.Reader)
- return err
-}
-
-func writeMultipartFormFile(w *multipart.Writer, fieldName, fileName string, r io.Reader) error {
- // Auto detect actual multipart content type
- cbuf := make([]byte, 512)
- size, err := r.Read(cbuf)
- if err != nil {
- return err
- }
-
- partWriter, err := w.CreatePart(createMultipartHeader(fieldName, fileName, http.DetectContentType(cbuf)))
- if err != nil {
- return err
- }
-
- if _, err = partWriter.Write(cbuf[:size]); err != nil {
- return err
- }
-
- _, err = io.Copy(partWriter, r)
- return err
-}
-
-func addFile(w *multipart.Writer, fieldName, path string) error {
- file, err := os.Open(path)
- if err != nil {
- return err
- }
- defer closeq(file)
- return writeMultipartFormFile(w, fieldName, filepath.Base(path), file)
-}
-
-func addFileReader(w *multipart.Writer, f *File) error {
- return writeMultipartFormFile(w, f.ParamName, f.Name, f.Reader)
-}
-
-func getPointer(v interface{}) interface{} {
- vv := valueOf(v)
- if vv.Kind() == reflect.Ptr {
- return v
- }
- return reflect.New(vv.Type()).Interface()
-}
-
-func isPayloadSupported(m string, allowMethodGet bool) bool {
- return !(m == MethodHead || m == MethodOptions || (m == MethodGet && !allowMethodGet))
-}
-
-func typeOf(i interface{}) reflect.Type {
- return indirect(valueOf(i)).Type()
-}
-
-func valueOf(i interface{}) reflect.Value {
- return reflect.ValueOf(i)
-}
-
-func indirect(v reflect.Value) reflect.Value {
- return reflect.Indirect(v)
-}
-
-func kindOf(v interface{}) reflect.Kind {
- return typeOf(v).Kind()
-}
-
-func createDirectory(dir string) (err error) {
- if _, err = os.Stat(dir); err != nil {
- if os.IsNotExist(err) {
- if err = os.MkdirAll(dir, 0755); err != nil {
- return
- }
- }
- }
- return
-}
-
-func canJSONMarshal(contentType string, kind reflect.Kind) bool {
- return IsJSONType(contentType) && (kind == reflect.Struct || kind == reflect.Map || kind == reflect.Slice)
-}
-
-func functionName(i interface{}) string {
- return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
-}
-
-func acquireBuffer() *bytes.Buffer {
- return bufPool.Get().(*bytes.Buffer)
-}
-
-func releaseBuffer(buf *bytes.Buffer) {
- if buf != nil {
- buf.Reset()
- bufPool.Put(buf)
- }
-}
-
-func closeq(v interface{}) {
- if c, ok := v.(io.Closer); ok {
- silently(c.Close())
- }
-}
-
-func silently(_ ...interface{}) {}
-
-func composeHeaders(c *Client, r *Request, hdrs http.Header) string {
- str := make([]string, 0, len(hdrs))
- for _, k := range sortHeaderKeys(hdrs) {
- var v string
- if k == "Cookie" {
- cv := strings.TrimSpace(strings.Join(hdrs[k], ", "))
- if c.GetClient().Jar != nil {
- for _, c := range c.GetClient().Jar.Cookies(r.RawRequest.URL) {
- if cv != "" {
- cv = cv + "; " + c.String()
- } else {
- cv = c.String()
- }
- }
- }
- v = strings.TrimSpace(fmt.Sprintf("%25s: %s", k, cv))
- } else {
- v = strings.TrimSpace(fmt.Sprintf("%25s: %s", k, strings.Join(hdrs[k], ", ")))
- }
- if v != "" {
- str = append(str, "\t"+v)
- }
- }
- return strings.Join(str, "\n")
-}
-
-func sortHeaderKeys(hdrs http.Header) []string {
- keys := make([]string, 0, len(hdrs))
- for key := range hdrs {
- keys = append(keys, key)
- }
- sort.Strings(keys)
- return keys
-}
-
-func copyHeaders(hdrs http.Header) http.Header {
- nh := http.Header{}
- for k, v := range hdrs {
- nh[k] = v
- }
- return nh
-}
-
-type noRetryErr struct {
- err error
-}
-
-func (e *noRetryErr) Error() string {
- return e.err.Error()
-}
-
-func wrapNoRetryErr(err error) error {
- if err != nil {
- err = &noRetryErr{err: err}
- }
- return err
-}
-
-func unwrapNoRetryErr(err error) error {
- if e, ok := err.(*noRetryErr); ok {
- err = e.err
- }
- return err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/.gitignore b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/.gitignore
deleted file mode 100644
index 74abc6e7e..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/.gitignore
+++ /dev/null
@@ -1,30 +0,0 @@
-# Compiled Object files, Static and Dynamic libs (Shared Objects)
-*.o
-*.a
-*.so
-
-# Folders
-_obj
-_test
-.vscode/
-
-# Architecture specific extensions/prefixes
-*.[568vq]
-[568vq].out
-
-*.cgo1.go
-*.cgo2.c
-_cgo_defun.c
-_cgo_gotypes.go
-_cgo_export.*
-
-_testmain.go
-
-*.exe
-*.test
-*.prof
-.idea/
-.DS_Store
-
-# direnv environment file
-.envrc
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/LICENSE b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/LICENSE
deleted file mode 100644
index 42c49ecc2..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright 2015 ProfitBricks GmbH
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/README.md b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/README.md
deleted file mode 100644
index 51211f80f..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/README.md
+++ /dev/null
@@ -1,3158 +0,0 @@
-# Go SDK
-
-Version: profitbricks-sdk-go **5.0**
-
-The ProfitBricks Client Library for [Go](https://www.golang.org/) provides you with access to the ProfitBricks Cloud API. It is designed for developers who are building applications in Go.
-
-This guide will walk you through getting setup with the library and performing various actions against the API.
-
-## Table of Contents
-
-- [Description](#description)
-- [Getting Started](#getting-started)
- - [Installation](#installation)
- - [Authentication](#authentication)
- - [Error Handling](#error-handling)
-- [Reference](#reference)
- - [Client Configuration](#client-configuration)
- - [SetDepth](#setdepth)
- - [SetURL](#seturl)
- - [SetUserAgent](#setuseragent)
- - [Data Centers](#data-centers)
- - [List Data Centers](#list-data-centers)
- - [Retrieve a Data Center](#retrieve-a-data-center)
- - [Create a Data Center](#create-a-data-center)
- - [Update a Data Center](#update-a-data-center)
- - [Delete a Data Center](#delete-a-data-center)
- - [Locations](#locations)
- - [List Locations](#list-locations)
- - [Get a Location](#get-a-location)
- - [Servers](#servers)
- - [List Servers](#list-servers)
- - [Retrieve a Server](#retrieve-a-server)
- - [Create a Server](#create-a-server)
- - [Update a Server](#update-a-server)
- - [Delete a Server](#delete-a-server)
- - [List Attached Volumes](#list-attached-volumes)
- - [Attach a Volume](#attach-a-volume)
- - [Retrieve an Attached Volume](#retrieve-an-attached-volume)
- - [Detach a Volume](#detach-a-volume)
- - [List Attached CD-ROMs](#list-attached-cd-roms)
- - [Attach a CD-ROM](#attach-a-cd-rom)
- - [Retrieve an Attached CD-ROM](#retrieve-an-attached-cd-rom)
- - [Detach a CD-ROM](#detach-a-cd-rom)
- - [Reboot a Server](#reboot-a-server)
- - [Start a Server](#start-a-server)
- - [Stop a Server](#stop-a-server)
- - [Images](#images)
- - [List Images](#list-images)
- - [Get an Image](#get-an-image)
- - [Update an Image](#update-an-image)
- - [Delete an Image](#delete-an-image)
- - [Volumes](#volumes)
- - [List Volumes](#list-volumes)
- - [Get a Volume](#get-a-volume)
- - [Create a Volume](#create-a-volume)
- - [Update a Volume](#update-a-volume)
- - [Delete a Volume](#delete-a-volume)
- - [Create a Volume Snapshot](#create-a-volume-snapshot)
- - [Restore a Volume Snapshot](#restore-a-volume-snapshot)
- - [Snapshots](#snapshots)
- - [List Snapshots](#list-snapshots)
- - [Get a Snapshot](#get-a-snapshot)
- - [Update a Snapshot](#update-a-snapshot)
- - [Delete a Snapshot](#delete-a-snapshot)
- - [IP Blocks](#ip-blocks)
- - [List IP Blocks](#list-ip-blocks)
- - [Get an IP Block](#get-an-ip-block)
- - [Create an IP Block](#create-an-ip-block)
- - [Delete an IP Block](#delete-an-ip-block)
- - [LANs](#lans)
- - [List LANs](#list-lans)
- - [Create a LAN](#create-a-lan)
- - [Get a LAN](#get-a-lan)
- - [Update a LAN](#update-a-lan)
- - [Delete a LAN](#delete-a-lan)
- - [Network Interfaces (NICs)](#network-interfaces-nics)
- - [List NICs](#list-nics)
- - [Get a NIC](#get-a-nic)
- - [Create a NIC](#create-a-nic)
- - [Update a NIC](#update-a-nic)
- - [Delete a NIC](#delete-a-nic)
- - [Firewall Rules](#firewall-rules)
- - [List Firewall Rules](#list-firewall-rules)
- - [Get a Firewall Rule](#get-a-firewall-rule)
- - [Create a Firewall Rule](#create-a-firewall-rule)
- - [Update a Firewall Rule](#update-a-firewall-rule)
- - [Delete a Firewall Rule](#delete-a-firewall-rule)
- - [Load Balancers](#load-balancers)
- - [List Load Balancers](#list-load-balancers)
- - [Get a Load Balancer](#get-a-load-balancer)
- - [Create a Load Balancer](#create-a-load-balancer)
- - [Update a Load Balancer](#update-a-load-balancer)
- - [List Load Balanced NICs](#list-load-balanced-nics)
- - [Get a Load Balanced NIC](#get-a-load-balanced-nic)
- - [Associate NIC to a Load Balancer](#associate-nic-to-a-load-balancer)
- - [Remove a NIC Association](#remove-a-nic-association)
- - [Requests](#requests)
- - [List Requests](#list-requests)
- - [Get a Request](#get-a-request)
- - [Get a Request Status](#get-a-request-status)
- - [Contract Resources](#contract-resources)
- - [Users Management](#users-management)
- - [List Groups](#list-groups)
- - [Retrieve a Group](#retrieve-a-group)
- - [Create a Group](#create-a-group)
- - [Update a Group](#update-a-group)
- - [Delete a Group](#delete-a-group)
- - [List Shares](#list-shares)
- - [Retrieve a Share](#retrieve-a-share)
- - [Add a Share](#add-a-share)
- - [Update a Share](#update-a-share)
- - [Delete a Share](#delete-a-share)
- - [List Users in a Group](#list-users-in-a-group)
- - [Add User to Group](#add-user-to-group)
- - [Remove User from a Group](#remove-user-from-a-group)
- - [List Users](#list-users)
- - [Retrieve a User](#retrieve-a-user)
- - [Create a User](#create-a-user)
- - [Update a User](#update-a-user)
- - [Delete a User](#delete-a-user)
- - [List Resources](#list-resources)
- - [List All Resources of a Type](#list-all-resources-of-a-type)
- - [List a specific Resource Type](#list-a-specific-resource-type)
- - [Managed Kubernetes](#managed-kubernetes)
- - [Create Cluster](#create-cluster)
- - [Read Cluster](#read-cluster)
- - [List Clusters](#list-clusters)
- - [Update Cluster](#update-cluster)
- - [Delete Cluster](#delete-cluster)
- - [Read Kubeconfig](#read-kubeconfig)
- - [Create Node Pool](#create-node-pool)
- - [Read Node Pool](#read-node-pool)
- - [List Node Pools](#list-node-pools)
- - [Update Node Pool](#update-node-pool)
- - [Delete Node Pool](#delete-node-pool)
- - [Backup Units](#backup-units)
- - [Create Backup Unit](#create-backup-unit)
- - [Read Backup Unit](#read-backup-unit)
- - [List Backup Units](#list-backup-units)
- - [Update Backup Unit](#update-backup-unit)
- - [Delete Backup Unit](#delete-backup-unit)
- - [Get Backup Unit SSO URL](#get-backup-unit-sso-url)
- - [User S3 Keys](#user-s3-keys)
- - [Create S3 Key](#create-s3-key)
- - [Read S3 Key](#create-s3-key)
- - [List S3 Keys](#list-s3-keys)
- - [Update S3 Key](#update-s3-key)
- - [Delete S3 Key](#delete-s3-key)
- - [Private Cross Connects](#private-cross-connects)
- - [Create Private Cross Connect](#create-private-cross-connect)
- - [Read Private Cross Connect](#read-private-cross-connect)
- - [List Private Cross Connects](#list-private-cross-connects)
- - [Update Private Cross Connect](#update-private-cross-connect)
- - [Delete Private Cross Connect](#delete-private-cross-connect)
-- [Example](#example)
-- [Support](#support)
-- [Testing](#testing)
-- [Contributing](#contributing)
-
-# Description
-
-The Go SDK wraps the latest version of the ProfitBricks Cloud API. All API operations are performed over SSL and authenticated using your ProfitBricks portal credentials. The API can be accessed within an instance running in ProfitBricks or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.
-
-## Getting Started
-
-Before you begin you will need to have [signed-up](https://www.profitbricks.com/signup) for a ProfitBricks account. The credentials you setup during sign-up will be used to authenticate against the API.
-
-#### Installation
-
-Install the Go language from from the official [Go installation](https://golang.org/doc/install) guide or using your Linux distribution package management system.
-
-The `GOPATH` environment variable specifies the location of your Go workspace. It is likely the only environment variable you will need to set when developing Go code. This is an example of pointing to a workspace configured under your home directory:
-
-```
-mkdir -p ~/go/bin
-export GOPATH=~/go
-export GOBIN=$GOPATH/bin
-export PATH=$PATH:$GOBIN
-```
-
-The following `go` command will download `profitbricks-sdk-go` to your configured `GOPATH`:
-
-```go
-go get "github.com/profitbricks/profitbricks-sdk-go/v5"
-```
-
-The source code of the package will be located here:
-
- $GOPATH/src/github.com/profitbricks/profitbricks-sdk-go
-
-Create main package file _example.go_:
-
-```go
-package main
-
-import (
- "fmt"
-)
-
-func main() {
-}
-```
-
-Include the ProfitBricks SDK for Go under the list of imports.
-
-```go
-import(
- "fmt"
-
- "github.com/profitbricks/profitbricks-sdk-go/v5"
-)
-```
-
-#### Authentication
-
-Add your ProfitBricks credentials to the client connection.
-
-```go
-client := profitbricks.NewClient("username", "password")
-```
-
-It might be necessary to accept credentials through environment variables in a containerized environment.
-
-```go
-import (
- "fmt"
- "os"
-
- "github.com/profitbricks/profitbricks-sdk-go/v5"
-)
-
-func main() {
- client := profitbricks.NewClient(
- os.Getenv("PROFITBRICKS_USERNAME"),
- os.Getenv("PROFITBRICKS_PASSWORD"),
- )
-```
-
-**Caution**: You will want to ensure you follow security best practices when using credentials within your code or stored in a file.
-
-#### Error Handling
-
-The SDK will raise custom exceptions when the Cloud API returns an error. There are four response types:
-
-| HTTP Code | Description |
-| --------- | --------------------------------------------------- |
-| 400 | Bad request. |
-| 401 | The supplied user credentials are invalid. |
-| 404 | The requested resource cannot be found. |
-| 422 | Invalid parameters have been passed onto Cloud API. |
-| 429 | The Cloud API rate limit has been exceeded. |
-
-Therefore each client function returns two parameters expected response and an error. For example:
-
-```go
-datacenters, err := ListDatacenters()
-```
-
-In the example the first parameter is a collection of virtual data centers and an error.
-
-## Reference
-
-This section provides details on all the available operations and the arguments they accept. Brief code snippets demonstrating usage are also included.
-
-## Client Configuration
-
-Clients can be created using either username / password or a bearer token for client authentification. A bearer token can be obtained from the auth api, e.g. by using a curl request
-
-```bash
-curl --user '' https://api.profitbricks.com/auth/v1/tokens/generate
-```
-
-```go
-client := profitbricks.NewClient("username", "password")
-token_client := profitbricks.NewClientbyToken("token")
-```
-
-#### SetDepth
-
-Many of the _List_ or _Get_ operations will accept an optional _depth_ argument. Setting this to a value between 0 and 5 affects the amount of data that is returned. The details returned vary depending on the resource being queried, however, it generally follows this pattern.
-
-| Depth | Description |
-| :---: | ----------------------------------------------------------------------------------- |
-| 0 | Only direct properties are included. Children are not included. |
-| 1 | Direct properties and children's references are returned. |
-| 2 | Direct properties and children's properties are returned. |
-| 3 | Direct properties, children's properties, and descendant's references are returned. |
-| 4 | Direct properties, children's properties, and descendant's properties are returned. |
-| 5 | Returns all available properties. |
-
-This SDK sets the _Depth=5_ by default as that works well in the majority of cases. You may find that setting _Depth_ to a lower or higher value could simplify a later operation by reducing or increasing the data available in the response object.
-
-```go
-client := profitbricks.NewClient("username", "password")
-client.SetDepth(3)
-```
-
-#### SetURL
-
-Set Cloud API URL:
-
-```go
-client.SetURL("https://api.profitbricks.com/cloudapi/v5")
-```
-
-#### SetUserAgent
-
-Set "User-Agent" HTTP header for all Cloud API calls:
-
-```go
-client.SetUserAgent("myproject/1.0.0")
-```
-
-## Data Centers
-
-Virtual Data Centers (VDCs) are the foundation of the ProfitBricks platform. VDCs act as logical containers for all other objects you will be creating, e.g., servers. You can provision as many VDCs as you want. VDCs have their own private network and are logically segmented from each other to create isolation.
-
-#### List Data Centers
-
-This operation will list all currently provisioned VDCs that your account credentials provide access to.
-
-There are no request arguments that need to be supplied.
-
-Call `ListDatacenters`:
-
- ListDatacenters()
-
----
-
-#### Retrieve a Data Center
-
-Use this to retrieve details about a specific VDC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---- | -------- | ------ | -------------------------- |
-| dcid | Yes | string | The ID of the data center. |
-
-Pass the arguments to `GetDatacenter`:
-
- GetDatacenter(dcid string)
-
----
-
-#### Create a Data Center
-
-Use this operation to create a new VDC. You can create a "simple" VDC by supplying just the required _Name_ and _Location_ arguments. This operation also has the capability of provisioning a "complex" VDC by supplying additional arguments for servers, volumes, LANs, and/or load balancers.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------ | ------------------------------------------------------------------------------------ |
-| datacenter | **yes** | object | A [Datacenter object](#datacenter-resource-object) describing the VDC being created. |
-
-Build the `Datacenter` resource object:
-
- var obj = Datacenter{
- Properties: DatacenterProperties{
- Name: "GO SDK Test",
- Description: "GO SDK test datacenter",
- Location: location,
- },
- }
-
-Pass the object to `CreateDatacenter`:
-
- CreateDatacenter(obj)
-
-##### Datacenter Resource Object
-
-| Name | Required | Type | Description |
-| ------------- | :------: | ------ | -------------------------------------------------------------------------------------------------------------- |
-| Name | **yes** | string | The name of the VDC. |
-| Location | **yes** | string | The physical ProfitBricks location where the VDC will be created (Please see [Locations](#locations) section). |
-| Description | no | string | A description for the VDC, e.g. staging, production. |
-| Servers | no | list | A list of one or more [Server objects](#server-resource-object) to be created. |
-| Volumes | no | list | A list of one or more [Volume objects](#volume-resource-object) to be created. |
-| Lans | no | list | A list of one or more [LAN objects](#lan-resource-object) to be created. |
-| Loadbalancers | no | list | A list of one or more [LoadBalancer objects](#load-balancer-resource-object) to be created. |
-
-**NOTES**:
-
-- The value for `Name` cannot contain the following characters: (@, /, , |, ‘’, ‘).
-- You cannot change the VDC `Location` once it has been provisioned.
-
----
-
-#### Update a Data Center
-
-After retrieving a VDC, either by ID or as a create response object, you can change its properties by calling the `update_datacenter` method. Some arguments may not be changed using `update_datacenter`.
-
-The following table describes the available request arguments:
-
-| Name | Required | Type | Description |
-| ----------- | :------: | ------ | ------------------------------- |
-| dcid | **yes** | string | The ID of the VDC. |
-| Name | no | string | The new name of the VDC. |
-| Description | no | string | The new description of the VDC. |
-
-Build the `DatacenterProperties` resource object:
-
- var obj = DatacenterProperties{Name: "new Name",Description: "new desc"}
-
-Pass the arguments to `UpdateDatacenter`:
-
-UpdateDatacenter(dcid string, obj DatacenterProperties)
-
----
-
-#### Delete a Data Center
-
-This will remove all objects within the VDC and remove the VDC object itself.
-
-**NOTE**: This is a highly destructive operation which should be used with extreme caution!
-
-The following table describes the available request arguments:
-
-| Name | Required | Type | Description |
-| ---- | :------: | ------ | ------------------------------------------ |
-| dcid | **yes** | string | The ID of the VDC that you want to delete. |
-
-Pass the argument to `DeleteDatacenter`:
-
- DeleteDatacenter(dcid)
-
----
-
-## Locations
-
-Locations are the physical ProfitBricks data centers where you can provision your VDCs.
-
-The following table outlines the currently supported locations:
-
-| Value | Country | City | Supported **CPUFamily** values |
-| ------ | -------------- | --------- | ------------------------------ |
-| us/las | United States | Las Vegas | AMD_OPTERON, INTEL_XEON |
-| us/ewr | United States | Newark | AMD_OPTERON, INTEL_XEON |
-| de/fra | Germany | Frankfurt | AMD_OPTERON, INTEL_XEON |
-| de/fkb | Germany | Karlsruhe | AMD_OPTERON, INTEL_XEON |
-| de/txl | Germany | Berlin | INTEL_SKYLAKE |
-| gb/lhr | United Kingdom | London | INTEL_SKYLAKE |
-
-#### List Locations
-
-The `ListLocations` operation will return the list of currently available locations.
-
-There are no request arguments to supply.
-
- ListLocations()
-
----
-
-#### Get a Location
-
-Retrieves the attributes of a specific location.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------ | ---------------------------------- |
-| locationid | **yes** | string | The ID consisting of country/city. |
-
-Pass the argument to `GetLocation`:
-
- GetLocation("us/las")
-
----
-
-#### Get a Regional Location
-
-Retrieves the locations available in a specific region.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------- | :------: | ------ | ---------------------------------- |
-| regionid | **yes** | string | The ID consisting of country/city. |
-
-Pass the argument to `GetRegionalLocations`:
-
- GetRegionalLocations("us")
-
----
-
-## Servers
-
-#### List Servers
-
-You can retrieve a list of all the servers provisioned inside a specific VDC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---- | :------: | ------ | ------------------ |
-| dcid | **yes** | string | The ID of the VDC. |
-
-Pass the arguments to `ListServers`:
-
- ListServers(dcid)
-
----
-
-#### Retrieve a Server
-
-Returns information about a specific server such as its configuration, provisioning status, etc.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------- | :------: | ------ | --------------------- |
-| dcId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `GetServer`:
-
- GetServer(dcId, serverId)
-
----
-
-#### Create a Server
-
-Creates a server within an existing VDC. You can configure additional properties such as specifying a boot volume and connecting the server to a LAN.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| server | **yes** | object | A [Server object](#server-resource-object) describing the server being created. |
-
-Build a [Server](#server-resource-object) object:
-
- var server = Server{
- Properties: ServerProperties{
- Name: "GO SDK Test",
- RAM: 1024,
- Cores: 1,
- AvailabilityZone: "ZONE_1",
- CPUFamily: "INTEL_XEON",
- },
- }
-
-Pass the object and other arguments to `CreateServer`:
-
- CreateServer(datacenterId, server)
-
-#### Server Resource Object
-
-| Name | Required | Type | Description |
-| ---------------- | :------: | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Name | **yes** | string | The name of the server. |
-| Cores | **yes** | int | The total number of cores for the server. |
-| RAM | **yes** | int | The amount of memory for the server in MB, e.g. 2048. Size must be specified in multiples of 256 MB with a minimum of 256 MB; however, if you set `RamHotPlug` to _true_ then you must use a minimum of 1024 MB. |
-| AvailabilityZone | no | string | The availability zone in which the server should exist. Possible Values are: AUTO, ZONE_1, ZONE_2 |
-| CPUFamily | no | string | Sets the CPU type. For all supported values (depending on location), please see the [Locations](#locations) section. |
-| BootVolume | no | string | A volume ID that the server will boot from. If not _nil_ then `BootCdrom` has to be _nil_. |
-| BootCdrom | no | string | A CD-ROM image ID used for booting. If not _nil_ then `BootVolume` has to be _nil_. |
-| Cdroms | no | list | A list of existing volume IDs that you want to connect to the server. |
-| Volumes | no | list | One or more [Volume objects](#volume-resource-object) that you want to create and attach to the server. |
-| Nics | no | list | One or more [NIC objects](#nic-resource-object) that you wish to create at the time the server is provisioned. |
-
----
-
-#### Update a Server
-
-Perform updates to the attributes of a server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------------- | :------: | ------ | ---------------------------------------------------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| Name | no | string | The name of the server. |
-| Cores | no | int | The number of cores for the server. |
-| RAM | no | int | The amount of memory in the server. |
-| AvailabilityZone | no | string | The new availability zone for the server. Possible Values are: AUTO, ZONE_1, ZONE_2 |
-| CPUFamily | no | string | Sets the CPU type. For all supported values (depending on location), please check the [Locations](#locations) section. |
-| BootVolume | no | string | A volume ID used for booting. If not _nil_ then `BootCdrom` has to be _nil_. |
-| BootCdrom | no | string | A CD-ROM image ID used for booting. If not _nil_ then `BootVolume` has to be _nil_. |
-
-Build a [ServerProperties](#serverproperties) object:
-
- var server = ServerProperties{
- Name: "GO SDK Test RENAME",
- }
-
-Pass the arguments to `update_server`:
-
- UpdateServer(datacenterId, serverId, server)
-
----
-
-#### Delete a Server
-
-This will remove a server from a VDC. **NOTE**: This will not automatically remove the storage volume(s) attached to a server. A separate operation is required to delete a storage volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server that will be deleted. |
-
-Pass the arguments to `delete_server`:
-
- DeleteServer(datacenterId, serverId)
-
----
-
-#### List Attached Volumes
-
-Retrieves a list of volumes attached to the server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `ListAttachedVolumes`:
-
- ListAttachedVolumes(datacenterId, serverId)
-
----
-
-#### Attach a Volume
-
-This will attach a pre-existing storage volume to the server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| volumeId | **yes** | string | The ID of a storage volume. |
-
-Pass the arguments to `AttachVolume`:
-
-AttachVolume(datacenterId, serverId, volumeId)
-
----
-
-#### Retrieve an Attached Volume
-
-This will retrieve the properties of an attached volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| volumeId | **yes** | string | The ID of the attached volume. |
-
-Pass the arguments to `get_attached_volume`:
-
- GetAttachedVolume(srv_dc_id, srv_srvid, srv_vol)
-
----
-
-#### Detach a Volume
-
-This will detach the volume from the server. Depending on the volume `hot_unplug` settings, this may result in the server being rebooted. If `disc_virtio_hot_unplug` has been set to _true_, then a reboot should not be required.
-
-This will **NOT** delete the volume from your VDC. You will need to make a separate request to delete a volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| volumeId | **yes** | string | The ID of the attached volume. |
-
-Pass the arguments to `detach_volume`:
-
- DetachVolume(datacenterId, serverId, volumeId)
-
----
-
-#### List Attached CD-ROMs
-
-Retrieves a list of CD-ROMs attached to a server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `ListAttachedCdroms`:
-
-ListAttachedCdroms(srv_dc_id, srv_srvid)
-
----
-
-#### Attach a CD-ROM
-
-You can attach a CD-ROM to an existing server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| cdromId | **yes** | string | The ID of a CD-ROM. |
-
-Pass the arguments to `attach_cdrom`:
-
- AttachCdrom(datacenterId, serverId, cdromId)
-
----
-
-#### Retrieve an Attached CD-ROM
-
-You can retrieve a specific CD-ROM attached to the server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| cdromId | **yes** | string | The ID of the attached CD-ROM. |
-
-Pass the arguments to `GetAttachedCdrom`:
-
-GetAttachedCdrom(datacenterId, serverId, cdromId)
-
----
-
-#### Detach a CD-ROM
-
-This will detach a CD-ROM from the server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| cdromId | **yes** | string | The ID of the attached CD-ROM. |
-
-Pass the arguments to `DetachCdrom`:
-
- DetachCdrom(datacenterId, serverId, cdromId)
-
----
-
-#### Reboot a Server
-
-This will force a hard reboot of the server. Do not use this method if you want to gracefully reboot the machine. This is the equivalent of powering off the machine and turning it back on.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `RebootServer`:
-
- RebootServer(datacenterId, serverId)
-
----
-
-#### Start a Server
-
-This will start a server. If a DHCP assigned public IP was deallocated when the server was stopped, then a new IP will be assigned.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `StartServer`:
-
- StartServer(datacenterId, serverId)
-
----
-
-#### Stop a Server
-
-This will stop a server. The machine will be forcefully powered off, billing will cease, and the public IP, if one is allocated, will be deallocated.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `StopServer`:
-
- StopServer(datacenterId, serverId)
-
----
-
-## Images
-
-#### List Images
-
-Retrieve a list of images.
-
-Just call the `ListImages`:
-
- ListImages()
-
----
-
-#### Get an Image
-
-Retrieves the attributes of a specific image.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ----- | :------: | ------ | -------------------- |
-| imgId | **yes** | string | The ID of the image. |
-
-Pass the arguments to `GetImage`:
-
- GetImage(imgid)
-
----
-
-## Volumes
-
-#### List Volumes
-
-Retrieve a list of volumes within the VDC. If you want to retrieve a list of volumes attached to a server please see the [List Attached Volumes](#list-attached-volumes) entry in the Server section for details.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-
-Pass the arguments to `ListVolumes`:
-
- ListVolumes(datacenterId)
-
----
-
-#### Get a Volume
-
-Retrieves the attributes of a given volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| volumeId | **yes** | string | The ID of the volume. |
-
-Pass the arguments to `GetVolume`:
-
- GetVolume(datacenterId, volumeId)
-
----
-
-#### Create a Volume
-
-Creates a volume within the VDC. This will NOT attach the volume to a server. Please see the [Attach a Volume](#attach-a-volume) entry in the Server section for details on how to attach storage volumes.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------- | :------: | ------ | -------------------------------------------------------------- |
-| datacenter_id | **yes** | string | The ID of the VDC. |
-| volume | **yes** | object | A [Volume object](#volume-resource-object) you wish to create. |
-
-Build the `Volume` resource object:
-
- var request = Volume{
- Properties: VolumeProperties{
- Size: 2,
- Name: "GO SDK Test",
- ImageAlias: "ubuntu:latest",
- Bus: "VIRTIO",
- SSHKeys: []string{"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCoLVLHON4BSK3D8L4H79aFo..."},
- Type: "HDD",
- ImagePassword: "test1234",
- AvailabilityZone: "ZONE_3",
- },
- }
-
-Pass the object and arguments to `CreateVolume`:
-
- CreateVolume(dcID, request)
-
-#### Volume Resource Object
-
-| Name | Required | Type | Description |
-| ---------------- | :------: | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| Name | no | string | The name of the volume. |
-| Size | **yes** | int | The size of the volume in GB. |
-| Bus | no | string | The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. |
-| Image | **yes** | string | The image or snapshot ID. Can be left empty for a data volume, however you'll need to set the `licence_type`. Default: _null_ |
-| Type | **yes** | string | The volume type, HDD or SSD. Default: HDD |
-| LicenceType | **yes** | string | The licence type of the volume. Options: LINUX, WINDOWS, WINDOWS2016, UNKNOWN, OTHER. Default: UNKNOWN |
-| ImagePassword | **yes** | string | A password to set on the volume for the appropriate root or administrative account. This field may only be set in creation requests. When reading, it always returns _null_. The password has to contain 8-50 characters. Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789] |
-| ImageAlias | **yes** | string | An alias to a ProfitBricks public image. Use instead of "image".] |
-| SSHKeys | **yes** | string | SSH keys to allow access to the volume via SSH. |
-| AvailabilityZone | no | string | The storage availability zone assigned to the volume. Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes. Leave blank or set to AUTO when provisioning SSD volumes. |
-
-The following table outlines the various licence types you can define:
-
-| Licence Type | Comment |
-| ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
-| WINDOWS2016 | Use this for the Microsoft Windows Server 2016 operating system. |
-| WINDOWS | Use this for the Microsoft Windows Server 2008 and 2012 operating systems. |
-| LINUX | Use this for Linux distributions such as CentOS, Ubuntu, Debian, etc. |
-| OTHER | Use this for any volumes that do not match one of the other licence types. |
-| UNKNOWN | This value may be inherited when you've uploaded an image and haven't set the license type. Use one of the options above instead. |
-
-The following table outlines the storage availability zones currently supported:
-
-| Availability Zone | Comment |
-| ----------------- | --------------------------- |
-| AUTO | Automatically Selected Zone |
-| ZONE_1 | Fire Zone 1 |
-| ZONE_2 | Fire Zone 2 |
-| ZONE_3 | Fire Zone 3 |
-
-**Note:** You will need to provide either the `Image` or the `LicenceType` arguments when creating a volume. A `LicenceType` is required, but if `Image` is supplied, it is already set and cannot be changed. Either the `ImagePassword` or `SshKeys` arguments need to be supplied when creating a volume using one of the official ProfitBricks images. Only official ProfitBricks provided images support the `SshKeys` and `ImagePassword` arguments.
-
----
-
-#### Update a Volume
-
-You can update various attributes of an existing volume; however, some restrictions are in place:
-
-You can increase the size of an existing storage volume. You cannot reduce the size of an existing storage volume. The volume size will be increased without requiring a reboot if the relevant hot plug settings (`disc_virtio_hot_plug`, `disc_virtio_hot_unplug`, etc.) have been set to _true_. The additional capacity is not added automatically added to any partition, therefore you will need to handle that inside the OS afterwards. Once you have increased the volume size you cannot decrease the volume size.
-
-Since an existing volume is being modified, none of the request arguments are specifically required as long as the changes being made satisfy the requirements for creating a volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| volumeId | **yes** | string | The ID of the volume. |
-| Name | no | string | The name of the volume. |
-| Size | no | int | The size of the volume in GB. You may only increase the `size` when updating. |
-| Bus | no | string | The bus type of the volume (VIRTIO or IDE). Default: VIRTIO. |
-| LicenceType | no | string | The licence type of the volume. Options: LINUX, WINDOWS, WINDOWS2016, UNKNOWN, OTHER. You may get an error trying to update `LicenceType` depending on the `Image` that was used to create the volume. For example, you cannot update the `LicenceType` for a volume created from a ProfitBricks supplied OS image. |
-
-**Note**: Trying to change the `Image`, `Type`, or `AvailabilityZone` in an update request will result in an error.
-
-Pass the arguments to `UpdateVolume`:
-
- var obj := VolumeProperties{
- Name: "GO SDK Test - RENAME",
- Size: 5,
- }
- UpdateVolume(datacenterId, volumeId, obj)
-
----
-
-#### Delete a Volume
-
-Deletes the specified volume. This will result in the volume being removed from your data center. Use this with caution.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| volumeId | **yes** | string | The ID of the volume. |
-
-Pass the arguments to `DeleteVolume`:
-
- DeleteVolume(datacenterId, volumeId)
-
----
-
-#### Create a Volume Snapshot
-
-Creates a snapshot of a volume within the VDC. You can use a snapshot to create a new storage volume or to restore a storage volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | -------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| volumeId | **yes** | string | The ID of the volume. |
-| Name | no | string | The name of the snapshot. |
-| Description | no | string | The description of the snapshot. |
-
-Pass the arguments to `CreateSnapshot`:
-
- CreateSnapshot(datacenterId, volumeId, Name,Description)
-
----
-
-#### Restore a Volume Snapshot
-
-This will restore a snapshot onto a volume. A snapshot is created as just another image that can be used to create new volumes or to restore an existing volume.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ----------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| volumeId | **yes** | string | The ID of the volume. |
-| snapshotId | **yes** | string | The ID of the snapshot. |
-
-Pass the arguments to `restore_snapshot`:
-
-RestoreSnapshot(datacenterId, volumeId, snapshotId)
-
----
-
-## Snapshots
-
-#### List Snapshots
-
-Call the `ListSnapshots`:
-
- ListSnapshots()
-
----
-
-#### Get a Snapshot
-
-Retrieves the attributes of a specific snapshot.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------ | ----------------------- |
-| snapshotId | **yes** | string | The ID of the snapshot. |
-
-Pass the arguments to `GetSnapshot`:
-
- GetSnapshot(snapshotId)
-
----
-
-#### Update a Snapshot
-
-Perform updates to attributes of a snapshot.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------------- | :------: | ------ | ---------------------------------------------------------------------- |
-| snapshotId | **yes** | string | The ID of the snapshot. |
-| Name | no | string | The name of the snapshot. |
-| Description | no | string | The description of the snapshot. |
-| LicenceType | no | string | The snapshot's licence type: LINUX, WINDOWS, WINDOWS2016, or OTHER. |
-| CPUHotPlug | no | bool | This volume is capable of CPU hot plug (no reboot required) |
-| CPUHotUnplug | no | bool | This volume is capable of CPU hot unplug (no reboot required) |
-| RAMHotPlug | no | bool | This volume is capable of memory hot plug (no reboot required) |
-| RAMHotUnplug | no | bool | This volume is capable of memory hot unplug (no reboot required) |
-| NicHotPlug | no | bool | This volume is capable of NIC hot plug (no reboot required) |
-| NicHotUnplug | no | bool | This volume is capable of NIC hot unplug (no reboot required) |
-| DiscVirtioHotPlug | no | bool | This volume is capable of VirtIO drive hot plug (no reboot required) |
-| DiscVirtioHotUnplug | no | bool | This volume is capable of VirtIO drive hot unplug (no reboot required) |
-| DiscScsiHotPlug | no | bool | This volume is capable of SCSI drive hot plug (no reboot required) |
-| DiscScsiHotUnplug | no | bool | This volume is capable of SCSI drive hot unplug (no reboot required) |
-
-Pass the arguments to `UpdateSnapshot`:
-
- UpdateSnapshot(snapshotId, SnapshotProperties{Name: newValue})
-
----
-
-#### Delete a Snapshot
-
-Deletes the specified snapshot.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------ | ----------------------- |
-| snapshotId | **yes** | string | The ID of the snapshot. |
-
-Pass the arguments to `DeleteSnapshot`:
-
- DeleteSnapshot(snapshotId)
-
----
-
-## IP Blocks
-
-The IP block operations assist with managing reserved /static public IP addresses.
-
-#### List IP Blocks
-
-Retrieve a list of available IP blocks.
-
- ListIpBlocks()
-
----
-
-#### Get an IP Block
-
-Retrieves the attributes of a specific IP block.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| --------- | :------: | ------ | ----------------------- |
-| ipblockid | **yes** | string | The ID of the IP block. |
-
-Pass the arguments to `GetIPBlock`:
-
- response = client.GetIPBlock('UUID')
-
----
-
-#### Create an IP Block
-
-Creates an IP block. Creating an IP block is a bit different than some of the other available create operations. IP blocks are not attached to a particular VDC, but rather to a location. Therefore, you must specify a valid `location` along with a `size` argument indicating the number of IP addresses you want to reserve in the IP block. Any resources using an IP address from an IP block must be in the same `location`.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------- | :------: | ------ | ----------------------------------------------------------------- |
-| ipblock | **yes** | object | An [IPBlock object](#ipblock-resource-object) you wish to create. |
-
-To create an IP block, define the `IPBlock` resource object:
-
- var ipblock = IpBlock{
- Properties: IpBlockProperties{
- Name: "GO SDK Test",
- Size: 2,
- Location: location,
- },
- }
-
-Pass it to `ReserveIpBlock`:
-
- ReserveIpBlock(ipblock)
-
-#### IPBlock Resource Object
-
-| Name | Required | Type | Description |
-| -------- | :------: | ------ | --------------------------------------------------------------------- |
-| Location | **yes** | string | This must be one of the available locations: [Locations](#locations). |
-| Size | **yes** | int | The size of the IP block you want. |
-| Name | no | string | A descriptive name for the IP block |
-
----
-
-#### Update an IPBlock
-
-Perform updates to the attributes of a ipblock.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------- | :------: | ------ | ------------------------------------------ |
-| ipblkid | **yes** | string | The ID of the IP Block you want to update. |
-| Name | no | string | A descriptive name for the IP Block. |
-
-Build an [IpBlockProperties] object:
-
- var ipblock = IPBlockProperties{
- Name: "GO SDK Test RENAME",
- }
-
-Pass the arguments to `UpdateIPBlock`:
-
- UpdateIPBlock(ipblkid, ipblock)
-
----
-
-#### Delete an IP Block
-
-Deletes the specified IP Block.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------- | :------: | ------ | ----------------------- |
-| ipblkid | **yes** | string | The ID of the IP block. |
-
-Pass the arguments to `ReleaseIpBlock`:
-
- ReleaseIpBlock(ipblkid)
-
----
-
-## LANs
-
-#### List LANs
-
-Retrieve a list of LANs within the VDC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-
-Pass the arguments to `ListLans`:
-
- ListLans(datacenterId)
-
----
-
-#### Create a LAN
-
-Creates a LAN within a VDC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------------------------------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| lan | **yes** | object | A [LAN object](#lan-resource-object) describing the LAN to create. |
-
-Create the `LAN` resource object:
-
- var request = CreateLanRequest{
- Properties: LanProperties{
- Public: true,
- Name: "GO SDK Test with failover",
- },
- Entities: &LanEntities{
- Nics: lanNics,
- },
- }
-
-Pass the object and arguments to `create_lan`:
-
- CreateLan(datacenterId, request)
-
-#### LAN Resource Object
-
-| Name | Required | Type | Description |
-| ------ | :------: | ------ | ------------------------------------------------------------------------------------------------------------- |
-| Name | no | string | The name of your LAN. |
-| Public | **Yes** | bool | Boolean indicating if the LAN faces the public Internet or not. |
-| Nics | no | list | One or more NIC IDs attached to the LAN. |
-| PCC | no | string | Optionally, add this LAN as a peer to a [PrivateCrossConnect](#Private-Cross-Connects) by specifying its UUID |
-
-#### IPFailover Resource Object
-
-| Name | Required | Type | Description |
-| ------- | -------- | ------ | ----------------------- |
-| IP | **yes** | string | The failover IP Address |
-| NicUUID | **yes** | string | The NIC UUID |
-
-#### Get a LAN
-
-Retrieves the attributes of a given LAN.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| lanId | **yes** | int | The ID of the LAN. |
-
-Pass the arguments to `GetLan`:
-
- GetLan(datacenterId, lanId)
-
----
-
-#### Update a LAN
-
-Perform updates to attributes of a LAN.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | -------------------------------------------------------------- | --------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| lanId | **yes** | int | The ID of the LAN. |
-| Name | no | string | A descriptive name for the LAN. |
-| Public | no | bool | Boolean indicating if the LAN faces the public Internet or not. |
-| IPFailover | no | \*[] seeIPFailover - [IPFailover](#ipfailover-resource-object) | Only supported when updating a LAN |
-
-Pass the arguments to `update_lan`:
-
- var obj = LanProperties{
- Properties: LanProperties{
- Public: true,
- Name: "GO SDK Test with failover",
- IPFailover: &[]IPFailover {
- IPFailover {
- IP: "1.1.1.1",
- NicUUID: ".....",
- }
- },
- }
- UpdateLan(datacenterId, lanId, obj)
-
----
-
-#### Delete a LAN
-
-Deletes the specified LAN.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| lanId | **yes** | string | The ID of the LAN. |
-
-Pass the arguments to `delete_lan`:
-
- DeleteLan(lan_dcid, lanid)
-
----
-
-## Network Interfaces (NICs)
-
-#### List NICs
-
-Retrieve a list of LANs within the VDC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-
-Pass the arguments to `ListNics`:
-
- ListNics(datacenterId, serverId)
-
----
-
-#### Get a NIC
-
-Retrieves the attributes of a given NIC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-
-Pass the arguments to `GetNic`:
-
- GetNic(datacenterId, serverId, nicId)
-
----
-
-#### Create a NIC
-
-Adds a NIC to the target server.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ---------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nic | **yes** | object | A [NIC object](#nic-resource-object) describing the NIC to be created. |
-
-Create the `NIC` resource object:
-
- var nic = Nic{
- Properties: &NicProperties{
- Lan: 1,
- Name: "GO SDK Test",
- Nat: false,
- Dhcp: true,
- FirewallActive: true,
- Ips: []string{"10.0.0.1"},
- },
- }
-
-Pass the object and arguments to `create_nic`:
-
-CreateNic(datacenterId, serverId, nic)
-
-#### NIC Resource Object
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | -------------------------------------------------------------------------------------------- |
-| Name | no | string | The name of the NIC. |
-| Ips | no | list | IP addresses assigned to the NIC. |
-| Dhcp | no | bool | Set to _false_ if you wish to disable DHCP on the NIC. Default: _true_. |
-| Lan | **yes** | int | The LAN ID the NIC will sit on. If the LAN ID does not exist it will be created. |
-| Nat | no | bool | Indicates the private IP address has outbound access to the public internet. |
-| FirewallActive | no | bool | Set this to _true_ to enable the ProfitBricks firewall, _false_ to disable. |
-| Firewallrules | no | list | A list of [FirewallRule objects](#firewall-rule-resource-object) to be created with the NIC. |
-
----
-
-#### Update a NIC
-
-You can update -- in full or partially -- various attributes on the NIC; however, some restrictions are in place:
-
-The primary address of a NIC connected to a load balancer can only be changed by changing the IP of the load balancer. You can also add additional reserved, public IPs to the NIC.
-
-The user can specify and assign private IPs manually. Valid IP addresses for private networks are 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-| Name | no | string | The name of the NIC. |
-| Ips | no | list | IPs assigned to the NIC represented as a list of strings. |
-| Dhcp | no | bool | Boolean value that indicates if the NIC is using DHCP or not. |
-| Lan | no | int | The LAN ID the NIC sits on. |
-| Nat | no | bool | Indicates the private IP address has outbound access to the public internet. |
-| FirewallActive | no | bool | Set this to _true_ to enable the ProfitBricks firewall, _false_ to disable. |
-
-Pass the arguments to `update_nic`:
-
- var obj = NicProperties{Name: "GO SDK Test - RENAME", Lan: 1}
- UpdateNic(nic_dcid, nic_srvid, nicid, obj)
-
----
-
-#### Delete a NIC
-
-Deletes the specified NIC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-
-Pass the arguments to `DeleteNic`:
-
- DeleteNic(nic_dcid, nic_srvid, nicid)
-
----
-
-## Firewall Rules
-
-#### List Firewall Rules
-
-Retrieves a list of firewall rules associated with a particular NIC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-
-Pass the arguments to `ListFirewallRules`:
-
- ListFirewallRules(datacenterId, serverId, nicId)
-
----
-
-#### Get a Firewall Rule
-
-Retrieves the attributes of a given firewall rule.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-| firewallRuleId | **yes** | string | The ID of the firewall rule. |
-
-Pass the arguments to `get_firewall_rule`:
-
- GetFirewallRule(datacenterId, serverId, nicId, firewallRuleId)
-
----
-
-#### Create a Firewall Rule
-
-This will add a firewall rule to the NIC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------------------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-| firewallRule | **yes** | object | A [FirewallRule object](#firewall-rule-resource-object) describing the firewall rule to be created. |
-
-Create the `FirewallRule` resource object:
-
- var firewallRule FirewallRule{
- Properties: FirewallruleProperties{
- Name: "SSH",
- Protocol: "TCP",
- SourceMac: "01:23:45:67:89:00",
- PortRangeStart: 22,
- PortRangeEnd: 22,
- },
- }
-
-Pass the object and arguments to `create_firewall_rule`:
-
- CreateFirewallRule(datacenterId, serverId, nicId, firewallRule)
-
-#### Firewall Rule Resource Object
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| Name | no | string | The name of the firewall rule. |
-| Protocol | **yes** | string | The protocol for the rule: TCP, UDP, ICMP, ANY. |
-| SourceMac | no | string | Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. A _nil_ value allows all source MAC address. |
-| SourceIP | no | string | Only traffic originating from the respective IPv4 address is allowed. A _nil_ value allows all source IPs. |
-| TargetIP | no | string | In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. A _nil_ value allows all target IPs. |
-| PortRangeStart | no | string | Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave `PortRangeStart` and `PortRangeEnd` value as _nil_ to allow all ports. |
-| PortRangeEnd | no | string | Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave `PortRangeStart` and `PortRangeEnd` value as _nil_ to allow all ports. |
-| IcmpType | no | string | Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. A _nil_ value allows all types. |
-| IcmpCode | no | string | Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. A _nil_ value allows all codes. |
-
----
-
-#### Update a Firewall Rule
-
-Perform updates to an existing firewall rule. You will notice that some arguments, such as `protocol` cannot be updated. If the `protocol` needs to be changed, you can [delete](#delete-a-firewall-rule) the firewall rule and then [create](#create-a-firewall-rule) new one to replace it.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-| firewallRuleId | **yes** | string | The ID of the firewall rule. |
-| Name | no | string | The name of the firewall rule. |
-| SourceMac | no | string | Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. A _nil_ value allows all source MAC address. |
-| SourceIP | no | string | Only traffic originating from the respective IPv4 address is allowed. A _nil_ value allows all source IPs. |
-| TargetIP | no | string | In case the target NIC has multiple IP addresses, only traffic directed to the respective IP address of the NIC is allowed. A _nil_ value allows all target IPs. |
-| PortRangeStart | no | string | Defines the start range of the allowed port (from 1 to 65534) if protocol TCP or UDP is chosen. Leave `PortRangeStart` and `PortRangeEnd` value as _nil_ to allow all ports. |
-| PortRangeEnd | no | string | Defines the end range of the allowed port (from 1 to 65534) if the protocol TCP or UDP is chosen. Leave `PortRangeStart` and `PortRangeEnd` value as _nil_ to allow all ports. |
-| IcmpType | no | string | Defines the allowed type (from 0 to 254) if the protocol ICMP is chosen. A _nil_ value allows all types. |
-| IcmpCode | no | string | Defines the allowed code (from 0 to 254) if protocol ICMP is chosen. A _nil_ value allows all codes. |
-
-Pass the arguments to `UpdateFirewallRule`:
-
- props := FirewallruleProperties{
- Name: "SSH - RENAME",
- }
- UpdateFirewallRule(dcID, srv_srvid, nicid, fwId, props)
-
----
-
-#### Delete a Firewall Rule
-
-Removes a firewall rule.
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| serverId | **yes** | string | The ID of the server. |
-| nicId | **yes** | string | The ID of the NIC. |
-| firewallRuleId | **yes** | string | The ID of the firewall rule. |
-
-Pass the arguments to `DeleteFirewallRule`:
-
- DeleteFirewallRule(dcID, srv_srvid, nicid, fwId)
-
----
-
-## Load Balancers
-
-#### List Load Balancers
-
-Retrieve a list of load balancers within the data center.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ------------------ |
-| datacenterId | **yes** | string | The ID of the VDC. |
-
-Pass the arguments to `ListLoadbalancers`:
-
- ListLoadbalancers(datacenterId)
-
----
-
-#### Get a Load Balancer
-
-Retrieves the attributes of a given load balancer.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-
-Pass the arguments to `GetLoadbalancer`:
-
- GetLoadbalancer(datacenterId, loadbalancerId)
-
----
-
-#### Create a Load Balancer
-
-Creates a load balancer within the VDC. Load balancers can be used for public or private IP traffic.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | --------------------------------------------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancer | **yes** | object | A [LoadBalancer object](#load-balancer-resource-object) describing the load balancer to be created. |
-
-Create the `LoadBalancer` resource object:
-
- var loadbalancer = Loadbalancer{
- Properties: LoadbalancerProperties{
- Name: "GO SDK Test",
- Ip: "10.0.0.1",
- Dhcp: true,
- }
- }
-
-Pass the object and arguments to `CreateLoadbalancer`:
-
- CreateLoadbalancer(datacenterId, loadbalancer)
-
-#### Load Balancer Resource Object
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ----------------------------------------------------------------------------------------------------- |
-| Name | **yes** | string | The name of the load balancer. |
-| Ip | no | string | IPv4 address of the load balancer. All attached NICs will inherit this IP. |
-| Dhcp | no | bool | Indicates if the load balancer will reserve an IP using DHCP. |
-| Balancednics | no | list | List of NIC IDs taking part in load-balancing. All balanced NICs inherit the IP of the load balancer. |
-
----
-
-#### Update a Load Balancer
-
-Perform updates to attributes of a load balancer.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ------------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-| Name | no | string | The name of the load balancer. |
-| Ip | no | string | The IP of the load balancer. |
-| Dhcp | no | bool | Indicates if the load balancer will reserve an IP using DHCP. |
-
-Pass the arguments to `UpdateLoadbalancer`:
-
- var obj = LoadbalancerProperties{Name: "GO SDK Test - RENAME"}
- UpdateLoadbalancer(datacenterId, loadbalancerId, obj)
-
----
-
-#### Delete a Load Balancer
-
-Deletes the specified load balancer.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-
-Pass the arguments to `DeleteLoadbalancer`:
-
- DeleteLoadbalancer(datacenterId, loadbalancerId)
-
----
-
-#### List Load Balanced NICs
-
-This will retrieve a list of NICs associated with the load balancer.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-
-Pass the arguments to `ListBalancedNics`:
-
- ListBalancedNics(datacenterId, loadbalancerId)
-
----
-
-#### Get a Load Balanced NIC
-
-Retrieves the attributes of a given load balanced NIC.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-| nicId | **yes** | string | The ID of the NIC. |
-
-Pass the arguments to `GetBalancedNic`:
-
- GetBalancedNic(datacenterId, loadbalancerId, nicId)
-
----
-
-#### Associate NIC to a Load Balancer
-
-This will associate a NIC to a load balancer, enabling the NIC to participate in load-balancing.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-| nicId | **yes** | string | The ID of the NIC. |
-
-Pass the arguments to `add_loadbalanced_nics`:
-
- AssociateNic(datacenterId, loadbalancerId, nicId)
-
----
-
-#### Remove a NIC Association
-
-Removes the association of a NIC with a load balancer.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------------------------------------- |
-| datacenterId | **yes** | string | The ID of the VDC. |
-| loadbalancerId | **yes** | string | The ID of the load balancer. |
-| nicId | **yes** | string | The ID of the NIC you are removing from the load balancer. |
-
-Pass the arguments to `DeleteBalancedNic`:
-
- DeleteBalancedNic(datacenterId, loadbalancerId, nicId)
-
----
-
-## Requests
-
-Each call to the ProfitBricks Cloud API is assigned a request ID. These operations can be used to get information about the requests that have been submitted and their current status.
-
-#### List Requests
-
- ListRequests()
-
----
-
-#### Get a Request
-
-Retrieves the attributes of a specific request. This operation shares the same `get_request` method used for getting request status, however the response it determined by the boolean value you pass for _status_. To get details about the request itself, you want to pass a _status_ of _False_.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------ | ---------------------------------------------------- |
-| request_id | **yes** | string | The ID of the request. |
-| status | **yes** | bool | Set to _False_ to have the request details returned. |
-
-Pass the arguments to `get_request`:
-
- response = client.get_request(
- request_id='UUID',
- status=False)
-
----
-
-#### Get a Request Status
-
-Retrieves the status of a request. This operation shares the same `get_request` method used for getting the details of a request, however the response it determined by the boolean value you pass for _status_. To get the request status, you want to pass a _status_ of _True_.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---- | :------: | ------ | -------------------------------------------------------------- |
-| path | **yes** | string | The ID of the request. Retrieved from response header location |
-
-Pass the arguments to `get_request`:
-
-GetRequestStatus(path)
-
----
-
-## Contract Resources
-
-#### List Contract Resources
-
-Returns information about the resource limits for a particular contract and the current resource usage.
-
-```
-GetContractResources()
-```
-
----
-
-## Users Management
-
-These operations are designed to allow you to orchestrate users and resources via the Cloud API. Previously this functionality required use of the DCD (Data Center Designer) web application.
-
-#### List Groups
-
-This retrieves a full list of all groups.
-
-```
-ListGroups()
-```
-
-#### Retrieve a Group
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------- | -------- | ------ | ----------------------------------------- |
-| groupId | Yes | string | The ID of the specific group to retrieve. |
-
-```
-GetGroup(groupid)
-```
-
-#### Create a Group
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ----- | ----- | ------------------------------------------ | -------- |
-| group | Group | See [Group Object](#group-resource-object) | Yes |
-
-Build the `Group` resource object:
-
- var group = Group{
- Properties: GroupProperties{
- Name: "GO SDK Test",
- CreateDataCenter: &TRUE,
- CreateSnapshot: &TRUE,
- ReserveIp: &TRUE,
- AccessActivityLog: &TRUE,
- },
- }
-
-Pass the object to `CreateGroup`:
-
-```
-CreateGroup(group Group)
-```
-
-#### Group Resource Object
-
-| Name | Required | Type | Description |
-| -------------------- | :------: | ------ | --------------------------------------------------------- |
-| Name | **yes** | string | A name that was given to the group. |
-| CreateDataCenter | no | bool | The group has permission to create virtual data centers. |
-| CreateSnapshot | no | bool | The group has permission to create snapshots. |
-| ReserveIP | no | bool | The group has permission to reserve IP addresses. |
-| AccessActivityLog | no | bool | The group has permission to access the activity log. |
-| CreateBackupUnit | no | bool | The group has permission to create backup units. |
-| CreateInternetAccess | no | bool | The group has permission to create/grant internet access. |
-| CreateK8sCluster | no | bool | The group has permission to create k8s clusters. |
-| CreatePcc | no | bool | The group has permission to create PCC. |
-| S3Privilege | no | bool | The group has permission to create S3 Block Storage. |
-
-#### Update a Group
-
-Use this operation to update a group.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------- | ------------------------------------------ | ----------------------------------------- |
-| groupId | **yes** | string | The ID of the specific group to retrieve. |
-| group | Group | See [Group Object](#group-resource-object) | Yes |
-
-```
-UpdateGroup(groupId, group Group)
-```
-
----
-
-#### Delete a Group
-
-This will remove all objects within the data center and remove the data center object itself.
-Use this operation to delete a single group. Resources that are assigned to the group are NOT deleted, but are no longer accessible to the group members unless the member is a Contract Owner, Admin, or Resource Owner.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------- | ----------- | ----------------------------------------- |
-| groupId | **yes** | string | The ID of the specific group to retrieve. |
-
-```
-DeleteGroup(groupId)
-```
-
----
-
-#### List Shares
-
-Retrieves a full list of all the resources that are shared through this group and lists the permissions granted to the group members for each shared resource.
-
-```
-ListShares()
-```
-
-#### Retrieve a Share
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | -------- | ------ | -------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group to retrieve. |
-| resourceId | **yes** | string | The ID of the specific resource to retrieve. |
-
-```
-GetShare(groupid, resourceId)
-```
-
----
-
-#### Add a Share
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | -------- | ------ | --------------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group to add a resource too. |
-| resourceId | **yes** | string | The ID of the specific resource to add. |
-| share | **yes** | Share | See [Share Object](#share-resource-object) |
-
-Build the `Share` resource object:
-
- var share = Share{
- Properties: ShareProperties{
- SharePrivilege: true,
- EditPrivilege: true,
- },
- }
-
-Pass the object to `AddShare`:
-
-```
-AddShare(share Share, groupid, resourceId)
-```
-
-#### Share Resource Object
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ---- | ------------------------------------------------------------- |
-| EditPrivilege | no | bool | The group has permission to edit privileges on this resource. |
-| SharePrivilege | no | bool | The group has permission to share this resource. |
-
----
-
-#### Update a Share
-
-Use this to update the permissions that a group has for a specific resource share.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---------- | -------- | ------ | --------------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group to add a resource too. |
-| resourceId | **yes** | string | The ID of the specific resource to add. |
-| share | **yes** | Share | See [Share Object](#share-resource-object) |
-
-```
-UpdateShare(groupid, resourceId, obj)
-```
-
-#### Delete a Share
-
-This will remove all objects within the data center and remove the data center object itself.
-Use this operation to delete a single group. Resources that are assigned to the group are NOT deleted, but are no longer accessible to the group members unless the member is a Contract Owner, Admin, or Resource Owner.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---------- | ------- | ----------- | --------------------------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group containing the resource to delete. |
-| resourceId | **yes** | string | The ID of the specific resource to delete. |
-
-```
-DeleteShare(groupid, resourceId)
-```
-
----
-
-#### List Users in a Group
-
-Retrieves a full list of all the users that are members of a particular group.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------- | ----------- | --------------------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group to retrieve a user list for. |
-
-```
-ListGroupUsers(groupid)
-```
-
----
-
-#### Add User to Group
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------- | -------- | ------ | ------------------------------------------------------- |
-| groupid | **yes** | string | The ID of the specific group you want to add a user to. |
-| userid | **yes** | string | The ID of the specific user to add to the group. |
-
-```
-AddUserToGroup(groupid, userid)
-```
-
----
-
-#### Remove User from a Group
-
-Use this operation to remove a user from a group.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------- | ----------- | ------------------------------------------------------------ |
-| groupid | **yes** | string | The ID of the specific group you want to remove a user from. |
-| userid | **yes** | string | The ID of the specific user to remove from the group. |
-
-```
-DeleteUserFromGroup(groupid, userid)
-```
-
----
-
-#### List Users
-
-Retrieve a list of all the users that have been created under a contract.
-
-```
-ListUsers()
-```
-
----
-
-#### Retrieve a User
-
-Retrieve details about a specific user including what groups and resources the user is associated with.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------ | :------: | ------ | ---------------------------------------------------------- |
-| userid | **yes** | string | The ID of the specific user to retrieve information about. |
-
-```
-GetUser(userid)
-```
-
----
-
-#### Create a User
-
-Creates a new user under a particular contract.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ---- | :------: | ----------------------------- | --------------- |
-| user | **yes** | [User](#user-resource-object) | The user data. |
-
-Build the `User` resource object:
-
-```go
-user := User{
- Properties: &UserProperties{
- Firstname: "John",
- Lastname: "Doe",
- Email: "test@go.com",
- Password: "abc123-321CBA",
- Administrator: false,
- ForceSecAuth: false,
- SecAuthActive: false,
- },
-}
-```
-
-Pass the object to `CreateUser`:
-
-```go
-CreateUser(user)
-```
-
-#### User Resource Object
-
-| Name | Required | Type | Description |
-| ----------------- | :-----: | ------ | ------------------------------------------------------------------------- |
-| Firstname | **yes** | string | The first name of the user. |
-| Lastname | **yes** | string | The last name of the user. |
-| Email | **yes** | string | The e-mail address of the user. |
-| Password | **yes** | string | A password for the user. |
-| Administrator | no | bool | Indicates if the user has administrative rights. |
-| ForceSecAuth | no | bool | Indicates if secure (two-factor) authentication was enabled for the user. |
-| SecAuthActive | no | bool | Indicates if secure (two-factor) authentication is enabled for the user. |
-| Active | no | *bool | Indicates if the user is active (true) or disabled (false). |
-| S3CanonicalUserID | no | string | The user's S3 ID. |
----
-
-#### Update a User
-
-Update details about a specific user including its privileges.
-
-The following table describes the request arguments:
-
-| Name | Required | Type | Description |
-| ------ | :------: | ----------------------------- | -------------------------------------- |
-| userid | **yes** | string | The ID of the specific user to update. |
-| user | **yes** | [User](#user-resource-object) | The user data. |
-
-```go
-t := true
-user := User{
- Properties: &UserProperties{
- Firstname: "go sdk",
- Lastname: "newName",
- Email: "test@go.com",
- Administrator: false,
- ForceSecAuth: false,
- SecAuthActive: false,
- Active: &t,
- },
-}
-```
-
-Pass the object to `UpdateUser`:
-
-```go
-UpdateUser(userid, user)
-```
-
----
-
-#### Delete a User
-
-Blacklists the user, disabling them. The user is not completely purged, therefore if you anticipate needing to create a user with the same name in the future, we suggest renaming the user before you delete it.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------ | :-----: | ----------- | -------------------------------------- |
-| userid | **yes** | string | The ID of the specific user to delete. |
-
-```go
-DeleteUser(userid)
-```
-
----
-
-#### List Resources
-
-Retrieves a list of all resources and optionally their group associations.
-
-_Note_: This API call can take a significant amount of time to return when there are a large number of provisioned resources. You may wish to consult the next section on how to list resources of a particular type.
-
-```
-ListResources()
-```
-
----
-
-#### List All Resources of a Type
-
-Lists all shareable resources of a specific type. Optionally include their association with groups, permissions that a group has for the resource, and users that are members of the group. Because you are scoping your request to a specific resource type, this API will likely return faster than querying `/um/resources`.
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------- | ----------- | ------------------------------------------------------------- |
-| resourcetype | **Yes** | string | The specific type of resources to retrieve information about. |
-
-The values available for resourcetype are listed in this table:
-
-| Resource Type | Description |
-| ------------- | ------------------------------------------------------- |
-| datacenter | A virtual data center. |
-| image | A private image that has been uploaded to ProfitBricks. |
-| snapshot | A snapshot of a storage volume. |
-| ipblock | An IP block that has been reserved. |
-
-```
-ListResourcesByType(resourcetype)
-```
-
----
-
-#### List a specific Resource Type
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------- | ----------- | -------------------------------------------------------------- |
-| resourcetype | **Yes** | string | The specific type of resources to retrieve information about. |
-| resourceId | **Yes** | string | The ID of the specific resource to retrieve information about. |
-
-The values available for resourcetype are listed in this table:
-
-| Resource Type | Description |
-| ------------- | ------------------------------------------------------- |
-| datacenter | A virtual data center. |
-| image | A private image that has been uploaded to ProfitBricks. |
-| snapshot | A snapshot of a storage volume. |
-| ipblock | An IP block that has been reserved. |
-
-```
-GetResourceByType(resourcetype, resourceId)
-```
-
----
-
-## Managed Kubernetes
-
-##### KubernetesCluster Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ----------------------------------------------------------------------------- | ----------------------------------------- |
-| Properties | **yes** | \*[KubernetesClusterProperties](#KubernetesClusterProperties-resource-object) | The properties of the Kubernetes Cluster. |
-
-##### UpdatedKubernetesCluster Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ----------------------------------------------------------------------------- | ----------------------------------------- |
-| Properties | **yes** | \*[KubernetesClusterProperties](#KubernetesClusterProperties-resource-object) | The properties of the Kubernetes Cluster. |
-
-## AutoScaling Resource Object
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | -------------------------------------------------------------------------------------------------- |
-| MinNodeCount | **yes** | uint32 | The minimum number of nodes this node pool should scale down to. Should be less than MaxNodeCount |
-| MaxNodeCount | **yes** | uint32 | The maximum number of nodes this node pool should scale up to. Should be greater than MinNodeCount |
-
-## KubernetesNodePoolLAN Resource Object
-
-| Name | Required | Type | Description |
-| ---- | -------- | ------ | ---------------------------- |
-| ID | **yes** | uint32 | The ID of the LAN in the VDC |
-
-## MaintenanceWindow Resource Object
-
-| Name | Required | Type | Description |
-| ------------ | :------: | ------ | ----------------------------------------------------------------------------------------------------------- |
-| DayOfTheWeek | **yes** | string | The english name of the day of the week (One of: Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday). |
-| Time | **yes** | string | The time of the day in **HH:mm:ss** format |
-
-##### KubernetesClusterProperties Resource Object
-
-| Name | Required | Type | Description |
-| ----------------- | :------: | ------------------------------------------------------- | ------------------------------------------- |
-| Name | **yes** | string | The desired name for the Kubernetes Cluster |
-| K8sVersion | **no** | string | The desired Kubernetes Version |
-| MaintenanceWindow | **no** | [MaintenanceWindow](#MaintenanceWindow-resource-object) | The desired Maintenance Window |
-
-##### KubernetesNodePool Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ------------------------------------------------------------------------------- | ------------------------------------------- |
-| Properties | **yes** | \*[KubernetesNodePoolProperties](#KubernetesNodePoolProperties-resource-object) | The properties of the kubernetes node pool. |
-
-##### KubernetesNodePoolProperties Resource Object
-
-| Name | Required | Type | Description |
-| ----------------- | :------: | --------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
-| Name | **yes** | string | The desired name of the node pool - The name of each node in the pool will have this as prefix |
-| DatacenterID | **yes** | string | The desired datacenter location - see [Locations](#locations) |
-| NodeCount | **yes** | uint32 | The desired number of nodes in the cluster |
-| CPUFamily | **yes** | string | CPU Family for the nodes - see [Locations](#locations) |
-| CoresCount | **yes** | uint32 | Desired number of CPU cores per node |
-| AvailabilityZone | **yes** | string | Desired availability zone (one of AUTO, ZONE_1, ZONE_2) |
-| RAMSize | **yes** | uint32 | Desired amount of RAM per node in MB - Size must be specified in multiples of 256 MB with a minimum of 2048 MB |
-| StorageSize | **yes** | uint32 | Desired storage size, in MB |
-| StorageType | **yes** | string | The storage type for each node (one of HDD, SSD) |
-| K8sVersion | yes | string | The kubernetes version in which a nodepool is running |
-| AutoScaling | no | [\*AutoScaling](#AutoScaling-resource-object) | Whether this Node Pool should autoscale. Comprised of a minimum and a maximum number of nodes |
-| LANs | **no** | \*\[\][KubernetesNodePoolLAN](#KubernetesNodePoolLAN-Resource-Object) | A list of Local Area Networks the nodes in the pool should be a part of |
-| MaintenanceWindow | **no** | [MaintenanceWindow](#MaintenanceWindow-resource-object) | An optional object with 2 keys: dayOfTheWeek and time. |
-| PublicIPs | **no** | \*\[\]string | An optional array of strings with public IPs associated with the node pool. |
-
-### Create Cluster
-
-Creates a Kubernetes cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------------------------------------------------------------- | ------------------------------------- | -------- |
-| cluster | \*[KubernetesCluster](#KubernetesNodePoolLan-Resource-Object) | An Kubernetes cluster resource object | **yes** |
-
-```golang
-
-cluster := profitbricks.KubernetesCluster{
- Properties: &profitbricks.KubernetesClusterProperties{
- Name: "demo",
- },
-}
-
-createdCluster, err := client.CreateKubernetesCluster(cluster)
-
-if err != nil {
- fmt.Printf("Error while creating cluster: %+v\n", err)
-} else {
- fmt.Printf("Successfully created cluster: %+v\n", createdCluster)
-}
-
-```
-
-### Read Cluster
-
-Retrieves an existing Kubernetes cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ------ | ------------------------------------------ | -------- |
-| clusterID | string | The uuid of an existing Kubernetes cluster | **yes** |
-
-```golang
-
-cluster, err := client.GetKubernetesCluster("b924d955-4d2e-4e0d-806a-4350ac1ec92x")
-
-if err != nil {
- fmt.Printf("Error while reading the cluster: %+v\n", err)
-} else {
- fmt.Printf("Successfully read the cluster: %+v\n", cluster)
-}
-
-```
-
-### List Clusters
-
-Retrieves a list of all of the Kubernetes clusters the current user has access to
-
-```golang
-clusters, err := client.ListKubernetesClusters()
-
-if err != nil {
- fmt.Printf("Error while retrieving cluster list: %+v\n", err)
-} else {
- fmt.Printf("Successfully retrieved cluster list: %+v\n", clusters)
-}
-
-```
-
-### Update Cluster
-
-Updates an existing Kubernetes cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ----------------------------------------------------------------------- | ------------------------------------------------ | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster to be updated | **yes** |
-| cluster | \*[UpdatedKubernetesCluster](#UpdatedKubernetesCluster-resource-object) | An Kubernetes cluster resource object | **yes** |
-
-```golang
-
-cluster := profitbricks.UpdatedKubernetesCluster{
- Properties: &profitbricks.KubernetesClusterProperties{
- Name: "demo-renamed",
- },
-}
-
-updatedCluster, err := client.UpdateKubernetesCluster("b924d955-4d2e-4e0d-806a-4350ac1ec92x", cluster)
-
-if err != nil {
- fmt.Printf("Error while updating the cluster: %+v\n", err)
-} else {
- fmt.Printf("Successfully updated the cluster: %+v\n", updatedCluster)
-}
-
-```
-
-### Delete Cluster
-
-Deletes an existing Kubernetes cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ------ | ------------------------------------------------ | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster to be deleted | **yes** |
-
-```golang
-deleteClusterResponse, err := client.DeleteKubernetesCluster("b924d955-4d2e-4e0d-806a-4350ac1ec92x")
-
-if err != nil {
- fmt.Printf("Error deleting Kubernetes cluster: %+v\n", err)
-} else {
- fmt.Printf("Successfully deleted Kubernetes cluster: %+v\n", deleteClusterResponse)
-}
-```
-
-### Read Kubeconfig
-
-Retrieves the Kubeconfig (The kubectl configuration) as a string, for an existing cluster, so that it can be used remotely
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ------ | --------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the Kubernetes which you want the configuration for | **yes** |
-
-```golang
-kubeConfig, err := client.GetKubeconfig("b924d955-4d2e-4e0d-806a-4350ac1ec92x")
-
-if err != nil {
- fmt.Printf("Error retrieving kubeconfig: %+v\n", err)
-} else {
- fmt.Printf("Successfully retrieved kubeconfig: %+v\n", kubeConfig)
-}
-```
-
-### Create Node Pool
-
-Creates a Kubernetes node pool for an existing Kubernetes Cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ----------------------------------------------------------- | ---------------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster the node pool should be assigned to | **yes** |
-| nodePool | \*[KubernetesNodePool](#KubernetesNodePool-Resource-Object) | An Kubernetes node pool resource object | **yes** |
-
-```golang
-nodePool := profitbricks.KubernetesNodePool{
- Properties: &profitbricks.KubernetesNodePoolProperties{
- Name: "demo-nodepool",
- DatacenterID: existingDC,
- NodeCount: 3,
- CPUFamily: "INTEL_XEON",
- CoresCount: 4,
- AvailabilityZone: "AUTO",
- RAMSize: 16384,
- StorageSize: 300,
- StorageType: "SSD",
- },
-}
-
-createdNodePool, err := client.CreateKubernetesNodePool("b924d955-4d2e-4e0d-806a-4350ac1ec92x", nodePool)
-
-if err != nil {
- fmt.Printf("Error creating Kubernetes node pool: %+v\n", err)
-} else {
- fmt.Printf("Successfully created a Kubernetes node pool: %+v\n", createdNodePool)
-}
-```
-
-### Read Node Pool
-
-Retrieves an existing Kubernetes node pool
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---------- | ------ | -------------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster the existing node pool belongs to | **yes** |
-| nodePoolID | string | The UUID of the Kubernetes node pool to be retrieved | **yes** |
-
-```golang
-kubernetesNodePool, err := client.GetKubernetesNodePool("b924d955-4d2e-4e0d-806a-4350ac1ec92x", "d0ed6161-1e56-4db3-a094-08dddba2bc51")
-
-if err != nil {
- fmt.Printf("Error reading Kubernetes node pool: %+v\n", err)
-} else {
- fmt.Printf("Successfully read a Kubernetes node pool: %+v\n", kubernetesNodePool)
-}
-```
-
-### List Node Pools
-
-Retrieves all existing Kubernetes node pools found in an existing Kubernetes Cluster
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| --------- | ------ | ----------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster to retrieve the node pools for | **yes** |
-
-```golang
-kubernetesNodePools, err := client.GetKubernetesNodePools("b924d955-4d2e-4e0d-806a-4350ac1ec92x")
-
-if err != nil {
- fmt.Printf("Error retrieving Kubernetes node pools for cluster: %+v\n", err)
-} else {
- fmt.Printf("Successfully retrieved Kubernetes node pools for cluster: %+v\n", kubernetesNodePools)
-}
-```
-
-### Update Node Pool
-
-Updates an existing Kubernetes Node Pool
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---------- | ----------------------------------------------------------- | ----------------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the existingKubernetes cluster the node pool is assigned to | **yes** |
-| nodePoolID | string | The UUID of the Kubernetes node pool to be updated | **yes** |
-| nodePool | \*[KubernetesNodePool](#KubernetesNodePool-Resource-Object) | An Kubernetes node pool resource object | **yes** |
-
-_Note:_ Please Note that currently, the only property that can be updated for a Kubernetes node pool is the **NodeCount**
-
-```golang
-nodePoolUpdateRequest := profitbricks.KubernetesNodePool{
- Properties: &profitbricks.KubernetesNodePoolProperties{
- NodeCount: 3,
- },
-}
-
-updatedNodePool, err := client.UpdateKubernetesNodePool("b924d955-4d2e-4e0d-806a-4350ac1ec92x", "d0ed6161-1e56-4db3-a094-08dddba2bc51", nodePoolUpdateRequest)
-
-if err != nil {
- fmt.Printf("Error updating Kubernetes node pool: %+v\n", err)
-} else {
- fmt.Printf("Successfully updated Kubernetes node pool: %+v\n", updatedNodePool)
-}
-```
-
-### Delete Node Pool
-
-Deletes an existing Kubernetes node pool
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---------- | ------ | -------------------------------------------------------------------- | -------- |
-| clusterID | string | The UUID of the Kubernetes cluster the existing node pool belongs to | **yes** |
-| nodePoolID | string | The UUID of the Kubernetes node pool to be deleted | **yes** |
-
-```golang
-deleteNodePoolResponse, err := client.DeleteKubernetesNodePool("b924d955-4d2e-4e0d-806a-4350ac1ec92x", "d0ed6161-1e56-4db3-a094-08dddba2bc51")
-
-if err != nil {
- fmt.Printf("Error deleting Kubernetes node pool: %+v\n", err)
-} else {
- fmt.Printf("Successfully deleted Kubernetes node pool: %+v\n", deleteNodePoolResponse)
-}
-```
-
----
-
-## Backup Units
-
-##### BackupUnit Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | --------------------------------------------------------------- | --------------------------------- |
-| Properties | **yes** | \*[BackupUnitProperties](#BackupUnitProperties-resource-object) | The properties of the backup unit |
-
-##### BackupUnitProperties Resource Object
-
-| Name | Required | Type | Description |
-| -------- | :------: | ------ | ---------------------------------------------------------- |
-| Name | **yes** | string | Alphanumeric name you want assigned to the backup unit |
-| Email | **yes** | string | Alphanumeric password you want assigned to the backup unit |
-| Passowrd | **yes** | string | The e-mail address you want assigned to the backup unit |
-
-### Create Backup Unit
-
-Creates a new Backup Unit
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---------- | ------------------------------------------- | ----------------------------------------------- | -------- |
-| backupUnit | \*[BackupUnit](#BackupUnit-resource-object) | a BackupUnit object with the desired properties | **yes** |
-
-```golang
-backupUnit := profitbricks.BackupUnit{
- Properties: &profitbricks.BackupUnitProperties{
- Name: "demobackup",
- Email: "demo@demo.com",
- Password: "verystrongpassword",
- },
- }
-
-createdBackupUnit, err := client.CreateBackupUnit(backupUnit)
-
-if err != nil {
- fmt.Printf("Error creating backup unit: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully created backup unit: \n%+v\n", createdBackupUnit)
-}
-```
-
-### Read Backup Unit
-
-Retrieves an existing backup unit
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------ | ------------------------------------------------ | -------- |
-| backupUnitID | string | The UUID of the backup unit you want to retrieve | **yes** |
-
-```golang
-backupUnit, err := client.GetBackupUnit("6e7cd5e2-d2ad-4ebc-ab35-985ded43ee3x")
-
-if err != nil {
- fmt.Printf("Error reading backup unit: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully read backup unit: \n%+v\n", backupUnit)
-}
-```
-
-### List Backup Units
-
-Retrieves a list of all existing backup units associated with the current user account
-
-```golang
-backupUnits, err := client.ListBackupUnits()
-
-if err != nil {
- fmt.Printf("Error listing backup units: \n%+v\n", err)
-} else {
- fmt.Printf("Existing backup units: \n%+v\n", backupUnits)
-}
-```
-
-### Update Backup Unit
-
-Updates the email / password associated with an existing backup unit
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------------------------------------------- | ---------------------------------------------- | -------- |
-| backupUnitID | string | The UUID of the backup unit you want to update | **yes** |
-| BackupUnit | \*[BackupUnit](#BackupUnit-resource-object) | The updated BackupUnit object | **yes** |
-
-```golang
-backupUnit := profitbricks.BackupUnit{
- Properties: &profitbricks.BackupUnitProperties{
- Name: "demobackup",
- Email: "updateddemo@demo.com",
- Password: "verystrongUPDATEDpassword",
- },
- }
-
-updatedBackupUnit, err := client.UpdateBackupUnit("6e7cd5e2-d2ad-4ebc-ab35-985ded43ee3x", backupUnit)
-
-if err != nil {
- fmt.Printf("Error updating backup unit: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully updated backup unit: \n%+v\n", updatedBackupUnit)
-}
-```
-
-### Delete Backup Unit
-
-Deletes an existing backup unit
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------ | ---------------------------------------------- | -------- |
-| backupUnitID | string | The UUID of the backup unit you want to delete | **yes** |
-
-```golang
-backupUnitDeletionResult, err := client.DeleteBackupUnit("6e7cd5e2-d2ad-4ebc-ab35-985ded43ee3x")
-
-if err != nil {
- fmt.Printf("Error deleting backup unit: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully deleted backup unit: \n%+v\n", backupUnitDeletionResult)
-}
-```
-
-### Get Backup Unit SSO URL
-
-Retrieves the SSO URL for an existing backup unit
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------------ | ------ | ---------------------------------------------------------------------- | -------- |
-| backupUnitID | string | The UUID of the backup unit for which you want to retrieve the SSO URL | **yes** |
-
-```golang
-backupUnitSSOURL, err := client.DeleteBackupUnit("6e7cd5e2-d2ad-4ebc-ab35-985ded43ee3x")
-
-if err != nil {
- fmt.Printf("Error retrieving backup unit SSO URL: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully retrieved the backup unit's SSO URL: \n%+v\n", backupUnitDeletionResult)
-}
-```
-
----
-
-## User S3 Keys
-
-##### S3Key Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | ----------------------------------------------------- | ---------------------------- |
-| Properties | **yes** | \*[S3KeyProperties](#S3KeyProperties-resource-object) | The properties of the S3 key |
-
-##### S3KeyProperties Resource Object
-
-| Name | Required | Type | Description |
-| ------ | :------: | ------ | --------------------------------------------- |
-| S3Key | **no** | string | The S3 secret key |
-| Active | **yes** | bool | Indicates whether the S3 key is active or not |
-
-### Create S3 Key
-
-Creates a new S3 Key
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------ | ------ | -------------------------------------------------- | -------- |
-| userID | string | The UUID of the user the key should be assigned to | **yes** |
-
-```golang
-
-createdS3Key, err := client.CreateS3Key("d4246339-9c0f-41fb-a96d-1c640ae4501x")
-
-if err != nil {
- fmt.Printf("Error creating S3 Key: \n%+v", err)
-} else {
- fmt.Printf("Successfully created S3 Key: \n%+v", createdS3Key)
-}
-
-```
-
-### Read S3 Key
-
-Retrieves an existing S3 Key from the API
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------ | --------------------------------------- | -------- |
-| userID | string | The UUID of the user the key belongs to | **yes** |
-| s3KeyID | string | The UUID of the existing S3 key | **yes** |
-
-```golang
-s3Key, err := client.GetS3Key("d4246339-9c0f-41fb-a96d-1c640ae4501x", "00ddbdff682631d4c0f8")
-
-if err != nil {
- fmt.Printf("Error retrieving S3 Key: \n%+v", err)
-} else {
- fmt.Printf("Existing S3 Key: \n%+v", s3Key)
-}
-```
-
-### List S3 Keys
-
-Retrieves the existing S3 Keys for an user
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------ | ------ | -------------------------------------------- | -------- |
-| userID | string | The UUID of the user to list the S3 keys for | **yes** |
-
-```golang
-
-s3Keys, err := client.ListS3Keys("d4246339-9c0f-41fb-a96d-1c640ae4501x")
-
-if err != nil {
- fmt.Printf("Error retrieving S3 Keys: \n%+v", err)
-} else {
- fmt.Printf("Successfully retrieved S3 Keys: \n%+v", s3Keys)
-}
-
-```
-
-### Update S3 Key
-
-Updates the state of an existing S3 Key
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | --------------------------------- | ------------------------------------------ | -------- |
-| userID | string | The UUID of the user the S3 key belongs to | **yes** |
-| s3KeyID | string | The UUID of the existing S3 key | **yes** |
-| s3Key | \*[S3Key](#S3Key-resource-object) | The updated S3 Key Object | **yes** |
-
-```golang
-
-s3Key := profitbricks.S3Key{
- Properties: &profitbricks.S3KeyProperties{
- Active: false,
- },
-}
-
-updatedS3Key, err := client.UpdateS3Key("d4246339-9c0f-41fb-a96d-1c640ae4501x", "00ddbdff682631d4c0f8", s3Key)
-
-if err != nil {
- fmt.Printf("Error updating S3 Key: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully updated S3 Key: \n%+v\n", updatedS3Key)
-}
-
-```
-
-### Delete S3 Key
-
-Deletes an existing S3 Key
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ------- | ------ | ------------------------------------------ | -------- |
-| userID | string | The UUID of the user the S3 key belongs to | **yes** |
-| s3KeyID | string | The UUID of the existing S3 key | **yes** |
-
-```golang
-
-deletedS3KeyResponse, err := client.DeleteS3Key("d4246339-9c0f-41fb-a96d-1c640ae4501a", "00ddbdff682631d4c0f8")
-
-if err != nil {
- fmt.Printf("Error deleting S3 Key: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully deleted S3 Key: \n%+v\n", deletedS3KeyResponse)
-}
-
-```
-
----
-
-## Private Cross Connects
-
-**NOTE:** Please note that currently, only VDC's created in the same physical location can be cross-connected
-
-##### PrivateCrossConnect Resource Object
-
-| Name | Required | Type | Description |
-| ---------- | :------: | --------------------------------------------------------------------------------- | --------------------------------------- |
-| Properties | **yes** | \*[PrivateCrossConnectProperties](#PrivateCrossConnectProperties-resource-object) | The properties of private cross connect |
-
-##### PrivateCrossConnectProperties Resource Object
-
-| Name | Required | Type | Description |
-| ---------------------- | :------: | ------------------------------------------------------------------------- | ----------------------------------------------------------------- |
-| Name | **yes** | string | A humanly readable name for the private cross-connect |
-| Description | **no** | string | A short description for the private cross-connect |
-| Peers | **no** | \*[][pccpeer](#PCCPeer-resource-object) | A read-only property containing all the currentl peers of the PCC |
-| ConnectableDatacenters | **no** | \*[][pccconnectabledatacenter](#PCCConnectableDataCenter-resource-object) | A read-only property containing all the connectable VDC's |
-
-##### PCCPeer Resource Object
-
-| Name | Required | Type | Description |
-| -------------- | :------: | ------ | ---------------------------------------------------------------------------------------------------- |
-| LANId | **no** | string | The id of the cross-connected LAN |
-| LANName | **no** | string | The name of the cross-connected LAN |
-| DataCenterID | **no** | string | The id of the cross-connected datacenter |
-| DataCenterName | **no** | string | THe name of the cross-connected datacenter |
-| Location | **no** | string | The physical location of the cross-connected datacenter (Please see [Locations](#locations) section) |
-
-##### PCCConnectableDataCenter Resource Object
-
-| Name | Required | Type | Description |
-| -------- | :------: | ------ | ------------------------------------------------------------------------------------------------ |
-| ID | **no** | string | The UUID of the connectable datacenter |
-| Name | **no** | string | The name of the connectable datacenter |
-| Location | **no** | string | The physical location of the connectable datacenter (Please see [Locations](#locations) section) |
-
-### Create Private Cross Connect
-
-Creates a new, empty private cross-connect
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ---- | ------------------------------------------------------------- | ---------------------------------------------- | -------- |
-| pcc | \*[PrivateCrossConnect](#PrivateCrossConnect-resource-object) | The desired name for the private cross-connect | **yes** |
-
-```golang
-
-pcc := profitbricks.PrivateCrossConnect{
- Properties: &profitbricks.PrivateCrossConnectProperties{
- Name: "demo",
- Description: "description for demo",
- },
-}
-
-createdPCC, err := client.CreatePrivateCrossConnect(pcc)
-
-if err != nil {
- fmt.Printf("Error creating private cross-connect: \n%+v", err)
-} else {
- fmt.Printf("Successfully created private cross-connect: \n%+v", createdPCC)
-}
-
-```
-
-### Read Private Cross Connect
-
-Retrieves an existing private cross-connect from the API
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ----- | ------ | --------------------------------- | -------- |
-| pccID | string | The UUID of private cross-connect | **yes** |
-
-```golang
-pccID := "d4246339-9c0f-41fb-a96d-1c640ae4501x"
-
-pcc, err := client.GetPrivateCrossConnect(pccID)
-
-if err != nil {
- fmt.Printf("Error retrieving private cross-connect: \n%+v", err)
-} else {
- fmt.Printf("Existing private cross-connect: \n%+v", pcc)
-}
-```
-
-### List Private Cross Connects
-
-Retrieves the existing private cross-connects
-
-```golang
-
-pccs, err := client.ListPrivateCrossConnects()
-
-if err != nil {
- fmt.Printf("Error retrieving private cross-connects: \n%+v", err)
-} else {
- fmt.Printf("Successfully retrieved private cross-connects: \n%+v", pccs)
-}
-
-```
-
-### Update Private Cross Connect
-
-Updates the state of an existing Private cross-connect
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ----- | ------------------------------------------------------------- | -------------------------------------------------------- | -------- |
-| pccID | string | The UUID of the private cross-connect you wish to update | **yes** |
-| pcc | \*[PrivateCrossConnect](#PrivateCrossConnect-resource-object) | The desired name for the private cross-connect | **yes** |
-
-```golang
-
-pccID := "d4246339-9c0f-41fb-a96d-1c640ae4501x"
-
-pcc := profitbricks.PrivateCrossConnect{
- Properties: &profitbricks.PrivateCrossConnectProperties{
- Name: "demo-renamed",
- Description: "updated description for demo-renamed",
- },
-}
-
-updatedPCC, err := client.UpdatePrivateCrossConnect(pccID, pcc)
-
-if err != nil {
- fmt.Printf("Error updating private cross-connect: \n%+v", err)
-} else {
- fmt.Printf("Successfully updated private cross-connect: \n%+v", updatedPCC)
-}
-
-```
-
-### Delete Private Cross Connect
-
-Deletes an existing private cross-connect
-
-The following table describes the request arguments:
-
-| Name | Type | Description | Required |
-| ----- | ------ | -------------------------------------------------------- | -------- |
-| pccID | string | The UUID of the private cross-connect you wish to delete | **yes** |
-
-```golang
-
-pccID := "d4246339-9c0f-41fb-a96d-1c640ae4501x"
-
-deletedPCCResponse, err := client.DeletePrivateCrossConnect(pccID)
-
-if err != nil {
- fmt.Printf("Error deleting private cross-connect: \n%+v\n", err)
-} else {
- fmt.Printf("Successfully deleted private cross-connect: \n%+v\n", deletedPCCResponse)
-}
-
-```
-
-## Example
-
-```go
-package main
-
-import (
- "fmt"
- "os"
-
- "github.com/profitbricks/profitbricks-sdk-go/v5"
-)
-
-func main() {
-
- //Sets username and password
- client := profitbricks.NewClient(
- os.Getenv("PROFITBRICKS_USERNAME"),
- os.Getenv("PROFITBRICKS_PASSWORD"),
- )
-
- dcrequest := profitbricks.Datacenter{
- Properties: profitbricks.DatacenterProperties{
- Name: "Example",
- Description: "description",
- Location: "us/las",
- },
- }
-
- datacenter, err := client.CreateDatacenter(dcrequest)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- serverrequest := profitbricks.Server{
- Properties: profitbricks.ServerProperties{
- Name: "go01",
- RAM: 1024,
- Cores: 2,
- },
- }
-
- server, err := client.CreateServer(datacenter.ID, serverrequest)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- err = client.WaitTillProvisioned(server.Headers.Get("Location"))
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- volumerequest := profitbricks.Volume{
- Properties: profitbricks.VolumeProperties{
- Size: 1,
- Name: "Volume Test",
- LicenceType: "LINUX",
- Type: "HDD",
- },
- }
-
- volume, err := client.CreateVolume(datacenter.ID, volumerequest)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- err = client.WaitTillProvisioned(volume.Headers.Get("Location"))
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- serverupdaterequest := profitbricks.ServerProperties{
- Name: "go01renamed",
- Cores: 1,
- RAM: 256,
- }
-
- server, err = client.UpdateServer(datacenter.ID, server.ID, serverupdaterequest)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- err = client.WaitTillProvisioned(server.Headers.Get("Location"))
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- volume, err = client.AttachVolume(datacenter.ID, server.ID, volume.ID)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- err = client.WaitTillProvisioned(volume.Headers.Get("Location"))
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- volumes, err := client.ListVolumes(datacenter.ID)
- fmt.Println(volumes.Items)
- servers, err := client.ListServers(datacenter.ID)
- fmt.Println(servers.Items)
- datacenters, err := client.ListDatacenters()
- fmt.Println(datacenters.Items)
-
- resp, err := client.DeleteServer(datacenter.ID, server.ID)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- err = client.WaitTillProvisioned(resp.Get("Location"))
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-
- _, err = client.DeleteDatacenter(datacenter.ID)
- if err != nil {
- fmt.Println(err)
- os.Exit(0)
- }
-}
-```
-
-## Support
-
-Please report any issues via [GitHub's issue tracker](https://github.com/profitbricks/profitbricks-sdk-go/issues).
-
-## Testing
-
-You can run all test by using the command `go test -timeout=120m` or run a single test by specifying the name of the test file `go test servers_test.go`
-
-## Contributing
-
-1. Fork it ( https://github.com/profitbricks/profitbricks-sdk-go/fork )
-2. Create your feature branch (`git checkout -b my-new-feature`)
-3. Commit your changes (`git commit -am 'Add some feature'`)
-4. Push to the branch (`git push origin my-new-feature`)
-5. Create a new Pull Request
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/backupunit.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/backupunit.go
deleted file mode 100644
index 3de46524d..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/backupunit.go
+++ /dev/null
@@ -1,99 +0,0 @@
-package profitbricks
-
-import "net/http"
-
-// BackupUnits type
-type BackupUnits struct {
- // Enum: [backupunits]
- // Read Only: true
- ID string `json:"id,omitempty"`
- // Enum: [collection]
- // Read Only: true
- Type string `json:"type,omitempty"`
- // Format: uri
- Href string `json:"href"`
- // Read Only: true
- Items []BackupUnit `json:"items"`
-}
-
-// BackupUnit Object
-type BackupUnit struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // The type of object. In this case backupunit
- // Read Only: true
- Type string `json:"type,omitempty"`
-
- // The metadata for the backup unit
- // Read Only: true
- Metadata *Metadata `json:"metadata,omitempty"`
-
- Properties *BackupUnitProperties `json:"properties,omitempty"`
-}
-
-// BackupUnitProperties object
-type BackupUnitProperties struct {
- // Required: on create
- // Read only: yes
- Name string `json:"name,omitempty"`
- // Required: yes
- Password string `json:"password,omitempty"`
- // Required: yes
- Email string `json:"email,omitempty"`
-}
-
-// BackupUnitSSOURL object
-type BackupUnitSSOURL struct {
-
- // The type of object. In this case backupunit
- // Read Only: true
- Type string `json:"type,omitempty"`
- // SSO URL
-
- // Read Only: true
- SSOUrl string `json:"ssoURL,omitempty"`
-}
-
-//
-
-// CreateBackupUnit creates a Backup Unit
-func (c *Client) CreateBackupUnit(backupUnit BackupUnit) (*BackupUnit, error) {
- rsp := &BackupUnit{}
- return rsp, c.PostAcc(backupUnitsPath(), backupUnit, rsp)
-}
-
-// ListBackupUnits lists all available backup units
-func (c *Client) ListBackupUnits() (*BackupUnits, error) {
- rsp := &BackupUnits{}
- return rsp, c.GetOK(backupUnitsPath(), rsp)
-}
-
-// UpdateBackupUnit updates an existing backup unit
-func (c *Client) UpdateBackupUnit(backupUnitID string, backupUnit BackupUnit) (*BackupUnit, error) {
- rsp := &BackupUnit{}
- return rsp, c.PutAcc(backupUnitPath(backupUnitID), backupUnit, rsp)
-}
-
-// DeleteBackupUnit deletes an existing backup unit
-func (c *Client) DeleteBackupUnit(backupUnitID string) (*http.Header, error) {
- return c.DeleteAcc(backupUnitPath(backupUnitID))
-}
-
-// GetBackupUnit retrieves an existing backup unit
-func (c *Client) GetBackupUnit(backupUnitID string) (*BackupUnit, error) {
- rsp := &BackupUnit{}
- return rsp, c.GetOK(backupUnitPath(backupUnitID), rsp)
-}
-
-// GetBackupUnitSSOURL retrieves the SSO URL for an existing backup unit
-func (c *Client) GetBackupUnitSSOURL(backupUnitID string) (*BackupUnitSSOURL, error) {
- rsp := &BackupUnitSSOURL{}
- return rsp, c.GetOK(backupUnitSSOURLPath(backupUnitID), rsp)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/client.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/client.go
deleted file mode 100644
index be2817d75..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/client.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package profitbricks
-
-import (
- "fmt"
- "net/http"
- "reflect"
-
- resty "github.com/go-resty/resty/v2"
-)
-
-func (c *Client) Do(url, method string, body, result interface{}, expectedStatus int) error {
- req := c.R()
- if body != nil {
- req.SetBody(body)
- }
- if result != nil {
- req.SetResult(result)
- }
- return c.DoWithRequest(req, method, url, expectedStatus)
-}
-
-func (c *Client) DoWithRequest(request *resty.Request, method, url string, expectedStatus int) error {
- rsp, err := request.SetError(ApiError{}).Execute(method, url)
- if err != nil {
- return NewClientError(HttpClientError, fmt.Sprintf("[%s] %s: Client error %s", method, url, err))
- }
- if result := rsp.Result(); result != nil {
- if val := reflect.ValueOf(result).Elem().FieldByName("Headers"); val.IsValid() {
- h := rsp.Header()
- val.Set(reflect.ValueOf(&h))
- }
- }
- return validateResponse(rsp, expectedStatus)
-}
-
-func (c *Client) GetOK(url string, result interface{}) error {
- return c.Do(url, resty.MethodGet, nil, result, http.StatusOK)
-}
-
-func (c *Client) Get(url string, result interface{}, expectedStatus int) error {
- return c.Do(url, resty.MethodGet, nil, result, expectedStatus)
-}
-
-func (c *Client) Post(
- url string, body interface{}, result interface{}, expectedStatus int) error {
- return c.Do(url, resty.MethodPost, body, result, expectedStatus)
-}
-
-func (c *Client) PostAcc(url string, body, result interface{}) error {
- return c.Do(url, resty.MethodPost, body, result, http.StatusAccepted)
-}
-
-func (c *Client) PatchAcc(url string, body, result interface{}) error {
- return c.Do(url, resty.MethodPatch, body, result, http.StatusAccepted)
-}
-
-func (c *Client) Patch(url string, body, result interface{}, expectedStatus int) error {
- return c.Do(url, resty.MethodPatch, body, result, expectedStatus)
-}
-
-func (c *Client) PutAcc(url string, body, result interface{}) error {
- return c.Do(url, resty.MethodPut, body, result, http.StatusAccepted)
-}
-
-func (c *Client) Put(url string, body, result interface{}, expectedStatus int) error {
- return c.Do(url, resty.MethodPut, body, result, expectedStatus)
-}
-
-func (c *Client) DeleteAcc(url string) (*http.Header, error) {
- h := &http.Header{}
- return h, c.Delete(url, h, http.StatusAccepted)
-}
-
-func (c *Client) Delete(url string, responseHeader *http.Header, expectedStatus int) error {
- rsp, err := c.R().SetError(ApiError{}).Delete(url)
- if err != nil {
- return NewClientError(HttpClientError, fmt.Sprintf("[DELETE] %s: Client error: %s", url, err))
- }
- if responseHeader != nil {
- *responseHeader = rsp.Header()
- }
- return validateResponse(rsp, expectedStatus)
-}
-
-func validateResponse(rsp *resty.Response, expectedStatus ...int) error {
- for _, exp := range expectedStatus {
- if rsp.StatusCode() == exp {
- return nil
- }
- }
- if rsp.StatusCode() >= 400 {
- e := rsp.Error().(*ApiError)
- e.RawBody = rsp.Body()
- // if content type was not json, the api error is empty
- if e.HTTPStatus == 0 {
- e.HTTPStatus = rsp.StatusCode()
- }
- return *e
-
- }
- return NewClientError(UnexpectedResponse, fmt.Sprintf("[%s] %s: Unexpected status %s",
- rsp.Request.Method, rsp.Request.URL, rsp.Status()))
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/contractresources.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/contractresources.go
deleted file mode 100644
index e39d7ecd7..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/contractresources.go
+++ /dev/null
@@ -1,52 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-//ContractResources object
-type ContractResources struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Properties ContractResourcesProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ContractResourcesProperties object
-type ContractResourcesProperties struct {
- PBContractNumber int64 `json:"contractNumber,omitempty"`
- Owner string `json:"owner,omitempty"`
- Status string `json:"status,omitempty"`
- ResourceLimits *ResourcesLimits `json:"resourceLimits,omitempty"`
-}
-
-//ResourcesLimits object
-type ResourcesLimits struct {
- CoresPerServer int32 `json:"coresPerServer,omitempty"`
- CoresPerContract int32 `json:"coresPerContract,omitempty"`
- CoresProvisioned int32 `json:"coresProvisioned,omitempty"`
- RAMPerServer int32 `json:"ramPerServer,omitempty"`
- RAMPerContract int32 `json:"ramPerContract,omitempty"`
- RAMProvisioned int32 `json:"ramProvisioned,omitempty"`
- HddLimitPerVolume int64 `json:"hddLimitPerVolume,omitempty"`
- HddLimitPerContract int64 `json:"hddLimitPerContract,omitempty"`
- HddVolumeProvisioned int64 `json:"hddVolumeProvisioned,omitempty"`
- SsdLimitPerVolume int64 `json:"ssdLimitPerVolume,omitempty"`
- SsdLimitPerContract int64 `json:"ssdLimitPerContract,omitempty"`
- SsdVolumeProvisioned int64 `json:"ssdVolumeProvisioned,omitempty"`
- ReservableIps int32 `json:"reservableIps,omitempty"`
- ReservedIpsOnContract int32 `json:"reservedIpsOnContract,omitempty"`
- ReservedIpsInUse int32 `json:"reservedIpsInUse,omitempty"`
-}
-
-// GetContractResources returns list of contract resources
-func (c *Client) GetContractResources() (*ContractResources, error) {
- url := contractsPath()
- ret := &ContractResources{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/datacenter.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/datacenter.go
deleted file mode 100644
index 0f70bb4ee..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/datacenter.go
+++ /dev/null
@@ -1,156 +0,0 @@
-package profitbricks
-
-import (
- "context"
- "net/http"
-)
-
-const (
- // Resource state is unknown
- StateUnknown = "UNKNOWN"
- // Resource is being provisioned
- StateBusy = "BUSY"
- // Resource is ready to be used
- StateAvailable = "AVAILABLE"
- // Resource has been de-provisioned
- StateInactive = "INACTIVE"
-)
-
-// Datacenter represents Virtual Data Center
-type Datacenter struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties DatacenterProperties `json:"properties,omitempty"`
- Entities DatacenterEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
-}
-
-// Metadata represents metadata recieved from Cloud API
-type Metadata struct {
- CreatedDate string `json:"createdDate,omitempty"`
- CreatedBy string `json:"createdBy,omitempty"`
- CreatedByUserID string `json:"createdByUserId,omitempty"`
- Etag string `json:"etag,omitempty"`
- LastModifiedDate string `json:"lastModifiedDate,omitempty"`
- LastModifiedBy string `json:"lastModifiedBy,omitempty"`
- LastModifiedByUserID string `json:"lastModifiedByUserId,omitempty"`
- State string `json:"state,omitempty"`
-}
-
-// DatacenterProperties represents Virtual Data Center properties
-type DatacenterProperties struct {
- Name string `json:"name,omitempty"`
- Description string `json:"description,omitempty"`
- Location string `json:"location,omitempty"`
- Version int32 `json:"version,omitempty"`
-}
-
-// DatacenterEntities represents Virtual Data Center entities
-type DatacenterEntities struct {
- Servers *Servers `json:"servers,omitempty"`
- Volumes *Volumes `json:"volumes,omitempty"`
- Loadbalancers *Loadbalancers `json:"loadbalancers,omitempty"`
- Lans *Lans `json:"lans,omitempty"`
-}
-
-// Datacenters is a list of Virtual Data Centers
-type Datacenters struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Datacenter `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
-}
-
-// ListDatacenters lists all data centers
-func (c *Client) ListDatacenters() (*Datacenters, error) {
- url := datacentersPath()
- ret := &Datacenters{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// CreateDatacenter creates a data center
-func (c *Client) CreateDatacenter(dc Datacenter) (*Datacenter, error) {
- url := datacentersPath()
- ret := &Datacenter{}
- err := c.Post(url, dc, ret, http.StatusAccepted)
- return ret, err
-}
-
-// CreateDatacenterAndWait creates a data center, waits for the request to finish and returns a refreshed
-// result.
-// Note that an error does not necessarily means that the resource has not been created.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) CreateDatacenterAndWait(ctx context.Context, dc Datacenter) (res *Datacenter, err error) {
- res, err = c.CreateDatacenter(dc)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
- return
- }
- var rdc *Datacenter
- rdc, err = c.GetDatacenter(res.ID)
- if err != nil {
- return
- }
- return rdc, nil
-}
-
-// GetDatacenter gets a datacenter
-func (c *Client) GetDatacenter(dcid string) (*Datacenter, error) {
- url := datacenterPath(dcid)
- ret := &Datacenter{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// UpdateDataCenter updates a data center
-func (c *Client) UpdateDataCenter(dcid string, obj DatacenterProperties) (*Datacenter, error) {
- url := datacenterPath(dcid)
- ret := &Datacenter{}
- err := c.Patch(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateDatacenter updates a data center, waits for the request to finish and returns a refreshed result.
-// Note that an error does not necessarily means that the resource has not been updated.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) UpdateDatacenterAndWait(ctx context.Context, dcid string, obj DatacenterProperties) (res *Datacenter, err error) {
- res, err = c.UpdateDataCenter(dcid, obj)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
- return
- }
- var rdc *Datacenter
- if rdc, err = c.GetDatacenter(res.ID); err != nil {
- return
- } else {
- return rdc, nil
- }
-}
-
-// DeleteDatacenter deletes a data center
-func (c *Client) DeleteDatacenter(dcid string) (*http.Header, error) {
- url := datacenterPath(dcid)
- ret := &http.Header{}
- return ret, c.Delete(url, ret, http.StatusAccepted)
-}
-
-// DeleteDatacenterAndWait deletes given datacenter and waits for the request to finish
-func (c *Client) DeleteDatacenterAndWait(ctx context.Context, dcid string) error {
- rsp, err := c.DeleteDatacenter(dcid)
- if err != nil {
- return err
- }
- return c.WaitTillProvisionedOrCanceled(ctx, rsp.Get("location"))
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/error.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/error.go
deleted file mode 100644
index 18a33fb5f..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/error.go
+++ /dev/null
@@ -1,158 +0,0 @@
-/* This file contains helpers to check whether given error
-is specific http status code or not.
-
-*/
-package profitbricks
-
-import (
- "errors"
- "fmt"
- "net/http"
-)
-
-const (
- SnapshotInUseErrorCode = "200"
-)
-
-type ClientErrorType int
-
-const (
- RequestFailed ClientErrorType = iota
- UnexpectedResponse
- HttpClientError
- InvalidInput
-)
-
-type ClientError struct {
- errType ClientErrorType
- msg string
-}
-
-func (c ClientError) Error() string {
- return c.msg
-}
-
-func NewClientError(errType ClientErrorType, msg string) ClientError {
- return ClientError{
- errType: errType,
- msg: msg,
- }
-}
-
-func IsClientErrorType(err error, errType ClientErrorType) bool {
- var clientErr ClientError
- if errors.As(err, &clientErr) {
- return clientErr.errType == errType
- }
- return false
-}
-
-func IsHttpStatus(err error, status int) bool {
- var apiErr ApiError
- if errors.As(err, &apiErr) {
- return apiErr.HttpStatusCode() == status
- }
- return false
-}
-
-// IsStatusOK - (200)
-func IsStatusOK(err error) bool {
- return IsHttpStatus(err, http.StatusOK)
-}
-
-// IsStatusAccepted - (202) Used for asynchronous requests using PUT, DELETE, POST and PATCH methods.
-// The response will also include a Location header pointing to a resource. This can be used for polling.
-func IsStatusAccepted(err error) bool {
- return IsHttpStatus(err, http.StatusAccepted)
-}
-
-// IsStatusNotModified - (304) Response for GETs on resources that have not been changed. (based on ETag values).
-func IsStatusNotModified(err error) bool {
- return IsHttpStatus(err, http.StatusNotModified)
-}
-
-// IsStatusBadRequest - (400) Response to malformed requests or general client errors.
-func IsStatusBadRequest(err error) bool {
- return IsHttpStatus(err, http.StatusBadRequest)
-}
-
-// IsStatusUnauthorized - (401) Response to an unauthenticated connection.
-// You will need to use your API username and password to be authenticated.
-func IsStatusUnauthorized(err error) bool {
- return IsHttpStatus(err, http.StatusUnauthorized)
-}
-
-// IsStatusForbidden - (403) Forbidden
-func IsStatusForbidden(err error) bool {
- return IsHttpStatus(err, http.StatusForbidden)
-}
-
-// IsStatusNotFound - (404) if resource does not exist
-func IsStatusNotFound(err error) bool {
- return IsHttpStatus(err, http.StatusNotFound)
-}
-
-// IsStatusMethodNotAllowed - (405) Use for any POST, PUT, PATCH, or DELETE performed
-// on read-only resources. This is also the response to PATCH requests
-// on resources that do not support partial updates.
-func IsStatusMethodNotAllowed(err error) bool {
- return IsHttpStatus(err, http.StatusMethodNotAllowed)
-}
-
-// IsStatusUnsupportedMediaType - (415) The content-type is incorrect for the payload.
-func IsStatusUnsupportedMediaType(err error) bool {
- return IsHttpStatus(err, http.StatusUnsupportedMediaType)
-}
-
-// IsStatusUnprocessableEntity - (422) Validation errors.
-func IsStatusUnprocessableEntity(err error) bool {
- return IsHttpStatus(err, http.StatusUnprocessableEntity)
-}
-
-// IsStatusTooManyRequests - (429) The number of requests exceeds the rate limit.
-func IsStatusTooManyRequests(err error) bool {
- return IsHttpStatus(err, http.StatusTooManyRequests)
-}
-
-// IsRequestFailed - returns true if the error reason was that the request status was failed
-func IsRequestFailed(err error) bool {
- return IsClientErrorType(err, RequestFailed)
-}
-
-type ApiError struct {
- HTTPStatus int `json:"httpStatus"`
- Messages []struct {
- ErrorCode string `json:"errorCode"`
- Message string `json:"message"`
- } `json:"messages"`
- RawBody []byte
-}
-
-func (e ApiError) Error() string {
- return e.String()
-}
-
-func (e ApiError) String() string {
- toReturn := fmt.Sprintf("HTTP Status: %d\nError Messages:", e.HTTPStatus)
- for _, m := range e.Messages {
- toReturn = toReturn + fmt.Sprintf("Error Code: %s Message: %s\n", m.ErrorCode, m.Message)
- }
- return toReturn
-}
-
-func (e ApiError) HttpStatusCode() int {
- return e.HTTPStatus
-}
-
-func (e ApiError) Body() []byte {
- return e.RawBody
-}
-
-func (e ApiError) HasErrorCode(code string) bool {
- for _, m := range e.Messages {
- if m.ErrorCode == code {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/firewallrule.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/firewallrule.go
deleted file mode 100644
index 0dd4dde6d..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/firewallrule.go
+++ /dev/null
@@ -1,82 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-//FirewallRule object
-type FirewallRule struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties FirewallruleProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//FirewallruleProperties object
-type FirewallruleProperties struct {
- Name string `json:"name"`
- Protocol string `json:"protocol,omitempty"`
- SourceMac *string `json:"sourceMac"`
- SourceIP *string `json:"sourceIp"`
- TargetIP *string `json:"targetIp"`
- IcmpCode *int `json:"icmpCode"`
- IcmpType *int `json:"icmpType"`
- PortRangeStart *int `json:"portRangeStart"`
- PortRangeEnd *int `json:"portRangeEnd"`
-}
-
-//FirewallRules object
-type FirewallRules struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []FirewallRule `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ListFirewallRules lists all firewall rules
-func (c *Client) ListFirewallRules(dcID string, serverID string, nicID string) (*FirewallRules, error) {
- url := firewallRulesPath(dcID, serverID, nicID)
- ret := &FirewallRules{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//GetFirewallRule gets a firewall rule
-func (c *Client) GetFirewallRule(dcID string, serverID string, nicID string, fwID string) (*FirewallRule, error) {
- url := firewallRulePath(dcID, serverID, nicID, fwID)
- ret := &FirewallRule{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//CreateFirewallRule creates a firewall rule
-func (c *Client) CreateFirewallRule(dcID string, serverID string, nicID string, fw FirewallRule) (*FirewallRule, error) {
- url := firewallRulesPath(dcID, serverID, nicID)
- ret := &FirewallRule{}
- err := c.Post(url, fw, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateFirewallRule updates a firewall rule.
-// You need to pass all wanted properties, not just those you want to change.
-func (c *Client) UpdateFirewallRule(dcID string, serverID string, nicID string, fwID string, obj FirewallruleProperties) (*FirewallRule, error) {
- url := firewallRulePath(dcID, serverID, nicID, fwID)
- ret := &FirewallRule{}
- err := c.Patch(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-//DeleteFirewallRule deletes a firewall rule
-func (c *Client) DeleteFirewallRule(dcID string, serverID string, nicID string, fwID string) (*http.Header, error) {
- url := firewallRulePath(dcID, serverID, nicID, fwID)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.mod b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.mod
deleted file mode 100644
index 39597bb91..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.mod
+++ /dev/null
@@ -1,13 +0,0 @@
-module github.com/profitbricks/profitbricks-sdk-go/v5
-
-require (
- github.com/go-resty/resty/v2 v2.3.0
- github.com/jarcoal/httpmock v1.0.5
- github.com/kr/text v0.2.0 // indirect
- github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
- github.com/stretchr/testify v1.6.1
- gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
- gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect
-)
-
-go 1.13
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.sum b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.sum
deleted file mode 100644
index 978e9cf48..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/go.sum
+++ /dev/null
@@ -1,32 +0,0 @@
-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So=
-github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU=
-github.com/jarcoal/httpmock v1.0.5 h1:cHtVEcTxRSX4J0je7mWPfc9BpDpqzXSJ5HbymZmyHck=
-github.com/jarcoal/httpmock v1.0.5/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
-github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY=
-golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
-gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
-gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/image.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/image.go
deleted file mode 100644
index 64100781b..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/image.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-//Image object
-type Image struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties ImageProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ImageProperties object
-type ImageProperties struct {
- Name string `json:"name,omitempty"`
- Description string `json:"description,omitempty"`
- Location string `json:"location,omitempty"`
- Size float64 `json:"size,omitempty"`
- CPUHotPlug bool `json:"cpuHotPlug,omitempty"`
- CPUHotUnplug bool `json:"cpuHotUnplug,omitempty"`
- RAMHotPlug bool `json:"ramHotPlug,omitempty"`
- RAMHotUnplug bool `json:"ramHotUnplug,omitempty"`
- NicHotPlug bool `json:"nicHotPlug,omitempty"`
- NicHotUnplug bool `json:"nicHotUnplug,omitempty"`
- DiscVirtioHotPlug bool `json:"discVirtioHotPlug,omitempty"`
- DiscVirtioHotUnplug bool `json:"discVirtioHotUnplug,omitempty"`
- DiscScsiHotPlug bool `json:"discScsiHotPlug,omitempty"`
- DiscScsiHotUnplug bool `json:"discScsiHotUnplug,omitempty"`
- LicenceType string `json:"licenceType,omitempty"`
- ImageType string `json:"imageType,omitempty"`
- ImageAliases []string `json:"imageAliases,omitempty"`
- Public bool `json:"public,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//Images object
-type Images struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Image `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//Cdroms object
-type Cdroms struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Image `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ListImages returns an Collection struct
-func (c *Client) ListImages() (*Images, error) {
- url := imagesPath()
- ret := &Images{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// GetImage returns an Instance struct where id ==imageid
-func (c *Client) GetImage(imageid string) (*Image, error) {
- url := imagePath(imageid)
- ret := &Image{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/ipblock.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/ipblock.go
deleted file mode 100644
index a2f865997..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/ipblock.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-//IPBlock object
-type IPBlock struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties IPBlockProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//IPBlockProperties object
-type IPBlockProperties struct {
- Name string `json:"name,omitempty"`
- IPs []string `json:"ips,omitempty"`
- IPConsumers []IPConsumer `json:"ipConsumers,omitempty"`
- Location string `json:"location,omitempty"`
- Size int `json:"size,omitempty"`
-}
-
-type IPConsumer struct {
- IP string `json:"ip,omitempty"`
- Mac string `json:"mac,omitempty"`
- NicID string `json:"nicId,omitempty"`
- ServerID string `json:"serverId,omitempty"`
- ServerName string `json:"serverName,omitempty"`
- DatacenterID string `json:"datacenterId,omitempty"`
- DatacenterName string `json:"datacenterName,omitempty"`
-}
-
-//IPBlocks object
-type IPBlocks struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []IPBlock `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ListIPBlocks lists all IP blocks
-func (c *Client) ListIPBlocks() (*IPBlocks, error) {
- url := ipblocksPath()
- ret := &IPBlocks{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//ReserveIPBlock creates an IP block
-func (c *Client) ReserveIPBlock(request IPBlock) (*IPBlock, error) {
- url := ipblocksPath()
- ret := &IPBlock{}
- err := c.Post(url, request, ret, http.StatusAccepted)
- return ret, err
-}
-
-//GetIPBlock gets an IP blocks
-func (c *Client) GetIPBlock(ipblockid string) (*IPBlock, error) {
- url := ipblockPath(ipblockid)
- ret := &IPBlock{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// UpdateIPBlock partial update of ipblock properties
-func (c *Client) UpdateIPBlock(ipblockid string, props IPBlockProperties) (*IPBlock, error) {
- url := ipblockPath(ipblockid)
- ret := &IPBlock{}
- err := c.Patch(url, props, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ReleaseIPBlock deletes an IP block
-func (c *Client) ReleaseIPBlock(ipblockid string) (*http.Header, error) {
- url := ipblockPath(ipblockid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/k8s.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/k8s.go
deleted file mode 100644
index f2ace102e..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/k8s.go
+++ /dev/null
@@ -1,472 +0,0 @@
-package profitbricks
-
-import (
- "fmt"
- "net/http"
- "time"
-)
-
-const (
- // Kubernetes cluster/nodepool resource state is deploying
- K8sStateDeploying = "DEPLOYING"
- // Kubernetes cluster/nodepool resource state is active
- K8sStateActive = "ACTIVE"
- // Kubernetes cluster/nodepool resource state is failed
- K8sStateFailed = "FAILED"
- // Kubernetes cluster/nodepool resource state is updating
- K8sStateUpdating = "UPDATING"
- // Kubernetes cluster/nodepool resource state is failed_updating
- K8sStateFailedUpdating = "FAILED_UPDATING"
- // Kubernetes cluster/nodepool resource state is destroying
- K8sStateDestroying = "DESTROYING"
- // Kubernetes cluster/nodepool resource state is failed_destroying
- K8sStateFailedDestroying = "FAILED_DESTROYING"
- // Kubernetes cluster/nodepool resource state is terminated
- K8sStateTerminated = "TERMINATED"
-)
-
-const (
- // Kubernetes Node resource state is ready
- K8sNodeStateReady = "READY"
- // Kubernetes Node resource state is provisioning
- K8sNodeStateProvisioning = "PROVISIONING"
- // Kubernetes Node resource state is provisioned
- K8sNodeStateProvisioned = "PROVISIONED"
- // Kubernetes Node resource state is terminating
- K8sNodeStateTerminating = "TERMINATING"
- // Kubernetes Node resource state is rebuilding
- K8sNodeStateRebuilding = "REBUILDING"
-)
-
-type KubernetesClusters struct {
- // URL to the collection representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // Unique representation for Kubernetes Cluster as a collection on a resource.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // Slice of items in that collection
- // Read Only: true
- Items []KubernetesCluster `json:"items"`
-
- // The type of resource within a collection
- // Read Only: true
- // Enum: [collection]
- PBType string `json:"type,omitempty"`
-}
-
-type KubernetesCluster struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // metadata
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // properties
- // Required: true
- Properties *KubernetesClusterProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [k8s]
- PBType string `json:"type,omitempty"`
-
- // Entities of a cluster
- Entities KubernetesClusterEntities `json:"entities,omitempty"`
-}
-
-type UpdatedKubernetesCluster struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // metadata
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // properties
- // Required: true
- Properties *KubernetesClusterProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [k8s]
- PBType string `json:"type,omitempty"`
-
- // Entities of a cluster
- Entities KubernetesClusterEntities `json:"-"`
-}
-
-type KubernetesClusterEntities struct {
- // NodePools of a cluster
- NodePools *KubernetesNodePools `json:"nodepools,omitempty"`
-}
-
-type AutoScaling struct {
- // The minimum number of nodes this node pool can be scaled down to
- // Required: true
- MinNodeCount uint32 `json:"minNodeCount,omitempty"`
- // The maximum number of nodes this node pool can be scaled up to
- // Required: true
- MaxNodeCount uint32 `json:"maxNodeCount,omitempty"`
-}
-
-type KubernetesNodePoolLAN struct {
- // The ID of the lan the Kubernetes Node Pool should be part of
- // Required: true
- ID uint32 `json:"id"`
-}
-
-type MaintenanceWindow struct {
- // The english name of the day of the week
- // Required: false
- DayOfTheWeek string `json:"dayOfTheWeek,omitempty"`
- // A string of the following format: 08:00:00
- // Required: false
- Time string `json:"time,omitempty"`
-}
-
-type KubernetesClusterProperties struct {
- // A Kubernetes Cluster Name. Valid Kubernetes Cluster name must be 63 characters or less and must not be empty
- // and begin and end with an alphanumeric character ([a-z0-9]) with dashes (-), dots (.) and alphanumerics
- // between.
- // Required: true
- Name string `json:"name"`
- // The desired Kubernetes Version
- // Please consult the API documentation for supported versions
- // Required: false
- K8sVersion string `json:"k8sVersion,omitempty"`
- // The desired Maintanance Window
- // Required: false
- MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
-}
-
-type KubernetesConfig struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // properties
- // Required: true
- Properties KubernetesConfigProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [kubeconfig]
- PBType string `json:"type,omitempty"`
-}
-
-type KubernetesConfigProperties struct {
- // A Kubernetes Config file data
- KubeConfig string `json:"kubeconfig,omitempty"`
-}
-
-type KubernetesNodePool struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // metadata
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // properties
- // Required: true
- Properties *KubernetesNodePoolProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [nodepool]
- PBType string `json:"type,omitempty"`
-}
-
-type KubernetesNodePoolProperties struct {
- // The availability zone in which the servers should exist
- // Required: true
- // Enum: [AUTO ZONE_1 ZONE_2]
- AvailabilityZone string `json:"availabilityZone,omitempty"`
-
- // Number of cores for node
- // Required: true
- CoresCount uint32 `json:"coresCount,omitempty"`
-
- // A valid cpu family name
- // Required: true
- CPUFamily string `json:"cpuFamily,omitempty"`
-
- // The unique identifier of the data center where the worker nodes of the node pool will be provisioned.
- // Required: true
- DatacenterID string `json:"datacenterId,omitempty"`
-
- // A Kubernetes Node Pool Name. Valid Kubernetes Node Pool name must be 63 characters or less and must not be
- // empty or begin and end with an alphanumeric character ([a-z0-9]) with dashes (-), dots (.) and alphanumerics
- // between.
- // Required: true
- Name string `json:"name,omitempty"`
-
- // Number of nodes part of the Node Pool
- // Required: true
- NodeCount uint32 `json:"nodeCount,omitempty"`
-
- // RAM size for node, minimum size 2048MB is recommended
- // Required: true
- RAMSize uint32 `json:"ramSize,omitempty"`
-
- // The size of the volume in GB. The size should be greater than 10GB.
- // Required: true
- StorageSize uint32 `json:"storageSize,omitempty"`
-
- // Hardware type of the volume
- // Required: true
- // Enum: [HDD SSD]
- StorageType string `json:"storageType,omitempty"`
-
- // The kubernetes version in which a nodepool is running.
- // Required: true
- K8sVersion string `json:"k8sVersion,omitempty"`
-
- // Whether this cluster should autoscale. This is comprised of a minimum and maximum number of nodes
- // Required: false
- AutoScaling *AutoScaling `json:"autoScaling,omitempty"`
-
- // The LANs the nodes in this pool should be part of
- // Required: true
- LANs *[]KubernetesNodePoolLAN `json:"lans,omitempty"`
-
- // The desired Maintanance Window
- // Required: false
- MaintenanceWindow *MaintenanceWindow `json:"maintenanceWindow,omitempty"`
-
- // Public Ips
- // Required: false
- PublicIPs *[]string `json:"publicIps,omitempty"`
-}
-
-type KubernetesNodePools struct {
- // URL to the collection representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // Unique representation for Kubernetes Nodes as a collection on a resource.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // Slice of items in that collection
- // Read Only: true
- Items []KubernetesNodePool `json:"items"`
-
- // The type of resource within a collection
- // Read Only: true
- // Enum: [nodepool]
- Type string `json:"type,omitempty"`
-}
-
-type KubernetesNodes struct {
- // URL to the collection representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // Unique representation for Kubernetes Node Pool as a collection on a resource.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // Slice of items in that collection
- // Read Only: true
- Items []KubernetesNode `json:"items"`
-
- // The type of resource within a collection
- // Read Only: true
- // Enum: [nodepool]
- Type string `json:"type,omitempty"`
-}
-
-type KubernetesNode struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // metadata
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // The properties of the node
- Properties *KubernetesNodeProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [nodepool]
- PBType string `json:"type,omitempty"`
-}
-
-type KubernetesNodeProperties struct {
- // The generated unique name of the node.
- // Read Only: true
- Name string `json:"name,omitempty"`
-
- // The assigned public IP of the node.
- // Read Only: true
- PublicIP string `json:"publicIP,omitempty"`
-
- // The k8s version that the node has.
- // Read Only: false
- K8sVersion string `json:"k8sVersion,omitempty"`
-}
-
-// ListKubernetesClusters gets a list of all clusters
-func (c *Client) ListKubernetesClusters() (*KubernetesClusters, error) {
- rsp := &KubernetesClusters{}
- return rsp, c.GetOK(kubernetesClustersPath(), rsp)
-}
-
-// GetKubernetesCluster gets cluster with given id
-func (c *Client) GetKubernetesCluster(clusterID string) (*KubernetesCluster, error) {
- rsp := &KubernetesCluster{}
- return rsp, c.GetOK(kubernetesClusterPath(clusterID), rsp)
-}
-
-// CreateKubernetesCluster creates a cluster
-func (c *Client) CreateKubernetesCluster(cluster KubernetesCluster) (*KubernetesCluster, error) {
- rsp := &KubernetesCluster{}
- return rsp, c.PostAcc(kubernetesClustersPath(), cluster, rsp)
-}
-
-// DeleteKubernetesCluster deletes cluster
-func (c *Client) DeleteKubernetesCluster(clusterID string) (*http.Header, error) {
- h := &http.Header{}
- return h, c.Delete(kubernetesClusterPath(clusterID), h, http.StatusAccepted)
-}
-
-// UpdateKubernetesCluster updates cluster
-func (c *Client) UpdateKubernetesCluster(clusterID string, cluster UpdatedKubernetesCluster) (*KubernetesCluster, error) {
- rsp := &KubernetesCluster{}
- return rsp, c.Put(kubernetesClusterPath(clusterID), cluster, rsp, http.StatusOK)
-}
-
-// GetKubeconfig returns the kubeconfig of cluster
-func (c *Client) GetKubeconfig(clusterID string) (string, error) {
- rsp := &KubernetesConfig{}
- if err := c.GetOK(kubeConfigPath(clusterID), rsp); err != nil {
- return "", err
- }
- return rsp.Properties.KubeConfig, nil
-}
-
-// ListKubernetesNodePools gets a list of all node pools of a cluster
-func (c *Client) ListKubernetesNodePools(clusterID string) (*KubernetesNodePools, error) {
- rsp := &KubernetesNodePools{}
- return rsp, c.GetOK(kubernetesNodePoolsPath(clusterID), rsp)
-}
-
-// CreateKubernetesNodePool creates a new node pool for cluster
-func (c *Client) CreateKubernetesNodePool(clusterID string, nodePool KubernetesNodePool) (*KubernetesNodePool, error) {
- rsp := &KubernetesNodePool{}
- return rsp, c.PostAcc(kubernetesNodePoolsPath(clusterID), nodePool, rsp)
-}
-
-// DeleteKubernetesNodePool deletes node pool from cluster
-func (c *Client) DeleteKubernetesNodePool(clusterID, nodePoolID string) (*http.Header, error) {
- return c.DeleteAcc(kubernetesNodePoolPath(clusterID, nodePoolID))
-}
-
-// GetKubernetesNodePool gets node pool of the cluster
-func (c *Client) GetKubernetesNodePool(clusterID, nodePoolID string) (*KubernetesNodePool, error) {
- rsp := &KubernetesNodePool{}
- return rsp, c.GetOK(kubernetesNodePoolPath(clusterID, nodePoolID), rsp)
-}
-
-// Update KubernetesNodePool updates node pool
-func (c *Client) UpdateKubernetesNodePool(clusterID, nodePoolID string, nodePool KubernetesNodePool) (*KubernetesNodePool, error) {
- rsp := &KubernetesNodePool{}
- return rsp, c.PutAcc(kubernetesNodePoolPath(clusterID, nodePoolID), nodePool, rsp)
-}
-
-// ListKubernetesNodes gets a list of all nodes of a node pool
-func (c *Client) ListKubernetesNodes(clusterID, nodePoolID string) (*KubernetesNodes, error) {
- rsp := &KubernetesNodes{}
- return rsp, c.GetOK(kubernetesNodesPath(clusterID, nodePoolID), rsp)
-}
-
-// GetKubernetesNode gets node of a node pool
-func (c *Client) GetKubernetesNode(clusterID, nodePoolID, nodeID string) (*KubernetesNode, error) {
- rsp := &KubernetesNode{}
- return rsp, c.GetOK(kubernetesNodePath(clusterID, nodePoolID, nodeID), rsp)
-}
-
-// DeleteKubernetesNode deletes a node from a node pool, decreasing its size by 1.
-func (c *Client) DeleteKubernetesNode(clusterID, nodePoolID, nodeID string) (*http.Header, error) {
- return c.DeleteAcc(kubernetesNodePath(clusterID, nodePoolID, nodeID))
-}
-
-// ReplaceKubernetesNode replaces a node of a node pool.
-func (c *Client) ReplaceKubernetesNode(clusterID, nodePoolID, nodeID string) (*http.Header, error) {
- url := kubernetesNodeReplacePath(clusterID, nodePoolID, nodeID)
- rsp, err := c.R().SetError(ApiError{}).Post(url)
- if err != nil {
- return nil, NewClientError(HttpClientError, fmt.Sprintf("[POST] %s: Client error: %s", url, err))
- }
- h := rsp.Header()
- return &h, validateResponse(rsp, http.StatusAccepted)
-}
-
-// Enabled returns true when max > 0.
-func (a *AutoScaling) Enabled() bool {
- return a != nil && a.MaxNodeCount > 0
-}
-
-func (c *Client) WaitForKubernetesNodePoolState(
- clusterID, nodePoolID string,
- state string,
- timeout, interval time.Duration) error {
- if err := PollImmediate(interval, timeout, func() (bool, error) {
- np, err := c.GetKubernetesNodePool(clusterID, nodePoolID)
- if err != nil {
- return false, err
- }
- return np != nil && np.Metadata != nil && np.Metadata.State == state, err
- }); err != nil {
- return fmt.Errorf("error waiting for nodepool state %s: %w", state, err)
- }
- return nil
-}
-
-func (c *Client) WaitForKubernetesClusterState(
- clusterID string, state string, timeout, interval time.Duration) error {
- if err := PollImmediate(interval, timeout, func() (bool, error) {
- cl, err := c.GetKubernetesCluster(clusterID)
- if err != nil {
- return false, err
- }
- return cl != nil && cl.Metadata != nil && cl.Metadata.State == state, err
- }); err != nil {
- return fmt.Errorf("error waiting for cluster state %s: %w", state, err)
- }
- return nil
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/lan.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/lan.go
deleted file mode 100644
index 7e13dd82f..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/lan.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package profitbricks
-
-import (
- "context"
- "net/http"
-)
-
-// Lan object
-type Lan struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties LanProperties `json:"properties,omitempty"`
- Entities *LanEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// LanProperties object
-type LanProperties struct {
- Name string `json:"name,omitempty"`
- Public bool `json:"public,omitempty"`
- IPFailover *[]IPFailover `json:"ipFailover,omitempty"`
- PCC string `json:"pcc,omitempty"`
-}
-
-// LanEntities object
-type LanEntities struct {
- Nics *LanNics `json:"nics,omitempty"`
-}
-
-// IPFailover object
-type IPFailover struct {
- NicUUID string `json:"nicUuid,omitempty"`
- IP string `json:"ip,omitempty"`
-}
-
-// LanNics object
-type LanNics struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Nic `json:"items,omitempty"`
-}
-
-// Lans object
-type Lans struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Lan `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ListLans returns a Collection for lans in the Datacenter
-func (c *Client) ListLans(dcid string) (*Lans, error) {
- url := lansPath(dcid)
- ret := &Lans{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// CreateLan creates a lan in the datacenter
-// from a jason []byte and returns a Instance struct
-func (c *Client) CreateLan(dcid string, request Lan) (*Lan, error) {
- url := lansPath(dcid)
- ret := &Lan{}
- err := c.Post(url, request, ret, http.StatusAccepted)
- return ret, err
-}
-
-// CreateLanAndWait creates a lan, waits for the request to finish and returns a refreshed lan
-// Note that an error does not necessarily means that the resource has not been created.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) CreateLanAndWait(ctx context.Context, dcid string, request Lan) (res *Lan, err error) {
- res, err = c.CreateLan(dcid, request)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
- return
- }
- var lan *Lan
- if lan, err = c.GetLan(dcid, res.ID); err != nil {
- return
- } else {
- return lan, err
- }
-}
-
-// GetLan pulls data for the lan where id = lanid returns an Instance struct
-func (c *Client) GetLan(dcid, lanid string) (*Lan, error) {
- url := lanPath(dcid, lanid)
- ret := &Lan{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// UpdateLan does a partial update to a lan using json from []byte json returns a Instance struct
-func (c *Client) UpdateLan(dcid string, lanid string, obj LanProperties) (*Lan, error) {
- url := lanPath(dcid, lanid)
- ret := &Lan{}
- err := c.Patch(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateLanAndWait creates a lan, waits for the request to finish and returns a refreshed lan
-// Note that an error does not necessarily means that the resource has not been updated.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) UpdateLanAndWait(ctx context.Context, dcid, lanid string, props LanProperties) (res *Lan, err error) {
- res, err = c.UpdateLan(dcid, lanid, props)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
- return
- }
- var lan *Lan
- if lan, err = c.GetLan(dcid, res.ID); err != nil {
- return
- } else {
- return lan, err
- }
-}
-
-// DeleteLan deletes a lan where id == lanid
-func (c *Client) DeleteLan(dcid, lanid string) (*http.Header, error) {
- url := lanPath(dcid, lanid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-// DeleteLanAndWait deletes given lan and waits for the request to finish
-func (c *Client) DeleteLanAndWait(ctx context.Context, dcid, lanid string) error {
- rsp, err := c.DeleteLan(dcid, lanid)
- if err != nil {
- return err
- }
- return c.WaitTillProvisionedOrCanceled(ctx, rsp.Get("location"))
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/loadbalancer.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/loadbalancer.go
deleted file mode 100644
index 29ff0aa16..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/loadbalancer.go
+++ /dev/null
@@ -1,125 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-//Loadbalancer object
-type Loadbalancer struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties LoadbalancerProperties `json:"properties,omitempty"`
- Entities LoadbalancerEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//LoadbalancerProperties object
-type LoadbalancerProperties struct {
- Name string `json:"name,omitempty"`
- IP string `json:"ip,omitempty"`
- Dhcp bool `json:"dhcp,omitempty"`
-}
-
-//LoadbalancerEntities object
-type LoadbalancerEntities struct {
- Balancednics *BalancedNics `json:"balancednics,omitempty"`
-}
-
-//BalancedNics object
-type BalancedNics struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Nic `json:"items,omitempty"`
-}
-
-//Loadbalancers object
-type Loadbalancers struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Loadbalancer `json:"items,omitempty"`
-
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ListLoadbalancers returns a Collection struct for loadbalancers in the Datacenter
-func (c *Client) ListLoadbalancers(dcid string) (*Loadbalancers, error) {
-
- url := loadbalancersPath(dcid)
- ret := &Loadbalancers{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//CreateLoadbalancer creates a loadbalancer in the datacenter from a jason []byte and returns a Instance struct
-func (c *Client) CreateLoadbalancer(dcid string, request Loadbalancer) (*Loadbalancer, error) {
- url := loadbalancersPath(dcid)
- ret := &Loadbalancer{}
- err := c.Post(url, request, ret, http.StatusAccepted)
-
- return ret, err
-}
-
-//GetLoadbalancer pulls data for the Loadbalancer where id = lbalid returns a Instance struct
-func (c *Client) GetLoadbalancer(dcid, lbalid string) (*Loadbalancer, error) {
- url := loadbalancerPath(dcid, lbalid)
- ret := &Loadbalancer{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//UpdateLoadbalancer updates a load balancer
-func (c *Client) UpdateLoadbalancer(dcid string, lbalid string, obj LoadbalancerProperties) (*Loadbalancer, error) {
- url := loadbalancerPath(dcid, lbalid)
- ret := &Loadbalancer{}
- err := c.Patch(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-//DeleteLoadbalancer deletes a load balancer
-func (c *Client) DeleteLoadbalancer(dcid, lbalid string) (*http.Header, error) {
- url := loadbalancerPath(dcid, lbalid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ListBalancedNics lists balanced nics
-func (c *Client) ListBalancedNics(dcid, lbalid string) (*Nics, error) {
- url := balancedNicsPath(dcid, lbalid)
- ret := &Nics{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//AssociateNic attach a nic to load balancer
-func (c *Client) AssociateNic(dcid string, lbalid string, nicid string) (*Nic, error) {
- sm := map[string]string{"id": nicid}
- url := balancedNicsPath(dcid, lbalid)
- ret := &Nic{}
- err := c.Post(url, sm, ret, http.StatusAccepted)
- return ret, err
-}
-
-//GetBalancedNic gets a balanced nic
-func (c *Client) GetBalancedNic(dcid, lbalid, balnicid string) (*Nic, error) {
- url := balancedNicPath(dcid, lbalid, balnicid)
- ret := &Nic{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//DeleteBalancedNic removes a balanced nic
-func (c *Client) DeleteBalancedNic(dcid, lbalid, balnicid string) (*http.Header, error) {
- url := balancedNicPath(dcid, lbalid, balnicid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/location.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/location.go
deleted file mode 100644
index 153d53a3e..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/location.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
- "strings"
-)
-
-// Location object
-type Location struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata Metadata `json:"metadata,omitempty"`
- Properties LocationProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Locations object
-type Locations struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Location `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// LocationProperties object
-type LocationProperties struct {
- Name string `json:"name,omitempty"`
- Features []string `json:"features,omitempty"`
- ImageAliases []string `json:"imageAliases,omitempty"`
-}
-
-// ListLocations returns location collection data
-func (c *Client) ListLocations() (*Locations, error) {
- ret := &Locations{}
- return ret, c.GetOK(locationsPath(), ret)
-}
-
-// GetRegionalLocations returns a list of available locations in a specific region
-func (c *Client) GetRegionalLocations(regid string) (*Locations, error) {
- ret := &Locations{}
- return ret, c.GetOK(locationRegionPath(regid), ret)
-
-}
-
-// GetLocation returns location data
-func (c *Client) GetLocation(locid string) (*Location, error) {
- ret := &Location{}
- parts := strings.SplitN(locid, "/", 2)
- if len(parts) != 2 {
- return nil, NewClientError(InvalidInput, "Invalid location id")
- }
- return ret, c.GetOK(locationPath(parts[0], parts[1]), ret)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/model.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/model.go
deleted file mode 100644
index 304673a5b..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/model.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-This file will contain the data models. Until refactored only Headers will be here to be included everywhere else.
-*/
-
-package profitbricks
-
-import "net/http"
-
-type Header struct {
- Headers *http.Header
-}
-
-// GetHeader to be interfaceable
-func (h *Header) GetHeader() *http.Header {
- return h.Headers
-}
-
-// SetHeader to be interfaceable
-func (h *Header) SetHeader(header *http.Header) {
- h.Headers = header
-}
-
-// Get returns the actual value for given header key
-func (h *Header) Get(key string) string {
- return h.Headers.Get(key)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/nic.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/nic.go
deleted file mode 100644
index 7c51b1c26..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/nic.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-// Nic object
-type Nic struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties *NicProperties `json:"properties,omitempty"`
- Entities *NicEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// NicProperties object
-type NicProperties struct {
- Name string `json:"name,omitempty"`
- Mac string `json:"mac,omitempty"`
- Ips []string `json:"ips,omitempty"`
- Dhcp *bool `json:"dhcp,omitempty"`
- Lan int `json:"lan,omitempty"`
- FirewallActive *bool `json:"firewallActive,omitempty"`
- Nat *bool `json:"nat,omitempty"`
-}
-
-// NicEntities object
-type NicEntities struct {
- FirewallRules *FirewallRules `json:"firewallrules,omitempty"`
-}
-
-// Nics object
-type Nics struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Nic `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ListNics returns a Nics struct collection
-func (c *Client) ListNics(dcid, srvid string) (*Nics, error) {
- url := nicsPath(dcid, srvid)
- ret := &Nics{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// CreateNic creates a nic on a server
-func (c *Client) CreateNic(dcid string, srvid string, nic Nic) (*Nic, error) {
-
- url := nicsPath(dcid, srvid)
- ret := &Nic{}
- err := c.Post(url, nic, ret, http.StatusAccepted)
-
- return ret, err
-}
-
-// GetNic pulls data for the nic where id = srvid returns a Instance struct
-func (c *Client) GetNic(dcid, srvid, nicid string) (*Nic, error) {
-
- url := nicPath(dcid, srvid, nicid)
- ret := &Nic{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// UpdateNic partial update of nic properties
-func (c *Client) UpdateNic(dcid string, srvid string, nicid string, obj NicProperties) (*Nic, error) {
-
- url := nicPath(dcid, srvid, nicid)
- ret := &Nic{}
- err := c.Patch(url, obj, ret, http.StatusAccepted)
- return ret, err
-
-}
-
-// DeleteNic deletes the nic where id=nicid and returns a Resp struct
-func (c *Client) DeleteNic(dcid, srvid, nicid string) (*http.Header, error) {
- url := nicPath(dcid, srvid, nicid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/paths.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/paths.go
deleted file mode 100644
index 9a8c88357..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/paths.go
+++ /dev/null
@@ -1,358 +0,0 @@
-package profitbricks
-
-import (
- "fmt"
- "net/url"
- "path"
-)
-
-func safeJoin(str ...string) string {
- for _, s := range str {
- if s == "" {
- panic(fmt.Sprintf("path contains empty element: %v", str))
- }
- }
- return path.Join(str...)
-}
-
-// datacentersPath: "datacenters"
-func datacentersPath() string {
- return "datacenters"
-}
-
-// datacenterPath: "datacenters/"
-func datacenterPath(datacenterID string) string {
- return safeJoin(datacentersPath(), url.QueryEscape(datacenterID))
-}
-
-// imagesPath: "images"
-func imagesPath() string {
- return "images"
-}
-
-// imagePath: "images/"
-func imagePath(imageID string) string {
- return safeJoin(imagesPath(), url.QueryEscape(imageID))
-}
-
-// ipblocksPath: "ipblocks"
-func ipblocksPath() string {
- return "ipblocks"
-}
-
-// ipblockPath: "ipblocks/"
-func ipblockPath(ipblockID string) string {
- return safeJoin(ipblocksPath(), url.QueryEscape(ipblockID))
-}
-
-// locationsPath: "locations"
-func locationsPath() string {
- return "locations"
-}
-
-// locationRegionPath: "locations/"
-func locationRegionPath(regionID string) string {
- return safeJoin(locationsPath(), url.QueryEscape(regionID))
-}
-
-// locationPath: "locations//"
-func locationPath(regionID, locationID string) string {
- return safeJoin(locationRegionPath(regionID), url.QueryEscape(locationID))
-}
-
-// snapshotsPath: "snapshots"
-func snapshotsPath() string {
- return "snapshots"
-}
-
-// snapshotPath: "snapshots/"
-func snapshotPath(snapshotID string) string {
- return safeJoin(snapshotsPath(), url.QueryEscape(snapshotID))
-}
-
-// lansPath: "datacenters//lans"
-func lansPath(datacenterID string) string {
- return safeJoin(datacenterPath(datacenterID), "lans")
-}
-
-// lanPath: "datacenters//lans/"
-func lanPath(datacenterID, lanID string) string {
- return safeJoin(lansPath(datacenterID), url.QueryEscape(lanID))
-}
-
-// loadbalancersPath: "datacenters//loadbalancers"
-func loadbalancersPath(datacenterID string) string {
- return safeJoin(datacenterPath(datacenterID), "loadbalancers")
-}
-
-// loadbalancerPath: "datacenters//loadbalancers/"
-func loadbalancerPath(datacenterID, loadbalancerID string) string {
- return safeJoin(loadbalancersPath(datacenterID), url.QueryEscape(loadbalancerID))
-}
-
-// serversPath: "datacenters//servers"
-func serversPath(datacenterID string) string {
- return safeJoin(datacenterPath(datacenterID), "servers")
-}
-
-// serverPath: "datacenters//servers/"
-func serverPath(datacenterID, serverID string) string {
- return safeJoin(serversPath(datacenterID), url.QueryEscape(serverID))
-}
-
-// serverStartPath: "datacenters//servers//start"
-func serverStartPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "start")
-}
-
-// serverStopPath: "datacenters//servers//stop"
-func serverStopPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "stop")
-}
-
-// serverRebootPath: "datacenters//servers//reboot"
-func serverRebootPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "reboot")
-}
-
-// volumesPath: "datacenters//volumes"
-func volumesPath(datacenterID string) string {
- return safeJoin(datacenterPath(datacenterID), "volumes")
-}
-
-// volume_path "datacenters//volumes/"
-func volumePath(datacenterID, volumeID string) string {
- return safeJoin(volumesPath(datacenterID), url.QueryEscape(volumeID))
-}
-
-// createSnapshotPath: "datacenters//volumes//create-snapshot"
-func createSnapshotPath(datacenterID, volumeID string) string {
- return safeJoin(volumePath(datacenterID, volumeID), "create-snapshot")
-}
-
-// restoreSnapshotPath: "datacenters//volumes//restore-snapshot"
-func restoreSnapshotPath(datacenterID, volumeID string) string {
- return safeJoin(volumePath(datacenterID, volumeID), "restore-snapshot")
-}
-
-// balancedNicsPath: "datacenters//loadbalancers//balancednics"
-func balancedNicsPath(datacenterID, loadbalancerID string) string {
- return safeJoin(loadbalancerPath(datacenterID, loadbalancerID), "balancednics")
-}
-
-// balancedNicPath: "datacenters//loadbalancers//balancednics/"
-func balancedNicPath(datacenterID, loadbalancerID, balancedNicID string) string {
- return safeJoin(balancedNicsPath(datacenterID, loadbalancerID), url.QueryEscape(balancedNicID))
-}
-
-// cdromsPath: "datacenters//servers//cdroms"
-func cdromsPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "cdroms")
-}
-
-// cdromPath: "datacenters//servers//cdroms/"
-func cdromPath(datacenterID, serverID, cdID string) string {
- return safeJoin(cdromsPath(datacenterID, serverID), url.QueryEscape(cdID))
-}
-
-// attachedVolumesPath: "datacenters//servers//volumes"
-func attachedVolumesPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "volumes")
-}
-
-// attachedVolumePath: "datacenters//servers//volumes/"
-func attachedVolumePath(datacenterID, serverID, volumeID string) string {
- return safeJoin(attachedVolumesPath(datacenterID, serverID), url.QueryEscape(volumeID))
-}
-
-// nicsPath: "datacenters//servers//nics"
-func nicsPath(datacenterID, serverID string) string {
- return safeJoin(serverPath(datacenterID, serverID), "nics")
-}
-
-// nicPath: "datacenters//servers//nics/"
-func nicPath(datacenterID, serverID, nicID string) string {
- return safeJoin(nicsPath(datacenterID, serverID), url.QueryEscape(nicID))
-}
-
-// firewallRulesPath: "datacenters//servers//nics//firewallrules"
-func firewallRulesPath(datacenterID, serverID, nicID string) string {
- return safeJoin(nicPath(datacenterID, serverID, nicID), "firewallrules")
-}
-
-// firewallRulePath:
-// "datacenters//servers//nics//firewallrules/"
-func firewallRulePath(datacenterID, serverID, nicID, firewallRuleID string) string {
- return safeJoin(firewallRulesPath(datacenterID, serverID, nicID), url.QueryEscape(firewallRuleID))
-}
-
-// RequestsPath: "requests"
-func RequestsPath() string {
- return "requests"
-}
-
-// RequestPath: "requests/"
-func RequestPath(requestID string) string {
- return safeJoin(RequestsPath(), url.QueryEscape(requestID))
-}
-
-// RequestStatusPath: "requests//status"
-func RequestStatusPath(requestID string) string {
- return safeJoin(RequestPath(requestID), "status")
-}
-
-// contractsPath: "contracts"
-func contractsPath() string {
- return "contracts"
-}
-
-// umPath: "um"
-func um() string {
- return "um"
-}
-
-// groupsPath: "um/groups"
-func groupsPath() string {
- return safeJoin(um(), "groups")
-}
-
-// groupPath: "um/groups/"
-func groupPath(groupID string) string {
- return safeJoin(groupsPath(), url.QueryEscape(groupID))
-}
-
-// sharesPath: "um/groups//shares"
-func sharesPath(groupID string) string {
- return safeJoin(groupPath(groupID), "shares")
-}
-
-// sharePath: "um/groups//shares/"
-func sharePath(groupID string, resourceID string) string {
- return safeJoin(sharesPath(groupID), url.QueryEscape(resourceID))
-}
-
-// groupUsersPath: "um/groups//users"
-func groupUsersPath(groupID string) string {
- return safeJoin(groupPath(groupID), "users")
-}
-
-// groupUserPath: "um/groups//users/"
-func groupUserPath(groupID string, userID string) string {
- return safeJoin(groupUsersPath(groupID), url.QueryEscape(userID))
-}
-
-// usersPath: "um/users"
-func usersPath() string {
- return safeJoin(um(), "users")
-}
-
-// userPath: "um/users/"
-func userPath(userID string) string {
- return safeJoin(usersPath(), url.QueryEscape(userID))
-}
-
-// resourcesPath: "um/resources"
-func resourcesPath() string {
- return safeJoin(um(), "resources")
-}
-
-// resourcesTypePath: "um/resources/"
-func resourcesTypePath(resourceType string) string {
- return safeJoin(resourcesPath(), url.QueryEscape(resourceType))
-}
-
-// resourcePath: "um/resources//"
-func resourcePath(resourceType string, resourceID string) string {
- return safeJoin(resourcesTypePath(resourceType), url.QueryEscape(resourceID))
-}
-
-// tokensPath: "/tokens"
-func tokensPath() string {
- // comes with leading slash, as it is used for calls to a different api.
- return "/tokens"
-}
-
-// tokenPath: "tokens/"
-func tokenPath(tokenID string) string {
- return safeJoin(tokensPath(), url.QueryEscape(tokenID))
-}
-
-// kubernetesClustersPath: "k8s"
-func kubernetesClustersPath() string {
- return "k8s"
-}
-
-// kubernetesClusterPath: "k8s/"
-func kubernetesClusterPath(clusterID string) string {
- return safeJoin(kubernetesClustersPath(), clusterID)
-}
-
-// kubeConfigPath: "k8s//kubeconfig"
-func kubeConfigPath(clusterID string) string {
- return safeJoin(kubernetesClusterPath(clusterID), "kubeconfig")
-}
-
-// kubernetesNodePoolsPath: "k8s//nodepools"
-func kubernetesNodePoolsPath(clusterID string) string {
- return safeJoin(kubernetesClusterPath(clusterID), "nodepools")
-}
-
-// kubernetesNodePoolPath: "k8s//nodepools/"
-func kubernetesNodePoolPath(clusterID, nodepoolID string) string {
- return safeJoin(kubernetesNodePoolsPath(clusterID), nodepoolID)
-}
-
-// kubernetesNodesPath: "k8s//nodepools//nodes"
-func kubernetesNodesPath(clusterID, nodepoolID string) string {
- return safeJoin(kubernetesNodePoolPath(clusterID, nodepoolID), "nodes")
-}
-
-// kubernetesNodePath: "k8s//nodepools//nodes/"
-func kubernetesNodePath(clusterID, nodepoolID, nodeID string) string {
- return safeJoin(kubernetesNodesPath(clusterID, nodepoolID), nodeID)
-}
-
-// kubernetesNodeReplacePath: "k8s//nodepools//nodes//replace"
-func kubernetesNodeReplacePath(clusterID, nodepoolID, nodeID string) string {
- return safeJoin(kubernetesNodePath(clusterID, nodepoolID, nodeID), "replace")
-}
-
-// backupUnitsPath: "backupunits"
-func backupUnitsPath() string {
- return "backupunits"
-}
-
-// backupUnitsPath: "backupunits/"
-func backupUnitPath(backupUnitID string) string {
- return safeJoin(backupUnitsPath(), backupUnitID)
-}
-
-// backupUnitSSOURLPath: "backupunits/backupUnitID/ssourl"
-func backupUnitSSOURLPath(backupUnitID string) string {
- return safeJoin(backupUnitsPath(), backupUnitID, "ssourl")
-}
-
-// s3KeysPath: "um/users//s3keys"
-func s3KeysPath(userID string) string {
- return safeJoin(userPath(userID), "s3keys")
-}
-
-// s3KeysListPath: "um/users//s3keys?depth=1"
-func s3KeysListPath(userID string) string {
- return safeJoin(userPath(userID), "s3keys?depth=1")
-}
-
-// s3KeyPath: "um/users//s3keys/"
-func s3KeyPath(userID string, s3KeyID string) string {
- return safeJoin(s3KeysPath(userID), s3KeyID)
-}
-
-// PrivateCrossConnectsPath: "pccs"
-func PrivateCrossConnectsPath() string {
- return "pccs"
-}
-
-// PrivateCrossConnectPath: "pccs/"
-func PrivateCrossConnectPath(pccID string) string {
- return safeJoin(PrivateCrossConnectsPath(), pccID)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/pcc.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/pcc.go
deleted file mode 100644
index ec5386ab3..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/pcc.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package profitbricks
-
-import "net/http"
-
-// PrivateCrossConnect type
-type PrivateCrossConnect struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // metadata
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // properties
- // Required: true
- Properties *PrivateCrossConnectProperties `json:"properties"`
-
- // The type of object
- // Read Only: true
- // Enum: [pcc]
- PBType string `json:"type,omitempty"`
-}
-
-// PrivateCrossConnects type
-type PrivateCrossConnects struct {
- // URL to the collection representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // Unique representation for private cros-connect as a collection on a resource.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // Slice of items in that collection
- // Read Only: true
- Items []PrivateCrossConnect `json:"items"`
-
- // The type of resource within a collection
- // Read Only: true
- // Enum: [collection]
- PBType string `json:"type,omitempty"`
-}
-
-// PrivateCrossConnectProperties type
-type PrivateCrossConnectProperties struct {
- // The desired name for the PrivateCrossConnect
- // Required: true
- Name string `json:"name,omitempty"`
- // A description for this PrivateCrossConnect
- // Required: true
- Description string `json:"description,omitempty"`
- // The peers of the PrivateCrossConnect
- // Required: false
- // Readonly: true
- Peers *[]PCCPeer `json:"peers,omitempty"`
- // The Connectable VDC's
- // Required: false
- // Readonly: true
- ConnectableDatacenters *[]PCCConnectableDataCenter `json:"connectableDatacenters,omitempty"`
-}
-
-// PCCPeer type
-type PCCPeer struct {
- // The id of the cross-connected LAN
- // Required: false
- LANId string `json:"id,omitempty"`
- // The name of the cross-connected LAN
- // Required: false
- LANName string `json:"name,omitempty"`
- // The id of the cross-connected VDC
- // Required: false
- DataCenterID string `json:"datacenterId,omitempty"`
- // The name of the cross-connected VDC
- // Required: false
- DataCenterName string `json:"datacenterName,omitempty"`
- // The location of the cross-connected VDC
- // Required: false
- Location string `json:"location,omitempty"`
-}
-
-// PCCConnectableDataCenter type
-type PCCConnectableDataCenter struct {
- // The id of the cross-connectable VDC
- // Required: false
- ID string `json:"id,omitempty"`
- // The name of the cross-connectable VDC
- // Required: false
- Name string `json:"name,omitempty"`
- // The name of the cross-connectable VDC
- // Required: false
- Location string `json:"location,omitempty"`
-}
-
-// ListPrivateCrossConnects gets a list of all private cross-connects
-func (c *Client) ListPrivateCrossConnects() (*PrivateCrossConnects, error) {
- rsp := &PrivateCrossConnects{}
- return rsp, c.GetOK(PrivateCrossConnectsPath(), rsp)
-}
-
-// GetPrivateCrossConnect gets a private cross-connect with given id
-func (c *Client) GetPrivateCrossConnect(pccID string) (*PrivateCrossConnect, error) {
- rsp := &PrivateCrossConnect{}
- return rsp, c.GetOK(PrivateCrossConnectPath(pccID), rsp)
-}
-
-// CreatePrivateCrossConnect creates a private cross-connect
-func (c *Client) CreatePrivateCrossConnect(pcc PrivateCrossConnect) (*PrivateCrossConnect, error) {
- rsp := &PrivateCrossConnect{}
- return rsp, c.PostAcc(PrivateCrossConnectsPath(), pcc, rsp)
-}
-
-// UpdatePrivateCrossConnect updates a private cross-connect
-func (c *Client) UpdatePrivateCrossConnect(pccID string, pcc PrivateCrossConnect) (*PrivateCrossConnect, error) {
- rsp := &PrivateCrossConnect{}
- return rsp, c.PatchAcc(PrivateCrossConnectPath(pccID), pcc.Properties, rsp)
-}
-
-// DeletePrivateCrossConnect deletes a private cross-connect by its id
-func (c *Client) DeletePrivateCrossConnect(pccID string) (*http.Header, error) {
- h := &http.Header{}
- return h, c.Delete(PrivateCrossConnectPath(pccID), h, http.StatusAccepted)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/profitbricks.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/profitbricks.go
deleted file mode 100644
index 0cf8ba1c0..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/profitbricks.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
- "strconv"
- "time"
-
- resty "github.com/go-resty/resty/v2"
-)
-
-type Client struct {
- *resty.Client
- // AuthApiUrl will be used by methods talking to the auth api by sending absolute urls
- AuthApiUrl string
- CloudApiUrl string
-}
-
-const (
- DefaultApiUrl = "https://api.ionos.com/cloudapi/v5"
- DefaultAuthUrl = "https://api.ionos.com/auth/v1"
- Version = "5.0.3"
-)
-
-func RestyClient(username, password, token string) *Client {
- c := &Client{
- Client: resty.New(),
- AuthApiUrl: DefaultAuthUrl,
- CloudApiUrl: DefaultApiUrl,
- }
- if token == "" {
- c.SetBasicAuth(username, password)
- } else {
- c.SetAuthToken(token)
- }
- c.SetHostURL(DefaultApiUrl)
- c.SetDepth(10)
- c.SetTimeout(3 * time.Minute)
- c.SetUserAgent("ionos-enterprise-sdk-go " + Version)
- c.SetRetryCount(3)
- c.SetRetryMaxWaitTime(10 * time.Minute)
- c.SetRetryWaitTime(1 * time.Second)
- c.SetRetryAfter(func(cl *resty.Client, r *resty.Response) (time.Duration, error) {
- switch r.StatusCode() {
- case http.StatusTooManyRequests:
- if retryAfterSeconds := r.Header().Get("Retry-After"); retryAfterSeconds != "" {
- return time.ParseDuration(retryAfterSeconds + "s")
- }
- }
- return cl.RetryWaitTime, nil
- })
- c.AddRetryCondition(
- func(r *resty.Response, err error) bool {
- switch r.StatusCode() {
- case http.StatusTooManyRequests,
- http.StatusServiceUnavailable,
- http.StatusGatewayTimeout,
- http.StatusBadGateway:
- return true
- }
- return false
- })
- return c
-}
-
-// SetDebug activates/deactivates resty's debug mode. For better readability
-// the pretty print feature is also enabled.
-func (c *Client) SetDebug(debug bool) {
- c.Client.SetDebug(debug)
- c.SetPretty(debug)
-}
-
-// SetDepth sets the depth of information that will be retrieved by api calls. The
-// API accepts values from 0 to 10, a low depth means mostly only IDs and hrefs will be
-// returned. Therefore nested structures may be nil.
-func (c *Client) SetDepth(depth int) {
- c.Client.SetQueryParam("depth", strconv.Itoa(depth))
-}
-
-// SetPretty toggles if the data retrieved from the api will be delivered pretty printed.
-// Usually this does not make sense from an sdk perspective, but for debugging it's nice
-// therefore it is also set to true, if debug is enabled.
-func (c *Client) SetPretty(pretty bool) {
- c.Client.SetQueryParam("pretty", strconv.FormatBool(pretty))
-}
-
-// NewClient is a constructor for Client object
-func NewClient(username, password string) *Client {
- return RestyClient(username, password, "")
-}
-
-// NewClientbyToken is a constructor for Client object using bearer tokens for
-// authentication instead of username, password
-func NewClientbyToken(token string) *Client {
- return RestyClient("", "", token)
-}
-
-// SetUserAgent sets User-Agent request header for all API calls
-func (c *Client) SetUserAgent(agent string) {
- c.Client.SetHeader("User-Agent", agent)
-}
-
-// GetUserAgent gets User-Agent header
-func (c *Client) GetUserAgent() string {
- return c.Client.Header.Get("User-Agent")
-}
-
-// SetCloudApiURL sets Cloud API url
-func (c *Client) SetCloudApiURL(url string) {
- c.Client.SetHostURL(url)
-}
-
-// SetAuthApiUrl sets the Auth API url
-func (c *Client) SetAuthApiUrl(url string) {
- c.AuthApiUrl = url
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/request.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/request.go
deleted file mode 100644
index 9dbbb7f25..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/request.go
+++ /dev/null
@@ -1,338 +0,0 @@
-package profitbricks
-
-import (
- "context"
- "errors"
- "fmt"
- "net/http"
- "net/url"
- "time"
-
- resty "github.com/go-resty/resty/v2"
-)
-
-const (
- RequestStatusQueued = "QUEUED"
- RequestStatusRunning = "RUNNING"
- RequestStatusFailed = "FAILED"
- RequestStatusDone = "DONE"
-)
-
-// RequestStatus object
-type RequestStatus struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata RequestStatusMetadata `json:"metadata,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// RequestStatusMetadata object
-type RequestStatusMetadata struct {
- Status string `json:"status,omitempty"`
- Message string `json:"message,omitempty"`
- Etag string `json:"etag,omitempty"`
- Targets []RequestTarget `json:"targets,omitempty"`
-}
-
-// RequestTarget object
-type RequestTarget struct {
- Target ResourceReference `json:"target,omitempty"`
- Status string `json:"status,omitempty"`
-}
-
-// Requests object
-type Requests struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Request `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-type RequestMetadata struct {
- CreatedDate time.Time `json:"createdDate"`
- CreatedBy string `json:"createdBy"`
- Etag string `json:"etag"`
- RequestStatus RequestStatus `json:"requestStatus"`
-}
-
-type RequestProperties struct {
- Method string `json:"method"`
- Headers interface{} `json:"headers"`
- Body string `json:"body"`
- URL string `json:"url"`
-}
-
-// Request object
-type Request struct {
- ID string `json:"id"`
- Type string `json:"type"`
- Href string `json:"href"`
- Metadata RequestMetadata `json:"metadata"`
- Properties RequestProperties `json:"properties"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// RequestListFilter is a wrapper around url.Values to provide a common
-// interface to make use of the filters that the ionos API provides for the
-// requests endpoint.
-// Example:
-// filter := NewRequestListFilter().WithUrl("volumes").WithBody("de/fra") will create a api call
-// with query args like: /requests?filter.url=volumes&filter.body=de%2Ffra
-type RequestListFilter struct {
- url.Values
-}
-
-// NewRequestListFilter creates a new RequestListFilter
-func NewRequestListFilter() *RequestListFilter {
- return &RequestListFilter{Values: url.Values{}}
-}
-
-// Clone clones the RequestListFilter
-func (f *RequestListFilter) Clone() *RequestListFilter {
- values := make(url.Values, len(f.Values))
- for k, v := range f.Values {
- values[k] = v
- }
- return &RequestListFilter{Values: values}
-}
-
-// AddUrl adds an url filter to the request list filter
-func (f *RequestListFilter) AddUrl(url string) {
- f.WithUrl(url)
-}
-
-// WithUrl adds an url filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithUrl(url string) *RequestListFilter {
- f.Add("filter.url", url)
- return f
-}
-
-// AddCreatedDate adds a createdDate filter to the request list filter
-func (f *RequestListFilter) AddCreatedDate(createdDate string) {
- f.WithCreatedDate(createdDate)
-}
-
-// WithCreatedDate adds a createdDate filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithCreatedDate(createdDate string) *RequestListFilter {
- f.Add("filter.createdDate", createdDate)
- return f
-}
-
-// AddMethod adds a method filter to the request list filter
-func (f *RequestListFilter) AddMethod(method string) {
- f.WithMethod(method)
-}
-
-// WithMethod adds a method filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithMethod(method string) *RequestListFilter {
- f.Add("filter.method", method)
- return f
-}
-
-// AddBody adds a body filter to the request list filter
-func (f *RequestListFilter) AddBody(body string) {
- f.WithBody(body)
-}
-
-// WithBody adds a body filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithBody(body string) *RequestListFilter {
- f.Add("filter.body", body)
- return f
-}
-
-// AddRequestStatus adds a requestStatus filter to the request list filter
-func (f *RequestListFilter) AddRequestStatus(requestStatus string) {
- f.WithRequestStatus(requestStatus)
-}
-
-// WithRequestStatus adds a requestStatus filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithRequestStatus(requestStatus string) *RequestListFilter {
- f.Add("filter.status", requestStatus)
- return f
-}
-
-const timeFormat = "2006-01-02 15:04:05"
-
-// AddCreatedAfter adds a createdAfter filter to the request list filter
-func (f *RequestListFilter) AddCreatedAfter(t time.Time) {
- f.WithCreatedAfter(t)
-}
-
-// WithCreatedAfter adds a createdAfter filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithCreatedAfter(t time.Time) *RequestListFilter {
- f.Add("filter.createdAfter", t.Format(timeFormat))
- return f
-}
-
-// AddCreatedBefore adds a createdBefore filter to the request list filter
-func (f *RequestListFilter) AddCreatedBefore(t time.Time) *RequestListFilter {
- f.WithCreatedBefore(t)
- return f
-}
-
-// WithCreatedBefore adds a createdBefore filter to the request list filter returning the filter for chaining
-func (f *RequestListFilter) WithCreatedBefore(t time.Time) *RequestListFilter {
- f.Add("filter.createdBefore", t.Format(timeFormat))
- return f
-}
-
-// ListRequests lists all requests
-func (c *Client) ListRequests() (*Requests, error) {
- url := "/requests"
- ret := &Requests{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// ListRequestsWithFilter lists all requests that match the given filters
-func (c *Client) ListRequestsWithFilter(filter *RequestListFilter) (*Requests, error) {
- path := "/requests"
- ret := &Requests{}
- r := c.R().SetResult(ret)
- if filter != nil {
- for k, v := range filter.Values {
- for _, i := range v {
- r.SetQueryParam(k, i)
- }
- }
- }
- return ret, c.DoWithRequest(r, resty.MethodGet, path, http.StatusOK)
-}
-
-// GetRequest gets a specific request
-func (c *Client) GetRequest(reqID string) (*Request, error) {
- url := "/requests/" + reqID
- ret := &Request{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// GetRequestStatus returns status of the request
-func (c *Client) GetRequestStatus(path string) (*RequestStatus, error) {
- url := path
- ret := &RequestStatus{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// IsRequestFinished checks the given path to a request status resource. The request is considered "done"
-// if its status won't change, which is true for status FAILED and DONE. Since Failed is obviously not done,
-// the method returns true and RequestFailed error in that case.
-func (c *Client) IsRequestFinished(path string) (bool, error) {
- request, err := c.GetRequestStatus(path)
- if err != nil {
- return false, err
- }
- switch request.Metadata.Status {
- case RequestStatusDone:
- return true, nil
- case RequestStatusFailed:
- return true, NewClientError(
- RequestFailed,
- fmt.Sprintf("Request %s failed: %s", request.ID, request.Metadata.Message),
- )
- }
- return false, nil
-}
-
-// WaitTillProvisionedOrCanceled waits for a request to be completed.
-// It returns an error if the request status could not be fetched, the request
-// failed or the given context is canceled.
-func (c *Client) WaitTillProvisionedOrCanceled(ctx context.Context, path string) error {
- req := c.R()
- status := &RequestStatus{}
- req.SetContext(ctx).SetResult(status)
- ticker := time.NewTicker(1 * time.Second)
- defer ticker.Stop()
- for {
- err := c.DoWithRequest(req, resty.MethodGet, path, http.StatusOK)
- if err != nil {
- return err
- }
- switch status.Metadata.Status {
- case RequestStatusDone:
- return nil
- case RequestStatusFailed:
- return NewClientError(
- RequestFailed,
- fmt.Sprintf("Request %s failed: %s", status.ID, status.Metadata.Message),
- )
- }
- select {
- case <-ctx.Done():
- return ctx.Err()
- case <-ticker.C:
- continue
- }
- }
-}
-
-// WaitTillProvisioned waits for a request to be completed.
-// It returns an error if the request status could not be fetched, the request
-// failed or a timeout of 2.5 minutes is exceeded.
-func (c *Client) WaitTillProvisioned(path string) (err error) {
- ctx, cancel := context.WithTimeout(context.TODO(), 150*time.Second)
- defer cancel()
- if err = c.WaitTillProvisionedOrCanceled(ctx, path); err != nil {
- if err == context.DeadlineExceeded {
- return errors.New("timeout expired while waiting for request to complete")
- }
- }
- return
-}
-
-type RequestSelector func(Request) bool
-
-// IsRequestStatusFinished is true if the requests Status is neither QUEUED or RUNNING.
-func IsRequestStatusFinished(r Request) bool {
- switch r.Metadata.RequestStatus.Metadata.Status {
- case RequestStatusQueued, RequestStatusRunning:
- return false
- }
- return true
-}
-
-// WaitTillRequestsFinished will wait until there are no more unfinished requests matching the given filter
-func (c *Client) WaitTillRequestsFinished(ctx context.Context, filter *RequestListFilter) error {
- return c.WaitTillMatchingRequestsFinished(ctx, filter, func(r Request) bool { return !IsRequestStatusFinished(r) })
-}
-
-// WaitTillMatchingRequestsFinished gets open requests with given filters and will
-// wait for each request that is selected by the selector. The selector
-// should consider filtering out requests that are finished. (e.g. using IsRequestStatusFinished)
-func (c *Client) WaitTillMatchingRequestsFinished(
- ctx context.Context, filter *RequestListFilter, selector RequestSelector) error {
-
- waited := true
- for waited && ctx.Err() == nil {
-
- waited = false
- requests, err := c.ListRequestsWithFilter(filter)
- if err != nil {
- return err
- }
- for _, r := range requests.Items {
- if selector(r) {
- waited = true
- if err := c.WaitTillProvisionedOrCanceled(ctx, r.Metadata.RequestStatus.Href); err != nil {
- if !IsRequestFailed(err) {
- return err
- }
-
- }
- }
- }
- if !waited {
- break
- }
- }
- return nil
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/s3key.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/s3key.go
deleted file mode 100644
index a772a65bc..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/s3key.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package profitbricks
-
-import "net/http"
-
-// S3Keys type
-type S3Keys struct {
- // Enum: [backupunits]
- // Read Only: true
- ID string `json:"id,omitempty"`
- // Enum: [collection]
- // Read Only: true
- Type string `json:"type,omitempty"`
- // Format: uri
- Href string `json:"href"`
- // Read Only: true
- Items []S3Key `json:"items"`
-}
-
-// S3Key Object
-type S3Key struct {
- // URL to the object representation (absolute path)
- // Read Only: true
- // Format: uri
- Href string `json:"href,omitempty"`
-
- // The resource's unique identifier.
- // Read Only: true
- ID string `json:"id,omitempty"`
-
- // The type of object. In this case s3key
- // Read Only: true
- Type string `json:"type,omitempty"`
-
- // The metadata for the S3 key
- // Read Only: true
- Metadata *Metadata `json:"metadata,omitempty"`
-
- // The properties of the S3 key
- // Read Only: false
- Properties *S3KeyProperties `json:"properties,omitempty"`
-}
-
-// S3KeyProperties object
-type S3KeyProperties struct {
- // Read only: yes
- SecretKey string `json:"secretKey,omitempty"`
- // Required: yes
- // Read only: no
- Active bool `json:"active"`
-}
-
-// CreateS3Key creates an S3 Key for an user
-func (c *Client) CreateS3Key(userID string) (*S3Key, error) {
- rsp := &S3Key{}
- var requestBody interface{}
- err := c.Post(s3KeysPath(userID), requestBody, rsp, http.StatusCreated)
- return rsp, err
-}
-
-// ListS3Keys lists all available S3 keys for an user
-func (c *Client) ListS3Keys(userID string) (*S3Keys, error) {
- rsp := &S3Keys{}
- return rsp, c.GetOK(s3KeysListPath(userID), rsp)
-}
-
-// UpdateS3Key updates an existing S3 key
-func (c *Client) UpdateS3Key(userID string, s3KeyID string, s3Key S3Key) (*S3Key, error) {
- rsp := &S3Key{}
- return rsp, c.PutAcc(s3KeyPath(userID, s3KeyID), s3Key, rsp)
-}
-
-// DeleteS3Key deletes an existing S3 key
-func (c *Client) DeleteS3Key(userID string, s3KeyID string) (*http.Header, error) {
- return c.DeleteAcc(s3KeyPath(userID, s3KeyID))
-}
-
-// GetS3Key retrieves an existing S3 key
-func (c *Client) GetS3Key(userID string, s3KeyID string) (*S3Key, error) {
- rsp := &S3Key{}
- return rsp, c.GetOK(s3KeyPath(userID, s3KeyID), rsp)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/server.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/server.go
deleted file mode 100644
index 291eedc9d..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/server.go
+++ /dev/null
@@ -1,247 +0,0 @@
-package profitbricks
-
-import (
- "context"
- "net/http"
-)
-
-// Server object
-type Server struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties ServerProperties `json:"properties,omitempty"`
- Entities *ServerEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ServerProperties object
-type ServerProperties struct {
- Name string `json:"name,omitempty"`
- Cores int `json:"cores,omitempty"`
- RAM int `json:"ram,omitempty"`
- AvailabilityZone string `json:"availabilityZone,omitempty"`
- VMState string `json:"vmState,omitempty"`
- BootCdrom *ResourceReference `json:"bootCdrom,omitempty"`
- BootVolume *ResourceReference `json:"bootVolume,omitempty"`
- CPUFamily string `json:"cpuFamily,omitempty"`
-}
-
-// ServerEntities object
-type ServerEntities struct {
- Cdroms *Cdroms `json:"cdroms,omitempty"`
- Volumes *Volumes `json:"volumes,omitempty"`
- Nics *Nics `json:"nics,omitempty"`
-}
-
-// Servers collection
-type Servers struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Server `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ResourceReference object
-type ResourceReference struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
-}
-
-// ListServers returns a server struct collection
-func (c *Client) ListServers(dcid string) (*Servers, error) {
- url := serversPath(dcid)
- ret := &Servers{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// CreateServer creates a server in given datacenter
-func (c *Client) CreateServer(dcid string, server Server) (*Server, error) {
- url := serversPath(dcid)
- ret := &Server{}
- err := c.Post(url, server, ret, http.StatusAccepted)
- return ret, err
-}
-
-// CreateServerAndWait creates a server, waits for the request to finish and returns a refreshed resource
-// Note that an error does not necessarily means that the resource has not been created.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) CreateServerAndWait(ctx context.Context, dcid string, srvid Server) (res *Server, err error) {
- res, err = c.CreateServer(dcid, srvid)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
- return
- }
- var srv *Server
- if srv, err = c.GetServer(dcid, res.ID); err != nil {
- return
- } else {
- return srv, nil
- }
-}
-
-// GetServer pulls data for the server where id = srvid returns a Instance struct
-func (c *Client) GetServer(dcid, srvid string) (*Server, error) {
- url := serverPath(dcid, srvid)
- ret := &Server{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// UpdateServer updates server with given properties and returns instance
-func (c *Client) UpdateServer(dcid string, srvid string, props ServerProperties) (*Server, error) {
- url := serverPath(dcid, srvid)
- ret := &Server{}
- err := c.Patch(url, props, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateServerAndWait updates a server, waits for the request to finish and
-// returns a refreshed instance.
-// Note that an error does not necessarily means that the resource has not been updated.
-// If err & res are not nil, a resource with res.ID exists, but an error occurred either while waiting for
-// the request or when refreshing the resource.
-func (c *Client) UpdateServerAndWait(
- ctx context.Context, dcid, srvid string, props ServerProperties) (res *Server, err error) {
- res, err = c.UpdateServer(dcid, srvid, props)
- if err != nil {
- return
- }
- if err = c.WaitTillProvisionedOrCanceled(ctx, res.Headers.Get("location")); err != nil {
-
- return
- }
- var srv *Server
- if srv, err = c.GetServer(dcid, res.ID); err != nil {
- return
- } else {
- return srv, nil
- }
-}
-
-// DeleteServer deletes the server where id=srvid and returns Resp struct
-func (c *Client) DeleteServer(dcid, srvid string) (*http.Header, error) {
- ret := &http.Header{}
- err := c.Delete(serverPath(dcid, srvid), ret, http.StatusAccepted)
- return ret, err
-}
-
-// DeleteServerAndWait deletes a server and waits for the request to finish
-func (c *Client) DeleteServerAndWait(ctx context.Context, dcid, srvid string) error {
- rsp, err := c.DeleteServer(dcid, srvid)
- if err != nil {
- return err
- }
- return c.WaitTillProvisionedOrCanceled(ctx, rsp.Get("location"))
-}
-
-// ListAttachedCdroms returns list of attached cd roms
-func (c *Client) ListAttachedCdroms(dcid, srvid string) (*Images, error) {
- url := cdromsPath(dcid, srvid)
- ret := &Images{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// AttachCdrom attaches a CD rom
-func (c *Client) AttachCdrom(dcid string, srvid string, cdid string) (*Image, error) {
- data := struct {
- ID string `json:"id,omitempty"`
- }{
- cdid,
- }
- url := cdromsPath(dcid, srvid)
- ret := &Image{}
- err := c.Post(url, data, ret, http.StatusAccepted)
- return ret, err
-}
-
-// GetAttachedCdrom gets attached cd roms
-func (c *Client) GetAttachedCdrom(dcid, srvid, cdid string) (*Image, error) {
- url := cdromPath(dcid, srvid, cdid)
- ret := &Image{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// DetachCdrom detaches a CD rom
-func (c *Client) DetachCdrom(dcid, srvid, cdid string) (*http.Header, error) {
- url := cdromPath(dcid, srvid, cdid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-// ListAttachedVolumes lists attached volumes
-func (c *Client) ListAttachedVolumes(dcid, srvid string) (*Volumes, error) {
- url := attachedVolumesPath(dcid, srvid)
- ret := &Volumes{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// AttachVolume attaches a volume
-func (c *Client) AttachVolume(dcid string, srvid string, volid string) (*Volume, error) {
- data := struct {
- ID string `json:"id,omitempty"`
- }{
- volid,
- }
- url := attachedVolumesPath(dcid, srvid)
- ret := &Volume{}
- err := c.Post(url, data, ret, http.StatusAccepted)
-
- return ret, err
-}
-
-// GetAttachedVolume gets an attached volume
-func (c *Client) GetAttachedVolume(dcid, srvid, volid string) (*Volume, error) {
- url := attachedVolumePath(dcid, srvid, volid)
- ret := &Volume{}
- err := c.Get(url, ret, http.StatusOK)
-
- return ret, err
-}
-
-// DetachVolume detaches a volume
-func (c *Client) DetachVolume(dcid, srvid, volid string) (*http.Header, error) {
- url := attachedVolumePath(dcid, srvid, volid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-// StartServer starts a server
-func (c *Client) StartServer(dcid, srvid string) (*http.Header, error) {
- url := serverStartPath(dcid, srvid)
- ret := &Header{}
- err := c.Post(url, nil, ret, http.StatusAccepted)
- return ret.GetHeader(), err
-}
-
-// StopServer stops a server
-func (c *Client) StopServer(dcid, srvid string) (*http.Header, error) {
- url := serverStopPath(dcid, srvid)
- ret := &Header{}
- err := c.Post(url, nil, ret, http.StatusAccepted)
- return ret.GetHeader(), err
-}
-
-// RebootServer reboots a server
-func (c *Client) RebootServer(dcid, srvid string) (*http.Header, error) {
- url := serverRebootPath(dcid, srvid)
- ret := &Header{}
- err := c.Post(url, nil, ret, http.StatusAccepted)
- return ret.GetHeader(), err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/snapshot.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/snapshot.go
deleted file mode 100644
index 728ec8df8..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/snapshot.go
+++ /dev/null
@@ -1,189 +0,0 @@
-package profitbricks
-
-import (
- "fmt"
- "net/http"
-)
-
-//Snapshot object
-type Snapshot struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata Metadata `json:"metadata,omitempty"`
- Properties SnapshotProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// SnapshotProperties properties
-type SnapshotProperties struct {
- Name string `json:"name,omitempty"`
- Description string `json:"description,omitempty"`
- Location string `json:"location,omitempty"`
- Size int `json:"size,omitempty"`
- CPUHotPlug bool `json:"cpuHotPlug,omitempty"`
- CPUHotUnplug bool `json:"cpuHotUnplug,omitempty"`
- RAMHotPlug bool `json:"ramHotPlug,omitempty"`
- RAMHotUnplug bool `json:"ramHotUnplug,omitempty"`
- NicHotPlug bool `json:"nicHotPlug,omitempty"`
- NicHotUnplug bool `json:"nicHotUnplug,omitempty"`
- DiscVirtioHotPlug bool `json:"discVirtioHotPlug,omitempty"`
- DiscVirtioHotUnplug bool `json:"discVirtioHotUnplug,omitempty"`
- DiscScsiHotPlug bool `json:"discScsiHotPlug,omitempty"`
- DiscScsiHotUnplug bool `json:"discScsiHotUnplug,omitempty"`
- LicenceType string `json:"licenceType,omitempty"`
-}
-
-//Snapshots object
-type Snapshots struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Snapshot `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-//ListSnapshots lists all snapshots
-func (c *Client) ListSnapshots() (*Snapshots, error) {
- url := snapshotsPath()
- ret := &Snapshots{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//GetSnapshot gets a specific snapshot
-func (c *Client) GetSnapshot(snapshotID string) (*Snapshot, error) {
- url := snapshotPath(snapshotID)
- ret := &Snapshot{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// DeleteSnapshot deletes a specified snapshot
-func (c *Client) DeleteSnapshot(snapshotID string) (*http.Header, error) {
- url := snapshotPath(snapshotID)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateSnapshot updates a snapshot
-func (c *Client) UpdateSnapshot(snapshotID string, request SnapshotProperties) (*Snapshot, error) {
- url := snapshotPath(snapshotID)
- ret := &Snapshot{}
- err := c.Patch(url, request, ret, http.StatusAccepted)
- return ret, err
-}
-
-// DeleteSnapshotAndWait deletes a specified snapshot and waits for the request
-// to complete.
-func (c *Client) DeleteSnapshotAndWait(snapshotID string) error {
- ret, err := c.DeleteSnapshot(snapshotID)
- if err != nil {
- return err
- }
- return c.WaitTillProvisioned(ret.Get("location"))
-}
-
-// ListSnapshotsWithSelector retrieves all snapshots and performs client-side
-// filtering according to the selector.
-func (c *Client) ListSnapshotsWithSelector(selector SnapshotSelector) ([]Snapshot, error) {
- if selector == nil {
- return nil, fmt.Errorf("missing selector")
- }
-
- snapshots, err := c.ListSnapshots()
- if err != nil {
- return nil, err
- }
-
- var result []Snapshot
- for _, snapshot := range snapshots.Items {
- if !selector(&snapshot) {
- continue
- }
- result = append(result, snapshot)
- }
- return result, nil
-}
-
-// SnapshotSelector is used to do client-side filtering of a list of Snapshots
-type SnapshotSelector func(*Snapshot) bool
-
-// SnapshotByState selects snapshots with the given state
-func SnapshotByState(state string) SnapshotSelector {
- return func(snapshot *Snapshot) bool {
- return snapshot.Metadata.State == state
- }
-}
-
-// SnapshotByName selects snapshots with the given name
-func SnapshotByName(name string) SnapshotSelector {
- return func(snapshot *Snapshot) bool {
- return snapshot.Properties.Name == name
- }
-}
-
-// SnapshotByDescription selects snapshots with the given description
-func SnapshotByDescription(description string) SnapshotSelector {
- return func(snapshot *Snapshot) bool {
- return snapshot.Properties.Description == description
- }
-}
-
-// SelectExactSnapshot concatenates the provided selectors with logical AND.
-func SelectExactSnapshot(selectors ...SnapshotSelector) SnapshotSelector {
- return func(snapshot *Snapshot) bool {
- for _, selector := range selectors {
- if !selector(snapshot) {
- return false
- }
- }
- return true
- }
-}
-
-// SelectAnySnapshot concatenates the provided selectors with logical OR.
-func SelectAnySnapshot(selectors ...SnapshotSelector) SnapshotSelector {
- return func(snapshot *Snapshot) bool {
- for _, selector := range selectors {
- if selector(snapshot) {
- return true
- }
- }
- return false
- }
-}
-
-// IsSnapshotDeletionRequested checks if there is any active delete snapshot request
-// (QUEUED or RUNNING).
-func (c *Client) IsSnapshotDeletionRequested(snapshotID string) (bool, error) {
- f := NewRequestListFilter().WithUrl(snapshotPath(snapshotID)).WithMethod(http.MethodDelete)
- result, err := c.ListRequestsWithFilter(f.Clone().WithRequestStatus(RequestStatusQueued))
- if err != nil {
- return false, err
- }
- if len(result.Items) > 0 {
- return true, nil
- }
- result, err = c.ListRequestsWithFilter(f.Clone().WithRequestStatus(RequestStatusRunning))
- if err != nil {
- return false, err
- }
- return len(result.Items) > 0, nil
-}
-
-// IsSnapshotInUseError returns true if the given error indicates that a snapshot
-// is being referenced by a volume that is currently being created.
-func IsSnapshotInUseError(err error) bool {
- apiErr, ok := err.(ApiError)
- if !ok {
- return false
- }
- return apiErr.HTTPStatus == http.StatusUnprocessableEntity &&
- apiErr.HasErrorCode(SnapshotInUseErrorCode)
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/token.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/token.go
deleted file mode 100644
index 09e01edbd..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/token.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package profitbricks
-
-import (
- "encoding/base64"
- "encoding/json"
- "net/http"
- "strings"
-
- resty "github.com/go-resty/resty/v2"
-)
-
-type tokenHeader struct {
- Typ string
- Kid string
- Alg string
-}
-
-// ExtractIDFromToken returns the given token's key ID
-func ExtractIDFromToken(token string) (string, error) {
- headerB64 := strings.Split(token, ".")[0]
- headerMarshaled, err := base64.StdEncoding.DecodeString(headerB64)
- if err != nil {
- return "", err
- }
- var header tokenHeader
- if err = json.Unmarshal(headerMarshaled, &header); err != nil {
- return "", err
- }
- return header.Kid, nil
-}
-
-// TokenID returns the client's token's key ID if a token is set.
-// Returns an empty string when using basic auth.
-func (c *Client) TokenID() (string, error) {
- if c.Token != "" {
- return ExtractIDFromToken(c.Token)
- }
- return "", nil
-}
-
-// DeleteTokenByID deletes the token with the given key ID
-func (c *Client) DeleteTokenByID(tokenID string) error {
- url := tokenPath(tokenID)
- return c.Do(c.AuthApiUrl+url, resty.MethodDelete, nil, nil, http.StatusOK)
-}
-
-// DeleteToken deletes the given token
-func (c *Client) DeleteToken(token string) error {
- tokenID, err := ExtractIDFromToken(token)
- if err != nil {
- return err
- }
- return c.DeleteTokenByID(tokenID)
-}
-
-// DeleteCurrentToken deletes the client's token if a token is set.
-// Noop when using basic auth.
-func (c *Client) DeleteCurrentToken() error {
- if c.Token != "" {
- return c.DeleteToken(c.Token)
- }
- return nil
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/usermanagment.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/usermanagment.go
deleted file mode 100644
index 0d36662cf..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/usermanagment.go
+++ /dev/null
@@ -1,339 +0,0 @@
-package profitbricks
-
-import (
- "net/http"
-)
-
-// Groups object
-type Groups struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Group `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Group object
-type Group struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Properties GroupProperties `json:"properties,omitempty"`
- Entities *GroupEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// GroupProperties object
-type GroupProperties struct {
- Name string `json:"name,omitempty"`
- CreateDataCenter *bool `json:"createDataCenter,omitempty"`
- CreateSnapshot *bool `json:"createSnapshot,omitempty"`
- ReserveIP *bool `json:"reserveIp,omitempty"`
- AccessActivityLog *bool `json:"accessActivityLog,omitempty"`
- CreateBackupUnit *bool `json:"createBackupUnit,omitempty"`
- CreateInternetAccess *bool `json:"createInternetAccess,omitempty"`
- CreateK8sCluster *bool `json:"createK8sCluster,omitempty"`
- CreatePcc *bool `json:"createPcc,omitempty"`
- S3Privilege *bool `json:"s3Privilege,omitempty"`
-}
-
-// GroupEntities object
-type GroupEntities struct {
- Users Users `json:"users,omitempty"`
- Resources Resources `json:"resources,omitempty"`
-}
-
-// Users object
-type Users struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []User `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// User object
-type User struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties *UserProperties `json:"properties,omitempty"`
- Entities *UserEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// UserProperties object
-type UserProperties struct {
- Firstname string `json:"firstname,omitempty"`
- Lastname string `json:"lastname,omitempty"`
- Email string `json:"email,omitempty"`
- Password string `json:"password,omitempty"`
- Administrator bool `json:"administrator,omitempty"`
- ForceSecAuth bool `json:"forceSecAuth,omitempty"`
- SecAuthActive bool `json:"secAuthActive,omitempty"`
- Active *bool `json:"active,omitempty"`
- S3CanonicalUserID string `json:"s3CanonicalUserId,omitempty"`
-}
-
-// UserEntities object
-type UserEntities struct {
- Groups Groups `json:"groups,omitempty"`
- Owns Owns `json:"owns,omitempty"`
-}
-
-// Resources object
-type Resources struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Resource `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Resource object
-type Resource struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Entities *ResourceEntities `json:"entities,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ResourceEntities object
-type ResourceEntities struct {
- Groups Groups `json:"groups,omitempty"`
-}
-
-// Owns object
-type Owns struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Entity `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Entity object
-type Entity struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Shares object
-type Shares struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Share `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// Share object
-type Share struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Properties ShareProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ShareProperties object
-type ShareProperties struct {
- EditPrivilege *bool `json:"editPrivilege,omitempty"`
- SharePrivilege *bool `json:"sharePrivilege,omitempty"`
-}
-
-//ListGroups lists all groups
-func (c *Client) ListGroups() (*Groups, error) {
- url := groupsPath()
- ret := &Groups{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//GetGroup gets a group
-func (c *Client) GetGroup(groupid string) (*Group, error) {
- url := groupPath(groupid)
- ret := &Group{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//CreateGroup creates a group
-func (c *Client) CreateGroup(grp Group) (*Group, error) {
- url := groupsPath()
- ret := &Group{}
- err := c.Post(url, grp, ret, http.StatusAccepted)
- return ret, err
-}
-
-//UpdateGroup updates a group
-func (c *Client) UpdateGroup(groupid string, obj Group) (*Group, error) {
- url := groupPath(groupid)
- ret := &Group{}
- err := c.Put(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-//DeleteGroup deletes a group
-func (c *Client) DeleteGroup(groupid string) (*http.Header, error) {
- url := groupPath(groupid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ListShares lists all shares
-func (c *Client) ListShares(grpid string) (*Shares, error) {
- url := sharesPath(grpid)
- ret := &Shares{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// GetShare gets a share
-func (c *Client) GetShare(groupid string, resourceid string) (*Share, error) {
- url := sharePath(groupid, resourceid)
- ret := &Share{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// AddShare adds a share
-func (c *Client) AddShare(groupid string, resourceid string, share Share) (*Share, error) {
- url := sharePath(groupid, resourceid)
- ret := &Share{}
- err := c.Post(url, share, ret, http.StatusAccepted)
- return ret, err
-}
-
-// UpdateShare updates a share
-func (c *Client) UpdateShare(groupid string, resourceid string, obj Share) (*Share, error) {
- url := sharePath(groupid, resourceid)
- ret := &Share{}
- err := c.Put(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-// DeleteShare deletes a share
-func (c *Client) DeleteShare(groupid string, resourceid string) (*http.Header, error) {
- url := sharePath(groupid, resourceid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ListGroupUsers lists Users in a group
-func (c *Client) ListGroupUsers(groupid string) (*Users, error) {
- url := groupUsersPath(groupid)
- ret := &Users{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// AddUserToGroup adds a user to a group
-func (c *Client) AddUserToGroup(groupid string, userid string) (*User, error) {
- var usr User
- usr.ID = userid
- url := groupUsersPath(groupid)
- ret := &User{}
- err := c.Post(url, usr, ret, http.StatusAccepted)
- return ret, err
-}
-
-// DeleteUserFromGroup removes a user from a group
-func (c *Client) DeleteUserFromGroup(groupid string, userid string) (*http.Header, error) {
- url := groupUserPath(groupid, userid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ListUsers lists all users
-func (c *Client) ListUsers() (*Users, error) {
- url := usersPath()
- ret := &Users{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-// GetUser gets a user
-func (c *Client) GetUser(usrid string) (*User, error) {
- url := userPath(usrid)
- ret := &User{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//CreateUser creates a user
-func (c *Client) CreateUser(usr User) (*User, error) {
- url := usersPath()
- ret := &User{}
- err := c.Post(url, usr, ret, http.StatusAccepted)
- return ret, err
-}
-
-//UpdateUser updates user information
-func (c *Client) UpdateUser(userid string, obj User) (*User, error) {
- url := userPath(userid)
- ret := &User{}
- err := c.Put(url, obj, ret, http.StatusAccepted)
- return ret, err
-}
-
-//DeleteUser deletes the specified user
-func (c *Client) DeleteUser(userid string) (*http.Header, error) {
- url := userPath(userid)
- ret := &http.Header{}
- err := c.Delete(url, ret, http.StatusAccepted)
- return ret, err
-}
-
-//ListResources lists all resources
-func (c *Client) ListResources() (*Resources, error) {
- url := resourcesPath()
- ret := &Resources{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//GetResourceByType gets a resource by type
-func (c *Client) GetResourceByType(resourcetype string, resourceid string) (*Resource, error) {
- url := resourcePath(resourcetype, resourceid)
- ret := &Resource{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
-
-//ListResourcesByType list resources by type
-func (c *Client) ListResourcesByType(resourcetype string) (*Resources, error) {
- url := resourcesTypePath(resourcetype)
- ret := &Resources{}
- err := c.Get(url, ret, http.StatusOK)
- return ret, err
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/volume.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/volume.go
deleted file mode 100644
index 0f697d29a..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/volume.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package profitbricks
-
-import (
- "context"
- "net/http"
-
- resty "github.com/go-resty/resty/v2"
-)
-
-// Volume object
-type Volume struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Metadata *Metadata `json:"metadata,omitempty"`
- Properties VolumeProperties `json:"properties,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// VolumeProperties object
-type VolumeProperties struct {
- Name string `json:"name,omitempty"`
- Type string `json:"type,omitempty"`
- Size int `json:"size,omitempty"`
- AvailabilityZone string `json:"availabilityZone,omitempty"`
- Image string `json:"image,omitempty"`
- ImageAlias string `json:"imageAlias,omitempty"`
- ImagePassword string `json:"imagePassword,omitempty"`
- SSHKeys []string `json:"sshKeys,omitempty"`
- Bus string `json:"bus,omitempty"`
- LicenceType string `json:"licenceType,omitempty"`
- CPUHotPlug bool `json:"cpuHotPlug,omitempty"`
- CPUHotUnplug bool `json:"cpuHotUnplug,omitempty"`
- RAMHotPlug bool `json:"ramHotPlug,omitempty"`
- RAMHotUnplug bool `json:"ramHotUnplug,omitempty"`
- NicHotPlug bool `json:"nicHotPlug,omitempty"`
- NicHotUnplug bool `json:"nicHotUnplug,omitempty"`
- DiscVirtioHotPlug bool `json:"discVirtioHotPlug,omitempty"`
- DiscVirtioHotUnplug bool `json:"discVirtioHotUnplug,omitempty"`
- DiscScsiHotPlug bool `json:"discScsiHotPlug,omitempty"`
- DiscScsiHotUnplug bool `json:"discScsiHotUnplug,omitempty"`
- DeviceNumber int64 `json:"deviceNumber,omitempty"`
-}
-
-// Volumes object
-type Volumes struct {
- ID string `json:"id,omitempty"`
- PBType string `json:"type,omitempty"`
- Href string `json:"href,omitempty"`
- Items []Volume `json:"items,omitempty"`
- Response string `json:"Response,omitempty"`
- Headers *http.Header `json:"headers,omitempty"`
- StatusCode int `json:"statuscode,omitempty"`
-}
-
-// ListVolumes returns a Collection struct for volumes in the Datacenter
-func (c *Client) ListVolumes(dcid string) (*Volumes, error) {
- ret := &Volumes{}
- return ret, c.GetOK(volumesPath(dcid), ret)
-}
-
-// GetVolume gets a volume
-func (c *Client) GetVolume(dcid string, volumeID string) (*Volume, error) {
- ret := &Volume{}
- return ret, c.GetOK(volumePath(dcid, volumeID), ret)
-}
-
-// UpdateVolume updates a volume
-func (c *Client) UpdateVolume(dcid string, volid string, request VolumeProperties) (*Volume, error) {
- ret := &Volume{}
- return ret, c.PatchAcc(volumePath(dcid, volid), request, ret)
-}
-
-// CreateVolume creates a volume
-func (c *Client) CreateVolume(dcid string, request Volume) (*Volume, error) {
- ret := &Volume{}
- return ret, c.PostAcc(volumesPath(dcid), request, ret)
-}
-
-// DeleteVolume deletes a volume
-func (c *Client) DeleteVolume(dcid, volid string) (*http.Header, error) {
- return c.DeleteAcc(volumePath(dcid, volid))
-}
-
-// CreateSnapshot creates a volume snapshot
-func (c *Client) CreateSnapshot(dcid string, volid string, name string, description string) (*Snapshot, error) {
- ret := &Snapshot{}
- req := c.Client.R().
- SetFormData(map[string]string{"name": name, "description": description}).
- SetResult(ret)
- return ret, c.DoWithRequest(req, resty.MethodPost, createSnapshotPath(dcid, volid), http.StatusAccepted)
-}
-
-// RestoreSnapshot restores a volume with provided snapshot
-func (c *Client) RestoreSnapshot(dcid string, volid string, snapshotID string) (*http.Header, error) {
- ret := &Header{}
- req := c.Client.R().
- SetFormData(map[string]string{"snapshotId": snapshotID}).
- SetResult(ret)
- err := c.DoWithRequest(req, resty.MethodPost, restoreSnapshotPath(dcid, volid), http.StatusAccepted)
- return ret.GetHeader(), err
-}
-
-// CreateVolumeAndWait creates a volume and waits for the request to complete.
-func (c *Client) CreateVolumeAndWait(ctx context.Context, dcid string, request Volume) (*Volume, error) {
- volume, err := c.CreateVolume(dcid, request)
- if err != nil {
- return nil, err
- }
- if err := c.WaitTillProvisionedOrCanceled(ctx, volume.Headers.Get("location")); err != nil {
- return volume, err
- }
- return c.GetVolume(dcid, volume.ID)
-}
-
-// CreateSnapshotAndWait creates a volume snapshot and waits for the request to
-// complete.
-func (c *Client) CreateSnapshotAndWait(ctx context.Context, dcId, volId, name, description string) (*Snapshot, error) {
- snapshot, err := c.CreateSnapshot(dcId, volId, name, description)
- if err != nil {
- return nil, err
- }
- if err := c.WaitTillProvisionedOrCanceled(ctx, snapshot.Headers.Get("location")); err != nil {
- return snapshot, err
- }
- return c.GetSnapshot(snapshot.ID)
-}
-
-// RestoreSnapshotAndWait restores a volume with the provided snapshot and
-// waits for the request to complete.
-func (c *Client) RestoreSnapshotAndWait(ctx context.Context, dcId, volId, snapshotId string) error {
- ret, err := c.RestoreSnapshot(dcId, volId, snapshotId)
- if err != nil {
- return err
- }
- return c.WaitTillProvisionedOrCanceled(ctx, ret.Get("location"))
-}
-
-// IsSnapshotCreationRequested checks if an active create-snapshot request (QUEUED or RUNNING)
-// exists for the given volume.
-// Even though the snapshot lock prevents mulitple requests from being processed at the same time,
-// this information is only visible by inspecting the request queue. This method can be used to
-// verify that the snapshot lock is not held by any other client request.
-func (c *Client) IsSnapshotCreationRequested(dcId, volId string) (bool, error) {
- f := NewRequestListFilter().WithUrl(createSnapshotPath(dcId, volId)).WithMethod(http.MethodPost)
- result, err := c.ListRequestsWithFilter(f.Clone().WithRequestStatus(RequestStatusQueued))
- if err != nil {
- return false, err
- }
- if len(result.Items) > 0 {
- return true, nil
- }
- result, err = c.ListRequestsWithFilter(f.Clone().WithRequestStatus(RequestStatusRunning))
- if err != nil {
- return false, err
- }
- return len(result.Items) > 0, nil
-}
diff --git a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/wait.go b/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/wait.go
deleted file mode 100644
index dadda863d..000000000
--- a/vendor/github.com/profitbricks/profitbricks-sdk-go/v5/wait.go
+++ /dev/null
@@ -1,114 +0,0 @@
-package profitbricks
-
-import (
- "errors"
- "time"
-)
-
-// ErrWaitTimeout is returned when the condition exited without success.
-var ErrWaitTimeout = errors.New("timed out waiting for the condition")
-
-// ConditionFunc returns true if the condition is satisfied, or an error
-// if the loop should be aborted.
-type ConditionFunc func() (done bool, err error)
-
-// WaitFunc creates a channel that receives an item every time a test
-// should be executed and is closed when the last test should be invoked.
-type WaitFunc func(done <-chan struct{}) <-chan struct{}
-
-func runConditionWithCrashProtection(condition ConditionFunc) (done bool, err error) {
- defer func() {
- if r := recover(); r != nil {
- done = false
- switch x := r.(type) {
- case string:
- err = errors.New(x)
- case error:
- err = x
- default:
- err = errors.New("unknown panic")
- }
- }
- }()
- done, err = condition()
- return
-}
-
-func PollImmediate(interval, timeout time.Duration, condition ConditionFunc) error {
- return pollImmediateInternal(poller(interval, timeout), condition)
-}
-
-func pollInternal(wait WaitFunc, condition ConditionFunc) error {
- done := make(chan struct{})
- defer close(done)
- return WaitFor(wait, condition, done)
-}
-
-func pollImmediateInternal(wait WaitFunc, condition ConditionFunc) error {
- done, err := runConditionWithCrashProtection(condition)
- if err != nil {
- return err
- }
- if done {
- return nil
- }
- return pollInternal(wait, condition)
-}
-
-func WaitFor(wait WaitFunc, fn ConditionFunc, done <-chan struct{}) error {
- stopCh := make(chan struct{})
- defer close(stopCh)
- c := wait(stopCh)
- for {
- select {
- case _, open := <-c:
- ok, err := runConditionWithCrashProtection(fn)
- if err != nil {
- return err
- }
- if ok {
- return nil
- }
- if !open {
- return ErrWaitTimeout
- }
- case <-done:
- return ErrWaitTimeout
- }
- }
-}
-
-func poller(interval, timeout time.Duration) WaitFunc {
- return func(done <-chan struct{}) <-chan struct{} {
- ch := make(chan struct{})
-
- go func() {
- defer close(ch)
-
- tick := time.NewTicker(interval)
- defer tick.Stop()
-
- var after <-chan time.Time
- if timeout != 0 {
- timer := time.NewTimer(timeout)
- after = timer.C
- defer timer.Stop()
- }
-
- for {
- select {
- case <-tick.C:
- select {
- case ch <- struct{}{}:
- default:
- }
- case <-after:
- return
- case <-done:
- return
- }
- }
- }()
- return ch
- }
-}
diff --git a/vendor/golang.org/x/net/publicsuffix/list.go b/vendor/golang.org/x/net/publicsuffix/list.go
deleted file mode 100644
index 200617ea8..000000000
--- a/vendor/golang.org/x/net/publicsuffix/list.go
+++ /dev/null
@@ -1,181 +0,0 @@
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-//go:generate go run gen.go
-
-// Package publicsuffix provides a public suffix list based on data from
-// https://publicsuffix.org/
-//
-// A public suffix is one under which Internet users can directly register
-// names. It is related to, but different from, a TLD (top level domain).
-//
-// "com" is a TLD (top level domain). Top level means it has no dots.
-//
-// "com" is also a public suffix. Amazon and Google have registered different
-// siblings under that domain: "amazon.com" and "google.com".
-//
-// "au" is another TLD, again because it has no dots. But it's not "amazon.au".
-// Instead, it's "amazon.com.au".
-//
-// "com.au" isn't an actual TLD, because it's not at the top level (it has
-// dots). But it is an eTLD (effective TLD), because that's the branching point
-// for domain name registrars.
-//
-// Another name for "an eTLD" is "a public suffix". Often, what's more of
-// interest is the eTLD+1, or one more label than the public suffix. For
-// example, browsers partition read/write access to HTTP cookies according to
-// the eTLD+1. Web pages served from "amazon.com.au" can't read cookies from
-// "google.com.au", but web pages served from "maps.google.com" can share
-// cookies from "www.google.com", so you don't have to sign into Google Maps
-// separately from signing into Google Web Search. Note that all four of those
-// domains have 3 labels and 2 dots. The first two domains are each an eTLD+1,
-// the last two are not (but share the same eTLD+1: "google.com").
-//
-// All of these domains have the same eTLD+1:
-// - "www.books.amazon.co.uk"
-// - "books.amazon.co.uk"
-// - "amazon.co.uk"
-// Specifically, the eTLD+1 is "amazon.co.uk", because the eTLD is "co.uk".
-//
-// There is no closed form algorithm to calculate the eTLD of a domain.
-// Instead, the calculation is data driven. This package provides a
-// pre-compiled snapshot of Mozilla's PSL (Public Suffix List) data at
-// https://publicsuffix.org/
-package publicsuffix // import "golang.org/x/net/publicsuffix"
-
-// TODO: specify case sensitivity and leading/trailing dot behavior for
-// func PublicSuffix and func EffectiveTLDPlusOne.
-
-import (
- "fmt"
- "net/http/cookiejar"
- "strings"
-)
-
-// List implements the cookiejar.PublicSuffixList interface by calling the
-// PublicSuffix function.
-var List cookiejar.PublicSuffixList = list{}
-
-type list struct{}
-
-func (list) PublicSuffix(domain string) string {
- ps, _ := PublicSuffix(domain)
- return ps
-}
-
-func (list) String() string {
- return version
-}
-
-// PublicSuffix returns the public suffix of the domain using a copy of the
-// publicsuffix.org database compiled into the library.
-//
-// icann is whether the public suffix is managed by the Internet Corporation
-// for Assigned Names and Numbers. If not, the public suffix is either a
-// privately managed domain (and in practice, not a top level domain) or an
-// unmanaged top level domain (and not explicitly mentioned in the
-// publicsuffix.org list). For example, "foo.org" and "foo.co.uk" are ICANN
-// domains, "foo.dyndns.org" and "foo.blogspot.co.uk" are private domains and
-// "cromulent" is an unmanaged top level domain.
-//
-// Use cases for distinguishing ICANN domains like "foo.com" from private
-// domains like "foo.appspot.com" can be found at
-// https://wiki.mozilla.org/Public_Suffix_List/Use_Cases
-func PublicSuffix(domain string) (publicSuffix string, icann bool) {
- lo, hi := uint32(0), uint32(numTLD)
- s, suffix, icannNode, wildcard := domain, len(domain), false, false
-loop:
- for {
- dot := strings.LastIndex(s, ".")
- if wildcard {
- icann = icannNode
- suffix = 1 + dot
- }
- if lo == hi {
- break
- }
- f := find(s[1+dot:], lo, hi)
- if f == notFound {
- break
- }
-
- u := nodes[f] >> (nodesBitsTextOffset + nodesBitsTextLength)
- icannNode = u&(1<>= nodesBitsICANN
- u = children[u&(1<>= childrenBitsLo
- hi = u & (1<>= childrenBitsHi
- switch u & (1<>= childrenBitsNodeType
- wildcard = u&(1<>= nodesBitsTextLength
- offset := x & (1<