From 3c7d1bc098e837063ac261f43571398b4d845962 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 18 Apr 2024 22:55:37 -0700 Subject: [PATCH] Update deps Signed-off-by: Tamal Saha --- go.mod | 9 +- go.sum | 55 - .../github.com/deepmap/oapi-codegen/LICENSE | 201 - .../deepmap/oapi-codegen/pkg/runtime/bind.go | 24 - .../oapi-codegen/pkg/runtime/bindparam.go | 501 - .../oapi-codegen/pkg/runtime/bindstring.go | 153 - .../oapi-codegen/pkg/runtime/deepobject.go | 357 - .../oapi-codegen/pkg/runtime/styleparam.go | 389 - .../deepmap/oapi-codegen/pkg/types/date.go | 34 - .../deepmap/oapi-codegen/pkg/types/email.go | 27 - .../deepmap/oapi-codegen/pkg/types/regexes.go | 11 - vendor/github.com/exoscale/egoscale/AUTHORS | 9 - vendor/github.com/exoscale/egoscale/LICENSE | 201 - .../egoscale/v2/anti_affinity_group.go | 139 - .../exoscale/egoscale/v2/api/api.go | 3 - .../exoscale/egoscale/v2/api/error.go | 17 - .../exoscale/egoscale/v2/api/middleware.go | 100 - .../exoscale/egoscale/v2/api/request.go | 70 - .../exoscale/egoscale/v2/api/security.go | 127 - .../github.com/exoscale/egoscale/v2/client.go | 323 - .../exoscale/egoscale/v2/client_mock.go | 1293 - .../exoscale/egoscale/v2/database.go | 320 - .../exoscale/egoscale/v2/database_mysql.go | 26 - .../exoscale/egoscale/v2/database_pg.go | 26 - .../exoscale/egoscale/v2/database_redis.go | 26 - .../exoscale/egoscale/v2/deploy_target.go | 71 - vendor/github.com/exoscale/egoscale/v2/dns.go | 260 - .../exoscale/egoscale/v2/elastic_ip.go | 333 - .../github.com/exoscale/egoscale/v2/error.go | 6 - vendor/github.com/exoscale/egoscale/v2/iam.go | 49 - .../exoscale/egoscale/v2/iam_access_key.go | 228 - .../exoscale/egoscale/v2/iam_api_key.go | 106 - .../exoscale/egoscale/v2/iam_org_policy.go | 73 - .../exoscale/egoscale/v2/iam_role.go | 289 - .../exoscale/egoscale/v2/instance.go | 912 - .../exoscale/egoscale/v2/instance_pool.go | 491 - .../exoscale/egoscale/v2/instance_type.go | 89 - .../egoscale/v2/network_load_balancer.go | 198 - .../v2/network_load_balancer_service.go | 300 - .../exoscale/egoscale/v2/oapi/.gitignore | 1 - .../exoscale/egoscale/v2/oapi/async.go | 124 - .../exoscale/egoscale/v2/oapi/oapi.gen.go | 34495 ---------------- .../exoscale/egoscale/v2/oapi/oapi.go | 42 - .../exoscale/egoscale/v2/oapi/oapi_mock.go | 21 - .../exoscale/egoscale/v2/oapi/reference.go | 18 - .../exoscale/egoscale/v2/oapi/request.go | 20 - .../exoscale/egoscale/v2/private_network.go | 313 - .../github.com/exoscale/egoscale/v2/quota.go | 51 - .../exoscale/egoscale/v2/security_group.go | 220 - .../egoscale/v2/security_group_rule.go | 268 - .../exoscale/egoscale/v2/sks_cluster.go | 500 - .../exoscale/egoscale/v2/sks_nodepool.go | 446 - .../exoscale/egoscale/v2/snapshot.go | 122 - .../exoscale/egoscale/v2/ssh_key.go | 86 - .../exoscale/egoscale/v2/template.go | 284 - .../github.com/exoscale/egoscale/v2/test.go | 5 - .../github.com/exoscale/egoscale/v2/utils.go | 18 - vendor/github.com/exoscale/egoscale/v2/v2.go | 74 - .../github.com/exoscale/egoscale/v2/zone.go | 24 - .../exoscale/egoscale/version/version.go | 5 - vendor/github.com/gofrs/uuid/.gitignore | 15 - vendor/github.com/gofrs/uuid/LICENSE | 20 - vendor/github.com/gofrs/uuid/README.md | 117 - vendor/github.com/gofrs/uuid/codec.go | 234 - vendor/github.com/gofrs/uuid/fuzz.go | 48 - vendor/github.com/gofrs/uuid/generator.go | 456 - vendor/github.com/gofrs/uuid/sql.go | 116 - vendor/github.com/gofrs/uuid/uuid.go | 285 - vendor/github.com/pmezard/go-difflib/LICENSE | 27 - .../pmezard/go-difflib/difflib/difflib.go | 772 - .../github.com/stretchr/objx/.codeclimate.yml | 21 - vendor/github.com/stretchr/objx/.gitignore | 11 - vendor/github.com/stretchr/objx/LICENSE | 22 - vendor/github.com/stretchr/objx/README.md | 80 - vendor/github.com/stretchr/objx/Taskfile.yml | 27 - vendor/github.com/stretchr/objx/accessors.go | 197 - .../github.com/stretchr/objx/conversions.go | 280 - vendor/github.com/stretchr/objx/doc.go | 66 - vendor/github.com/stretchr/objx/map.go | 214 - vendor/github.com/stretchr/objx/mutations.go | 77 - vendor/github.com/stretchr/objx/security.go | 12 - vendor/github.com/stretchr/objx/tests.go | 17 - .../github.com/stretchr/objx/type_specific.go | 346 - .../stretchr/objx/type_specific_codegen.go | 2261 - vendor/github.com/stretchr/objx/value.go | 159 - vendor/github.com/stretchr/testify/LICENSE | 21 - .../testify/assert/assertion_compare.go | 480 - .../testify/assert/assertion_format.go | 815 - .../testify/assert/assertion_format.go.tmpl | 5 - .../testify/assert/assertion_forward.go | 1621 - .../testify/assert/assertion_forward.go.tmpl | 5 - .../testify/assert/assertion_order.go | 81 - .../stretchr/testify/assert/assertions.go | 2105 - .../github.com/stretchr/testify/assert/doc.go | 46 - .../stretchr/testify/assert/errors.go | 10 - .../testify/assert/forward_assertions.go | 16 - .../testify/assert/http_assertions.go | 165 - .../github.com/stretchr/testify/mock/doc.go | 44 - .../github.com/stretchr/testify/mock/mock.go | 1241 - vendor/modules.txt | 26 +- .../provider/exoscale/exoscale.go | 344 - 101 files changed, 4 insertions(+), 57884 deletions(-) delete mode 100644 vendor/github.com/deepmap/oapi-codegen/LICENSE delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bind.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindparam.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindstring.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/runtime/deepobject.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/runtime/styleparam.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/types/date.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/types/email.go delete mode 100644 vendor/github.com/deepmap/oapi-codegen/pkg/types/regexes.go delete mode 100644 vendor/github.com/exoscale/egoscale/AUTHORS delete mode 100644 vendor/github.com/exoscale/egoscale/LICENSE delete mode 100644 vendor/github.com/exoscale/egoscale/v2/anti_affinity_group.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/api/api.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/api/error.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/api/middleware.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/api/request.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/api/security.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/client.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/client_mock.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/database.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/database_mysql.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/database_pg.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/database_redis.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/deploy_target.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/dns.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/elastic_ip.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/error.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/iam.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/iam_access_key.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/iam_api_key.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/iam_org_policy.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/iam_role.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/instance.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/instance_pool.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/instance_type.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/network_load_balancer.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/network_load_balancer_service.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/.gitignore delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/async.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/oapi.gen.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/oapi.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/oapi_mock.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/reference.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/oapi/request.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/private_network.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/quota.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/security_group.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/security_group_rule.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/sks_cluster.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/sks_nodepool.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/snapshot.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/ssh_key.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/template.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/test.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/utils.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/v2.go delete mode 100644 vendor/github.com/exoscale/egoscale/v2/zone.go delete mode 100644 vendor/github.com/exoscale/egoscale/version/version.go delete mode 100644 vendor/github.com/gofrs/uuid/.gitignore delete mode 100644 vendor/github.com/gofrs/uuid/LICENSE delete mode 100644 vendor/github.com/gofrs/uuid/README.md delete mode 100644 vendor/github.com/gofrs/uuid/codec.go delete mode 100644 vendor/github.com/gofrs/uuid/fuzz.go delete mode 100644 vendor/github.com/gofrs/uuid/generator.go delete mode 100644 vendor/github.com/gofrs/uuid/sql.go delete mode 100644 vendor/github.com/gofrs/uuid/uuid.go delete mode 100644 vendor/github.com/pmezard/go-difflib/LICENSE delete mode 100644 vendor/github.com/pmezard/go-difflib/difflib/difflib.go delete mode 100644 vendor/github.com/stretchr/objx/.codeclimate.yml delete mode 100644 vendor/github.com/stretchr/objx/.gitignore delete mode 100644 vendor/github.com/stretchr/objx/LICENSE delete mode 100644 vendor/github.com/stretchr/objx/README.md delete mode 100644 vendor/github.com/stretchr/objx/Taskfile.yml delete mode 100644 vendor/github.com/stretchr/objx/accessors.go delete mode 100644 vendor/github.com/stretchr/objx/conversions.go delete mode 100644 vendor/github.com/stretchr/objx/doc.go delete mode 100644 vendor/github.com/stretchr/objx/map.go delete mode 100644 vendor/github.com/stretchr/objx/mutations.go delete mode 100644 vendor/github.com/stretchr/objx/security.go delete mode 100644 vendor/github.com/stretchr/objx/tests.go delete mode 100644 vendor/github.com/stretchr/objx/type_specific.go delete mode 100644 vendor/github.com/stretchr/objx/type_specific_codegen.go delete mode 100644 vendor/github.com/stretchr/objx/value.go delete mode 100644 vendor/github.com/stretchr/testify/LICENSE delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_compare.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl delete mode 100644 vendor/github.com/stretchr/testify/assert/assertion_order.go delete mode 100644 vendor/github.com/stretchr/testify/assert/assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/doc.go delete mode 100644 vendor/github.com/stretchr/testify/assert/errors.go delete mode 100644 vendor/github.com/stretchr/testify/assert/forward_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/assert/http_assertions.go delete mode 100644 vendor/github.com/stretchr/testify/mock/doc.go delete mode 100644 vendor/github.com/stretchr/testify/mock/mock.go delete mode 100644 vendor/sigs.k8s.io/external-dns/provider/exoscale/exoscale.go diff --git a/go.mod b/go.mod index ccbc0573..f25b8e92 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.22.0 toolchain go1.22.2 require ( + github.com/aws/aws-sdk-go v1.51.14 github.com/google/gofuzz v1.2.0 github.com/onsi/ginkgo v1.16.5 github.com/onsi/gomega v1.31.1 @@ -51,7 +52,6 @@ require ( github.com/ans-group/go-durationstring v1.2.0 // indirect github.com/ans-group/sdk-go v1.17.0 // indirect github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect - github.com/aws/aws-sdk-go v1.51.14 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bodgit/tsig v1.2.2 // indirect @@ -62,14 +62,12 @@ require ( github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/datawire/ambassador v1.12.4 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/deepmap/oapi-codegen v1.9.1 // indirect github.com/denverdino/aliyungo v0.0.0-20230411124812-ab98a9173ace // indirect github.com/digitalocean/godo v1.111.0 // indirect github.com/dnsimple/dnsimple-go v1.7.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch v5.7.0+incompatible // indirect github.com/evanphx/json-patch/v5 v5.8.0 // indirect - github.com/exoscale/egoscale v0.102.3 // indirect github.com/fatih/structs v1.1.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/ffledgling/pdns-go v0.0.0-20180219074714-524e7daccd99 // indirect @@ -90,7 +88,6 @@ require ( github.com/go-resty/resty/v2 v2.12.0 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/gofrs/flock v0.8.1 // indirect - github.com/gofrs/uuid v4.4.0+incompatible // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -105,6 +102,7 @@ require ( github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/gophercloud/gophercloud v1.11.0 // indirect + github.com/gorilla/mux v1.8.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect @@ -153,7 +151,6 @@ require ( github.com/pelletier/go-toml/v2 v2.1.0 // indirect github.com/peterhellberg/link v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/projectcontour/contour v1.28.2 // indirect github.com/prometheus/client_golang v1.19.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect @@ -172,8 +169,6 @@ require ( github.com/spf13/cast v1.5.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.17.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect - github.com/stretchr/testify v1.9.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/terra-farm/udnssdk v1.3.5 // indirect github.com/transip/gotransip/v6 v6.23.0 // indirect diff --git a/go.sum b/go.sum index e675f6a4..ea9cad9b 100644 --- a/go.sum +++ b/go.sum @@ -991,7 +991,6 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4= github.com/datawire/ambassador v1.12.4 h1:g+agFHayLqETkCgFgEQi9qk4zakE0UAhgK8xVUEcDDI= github.com/datawire/ambassador v1.12.4/go.mod h1:2grBLdYgILzrgTpenDMB5OeyhObIUaT+KwkLkZI1KDE= @@ -1002,10 +1001,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1:dv4zxwHi5C/8AeI+4gX4dCWOIvNi7I6JCSX0HvlKPgE= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= -github.com/deepmap/oapi-codegen v1.9.1 h1:yHmEnA7jSTUMQgV+uN02WpZtwHnz2CBW3mZRIxr1vtI= -github.com/deepmap/oapi-codegen v1.9.1/go.mod h1:PLqNAhdedP8ttRpBBkzLKU3bp+Fpy+tTgeAMlztR2cw= github.com/deislabs/oras v0.8.1/go.mod h1:Mx0rMSbBNaNfY9hjpccEnxkOqJL6KGjtxNHPLC4G4As= github.com/denisenkom/go-mssqldb v0.0.0-20191001013358-cfbb681360f0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= @@ -1081,8 +1076,6 @@ github.com/evanphx/json-patch v5.7.0+incompatible h1:vgGkfT/9f8zE6tvSCe74nfpAVDQ github.com/evanphx/json-patch v5.7.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch/v5 v5.8.0 h1:lRj6N9Nci7MvzrXuX6HFzU8XjmhPiXPlsKEy1u0KQro= github.com/evanphx/json-patch/v5 v5.8.0/go.mod h1:VNkHZ/282BpEyt/tObQO8s5CMPmYYq14uClGH4abBuQ= -github.com/exoscale/egoscale v0.102.3 h1:DYqN2ipoLKpiFoprRGQkp2av/Ze7sUYYlGhi1N62tfY= -github.com/exoscale/egoscale v0.102.3/go.mod h1:RPf2Gah6up+6kAEayHTQwqapzXlm93f0VQas/UEGU5c= github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d/go.mod h1:ZZMPRZwes7CROmyNKgQzC3XPs6L/G2EJLHddWejkmf4= github.com/fatih/camelcase v1.0.0/go.mod h1:yN2Sb0lFhZJUdVvtELVWefmrXpuZESvPmqwoZc+/fpc= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= @@ -1109,14 +1102,10 @@ github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyT github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= -github.com/getkin/kin-openapi v0.87.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= github.com/go-fonts/liberation v0.1.1/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= @@ -1171,7 +1160,6 @@ github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwds github.com/go-openapi/jsonpointer v0.18.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= @@ -1216,19 +1204,12 @@ github.com/go-openapi/validate v0.19.2/go.mod h1:1tRCw7m3jtI8eNWEEliiAqUIcBztB2K github.com/go-openapi/validate v0.19.5/go.mod h1:8DJv2CVJQ6kGNpFW6eV9N3JviE1C85nY1c2z52x1Gk4= github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= -github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-playground/validator/v10 v10.18.0 h1:BvolUXjp4zuvkZ5YN5t7ebzbhlUtPsPm2S9NAZ5nl9U= github.com/go-playground/validator/v10 v10.18.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM= github.com/go-resty/resty/v2 v2.12.0 h1:rsVL8P90LFvkUYq/V5BTVe203WfRIU4gvcf+yfzJzGA= @@ -1248,7 +1229,6 @@ github.com/gobuffalo/logger v1.0.1/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8z github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= github.com/gobuffalo/packr/v2 v2.7.1/go.mod h1:qYEvAazPaVxy7Y7KR0W8qYEE+RymX74kETFqjFoFlOc= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= -github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= @@ -1258,8 +1238,6 @@ github.com/godror/godror v0.13.3/go.mod h1:2ouUT4kdhUBk7TAkHWD4SN0CdI0pgEQbo8FVH github.com/gofrs/flock v0.7.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= -github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= -github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -1268,7 +1246,6 @@ github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw= @@ -1321,7 +1298,6 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/golangplus/bytes v0.0.0-20160111154220-45c989fe5450/go.mod h1:Bk6SMAONeMXrxql8uvOKuAZSu8aM5RUGv+1C6IJaEho= github.com/golangplus/fmt v0.0.0-20150411045040-2a5d6d7d2995/go.mod h1:lJgMEyOkYFkPcDKwRXegd+iM6E7matEszMG5HhwytU8= github.com/golangplus/testing v0.0.0-20180327235837-af21d9c3145e/go.mod h1:0AA//k/eakGydO4jKRoRL2j92ZKSzTgj9tclaCrvXHk= @@ -1601,21 +1577,10 @@ github.com/kubeops/external-dns v0.14.2-0.20240410014852-72743e265ef6 h1:XOD6NMe github.com/kubeops/external-dns v0.14.2-0.20240410014852-72743e265ef6/go.mod h1:3KbtLqQMgpTf6c0xPXcAPxkANFBkBiJngZEANrDXYxQ= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.6.3/go.mod h1:Hk5OiHj0kDqmFq7aHe7eDqI7CUhuCrfpupQtLGGLm7A= -github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= -github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= -github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= -github.com/lestrrat-go/codegen v1.0.2/go.mod h1:JhJw6OQAuPEfVKUCLItpaVLumDGWQznd1VaXrBk9TdM= -github.com/lestrrat-go/httpcc v1.0.0/go.mod h1:tGS/u00Vh5N6FHNkExqGGNId8e0Big+++0Gf8MBnAvE= -github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= -github.com/lestrrat-go/jwx v1.2.7/go.mod h1:bw24IXWbavc0R2RsOtpXL7RtMyP589yZ1+L7kd09ZGA= -github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1650,17 +1615,14 @@ github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ github.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11 h1:YFh+sjyJTMQSYjKwM4dFKhJPJC/wfo98tPUc17HdoYw= github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11/go.mod h1:Ah2dBMoxZEqk118as2T4u4fjfXarE0pPnMJaArZQZsI= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -1943,7 +1905,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.4.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= @@ -2078,19 +2039,13 @@ github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMW github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ultradns/ultradns-sdk-go v1.3.7 h1:P4CaM+npeXIybbLL27ezR316NnyILI1Y8IvfZtNE+Co= github.com/ultradns/ultradns-sdk-go v1.3.7/go.mod h1:43vmy6GEvRuVMpGEWfJ/JoEM6RIqUQI1/tb8JqZR1zI= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vinyldns/go-vinyldns v0.9.16 h1:GZJStDkcCk1F1AcRc64LuuMh+ENL8pHA0CVd4ulRMcQ= github.com/vinyldns/go-vinyldns v0.9.16/go.mod h1:5qIJOdmzAnatKjurI+Tl4uTus7GJKJxb+zitufjHs3Q= @@ -2245,10 +2200,7 @@ golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201217014255-9d1352758620/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220314234659-1baeb1ce4c0b/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= @@ -2391,7 +2343,6 @@ golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210913180222-943fd674d43e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211123203042-d83791d6bcd9/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2569,10 +2520,8 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -2614,7 +2563,6 @@ golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -2661,7 +2609,6 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2730,7 +2677,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20200918232735-d647fc253266/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -2739,7 +2685,6 @@ golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4f golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210114065538-d78b04bdf963/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= diff --git a/vendor/github.com/deepmap/oapi-codegen/LICENSE b/vendor/github.com/deepmap/oapi-codegen/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/LICENSE +++ /dev/null @@ -1,201 +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 [yyyy] [name of copyright owner] - - 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/deepmap/oapi-codegen/pkg/runtime/bind.go b/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bind.go deleted file mode 100644 index 3e2a689c..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bind.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2021 DeepMap, Inc. -// -// 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. -package runtime - -// Binder is the interface implemented by types that can be bound to a query string or a parameter string -// The input can be assumed to be a valid string. If you define a Bind method you are responsible for all -// data being completely bound to the type. -// -// By convention, to approximate the behavior of Bind functions themselves, -// Binder implements Bind("") as a no-op. -type Binder interface { - Bind(src string) error -} \ No newline at end of file diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindparam.go b/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindparam.go deleted file mode 100644 index 3148c3a0..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindparam.go +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright 2019 DeepMap, Inc. -// -// 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. -package runtime - -import ( - "encoding" - "encoding/json" - "errors" - "fmt" - "net/url" - "reflect" - "strings" - "time" - - "github.com/deepmap/oapi-codegen/pkg/types" -) - -// This function binds a parameter as described in the Path Parameters -// section here to a Go object: -// https://swagger.io/docs/specification/serialization/ -// It is a backward compatible function to clients generated with codegen -// up to version v1.5.5. v1.5.6+ calls the function below. -func BindStyledParameter(style string, explode bool, paramName string, - value string, dest interface{}) error { - return BindStyledParameterWithLocation(style, explode, paramName, ParamLocationUndefined, value, dest) -} - -// This function binds a parameter as described in the Path Parameters -// section here to a Go object: -// https://swagger.io/docs/specification/serialization/ -func BindStyledParameterWithLocation(style string, explode bool, paramName string, - paramLocation ParamLocation, value string, dest interface{}) error { - - if value == "" { - return fmt.Errorf("parameter '%s' is empty, can't bind its value", paramName) - } - - // Based on the location of the parameter, we need to unescape it properly. - var err error - switch paramLocation { - case ParamLocationQuery, ParamLocationUndefined: - // We unescape undefined parameter locations here for older generated code, - // since prior to this refactoring, they always query unescaped. - value, err = url.QueryUnescape(value) - if err != nil { - return fmt.Errorf("error unescaping query parameter '%s': %v", paramName, err) - } - case ParamLocationPath: - value, err = url.PathUnescape(value) - if err != nil { - return fmt.Errorf("error unescaping path parameter '%s': %v", paramName, err) - } - default: - // Headers and cookies aren't escaped. - } - - // If the destination implements encoding.TextUnmarshaler we use it for binding - if tu, ok := dest.(encoding.TextUnmarshaler); ok { - if err := tu.UnmarshalText([]byte(value)); err != nil { - return fmt.Errorf("error unmarshaling '%s' text as %T: %s", value, dest, err) - } - - return nil - } - - // Everything comes in by pointer, dereference it - v := reflect.Indirect(reflect.ValueOf(dest)) - - // This is the basic type of the destination object. - t := v.Type() - - if t.Kind() == reflect.Struct { - // We've got a destination object, we'll create a JSON representation - // of the input value, and let the json library deal with the unmarshaling - parts, err := splitStyledParameter(style, explode, true, paramName, value) - if err != nil { - return err - } - - return bindSplitPartsToDestinationStruct(paramName, parts, explode, dest) - } - - if t.Kind() == reflect.Slice { - // Chop up the parameter into parts based on its style - parts, err := splitStyledParameter(style, explode, false, paramName, value) - if err != nil { - return fmt.Errorf("error splitting input '%s' into parts: %s", value, err) - } - - return bindSplitPartsToDestinationArray(parts, dest) - } - - // Try to bind the remaining types as a base type. - return BindStringToObject(value, dest) -} - -// This is a complex set of operations, but each given parameter style can be -// packed together in multiple ways, using different styles of separators, and -// different packing strategies based on the explode flag. This function takes -// as input any parameter format, and unpacks it to a simple list of strings -// or key-values which we can then treat generically. -// Why, oh why, great Swagger gods, did you have to make this so complicated? -func splitStyledParameter(style string, explode bool, object bool, paramName string, value string) ([]string, error) { - switch style { - case "simple": - // In the simple case, we always split on comma - parts := strings.Split(value, ",") - return parts, nil - case "label": - // In the label case, it's more tricky. In the no explode case, we have - // /users/.3,4,5 for arrays - // /users/.role,admin,firstName,Alex for objects - // in the explode case, we have: - // /users/.3.4.5 - // /users/.role=admin.firstName=Alex - if explode { - // In the exploded case, split everything on periods. - parts := strings.Split(value, ".") - // The first part should be an empty string because we have a - // leading period. - if parts[0] != "" { - return nil, fmt.Errorf("invalid format for label parameter '%s', should start with '.'", paramName) - } - return parts[1:], nil - - } else { - // In the unexploded case, we strip off the leading period. - if value[0] != '.' { - return nil, fmt.Errorf("invalid format for label parameter '%s', should start with '.'", paramName) - } - // The rest is comma separated. - return strings.Split(value[1:], ","), nil - } - - case "matrix": - if explode { - // In the exploded case, we break everything up on semicolon - parts := strings.Split(value, ";") - // The first part should always be empty string, since we started - // with ;something - if parts[0] != "" { - return nil, fmt.Errorf("invalid format for matrix parameter '%s', should start with ';'", paramName) - } - parts = parts[1:] - // Now, if we have an object, we just have a list of x=y statements. - // for a non-object, like an array, we have id=x, id=y. id=z, etc, - // so we need to strip the prefix from each of them. - if !object { - prefix := paramName + "=" - for i := range parts { - parts[i] = strings.TrimPrefix(parts[i], prefix) - } - } - return parts, nil - } else { - // In the unexploded case, parameters will start with ;paramName= - prefix := ";" + paramName + "=" - if !strings.HasPrefix(value, prefix) { - return nil, fmt.Errorf("expected parameter '%s' to start with %s", paramName, prefix) - } - str := strings.TrimPrefix(value, prefix) - return strings.Split(str, ","), nil - } - case "form": - var parts []string - if explode { - parts = strings.Split(value, "&") - if !object { - prefix := paramName + "=" - for i := range parts { - parts[i] = strings.TrimPrefix(parts[i], prefix) - } - } - return parts, nil - } else { - parts = strings.Split(value, ",") - prefix := paramName + "=" - for i := range parts { - parts[i] = strings.TrimPrefix(parts[i], prefix) - } - } - return parts, nil - } - - return nil, fmt.Errorf("unhandled parameter style: %s", style) -} - -// Given a set of values as a slice, create a slice to hold them all, and -// assign to each one by one. -func bindSplitPartsToDestinationArray(parts []string, dest interface{}) error { - // Everything comes in by pointer, dereference it - v := reflect.Indirect(reflect.ValueOf(dest)) - - // This is the basic type of the destination object. - t := v.Type() - - // We've got a destination array, bind each object one by one. - // This generates a slice of the correct element type and length to - // hold all the parts. - newArray := reflect.MakeSlice(t, len(parts), len(parts)) - for i, p := range parts { - err := BindStringToObject(p, newArray.Index(i).Addr().Interface()) - if err != nil { - return fmt.Errorf("error setting array element: %s", err) - } - } - v.Set(newArray) - return nil -} - -// Given a set of chopped up parameter parts, bind them to a destination -// struct. The exploded parameter controls whether we send key value pairs -// in the exploded case, or a sequence of values which are interpreted as -// tuples. -// Given the struct Id { firstName string, role string }, as in the canonical -// swagger examples, in the exploded case, we would pass -// ["firstName=Alex", "role=admin"], where in the non-exploded case, we would -// pass "firstName", "Alex", "role", "admin"] -// -// We punt the hard work of binding these values to the object to the json -// library. We'll turn those arrays into JSON strings, and unmarshal -// into the struct. -func bindSplitPartsToDestinationStruct(paramName string, parts []string, explode bool, dest interface{}) error { - // We've got a destination object, we'll create a JSON representation - // of the input value, and let the json library deal with the unmarshaling - var fields []string - if explode { - fields = make([]string, len(parts)) - for i, property := range parts { - propertyParts := strings.Split(property, "=") - if len(propertyParts) != 2 { - return fmt.Errorf("parameter '%s' has invalid exploded format", paramName) - } - fields[i] = "\"" + propertyParts[0] + "\":\"" + propertyParts[1] + "\"" - } - } else { - if len(parts)%2 != 0 { - return fmt.Errorf("parameter '%s' has invalid format, property/values need to be pairs", paramName) - } - fields = make([]string, len(parts)/2) - for i := 0; i < len(parts); i += 2 { - key := parts[i] - value := parts[i+1] - fields[i/2] = "\"" + key + "\":\"" + value + "\"" - } - } - jsonParam := "{" + strings.Join(fields, ",") + "}" - err := json.Unmarshal([]byte(jsonParam), dest) - if err != nil { - return fmt.Errorf("error binding parameter %s fields: %s", paramName, err) - } - return nil -} - -// This works much like BindStyledParameter, however it takes a query argument -// input array from the url package, since query arguments come through a -// different path than the styled arguments. They're also exceptionally fussy. -// For example, consider the exploded and unexploded form parameter examples: -// (exploded) /users?role=admin&firstName=Alex -// (unexploded) /users?id=role,admin,firstName,Alex -// -// In the first case, we can pull the "id" parameter off the context, -// and unmarshal via json as an intermediate. Easy. In the second case, we -// don't have the id QueryParam present, but must find "role", and "firstName". -// what if there is another parameter similar to "ID" named "role"? We can't -// tell them apart. This code tries to fail, but the moral of the story is that -// you shouldn't pass objects via form styled query arguments, just use -// the Content parameter form. -func BindQueryParameter(style string, explode bool, required bool, paramName string, - queryParams url.Values, dest interface{}) error { - - // dv = destination value. - dv := reflect.Indirect(reflect.ValueOf(dest)) - - // intermediate value form which is either dv or dv dereferenced. - v := dv - - // inner code will bind the string's value to this interface. - var output interface{} - - if required { - // If the parameter is required, then the generated code will pass us - // a pointer to it: &int, &object, and so forth. We can directly set - // them. - output = dest - } else { - // For optional parameters, we have an extra indirect. An optional - // parameter of type "int" will be *int on the struct. We pass that - // in by pointer, and have **int. - - // If the destination, is a nil pointer, we need to allocate it. - if v.IsNil() { - t := v.Type() - newValue := reflect.New(t.Elem()) - // for now, hang onto the output buffer separately from destination, - // as we don't want to write anything to destination until we can - // unmarshal successfully, and check whether a field is required. - output = newValue.Interface() - } else { - // If the destination isn't nil, just use that. - output = v.Interface() - } - - // Get rid of that extra indirect as compared to the required case, - // so the code below doesn't have to care. - v = reflect.Indirect(reflect.ValueOf(output)) - } - - // This is the basic type of the destination object. - t := v.Type() - k := t.Kind() - - switch style { - case "form": - var parts []string - if explode { - // ok, the explode case in query arguments is very, very annoying, - // because an exploded object, such as /users?role=admin&firstName=Alex - // isn't actually present in the parameter array. We have to do - // different things based on destination type. - values, found := queryParams[paramName] - var err error - - switch k { - case reflect.Slice: - // In the slice case, we simply use the arguments provided by - // http library. - if !found { - if required { - return fmt.Errorf("query parameter '%s' is required", paramName) - } else { - return nil - } - } - err = bindSplitPartsToDestinationArray(values, output) - case reflect.Struct: - // This case is really annoying, and error prone, but the - // form style object binding doesn't tell us which arguments - // in the query string correspond to the object's fields. We'll - // try to bind field by field. - err = bindParamsToExplodedObject(paramName, queryParams, output) - default: - // Primitive object case. We expect to have 1 value to - // unmarshal. - if len(values) == 0 { - if required { - return fmt.Errorf("query parameter '%s' is required", paramName) - } else { - return nil - } - } - if len(values) != 1 { - return fmt.Errorf("multiple values for single value parameter '%s'", paramName) - } - err = BindStringToObject(values[0], output) - } - if err != nil { - return err - } - // If the parameter is required, and we've successfully unmarshaled - // it, this assigns the new object to the pointer pointer. - if !required { - dv.Set(reflect.ValueOf(output)) - } - return nil - } else { - values, found := queryParams[paramName] - if !found { - if required { - return fmt.Errorf("query parameter '%s' is required", paramName) - } else { - return nil - } - } - if len(values) != 1 { - return fmt.Errorf("parameter '%s' is not exploded, but is specified multiple times", paramName) - } - parts = strings.Split(values[0], ",") - } - var err error - switch k { - case reflect.Slice: - err = bindSplitPartsToDestinationArray(parts, output) - case reflect.Struct: - err = bindSplitPartsToDestinationStruct(paramName, parts, explode, output) - default: - if len(parts) == 0 { - if required { - return fmt.Errorf("query parameter '%s' is required", paramName) - } else { - return nil - } - } - if len(parts) != 1 { - return fmt.Errorf("multiple values for single value parameter '%s'", paramName) - } - err = BindStringToObject(parts[0], output) - } - if err != nil { - return err - } - if !required { - dv.Set(reflect.ValueOf(output)) - } - return nil - case "deepObject": - if !explode { - return errors.New("deepObjects must be exploded") - } - return UnmarshalDeepObject(dest, paramName, queryParams) - case "spaceDelimited", "pipeDelimited": - return fmt.Errorf("query arguments of style '%s' aren't yet supported", style) - default: - return fmt.Errorf("style '%s' on parameter '%s' is invalid", style, paramName) - - } -} - -// This function reflects the destination structure, and pulls the value for -// each settable field from the given parameters map. This is to deal with the -// exploded form styled object which may occupy any number of parameter names. -// We don't try to be smart here, if the field exists as a query argument, -// set its value. -func bindParamsToExplodedObject(paramName string, values url.Values, dest interface{}) error { - // Dereference pointers to their destination values - binder, v, t := indirect(dest) - if binder != nil { - return BindStringToObject(values.Get(paramName), dest) - } - if t.Kind() != reflect.Struct { - return fmt.Errorf("unmarshaling query arg '%s' into wrong type", paramName) - } - - for i := 0; i < t.NumField(); i++ { - fieldT := t.Field(i) - - // Skip unsettable fields, such as internal ones. - if !v.Field(i).CanSet() { - continue - } - - // Find the json annotation on the field, and use the json specified - // name if available, otherwise, just the field name. - tag := fieldT.Tag.Get("json") - fieldName := fieldT.Name - if tag != "" { - tagParts := strings.Split(tag, ",") - name := tagParts[0] - if name != "" { - fieldName = name - } - } - - // At this point, we look up field name in the parameter list. - fieldVal, found := values[fieldName] - if found { - if len(fieldVal) != 1 { - return fmt.Errorf("field '%s' specified multiple times for param '%s'", fieldName, paramName) - } - err := BindStringToObject(fieldVal[0], v.Field(i).Addr().Interface()) - if err != nil { - return fmt.Errorf("could not bind query arg '%s' to request object: %s'", paramName, err) - } - } - } - return nil -} - -// indirect -func indirect(dest interface{}) (interface{}, reflect.Value, reflect.Type) { - v := reflect.ValueOf(dest) - if v.Type().NumMethod() > 0 && v.CanInterface() { - if u, ok := v.Interface().(Binder); ok { - return u, reflect.Value{}, nil - } - } - v = reflect.Indirect(v) - t := v.Type() - // special handling for custom types which might look like an object. We - // don't want to use object binding on them, but rather treat them as - // primitive types. time.Time{} is a unique case since we can't add a Binder - // to it without changing the underlying generated code. - if t.ConvertibleTo(reflect.TypeOf(time.Time{})) { - return dest, reflect.Value{}, nil - } - if t.ConvertibleTo(reflect.TypeOf(types.Date{})) { - return dest, reflect.Value{}, nil - } - return nil, v, t -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindstring.go b/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindstring.go deleted file mode 100644 index 6af8c94d..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/bindstring.go +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2019 DeepMap, Inc. -// -// 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. -package runtime - -import ( - "errors" - "fmt" - "reflect" - "strconv" - "time" - - "github.com/deepmap/oapi-codegen/pkg/types" -) - -// This function takes a string, and attempts to assign it to the destination -// interface via whatever type conversion is necessary. We have to do this -// via reflection instead of a much simpler type switch so that we can handle -// type aliases. This function was the easy way out, the better way, since we -// know the destination type each place that we use this, is to generate code -// to read each specific type. -func BindStringToObject(src string, dst interface{}) error { - var err error - - v := reflect.ValueOf(dst) - t := reflect.TypeOf(dst) - - // We need to dereference pointers - if t.Kind() == reflect.Ptr { - v = reflect.Indirect(v) - t = v.Type() - } - - // For some optioinal args - if t.Kind() == reflect.Ptr { - if v.IsNil() { - v.Set(reflect.New(t.Elem())) - } - - v = reflect.Indirect(v) - t = v.Type() - } - - // The resulting type must be settable. reflect will catch issues like - // passing the destination by value. - if !v.CanSet() { - return errors.New("destination is not settable") - } - - switch t.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - var val int64 - val, err = strconv.ParseInt(src, 10, 64) - if err == nil { - v.SetInt(val) - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: - var val uint64 - val, err = strconv.ParseUint(src, 10, 64) - if err == nil { - v.SetUint(val) - } - case reflect.String: - v.SetString(src) - err = nil - case reflect.Float64, reflect.Float32: - var val float64 - val, err = strconv.ParseFloat(src, 64) - if err == nil { - v.SetFloat(val) - } - case reflect.Bool: - var val bool - val, err = strconv.ParseBool(src) - if err == nil { - v.SetBool(val) - } - case reflect.Struct: - // if this is not of type Time or of type Date look to see if this is of type Binder. - if dstType, ok := dst.(Binder); ok { - return dstType.Bind(src) - } - - if t.ConvertibleTo(reflect.TypeOf(time.Time{})) { - // Don't fail on empty string. - if src == "" { - return nil - } - // Time is a special case of a struct that we handle - parsedTime, err := time.Parse(time.RFC3339Nano, src) - if err != nil { - parsedTime, err = time.Parse(types.DateFormat, src) - if err != nil { - return fmt.Errorf("error parsing '%s' as RFC3339 or 2006-01-02 time: %s", src, err) - } - } - // So, assigning this gets a little fun. We have a value to the - // dereference destination. We can't do a conversion to - // time.Time because the result isn't assignable, so we need to - // convert pointers. - if t != reflect.TypeOf(time.Time{}) { - vPtr := v.Addr() - vtPtr := vPtr.Convert(reflect.TypeOf(&time.Time{})) - v = reflect.Indirect(vtPtr) - } - v.Set(reflect.ValueOf(parsedTime)) - return nil - } - - if t.ConvertibleTo(reflect.TypeOf(types.Date{})) { - // Don't fail on empty string. - if src == "" { - return nil - } - parsedTime, err := time.Parse(types.DateFormat, src) - if err != nil { - return fmt.Errorf("error parsing '%s' as date: %s", src, err) - } - parsedDate := types.Date{Time: parsedTime} - - // We have to do the same dance here to assign, just like with times - // above. - if t != reflect.TypeOf(types.Date{}) { - vPtr := v.Addr() - vtPtr := vPtr.Convert(reflect.TypeOf(&types.Date{})) - v = reflect.Indirect(vtPtr) - } - v.Set(reflect.ValueOf(parsedDate)) - return nil - } - - // We fall through to the error case below if we haven't handled the - // destination type above. - fallthrough - default: - // We've got a bunch of types unimplemented, don't fail silently. - err = fmt.Errorf("can not bind to destination of type: %s", t.Kind()) - } - if err != nil { - return fmt.Errorf("error binding string parameter: %s", err) - } - return nil -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/deepobject.go b/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/deepobject.go deleted file mode 100644 index 54fc1631..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/deepobject.go +++ /dev/null @@ -1,357 +0,0 @@ -package runtime - -import ( - "encoding/json" - "errors" - "fmt" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/deepmap/oapi-codegen/pkg/types" -) - -func marshalDeepObject(in interface{}, path []string) ([]string, error) { - var result []string - - switch t := in.(type) { - case []interface{}: - // For the array, we will use numerical subscripts of the form [x], - // in the same order as the array. - for i, iface := range t { - newPath := append(path, strconv.Itoa(i)) - fields, err := marshalDeepObject(iface, newPath) - if err != nil { - return nil, fmt.Errorf("error traversing array: %w", err) - } - result = append(result, fields...) - } - case map[string]interface{}: - // For a map, each key (field name) becomes a member of the path, and - // we recurse. First, sort the keys. - keys := make([]string, len(t)) - i := 0 - for k := range t { - keys[i] = k - i++ - } - sort.Strings(keys) - - // Now, for each key, we recursively marshal it. - for _, k := range keys { - newPath := append(path, k) - fields, err := marshalDeepObject(t[k], newPath) - if err != nil { - return nil, fmt.Errorf("error traversing map: %w", err) - } - result = append(result, fields...) - } - default: - // Now, for a concrete value, we will turn the path elements - // into a deepObject style set of subscripts. [a, b, c] turns into - // [a][b][c] - prefix := "[" + strings.Join(path, "][") + "]" - result = []string{ - prefix + fmt.Sprintf("=%v", t), - } - } - return result, nil -} - -func MarshalDeepObject(i interface{}, paramName string) (string, error) { - // We're going to marshal to JSON and unmarshal into an interface{}, - // which will use the json pkg to deal with all the field annotations. We - // can then walk the generic object structure to produce a deepObject. This - // isn't efficient and it would be more efficient to reflect on our own, - // but it's complicated, error-prone code. - buf, err := json.Marshal(i) - if err != nil { - return "", fmt.Errorf("failed to marshal input to JSON: %w", err) - } - var i2 interface{} - err = json.Unmarshal(buf, &i2) - if err != nil { - return "", fmt.Errorf("failed to unmarshal JSON: %w", err) - } - fields, err := marshalDeepObject(i2, nil) - if err != nil { - return "", fmt.Errorf("error traversing JSON structure: %w", err) - } - - // Prefix the param name to each subscripted field. - for i := range fields { - fields[i] = paramName + fields[i] - } - return strings.Join(fields, "&"), nil -} - -type fieldOrValue struct { - fields map[string]fieldOrValue - value string -} - -func (f *fieldOrValue) appendPathValue(path []string, value string) { - fieldName := path[0] - if len(path) == 1 { - f.fields[fieldName] = fieldOrValue{value: value} - return - } - - pv, found := f.fields[fieldName] - if !found { - pv = fieldOrValue{ - fields: make(map[string]fieldOrValue), - } - f.fields[fieldName] = pv - } - pv.appendPathValue(path[1:], value) -} - -func makeFieldOrValue(paths [][]string, values []string) fieldOrValue { - - f := fieldOrValue{ - fields: make(map[string]fieldOrValue), - } - for i := range paths { - path := paths[i] - value := values[i] - f.appendPathValue(path, value) - } - return f -} - -func UnmarshalDeepObject(dst interface{}, paramName string, params url.Values) error { - // Params are all the query args, so we need those that look like - // "paramName["... - var fieldNames []string - var fieldValues []string - searchStr := paramName + "[" - for pName, pValues := range params { - if strings.HasPrefix(pName, searchStr) { - // trim the parameter name from the full name. - pName = pName[len(paramName):] - fieldNames = append(fieldNames, pName) - if len(pValues) != 1 { - return fmt.Errorf("%s has multiple values", pName) - } - fieldValues = append(fieldValues, pValues[0]) - } - } - - // Now, for each field, reconstruct its subscript path and value - paths := make([][]string, len(fieldNames)) - for i, path := range fieldNames { - path = strings.TrimLeft(path, "[") - path = strings.TrimRight(path, "]") - paths[i] = strings.Split(path, "][") - } - - fieldPaths := makeFieldOrValue(paths, fieldValues) - err := assignPathValues(dst, fieldPaths) - if err != nil { - return fmt.Errorf("error assigning value to destination: %w", err) - } - - return nil -} - -// This returns a field name, either using the variable name, or the json -// annotation if that exists. -func getFieldName(f reflect.StructField) string { - n := f.Name - tag, found := f.Tag.Lookup("json") - if found { - // If we have a json field, and the first part of it before the - // first comma is non-empty, that's our field name. - parts := strings.Split(tag, ",") - if parts[0] != "" { - n = parts[0] - } - } - return n -} - -// Create a map of field names that we'll see in the deepObject to reflect -// field indices on the given type. -func fieldIndicesByJsonTag(i interface{}) (map[string]int, error) { - t := reflect.TypeOf(i) - if t.Kind() != reflect.Struct { - return nil, errors.New("expected a struct as input") - } - - n := t.NumField() - fieldMap := make(map[string]int) - for i := 0; i < n; i++ { - field := t.Field(i) - fieldName := getFieldName(field) - fieldMap[fieldName] = i - } - return fieldMap, nil -} - -func assignPathValues(dst interface{}, pathValues fieldOrValue) error { - //t := reflect.TypeOf(dst) - v := reflect.ValueOf(dst) - - iv := reflect.Indirect(v) - it := iv.Type() - - switch it.Kind() { - case reflect.Slice: - sliceLength := len(pathValues.fields) - dstSlice := reflect.MakeSlice(it, sliceLength, sliceLength) - err := assignSlice(dstSlice, pathValues) - if err != nil { - return fmt.Errorf("error assigning slice: %w", err) - } - iv.Set(dstSlice) - return nil - case reflect.Struct: - // Some special types we care about are structs. Handle them - // here. They may be redefined, so we need to do some hoop - // jumping. If the types are aliased, we need to type convert - // the pointer, then set the value of the dereference pointer. - - // We check to see if the object implements the Binder interface first. - if dst, isBinder := v.Interface().(Binder); isBinder { - return dst.Bind(pathValues.value) - } - // Then check the legacy types - if it.ConvertibleTo(reflect.TypeOf(types.Date{})) { - var date types.Date - var err error - date.Time, err = time.Parse(types.DateFormat, pathValues.value) - if err != nil { - return fmt.Errorf("invalid date format: %w", err) - } - dst := iv - if it != reflect.TypeOf(types.Date{}) { - // Types are aliased, convert the pointers. - ivPtr := iv.Addr() - aPtr := ivPtr.Convert(reflect.TypeOf(&types.Date{})) - dst = reflect.Indirect(aPtr) - } - dst.Set(reflect.ValueOf(date)) - } - if it.ConvertibleTo(reflect.TypeOf(time.Time{})) { - var tm time.Time - var err error - tm, err = time.Parse(time.RFC3339Nano, pathValues.value) - if err != nil { - // Fall back to parsing it as a date. - tm, err = time.Parse(types.DateFormat, pathValues.value) - if err != nil { - return fmt.Errorf("error parsing tim as RFC3339 or 2006-01-02 time: %s", err) - } - return fmt.Errorf("invalid date format: %w", err) - } - dst := iv - if it != reflect.TypeOf(time.Time{}) { - // Types are aliased, convert the pointers. - ivPtr := iv.Addr() - aPtr := ivPtr.Convert(reflect.TypeOf(&time.Time{})) - dst = reflect.Indirect(aPtr) - } - dst.Set(reflect.ValueOf(tm)) - } - fieldMap, err := fieldIndicesByJsonTag(iv.Interface()) - if err != nil { - return fmt.Errorf("failed enumerating fields: %w", err) - } - for _, fieldName := range sortedFieldOrValueKeys(pathValues.fields) { - fieldValue := pathValues.fields[fieldName] - fieldIndex, found := fieldMap[fieldName] - if !found { - return fmt.Errorf("field [%s] is not present in destination object", fieldName) - } - field := iv.Field(fieldIndex) - err = assignPathValues(field.Addr().Interface(), fieldValue) - if err != nil { - return fmt.Errorf("error assigning field [%s]: %w", fieldName, err) - } - } - return nil - case reflect.Ptr: - // If we have a pointer after redirecting, it means we're dealing with - // an optional field, such as *string, which was passed in as &foo. We - // will allocate it if necessary, and call ourselves with a different - // interface. - dstVal := reflect.New(it.Elem()) - dstPtr := dstVal.Interface() - err := assignPathValues(dstPtr, pathValues) - iv.Set(dstVal) - return err - case reflect.Bool: - val, err := strconv.ParseBool(pathValues.value) - if err != nil { - return fmt.Errorf("expected a valid bool, got %s", pathValues.value) - } - iv.SetBool(val) - return nil - case reflect.Float32: - val, err := strconv.ParseFloat(pathValues.value, 32) - if err != nil { - return fmt.Errorf("expected a valid float, got %s", pathValues.value) - } - iv.SetFloat(val) - return nil - case reflect.Float64: - val, err := strconv.ParseFloat(pathValues.value, 64) - if err != nil { - return fmt.Errorf("expected a valid float, got %s", pathValues.value) - } - iv.SetFloat(val) - return nil - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - val, err := strconv.ParseInt(pathValues.value, 10, 64) - if err != nil { - return fmt.Errorf("expected a valid int, got %s", pathValues.value) - } - iv.SetInt(val) - return nil - case reflect.String: - iv.SetString(pathValues.value) - return nil - default: - return errors.New("unhandled type: " + it.String()) - } -} - -func assignSlice(dst reflect.Value, pathValues fieldOrValue) error { - // Gather up the values - nValues := len(pathValues.fields) - values := make([]string, nValues) - // We expect to have consecutive array indices in the map - for i := 0; i < nValues; i++ { - indexStr := strconv.Itoa(i) - fv, found := pathValues.fields[indexStr] - if !found { - return errors.New("array deepObjects must have consecutive indices") - } - values[i] = fv.value - } - - // This could be cleaner, but we can call into assignPathValues to - // avoid recreating this logic. - for i := 0; i < nValues; i++ { - dstElem := dst.Index(i).Addr() - err := assignPathValues(dstElem.Interface(), fieldOrValue{value: values[i]}) - if err != nil { - return fmt.Errorf("error binding array: %w", err) - } - } - - return nil -} - -func sortedFieldOrValueKeys(m map[string]fieldOrValue) []string { - keys := make([]string, 0, len(m)) - for k := range m { - keys = append(keys, k) - } - sort.Strings(keys) - return keys -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/styleparam.go b/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/styleparam.go deleted file mode 100644 index 3d1b0c5b..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/runtime/styleparam.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2019 DeepMap, Inc. -// -// 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. -package runtime - -import ( - "errors" - "fmt" - "net/url" - "reflect" - "sort" - "strconv" - "strings" - "time" - - "github.com/deepmap/oapi-codegen/pkg/types" -) - -// Parameter escaping works differently based on where a header is found -type ParamLocation int - -const ( - ParamLocationUndefined ParamLocation = iota - ParamLocationQuery - ParamLocationPath - ParamLocationHeader - ParamLocationCookie -) - -// This function is used by older generated code, and must remain compatible -// with that code. It is not to be used in new templates. Please see the -// function below, which can specialize its output based on the location of -// the parameter. -func StyleParam(style string, explode bool, paramName string, value interface{}) (string, error) { - return StyleParamWithLocation(style, explode, paramName, ParamLocationUndefined, value) -} - -// Given an input value, such as a primitive type, array or object, turn it -// into a parameter based on style/explode definition, performing whatever -// escaping is necessary based on parameter location -func StyleParamWithLocation(style string, explode bool, paramName string, paramLocation ParamLocation, value interface{}) (string, error) { - t := reflect.TypeOf(value) - v := reflect.ValueOf(value) - - // Things may be passed in by pointer, we need to dereference, so return - // error on nil. - if t.Kind() == reflect.Ptr { - if v.IsNil() { - return "", fmt.Errorf("value is a nil pointer") - } - v = reflect.Indirect(v) - t = v.Type() - } - - switch t.Kind() { - case reflect.Slice: - n := v.Len() - sliceVal := make([]interface{}, n) - for i := 0; i < n; i++ { - sliceVal[i] = v.Index(i).Interface() - } - return styleSlice(style, explode, paramName, paramLocation, sliceVal) - case reflect.Struct: - return styleStruct(style, explode, paramName, paramLocation, value) - case reflect.Map: - return styleMap(style, explode, paramName, paramLocation, value) - default: - return stylePrimitive(style, explode, paramName, paramLocation, value) - } -} - -func styleSlice(style string, explode bool, paramName string, paramLocation ParamLocation, values []interface{}) (string, error) { - if style == "deepObject" { - if !explode { - return "", errors.New("deepObjects must be exploded") - } - return MarshalDeepObject(values, paramName) - } - - var prefix string - var separator string - - switch style { - case "simple": - separator = "," - case "label": - prefix = "." - if explode { - separator = "." - } else { - separator = "," - } - case "matrix": - prefix = fmt.Sprintf(";%s=", paramName) - if explode { - separator = prefix - } else { - separator = "," - } - case "form": - prefix = fmt.Sprintf("%s=", paramName) - if explode { - separator = "&" + prefix - } else { - separator = "," - } - case "spaceDelimited": - prefix = fmt.Sprintf("%s=", paramName) - if explode { - separator = "&" + prefix - } else { - separator = " " - } - case "pipeDelimited": - prefix = fmt.Sprintf("%s=", paramName) - if explode { - separator = "&" + prefix - } else { - separator = "|" - } - default: - return "", fmt.Errorf("unsupported style '%s'", style) - } - - // We're going to assume here that the array is one of simple types. - var err error - var part string - parts := make([]string, len(values)) - for i, v := range values { - part, err = primitiveToString(v) - part = escapeParameterString(part, paramLocation) - parts[i] = part - if err != nil { - return "", fmt.Errorf("error formatting '%s': %s", paramName, err) - } - } - return prefix + strings.Join(parts, separator), nil -} - -func sortedKeys(strMap map[string]string) []string { - keys := make([]string, len(strMap)) - i := 0 - for k := range strMap { - keys[i] = k - i++ - } - sort.Strings(keys) - return keys -} - -// This is a special case. The struct may be a date or time, in -// which case, marshal it in correct format. -func marshalDateTimeValue(value interface{}) (string, bool) { - v := reflect.Indirect(reflect.ValueOf(value)) - t := v.Type() - - if t.ConvertibleTo(reflect.TypeOf(time.Time{})) { - tt := v.Convert(reflect.TypeOf(time.Time{})) - timeVal := tt.Interface().(time.Time) - return timeVal.Format(time.RFC3339Nano), true - } - - if t.ConvertibleTo(reflect.TypeOf(types.Date{})) { - d := v.Convert(reflect.TypeOf(types.Date{})) - dateVal := d.Interface().(types.Date) - return dateVal.Format(types.DateFormat), true - } - - return "", false -} - -func styleStruct(style string, explode bool, paramName string, paramLocation ParamLocation, value interface{}) (string, error) { - - if timeVal, ok := marshalDateTimeValue(value); ok { - styledVal, err := stylePrimitive(style, explode, paramName, paramLocation, timeVal) - if err != nil { - return "", fmt.Errorf("failed to style time: %w", err) - } - return styledVal, nil - } - - if style == "deepObject" { - if !explode { - return "", errors.New("deepObjects must be exploded") - } - return MarshalDeepObject(value, paramName) - } - - // Otherwise, we need to build a dictionary of the struct's fields. Each - // field may only be a primitive value. - v := reflect.ValueOf(value) - t := reflect.TypeOf(value) - fieldDict := make(map[string]string) - - for i := 0; i < t.NumField(); i++ { - fieldT := t.Field(i) - // Find the json annotation on the field, and use the json specified - // name if available, otherwise, just the field name. - tag := fieldT.Tag.Get("json") - fieldName := fieldT.Name - if tag != "" { - tagParts := strings.Split(tag, ",") - name := tagParts[0] - if name != "" { - fieldName = name - } - } - f := v.Field(i) - - // Unset optional fields will be nil pointers, skip over those. - if f.Type().Kind() == reflect.Ptr && f.IsNil() { - continue - } - str, err := primitiveToString(f.Interface()) - if err != nil { - return "", fmt.Errorf("error formatting '%s': %s", paramName, err) - } - fieldDict[fieldName] = str - } - - return processFieldDict(style, explode, paramName, paramLocation, fieldDict) -} - -func styleMap(style string, explode bool, paramName string, paramLocation ParamLocation, value interface{}) (string, error) { - if style == "deepObject" { - if !explode { - return "", errors.New("deepObjects must be exploded") - } - return MarshalDeepObject(value, paramName) - } - - dict, ok := value.(map[string]interface{}) - if !ok { - return "", errors.New("map not of type map[string]interface{}") - } - - fieldDict := make(map[string]string) - for fieldName, value := range dict { - str, err := primitiveToString(value) - if err != nil { - return "", fmt.Errorf("error formatting '%s': %s", paramName, err) - } - fieldDict[fieldName] = str - } - return processFieldDict(style, explode, paramName, paramLocation, fieldDict) -} - -func processFieldDict(style string, explode bool, paramName string, paramLocation ParamLocation, fieldDict map[string]string) (string, error) { - var parts []string - - // This works for everything except deepObject. We'll handle that one - // separately. - if style != "deepObject" { - if explode { - for _, k := range sortedKeys(fieldDict) { - v := escapeParameterString(fieldDict[k], paramLocation) - parts = append(parts, k+"="+v) - } - } else { - for _, k := range sortedKeys(fieldDict) { - v := escapeParameterString(fieldDict[k], paramLocation) - parts = append(parts, k) - parts = append(parts, v) - } - } - } - - var prefix string - var separator string - - switch style { - case "simple": - separator = "," - case "label": - prefix = "." - if explode { - separator = prefix - } else { - separator = "," - } - case "matrix": - if explode { - separator = ";" - prefix = ";" - } else { - separator = "," - prefix = fmt.Sprintf(";%s=", paramName) - } - case "form": - if explode { - separator = "&" - } else { - prefix = fmt.Sprintf("%s=", paramName) - separator = "," - } - case "deepObject": - { - if !explode { - return "", fmt.Errorf("deepObject parameters must be exploded") - } - for _, k := range sortedKeys(fieldDict) { - v := fieldDict[k] - part := fmt.Sprintf("%s[%s]=%s", paramName, k, v) - parts = append(parts, part) - } - separator = "&" - } - default: - return "", fmt.Errorf("unsupported style '%s'", style) - } - - return prefix + strings.Join(parts, separator), nil -} - -func stylePrimitive(style string, explode bool, paramName string, paramLocation ParamLocation, value interface{}) (string, error) { - strVal, err := primitiveToString(value) - if err != nil { - return "", err - } - - var prefix string - switch style { - case "simple": - case "label": - prefix = "." - case "matrix": - prefix = fmt.Sprintf(";%s=", paramName) - case "form": - prefix = fmt.Sprintf("%s=", paramName) - default: - return "", fmt.Errorf("unsupported style '%s'", style) - } - return prefix + escapeParameterString(strVal, paramLocation), nil -} - -// Converts a primitive value to a string. We need to do this based on the -// Kind of an interface, not the Type to work with aliased types. -func primitiveToString(value interface{}) (string, error) { - var output string - - // Values may come in by pointer for optionals, so make sure to dereferene. - v := reflect.Indirect(reflect.ValueOf(value)) - t := v.Type() - kind := t.Kind() - - switch kind { - case reflect.Int8, reflect.Int32, reflect.Int64, reflect.Int: - output = strconv.FormatInt(v.Int(), 10) - case reflect.Float64: - output = strconv.FormatFloat(v.Float(), 'f', -1, 64) - case reflect.Float32: - output = strconv.FormatFloat(v.Float(), 'f', -1, 32) - case reflect.Bool: - if v.Bool() { - output = "true" - } else { - output = "false" - } - case reflect.String: - output = v.String() - default: - return "", fmt.Errorf("unsupported type %s", reflect.TypeOf(value).String()) - } - return output, nil -} - -// This function escapes a parameter value bas on the location of that parameter. -// Query params and path params need different kinds of escaping, while header -// and cookie params seem not to need escaping. -func escapeParameterString(value string, paramLocation ParamLocation) string { - switch paramLocation { - case ParamLocationQuery: - return url.QueryEscape(value) - case ParamLocationPath: - return url.PathEscape(value) - default: - return value - } -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/types/date.go b/vendor/github.com/deepmap/oapi-codegen/pkg/types/date.go deleted file mode 100644 index ffc665cf..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/types/date.go +++ /dev/null @@ -1,34 +0,0 @@ -package types - -import ( - "encoding/json" - "time" -) - -const DateFormat = "2006-01-02" - -type Date struct { - time.Time -} - -func (d Date) MarshalJSON() ([]byte, error) { - return json.Marshal(d.Time.Format(DateFormat)) -} - -func (d *Date) UnmarshalJSON(data []byte) error { - var dateStr string - err := json.Unmarshal(data, &dateStr) - if err != nil { - return err - } - parsed, err := time.Parse(DateFormat, dateStr) - if err != nil { - return err - } - d.Time = parsed - return nil -} - -func (d Date) String() string { - return d.Time.Format(DateFormat) -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/types/email.go b/vendor/github.com/deepmap/oapi-codegen/pkg/types/email.go deleted file mode 100644 index 00a4cf6b..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/types/email.go +++ /dev/null @@ -1,27 +0,0 @@ -package types - -import ( - "encoding/json" - "errors" -) - -type Email string - -func (e Email) MarshalJSON() ([]byte, error) { - if !emailRegex.MatchString(string(e)) { - return nil, errors.New("email: failed to pass regex validation") - } - return json.Marshal(string(e)) -} - -func (e *Email) UnmarshalJSON(data []byte) error { - var s string - if err := json.Unmarshal(data, &s); err != nil { - return err - } - if !emailRegex.MatchString(s) { - return errors.New("email: failed to pass regex validation") - } - *e = Email(s) - return nil -} diff --git a/vendor/github.com/deepmap/oapi-codegen/pkg/types/regexes.go b/vendor/github.com/deepmap/oapi-codegen/pkg/types/regexes.go deleted file mode 100644 index 94f17df5..00000000 --- a/vendor/github.com/deepmap/oapi-codegen/pkg/types/regexes.go +++ /dev/null @@ -1,11 +0,0 @@ -package types - -import "regexp" - -const ( - emailRegexString = "^(?:(?:(?:(?:[a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(?:\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|(?:(?:\\x22)(?:(?:(?:(?:\\x20|\\x09)*(?:\\x0d\\x0a))?(?:\\x20|\\x09)+)?(?:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:(?:[\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(?:(?:(?:\\x20|\\x09)*(?:\\x0d\\x0a))?(\\x20|\\x09)+)?(?:\\x22))))@(?:(?:(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])(?:[a-zA-Z]|\\d|-|\\.|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*(?:[a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(?:(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(?:(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])(?:[a-zA-Z]|\\d|-|\\.|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*(?:[a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$" -) - -var ( - emailRegex = regexp.MustCompile(emailRegexString) -) diff --git a/vendor/github.com/exoscale/egoscale/AUTHORS b/vendor/github.com/exoscale/egoscale/AUTHORS deleted file mode 100644 index 5c12a2a1..00000000 --- a/vendor/github.com/exoscale/egoscale/AUTHORS +++ /dev/null @@ -1,9 +0,0 @@ -Pierre-Yves Ritschard -Vincent Bernat -Chris Baumbauer -Marc-Aurèle Brothier -Sebastien Goasguen -Yoan Blanc -Stefano Marengo -Pierre-Emmanuel Jacquier -Fabrizio Steiner diff --git a/vendor/github.com/exoscale/egoscale/LICENSE b/vendor/github.com/exoscale/egoscale/LICENSE deleted file mode 100644 index 327ecb82..00000000 --- a/vendor/github.com/exoscale/egoscale/LICENSE +++ /dev/null @@ -1,201 +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 2014 exoscale(tm) - - 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/exoscale/egoscale/v2/anti_affinity_group.go b/vendor/github.com/exoscale/egoscale/v2/anti_affinity_group.go deleted file mode 100644 index f81278f5..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/anti_affinity_group.go +++ /dev/null @@ -1,139 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// AntiAffinityGroup represents an Anti-Affinity Group. -type AntiAffinityGroup struct { - Description *string - ID *string `req-for:"delete"` - InstanceIDs *[]string - Name *string `req-for:"create"` -} - -func antiAffinityGroupFromAPI(a *oapi.AntiAffinityGroup) *AntiAffinityGroup { - return &AntiAffinityGroup{ - Description: a.Description, - ID: a.Id, - InstanceIDs: func() (v *[]string) { - if a.Instances != nil && len(*a.Instances) > 0 { - ids := make([]string, len(*a.Instances)) - for i, item := range *a.Instances { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - Name: a.Name, - } -} - -// CreateAntiAffinityGroup creates an Anti-Affinity Group. -func (c *Client) CreateAntiAffinityGroup( - ctx context.Context, - zone string, - antiAffinityGroup *AntiAffinityGroup, -) (*AntiAffinityGroup, error) { - if err := validateOperationParams(antiAffinityGroup, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateAntiAffinityGroupWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreateAntiAffinityGroupJSONRequestBody{ - Description: antiAffinityGroup.Description, - Name: *antiAffinityGroup.Name, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetAntiAffinityGroup(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteAntiAffinityGroup deletes an Anti-Affinity Group. -func (c *Client) DeleteAntiAffinityGroup( - ctx context.Context, - zone string, - antiAffinityGroup *AntiAffinityGroup, -) error { - if err := validateOperationParams(antiAffinityGroup, "delete"); err != nil { - return err - } - - resp, err := c.DeleteAntiAffinityGroupWithResponse(apiv2.WithZone(ctx, zone), *antiAffinityGroup.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindAntiAffinityGroup attempts to find an Anti-Affinity Group by name or ID. -func (c *Client) FindAntiAffinityGroup(ctx context.Context, zone, x string) (*AntiAffinityGroup, error) { - res, err := c.ListAntiAffinityGroups(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetAntiAffinityGroup(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetAntiAffinityGroup returns the Anti-Affinity Group corresponding to the specified ID. -func (c *Client) GetAntiAffinityGroup(ctx context.Context, zone, id string) (*AntiAffinityGroup, error) { - resp, err := c.GetAntiAffinityGroupWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return antiAffinityGroupFromAPI(resp.JSON200), nil -} - -// ListAntiAffinityGroups returns the list of existing Anti-Affinity Groups. -func (c *Client) ListAntiAffinityGroups(ctx context.Context, zone string) ([]*AntiAffinityGroup, error) { - list := make([]*AntiAffinityGroup, 0) - - resp, err := c.ListAntiAffinityGroupsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.AntiAffinityGroups != nil { - for i := range *resp.JSON200.AntiAffinityGroups { - list = append(list, antiAffinityGroupFromAPI(&(*resp.JSON200.AntiAffinityGroups)[i])) - } - } - - return list, nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/api/api.go b/vendor/github.com/exoscale/egoscale/v2/api/api.go deleted file mode 100644 index c0660f86..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/api/api.go +++ /dev/null @@ -1,3 +0,0 @@ -// Package api implements low-level primitives for interacting with the -// Exoscale API. -package api diff --git a/vendor/github.com/exoscale/egoscale/v2/api/error.go b/vendor/github.com/exoscale/egoscale/v2/api/error.go deleted file mode 100644 index 7bbd59aa..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/api/error.go +++ /dev/null @@ -1,17 +0,0 @@ -package api - -import "errors" - -var ( - // ErrNotFound represents an error indicating a non-existent resource. - ErrNotFound = errors.New("resource not found") - - // ErrTooManyFound represents an error indicating multiple results found for a single resource. - ErrTooManyFound = errors.New("multiple resources found") - - // ErrInvalidRequest represents an error indicating that the caller's request is invalid. - ErrInvalidRequest = errors.New("invalid request") - - // ErrAPIError represents an error indicating an API-side issue. - ErrAPIError = errors.New("API error") -) diff --git a/vendor/github.com/exoscale/egoscale/v2/api/middleware.go b/vendor/github.com/exoscale/egoscale/v2/api/middleware.go deleted file mode 100644 index ea093486..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/api/middleware.go +++ /dev/null @@ -1,100 +0,0 @@ -package api - -import ( - "encoding/json" - "fmt" - "io" - "net/http" - "net/http/httputil" - "os" -) - -type Middleware interface { - http.RoundTripper -} - -// ErrorHandlerMiddleware is an Exoscale API HTTP client middleware that -// returns concrete Go errors according to API response errors. -type ErrorHandlerMiddleware struct { - next http.RoundTripper -} - -func NewAPIErrorHandlerMiddleware(next http.RoundTripper) Middleware { - if next == nil { - next = http.DefaultTransport - } - - return &ErrorHandlerMiddleware{next: next} -} - -func (m *ErrorHandlerMiddleware) RoundTrip(req *http.Request) (*http.Response, error) { - resp, err := m.next.RoundTrip(req) - if err != nil { - // If the request returned a Go error don't bother analyzing the response - // body, as there probably won't be any (e.g. connection timeout/refused). - return resp, err - } - - if resp.StatusCode >= 400 && resp.StatusCode <= 599 { - var res struct { - Message string `json:"message"` - } - - data, err := io.ReadAll(resp.Body) - if err != nil { - return nil, fmt.Errorf("error reading response body: %s", err) - } - - if json.Valid(data) { - if err = json.Unmarshal(data, &res); err != nil { - return nil, fmt.Errorf("error unmarshaling response: %s", err) - } - } else { - res.Message = string(data) - } - - switch { - case resp.StatusCode == http.StatusNotFound: - return nil, ErrNotFound - - case resp.StatusCode >= 400 && resp.StatusCode < 500: - return nil, fmt.Errorf("%w: %s", ErrInvalidRequest, res.Message) - - case resp.StatusCode >= 500: - return nil, fmt.Errorf("%w: %s", ErrAPIError, res.Message) - } - } - - return resp, err -} - -// TraceMiddleware is a client HTTP middleware that dumps HTTP requests and responses content. -type TraceMiddleware struct { - next http.RoundTripper -} - -func NewTraceMiddleware(next http.RoundTripper) Middleware { - if next == nil { - next = http.DefaultTransport - } - - return &TraceMiddleware{next: next} -} - -func (t *TraceMiddleware) RoundTrip(req *http.Request) (*http.Response, error) { - if dump, err := httputil.DumpRequest(req, true); err == nil { - fmt.Fprintf(os.Stderr, ">>> %s\n", dump) - } - - fmt.Fprintln(os.Stderr, "----------------------------------------------------------------------") - - resp, err := t.next.RoundTrip(req) - - if resp != nil { - if dump, err := httputil.DumpResponse(resp, true); err == nil { - fmt.Fprintf(os.Stderr, "<<< %s\n", dump) - } - } - - return resp, err -} diff --git a/vendor/github.com/exoscale/egoscale/v2/api/request.go b/vendor/github.com/exoscale/egoscale/v2/api/request.go deleted file mode 100644 index 5475f93d..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/api/request.go +++ /dev/null @@ -1,70 +0,0 @@ -package api - -import ( - "context" - "fmt" -) - -const ( - // EndpointURL represents the default API Endpoint URL. - EndpointURL = "https://api.exoscale.com/" - - // Prefix represents the current API prefix. - Prefix = "v2" -) - -const defaultReqEndpointEnv = "api" - -// ReqEndpoint represents an Exoscale API request endpoint. -type ReqEndpoint struct { - env string - zone string -} - -// NewReqEndpoint returns a new Exoscale API request endpoint from an environment and zone. -func NewReqEndpoint(env, zone string) ReqEndpoint { - re := ReqEndpoint{ - env: env, - zone: zone, - } - - if re.env == "" { - re.env = defaultReqEndpointEnv - } - - return re -} - -// Env returns the Exoscale API endpoint environment. -func (r *ReqEndpoint) Env() string { - return r.env -} - -// Zone returns the Exoscale API endpoint zone. -func (r *ReqEndpoint) Zone() string { - return r.zone -} - -// Host returns the Exoscale API endpoint host FQDN. -func (r *ReqEndpoint) Host() string { - return fmt.Sprintf("%s-%s.exoscale.com", r.env, r.zone) -} - -// WithEndpoint returns an augmented context instance containing the Exoscale endpoint to send -// the request to. -func WithEndpoint(ctx context.Context, endpoint ReqEndpoint) context.Context { - return context.WithValue(ctx, ReqEndpoint{}, endpoint) -} - -// WithZone is a shorthand to WithEndpoint where only the endpoint zone has to be specified. -// If a request endpoint is already set in the specified context instance, the value currently -// set for the environment will be reused. -func WithZone(ctx context.Context, zone string) context.Context { - var env string - - if v, ok := ctx.Value(ReqEndpoint{}).(ReqEndpoint); ok { - env = v.Env() - } - - return WithEndpoint(ctx, NewReqEndpoint(env, zone)) -} diff --git a/vendor/github.com/exoscale/egoscale/v2/api/security.go b/vendor/github.com/exoscale/egoscale/v2/api/security.go deleted file mode 100644 index 2fed6ced..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/api/security.go +++ /dev/null @@ -1,127 +0,0 @@ -package api - -import ( - "bytes" - "context" - "crypto/hmac" - "crypto/sha256" - "encoding/base64" - "errors" - "fmt" - "io" - "net/http" - "sort" - "strings" - "time" -) - -// SecurityProviderExoscale represents an Exoscale public API security -// provider. -type SecurityProviderExoscale struct { - // ReqExpire represents the request expiration duration. - ReqExpire time.Duration - - apiKey string - apiSecret string -} - -// NewSecurityProvider returns a new Exoscale public API security -// provider to sign API requests using the specified API key/secret. -func NewSecurityProvider(apiKey, apiSecret string) (*SecurityProviderExoscale, error) { - if apiKey == "" { - return nil, errors.New("missing API key") - } - - if apiSecret == "" { - return nil, errors.New("missing API secret") - } - - return &SecurityProviderExoscale{ - ReqExpire: 10 * time.Minute, - apiKey: apiKey, - apiSecret: apiSecret, - }, nil -} - -// Intercept is an HTTP middleware that intercepts and signs client requests -// before sending them to the API endpoint. -func (s *SecurityProviderExoscale) Intercept(_ context.Context, req *http.Request) error { - return s.signRequest(req, time.Now().UTC().Add(s.ReqExpire)) -} - -func (s *SecurityProviderExoscale) signRequest(req *http.Request, expiration time.Time) error { - var ( - sigParts []string - headerParts []string - ) - - // Request method/URL path - sigParts = append(sigParts, fmt.Sprintf("%s %s", req.Method, req.URL.EscapedPath())) - headerParts = append(headerParts, "EXO2-HMAC-SHA256 credential="+s.apiKey) - - // Request body if present - body := "" - if req.Body != nil { - data, err := io.ReadAll(req.Body) - if err != nil { - return err - } - err = req.Body.Close() - if err != nil { - return err - } - body = string(data) - req.Body = io.NopCloser(bytes.NewReader(data)) - } - sigParts = append(sigParts, body) - - // Request query string parameters - // Important: this is order-sensitive, we have to have to sort parameters alphabetically to ensure signed - // values match the names listed in the "signed-query-args=" signature pragma. - signedParams, paramsValues := extractRequestParameters(req) - sigParts = append(sigParts, paramsValues) - if len(signedParams) > 0 { - headerParts = append(headerParts, "signed-query-args="+strings.Join(signedParams, ";")) - } - - // Request headers -- none at the moment - // Note: the same order-sensitive caution for query string parameters applies to headers. - sigParts = append(sigParts, "") - - // Request expiration date (UNIX timestamp, no line return) - sigParts = append(sigParts, fmt.Sprint(expiration.Unix())) - headerParts = append(headerParts, "expires="+fmt.Sprint(expiration.Unix())) - - h := hmac.New(sha256.New, []byte(s.apiSecret)) - if _, err := h.Write([]byte(strings.Join(sigParts, "\n"))); err != nil { - return err - } - headerParts = append(headerParts, "signature="+base64.StdEncoding.EncodeToString(h.Sum(nil))) - - req.Header.Set("Authorization", strings.Join(headerParts, ",")) - - return nil -} - -// extractRequestParameters returns the list of request URL parameters names -// and a strings concatenating the values of the parameters. -func extractRequestParameters(req *http.Request) ([]string, string) { - var ( - names []string - values string - ) - - for param, values := range req.URL.Query() { - // Keep only parameters that hold exactly 1 value (i.e. no empty or multi-valued parameters) - if len(values) == 1 { - names = append(names, param) - } - } - sort.Strings(names) - - for _, param := range names { - values += req.URL.Query().Get(param) - } - - return names, values -} diff --git a/vendor/github.com/exoscale/egoscale/v2/client.go b/vendor/github.com/exoscale/egoscale/v2/client.go deleted file mode 100644 index 0b3f4f2f..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/client.go +++ /dev/null @@ -1,323 +0,0 @@ -package v2 - -import ( - "context" - "errors" - "fmt" - "io" - "log" - "net" - "net/http" - "net/url" - "reflect" - "runtime" - "time" - - "github.com/hashicorp/go-retryablehttp" - - "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" - "github.com/exoscale/egoscale/version" -) - -const ( - defaultTimeout = 60 * time.Second - defaultPollInterval = oapi.DefaultPollingInterval -) - -// UserAgent is the "User-Agent" HTTP request header added to outgoing HTTP requests. -var UserAgent = fmt.Sprintf("egoscale/%s (%s; %s/%s)", - version.Version, - runtime.Version(), - runtime.GOOS, - runtime.GOARCH) - -// defaultHTTPClient is HTTP client with retry logic. -// Default retry configuration can be found in go-retryablehttp repo. -var defaultHTTPClient = func() *http.Client { - rc := retryablehttp.NewClient() - // silence client by default - rc.Logger = log.New(io.Discard, "", 0) - return rc.StandardClient() -}() - -// ClientOpt represents a function setting Exoscale API client option. -type ClientOpt func(*Client) error - -// ClientOptWithAPIEndpoint returns a ClientOpt overriding the default Exoscale -// API endpoint. -func ClientOptWithAPIEndpoint(v string) ClientOpt { - return func(c *Client) error { - endpointURL, err := url.Parse(v) - if err != nil { - return fmt.Errorf("failed to parse URL: %s", err) - } - - endpointURL = endpointURL.ResolveReference(&url.URL{Path: api.Prefix}) - c.apiEndpoint = endpointURL.String() - - return nil - } -} - -// ClientOptWithTimeout returns a ClientOpt overriding the default client timeout. -func ClientOptWithTimeout(v time.Duration) ClientOpt { - return func(c *Client) error { - if v <= 0 { - return errors.New("timeout value must be greater than 0") - } - - c.timeout = v - - return nil - } -} - -// ClientOptWithPollInterval returns a ClientOpt overriding the default client async operation polling interval. -func ClientOptWithPollInterval(v time.Duration) ClientOpt { - return func(c *Client) error { - if v <= 0 { - return errors.New("poll interval value must be greater than 0") - } - - c.pollInterval = v - - return nil - } -} - -// ClientOptWithTrace returns a ClientOpt enabling HTTP request/response tracing. -func ClientOptWithTrace() ClientOpt { - return func(c *Client) error { - c.trace = true - return nil - } -} - -// ClientOptCond returns the specified ClientOpt if the fc function bool result -// evaluates to true, otherwise returns a no-op ClientOpt. -func ClientOptCond(fc func() bool, opt ClientOpt) ClientOpt { - if fc() { - return opt - } - - return func(*Client) error { return nil } -} - -// ClientOptWithHTTPClient returns a ClientOpt overriding the default http.Client. -// Note: the Exoscale API client will chain additional middleware -// (http.RoundTripper) on the HTTP client internally, which can alter the HTTP -// requests and responses. If you don't want any other middleware than the ones -// currently set to your HTTP client, you should duplicate it and pass a copy -// instead. -func ClientOptWithHTTPClient(v *http.Client) ClientOpt { - return func(c *Client) error { - c.httpClient = v - - return nil - } -} - -type oapiClient interface { - oapi.ClientWithResponsesInterface -} - -// Client represents an Exoscale API client. -type Client struct { - oapiClient - - apiKey string - apiSecret string - apiEndpoint string - timeout time.Duration - pollInterval time.Duration - trace bool - httpClient *http.Client -} - -// NewClient returns a new Exoscale API client, or an error if one couldn't be initialized. -// Default HTTP client is [go-retryablehttp] with static retry configuration. -// To change retry configuration, build new HTTP client and pass it using ClientOptWithHTTPClient. -// -// [go-retryablehttp]: https://github.com/hashicorp/go-retryablehttp -func NewClient(apiKey, apiSecret string, opts ...ClientOpt) (*Client, error) { - client := Client{ - apiKey: apiKey, - apiSecret: apiSecret, - apiEndpoint: api.EndpointURL, - httpClient: defaultHTTPClient, - timeout: defaultTimeout, - pollInterval: defaultPollInterval, - } - - if client.apiKey == "" || client.apiSecret == "" { - return nil, fmt.Errorf("%w: missing or incomplete API credentials", ErrClientConfig) - } - - for _, opt := range opts { - if err := opt(&client); err != nil { - return nil, fmt.Errorf("%w: %s", ErrClientConfig, err) - } - } - - apiSecurityProvider, err := api.NewSecurityProvider(client.apiKey, client.apiSecret) - if err != nil { - return nil, fmt.Errorf("unable to initialize API security provider: %w", err) - } - - apiURL, err := url.Parse(client.apiEndpoint) - if err != nil { - return nil, fmt.Errorf("unable to initialize API client: %w", err) - } - apiURL = apiURL.ResolveReference(&url.URL{Path: api.Prefix}) - - // Tracing must be performed before API error handling in the middleware chain, - // otherwise the response won't be dumped in case of an API error. - if client.trace { - client.httpClient.Transport = api.NewTraceMiddleware(client.httpClient.Transport) - } - - client.httpClient.Transport = api.NewAPIErrorHandlerMiddleware(client.httpClient.Transport) - - oapiOpts := []oapi.ClientOption{ - oapi.WithHTTPClient(client.httpClient), - oapi.WithRequestEditorFn( - oapi.MultiRequestsEditor( - setUserAgent, - apiSecurityProvider.Intercept, - setEndpointFromContext, - ), - ), - } - - if client.oapiClient, err = oapi.NewClientWithResponses(apiURL.String(), oapiOpts...); err != nil { - return nil, fmt.Errorf("unable to initialize API client: %w", err) - } - - return &client, nil -} - -// SetHTTPClient overrides the current HTTP client. -// As we don't return error, any error during intialization of client will make SetHTTPClient NOOP. -func (c *Client) SetHTTPClient(client *http.Client) { - c.httpClient = client - - apiURL, err := url.Parse(c.apiEndpoint) - if err != nil { - return - } - apiURL = apiURL.ResolveReference(&url.URL{Path: api.Prefix}) - - apiSecurityProvider, err := api.NewSecurityProvider(c.apiKey, c.apiSecret) - if err != nil { - return - } - - // Tracing must be performed before API error handling in the middleware chain, - // otherwise the response won't be dumped in case of an API error. - if c.trace { - c.httpClient.Transport = api.NewTraceMiddleware(c.httpClient.Transport) - } - - c.httpClient.Transport = api.NewAPIErrorHandlerMiddleware(c.httpClient.Transport) - - oapiOpts := []oapi.ClientOption{ - oapi.WithHTTPClient(c.httpClient), - oapi.WithRequestEditorFn( - oapi.MultiRequestsEditor( - setUserAgent, - apiSecurityProvider.Intercept, - setEndpointFromContext, - ), - ), - } - - if c.oapiClient, err = oapi.NewClientWithResponses(apiURL.String(), oapiOpts...); err != nil { - return - } -} - -// SetTimeout overrides the current client timeout value. -func (c *Client) SetTimeout(v time.Duration) { - c.timeout = v -} - -// SetTrace enables or disables HTTP request/response tracing. -func (c *Client) SetTrace(enabled bool) { - c.trace = enabled -} - -// setUserAgent is an HTTP client request interceptor that adds the "User-Agent" header -func setUserAgent(ctx context.Context, req *http.Request) error { - req.Header.Add("User-Agent", UserAgent) - - return nil -} - -// setEndpointFromContext is an HTTP client request interceptor that overrides the "Host" header -// with information from a request endpoint optionally set in the context instance. If none is -// found or host is an IP address, the request is left untouched. -func setEndpointFromContext(ctx context.Context, req *http.Request) error { - h, _, err := net.SplitHostPort(req.Host) - if err != nil { - h = req.Host - } - if net.ParseIP(h) == nil { - v, ok := ctx.Value(api.ReqEndpoint{}).(api.ReqEndpoint) - if ok { - req.Host = v.Host() - req.URL.Host = v.Host() - } - } - - return nil -} - -// fetchFromIDs returns a list of API resources fetched from the specified list of IDs. -// It is meant to be used with API resources implementing the getter interface, e.g.: -// -// func (i Instance) get(ctx context.Context, client *Client, zone, id string) (interface{}, error) { -// return client.GetInstance(ctx, zone, id) -// } -// -// func (i *InstancePool) Instances(ctx context.Context) ([]*Instance, error) { -// res, err := i.c.fetchFromIDs(ctx, i.zone, i.InstanceIDs, new(Instance)) -// return res.([]*Instance), err -// } -func (c *Client) fetchFromIDs(ctx context.Context, zone string, ids []string, rt interface{}) (interface{}, error) { - if rt == nil { - return nil, errors.New("resource type must not be ") - } - - resType := reflect.ValueOf(rt).Type() - if kind := resType.Kind(); kind != reflect.Ptr { - return nil, fmt.Errorf("expected resource type to be a pointer, got %s", kind) - } - - // Base type identification is necessary as it is not possible to call - // the Getter.Get() method on a nil pointer, so we create a new value - // using the base type and call the Get() method on it. The corollary is - // that the Get() method must be implemented on the type directly, - // not as a pointer receiver. - baseType := resType.Elem() - - if !resType.Implements(reflect.TypeOf(new(getter)).Elem()) { - return nil, fmt.Errorf("resource type %s does not implement the Getter interface", resType) - } - - // As a convenience to the caller, even if the list of IDs passed as - // parameter is empty we always allocate a slice of and return - // it to them, this way they can confidently convert the returned - // interface{} into a [] without having to perform type assertion. - collector := reflect.MakeSlice(reflect.SliceOf(resType), 0, 0) - - for _, id := range ids { - res, err := reflect.New(baseType).Elem().Interface().(getter).get(ctx, c, zone, id) - if err != nil { - return nil, err - } - collector = reflect.Append(collector, reflect.ValueOf(res)) - } - - return collector.Interface(), nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/client_mock.go b/vendor/github.com/exoscale/egoscale/v2/client_mock.go deleted file mode 100644 index 48f66b65..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/client_mock.go +++ /dev/null @@ -1,1293 +0,0 @@ -package v2 - -import ( - "context" - - "github.com/stretchr/testify/mock" - - "github.com/exoscale/egoscale/v2/oapi" -) - -type oapiClientMock struct { - oapi.ClientWithResponsesInterface - mock.Mock -} - -func (m *oapiClientMock) AddExternalSourceToSecurityGroupWithResponse( - ctx context.Context, - id string, - body oapi.AddExternalSourceToSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AddExternalSourceToSecurityGroupResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AddExternalSourceToSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) AddRuleToSecurityGroupWithResponse( - ctx context.Context, - id string, - body oapi.AddRuleToSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AddRuleToSecurityGroupResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AddRuleToSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) AddServiceToLoadBalancerWithResponse( - ctx context.Context, - id string, - body oapi.AddServiceToLoadBalancerJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AddServiceToLoadBalancerResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AddServiceToLoadBalancerResponse), args.Error(1) -} - -func (m *oapiClientMock) AttachInstanceToElasticIpWithResponse( // nolint:revive - ctx context.Context, - id string, - body oapi.AttachInstanceToElasticIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AttachInstanceToElasticIpResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AttachInstanceToElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) AttachInstanceToPrivateNetworkWithResponse( - ctx context.Context, - id string, - body oapi.AttachInstanceToPrivateNetworkJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AttachInstanceToPrivateNetworkResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AttachInstanceToPrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) AttachInstanceToSecurityGroupWithResponse( - ctx context.Context, - id string, - body oapi.AttachInstanceToSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.AttachInstanceToSecurityGroupResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.AttachInstanceToSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateAntiAffinityGroupWithResponse( - ctx context.Context, - body oapi.CreateAntiAffinityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateAntiAffinityGroupResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateAntiAffinityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateElasticIpWithResponse( // nolint:revive - ctx context.Context, - body oapi.CreateElasticIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateElasticIpResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateAccessKeyWithResponse( - ctx context.Context, - body oapi.CreateAccessKeyJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateAccessKeyResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateAccessKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateInstanceWithResponse( - ctx context.Context, - body oapi.CreateInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateInstanceResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateInstancePoolWithResponse( - ctx context.Context, - body oapi.CreateInstancePoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateInstancePoolResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateInstancePoolResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateLoadBalancerWithResponse( - ctx context.Context, - body oapi.CreateLoadBalancerJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateLoadBalancerResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateLoadBalancerResponse), args.Error(1) -} - -func (m *oapiClientMock) CreatePrivateNetworkWithResponse( - ctx context.Context, - body oapi.CreatePrivateNetworkJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreatePrivateNetworkResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreatePrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateSecurityGroupWithResponse( - ctx context.Context, - body oapi.CreateSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateSecurityGroupResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateSksClusterWithResponse( - ctx context.Context, - body oapi.CreateSksClusterJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateSksClusterResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateSksClusterResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateSksNodepoolWithResponse( - ctx context.Context, - id string, - body oapi.CreateSksNodepoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateSksNodepoolResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.CreateSksNodepoolResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateSnapshotWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn) (*oapi.CreateSnapshotResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.CreateSnapshotResponse), args.Error(1) -} - -func (m *oapiClientMock) CopyTemplateWithResponse( - ctx context.Context, - id string, - body oapi.CopyTemplateJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CopyTemplateResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.CopyTemplateResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteAntiAffinityGroupWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteAntiAffinityGroupResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteAntiAffinityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteDbaasServiceWithResponse( - ctx context.Context, - name string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteDbaasServiceResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.DeleteDbaasServiceResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteElasticIpWithResponse( // nolint:revive - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteElasticIpResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteInstancePoolWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteInstancePoolResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteInstancePoolResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteLoadBalancerWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteLoadBalancerResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteLoadBalancerResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteLoadBalancerServiceWithResponse( - ctx context.Context, - id string, - serviceId string, // nolint:revive - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteLoadBalancerServiceResponse, error) { - args := m.Called(ctx, id, serviceId, reqEditors) - return args.Get(0).(*oapi.DeleteLoadBalancerServiceResponse), args.Error(1) -} - -func (m *oapiClientMock) DeletePrivateNetworkWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeletePrivateNetworkResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeletePrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteRuleFromSecurityGroupWithResponse( - ctx context.Context, - id string, - ruleId string, // nolint:revive - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteRuleFromSecurityGroupResponse, error) { - args := m.Called(ctx, id, ruleId, reqEditors) - return args.Get(0).(*oapi.DeleteRuleFromSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteSecurityGroupWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteSecurityGroupResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteSksClusterWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteSksClusterResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteSksClusterResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteSksNodepoolWithResponse( - ctx context.Context, - id string, - sksNodepoolId string, // nolint:revive - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteSksNodepoolResponse, error) { - args := m.Called(ctx, id, sksNodepoolId, reqEditors) - return args.Get(0).(*oapi.DeleteSksNodepoolResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteSnapshotWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteSnapshotResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteSnapshotResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteSshKeyWithResponse( // nolint:revive - ctx context.Context, - name string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteSshKeyResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.DeleteSshKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteTemplateWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteTemplateResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteTemplateResponse), args.Error(1) -} - -func (m *oapiClientMock) DetachInstanceFromElasticIpWithResponse( // nolint:revive - ctx context.Context, - id string, - body oapi.DetachInstanceFromElasticIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DetachInstanceFromElasticIpResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.DetachInstanceFromElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) DetachInstanceFromPrivateNetworkWithResponse( - ctx context.Context, - id string, - body oapi.DetachInstanceFromPrivateNetworkJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DetachInstanceFromPrivateNetworkResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.DetachInstanceFromPrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) DetachInstanceFromSecurityGroupWithResponse( - ctx context.Context, - id string, - body oapi.DetachInstanceFromSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DetachInstanceFromSecurityGroupResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.DetachInstanceFromSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) EvictInstancePoolMembersWithResponse( - ctx context.Context, - id string, - body oapi.EvictInstancePoolMembersJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.EvictInstancePoolMembersResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.EvictInstancePoolMembersResponse), args.Error(1) -} - -func (m *oapiClientMock) EvictSksNodepoolMembersWithResponse( - ctx context.Context, - id string, - sksNodepoolId string, // nolint:revive - body oapi.EvictSksNodepoolMembersJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.EvictSksNodepoolMembersResponse, error) { - args := m.Called(ctx, id, sksNodepoolId, body, reqEditors) - return args.Get(0).(*oapi.EvictSksNodepoolMembersResponse), args.Error(1) -} - -func (m *oapiClientMock) ExportSnapshotWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ExportSnapshotResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.ExportSnapshotResponse), args.Error(1) -} - -func (m *oapiClientMock) GenerateSksClusterKubeconfigWithResponse( - ctx context.Context, - id string, - body oapi.GenerateSksClusterKubeconfigJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GenerateSksClusterKubeconfigResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.GenerateSksClusterKubeconfigResponse), args.Error(1) -} - -func (m *oapiClientMock) GetAntiAffinityGroupWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetAntiAffinityGroupResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetAntiAffinityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDbaasCaCertificateWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDbaasCaCertificateResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.GetDbaasCaCertificateResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDbaasServiceTypeWithResponse( - ctx context.Context, - name string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDbaasServiceTypeResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.GetDbaasServiceTypeResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDeployTargetWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDeployTargetResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetDeployTargetResponse), args.Error(1) -} - -func (m *oapiClientMock) GetElasticIpWithResponse( // nolint:revive - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetElasticIpResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) GetAccessKeyWithResponse( - ctx context.Context, - key string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetAccessKeyResponse, error) { - args := m.Called(ctx, key, reqEditors) - return args.Get(0).(*oapi.GetAccessKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) GetInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) GetInstancePoolWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetInstancePoolResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetInstancePoolResponse), args.Error(1) -} - -func (m *oapiClientMock) GetInstanceTypeWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetInstanceTypeResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetInstanceTypeResponse), args.Error(1) -} - -func (m *oapiClientMock) GetLoadBalancerWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetLoadBalancerResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetLoadBalancerResponse), args.Error(1) -} - -func (m *oapiClientMock) GetPrivateNetworkWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetPrivateNetworkResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetPrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) GetQuotaWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetQuotaResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetQuotaResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSecurityGroupWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSecurityGroupResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSksClusterWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSksClusterResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetSksClusterResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSksClusterAuthorityCertWithResponse( - ctx context.Context, - id string, - authority oapi.GetSksClusterAuthorityCertParamsAuthority, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSksClusterAuthorityCertResponse, error) { - args := m.Called(ctx, id, authority, reqEditors) - return args.Get(0).(*oapi.GetSksClusterAuthorityCertResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSksNodepoolWithResponse( - ctx context.Context, - id string, - sksNodepoolId string, // nolint:revive - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSksNodepoolResponse, error) { - args := m.Called(ctx, id, sksNodepoolId, reqEditors) - return args.Get(0).(*oapi.GetSksNodepoolResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSnapshotWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSnapshotResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetSnapshotResponse), args.Error(1) -} - -func (m *oapiClientMock) GetSshKeyWithResponse( // nolint:revive - ctx context.Context, - name string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetSshKeyResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.GetSshKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) GetTemplateWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetTemplateResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetTemplateResponse), args.Error(1) -} - -func (m *oapiClientMock) GetOperationWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetOperationResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetOperationResponse), args.Error(1) -} - -func (m *oapiClientMock) ListAccessKeyKnownOperationsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListAccessKeyKnownOperationsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListAccessKeyKnownOperationsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListAccessKeyOperationsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListAccessKeyOperationsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListAccessKeyOperationsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListAccessKeysWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListAccessKeysResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListAccessKeysResponse), args.Error(1) -} - -func (m *oapiClientMock) ListAntiAffinityGroupsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListAntiAffinityGroupsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListAntiAffinityGroupsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListDbaasServiceTypesWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListDbaasServiceTypesResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListDbaasServiceTypesResponse), args.Error(1) -} - -func (m *oapiClientMock) ListDbaasServicesWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListDbaasServicesResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListDbaasServicesResponse), args.Error(1) -} - -func (m *oapiClientMock) ListDeployTargetsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListDeployTargetsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListDeployTargetsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListElasticIpsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListElasticIpsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListElasticIpsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListInstancesWithResponse( - ctx context.Context, - params *oapi.ListInstancesParams, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListInstancesResponse, error) { - args := m.Called(ctx, params, reqEditors) - return args.Get(0).(*oapi.ListInstancesResponse), args.Error(1) -} - -func (m *oapiClientMock) ListInstancePoolsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListInstancePoolsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListInstancePoolsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListInstanceTypesWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListInstanceTypesResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListInstanceTypesResponse), args.Error(1) -} - -func (m *oapiClientMock) ListLoadBalancersWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListLoadBalancersResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListLoadBalancersResponse), args.Error(1) -} - -func (m *oapiClientMock) ListPrivateNetworksWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListPrivateNetworksResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListPrivateNetworksResponse), args.Error(1) -} - -func (m *oapiClientMock) ListQuotasWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListQuotasResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListQuotasResponse), args.Error(1) -} - -func (m *oapiClientMock) ListSecurityGroupsWithResponse( - ctx context.Context, - params *oapi.ListSecurityGroupsParams, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListSecurityGroupsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListSecurityGroupsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListSksClustersWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListSksClustersResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListSksClustersResponse), args.Error(1) -} - -func (m *oapiClientMock) ListSksClusterVersionsWithResponse( - ctx context.Context, - params *oapi.ListSksClusterVersionsParams, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListSksClusterVersionsResponse, error) { - args := m.Called(ctx, params, reqEditors) - return args.Get(0).(*oapi.ListSksClusterVersionsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListSnapshotsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListSnapshotsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListSnapshotsResponse), args.Error(1) -} - -func (m *oapiClientMock) ListSshKeysWithResponse( // nolint:revive - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListSshKeysResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListSshKeysResponse), args.Error(1) -} - -func (m *oapiClientMock) ListTemplatesWithResponse( - ctx context.Context, - params *oapi.ListTemplatesParams, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListTemplatesResponse, error) { - args := m.Called(ctx, params, reqEditors) - return args.Get(0).(*oapi.ListTemplatesResponse), args.Error(1) -} - -func (m *oapiClientMock) ListZonesWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListZonesResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListZonesResponse), args.Error(1) -} - -func (m *oapiClientMock) RebootInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RebootInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.RebootInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) RegisterSshKeyWithResponse( // nolint:revive - ctx context.Context, - body oapi.RegisterSshKeyJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RegisterSshKeyResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.RegisterSshKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) RegisterTemplateWithResponse( - ctx context.Context, - body oapi.RegisterTemplateJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RegisterTemplateResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.RegisterTemplateResponse), args.Error(1) -} - -func (m *oapiClientMock) RemoveExternalSourceFromSecurityGroupWithResponse( - ctx context.Context, - id string, - body oapi.RemoveExternalSourceFromSecurityGroupJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RemoveExternalSourceFromSecurityGroupResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.RemoveExternalSourceFromSecurityGroupResponse), args.Error(1) -} - -func (m *oapiClientMock) ResetInstanceWithResponse( - ctx context.Context, - id string, - body oapi.ResetInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ResetInstanceResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.ResetInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) ResizeInstanceDiskWithResponse( - ctx context.Context, - id string, - body oapi.ResizeInstanceDiskJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ResizeInstanceDiskResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.ResizeInstanceDiskResponse), args.Error(1) -} - -func (m *oapiClientMock) RevertInstanceToSnapshotWithResponse( - ctx context.Context, - instanceId string, // nolint:revive - body oapi.RevertInstanceToSnapshotJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RevertInstanceToSnapshotResponse, error) { - args := m.Called(ctx, instanceId, body, reqEditors) - return args.Get(0).(*oapi.RevertInstanceToSnapshotResponse), args.Error(1) -} - -func (m *oapiClientMock) RevokeAccessKeyWithResponse( - ctx context.Context, - key string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RevokeAccessKeyResponse, error) { - args := m.Called(ctx, key, reqEditors) - return args.Get(0).(*oapi.RevokeAccessKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) RotateSksCcmCredentialsWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.RotateSksCcmCredentialsResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.RotateSksCcmCredentialsResponse), args.Error(1) -} - -func (m *oapiClientMock) ScaleInstanceWithResponse( - ctx context.Context, - id string, - body oapi.ScaleInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ScaleInstanceResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.ScaleInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) ScaleInstancePoolWithResponse( - ctx context.Context, - id string, - body oapi.ScaleInstancePoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ScaleInstancePoolResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.ScaleInstancePoolResponse), args.Error(1) -} - -func (m *oapiClientMock) ScaleSksNodepoolWithResponse( - ctx context.Context, - id string, - sksNodepoolId string, // nolint:revive - body oapi.ScaleSksNodepoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ScaleSksNodepoolResponse, error) { - args := m.Called(ctx, id, sksNodepoolId, body, reqEditors) - return args.Get(0).(*oapi.ScaleSksNodepoolResponse), args.Error(1) -} - -func (m *oapiClientMock) StartInstanceWithResponse( - ctx context.Context, - id string, - body oapi.StartInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.StartInstanceResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.StartInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) StopInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.StopInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.StopInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateElasticIpWithResponse( // nolint:revive - ctx context.Context, - id string, - body oapi.UpdateElasticIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateElasticIpResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateInstanceWithResponse( - ctx context.Context, - id string, - body oapi.UpdateInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateInstanceResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateInstancePoolWithResponse( - ctx context.Context, - id string, - body oapi.UpdateInstancePoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateInstancePoolResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateInstancePoolResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateLoadBalancerWithResponse( - ctx context.Context, - id string, - body oapi.UpdateLoadBalancerJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateLoadBalancerResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateLoadBalancerResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateLoadBalancerServiceWithResponse( - ctx context.Context, - id string, - serviceId string, // nolint:revive - body oapi.UpdateLoadBalancerServiceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateLoadBalancerServiceResponse, error) { - args := m.Called(ctx, id, serviceId, body, reqEditors) - return args.Get(0).(*oapi.UpdateLoadBalancerServiceResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdatePrivateNetworkWithResponse( - ctx context.Context, - id string, - body oapi.UpdatePrivateNetworkJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdatePrivateNetworkResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdatePrivateNetworkResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdatePrivateNetworkInstanceIpWithResponse( // nolint:revive - ctx context.Context, - id string, - body oapi.UpdatePrivateNetworkInstanceIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdatePrivateNetworkInstanceIpResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdatePrivateNetworkInstanceIpResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateSksClusterWithResponse( - ctx context.Context, - id string, - body oapi.UpdateSksClusterJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateSksClusterResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateSksClusterResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateSksNodepoolWithResponse( - ctx context.Context, - id string, - sksNodepoolId string, // nolint:revive - body oapi.UpdateSksNodepoolJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateSksNodepoolResponse, error) { - args := m.Called(ctx, id, sksNodepoolId, body, reqEditors) - return args.Get(0).(*oapi.UpdateSksNodepoolResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateTemplateWithResponse( - ctx context.Context, - id string, - body oapi.UpdateTemplateJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateTemplateResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateTemplateResponse), args.Error(1) -} - -func (m *oapiClientMock) UpgradeSksClusterWithResponse( - ctx context.Context, - id string, - body oapi.UpgradeSksClusterJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpgradeSksClusterResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpgradeSksClusterResponse), args.Error(1) -} - -func (m *oapiClientMock) UpgradeSksClusterServiceLevelWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpgradeSksClusterServiceLevelResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.UpgradeSksClusterServiceLevelResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDbaasMigrationStatusWithResponse( - ctx context.Context, - name oapi.DbaasServiceName, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDbaasMigrationStatusResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.GetDbaasMigrationStatusResponse), args.Error(1) -} - -func (m *oapiClientMock) ListDnsDomainsWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListDnsDomainsResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListDnsDomainsResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDnsDomainWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDnsDomainResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetDnsDomainResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateDnsDomainWithResponse( - ctx context.Context, - body oapi.CreateDnsDomainJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateDnsDomainResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateDnsDomainResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteDnsDomainWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteDnsDomainResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteDnsDomainResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDnsDomainZoneFileWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDnsDomainZoneFileResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetDnsDomainZoneFileResponse), args.Error(1) -} - -func (m *oapiClientMock) ListDnsDomainRecordsWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListDnsDomainRecordsResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.ListDnsDomainRecordsResponse), args.Error(1) -} - -func (m *oapiClientMock) GetDnsDomainRecordWithResponse( - ctx context.Context, - domainId string, - recordId string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetDnsDomainRecordResponse, error) { - args := m.Called(ctx, domainId, recordId, reqEditors) - return args.Get(0).(*oapi.GetDnsDomainRecordResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateDnsDomainRecordWithResponse( - ctx context.Context, - domainId string, - body oapi.CreateDnsDomainRecordJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateDnsDomainRecordResponse, error) { - args := m.Called(ctx, domainId, body, reqEditors) - return args.Get(0).(*oapi.CreateDnsDomainRecordResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteDnsDomainRecordWithResponse( - ctx context.Context, - domainId string, - recordId string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteDnsDomainRecordResponse, error) { - args := m.Called(ctx, domainId, recordId, reqEditors) - return args.Get(0).(*oapi.DeleteDnsDomainRecordResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateDnsDomainRecordWithResponse( - ctx context.Context, - domainId string, - recordId string, - body oapi.UpdateDnsDomainRecordJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateDnsDomainRecordResponse, error) { - args := m.Called(ctx, domainId, recordId, body, reqEditors) - return args.Get(0).(*oapi.UpdateDnsDomainRecordResponse), args.Error(1) -} - -func (m *oapiClientMock) GetReverseDnsInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetReverseDnsInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetReverseDnsInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteReverseDnsInstanceWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteReverseDnsInstanceResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteReverseDnsInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateReverseDnsInstanceWithResponse( - ctx context.Context, - id string, - body oapi.UpdateReverseDnsInstanceJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateReverseDnsInstanceResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateReverseDnsInstanceResponse), args.Error(1) -} - -func (m *oapiClientMock) GetReverseDnsElasticIpWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetReverseDnsElasticIpResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetReverseDnsElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteReverseDnsElasticIpWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteReverseDnsElasticIpResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteReverseDnsElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateReverseDnsElasticIpWithResponse( - ctx context.Context, - id string, - body oapi.UpdateReverseDnsElasticIpJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateReverseDnsElasticIpResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateReverseDnsElasticIpResponse), args.Error(1) -} - -func (m *oapiClientMock) StopDbaasRedisMigrationWithResponse( - ctx context.Context, - name oapi.DbaasServiceName, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.StopDbaasRedisMigrationResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.StopDbaasRedisMigrationResponse), args.Error(1) -} - -func (m *oapiClientMock) StopDbaasPgMigrationWithResponse( - ctx context.Context, - name oapi.DbaasServiceName, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.StopDbaasPgMigrationResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.StopDbaasPgMigrationResponse), args.Error(1) -} - -func (m *oapiClientMock) StopDbaasMysqlMigrationWithResponse( - ctx context.Context, - name oapi.DbaasServiceName, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.StopDbaasMysqlMigrationResponse, error) { - args := m.Called(ctx, name, reqEditors) - return args.Get(0).(*oapi.StopDbaasMysqlMigrationResponse), args.Error(1) -} - -func (m *oapiClientMock) GetIamOrganizationPolicyWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetIamOrganizationPolicyResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.GetIamOrganizationPolicyResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateIamOrganizationPolicyWithResponse( - ctx context.Context, - body oapi.UpdateIamOrganizationPolicyJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateIamOrganizationPolicyResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.UpdateIamOrganizationPolicyResponse), args.Error(1) -} - -func (m *oapiClientMock) GetIamRoleWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetIamRoleResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetIamRoleResponse), args.Error(1) -} - -func (m *oapiClientMock) ListIamRolesWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListIamRolesResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListIamRolesResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateIamRoleWithResponse( - ctx context.Context, - body oapi.CreateIamRoleJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateIamRoleResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateIamRoleResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteIamRoleWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteIamRoleResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteIamRoleResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateIamRoleWithResponse( - ctx context.Context, - id string, - body oapi.UpdateIamRoleJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateIamRoleResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateIamRoleResponse), args.Error(1) -} - -func (m *oapiClientMock) UpdateIamRolePolicyWithResponse( - ctx context.Context, - id string, - body oapi.UpdateIamRolePolicyJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.UpdateIamRolePolicyResponse, error) { - args := m.Called(ctx, id, body, reqEditors) - return args.Get(0).(*oapi.UpdateIamRolePolicyResponse), args.Error(1) -} - -func (m *oapiClientMock) GetApiKeyWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.GetApiKeyResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.GetApiKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) ListApiKeysWithResponse( - ctx context.Context, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.ListApiKeysResponse, error) { - args := m.Called(ctx, reqEditors) - return args.Get(0).(*oapi.ListApiKeysResponse), args.Error(1) -} - -func (m *oapiClientMock) CreateApiKeyWithResponse( - ctx context.Context, - body oapi.CreateApiKeyJSONRequestBody, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.CreateApiKeyResponse, error) { - args := m.Called(ctx, body, reqEditors) - return args.Get(0).(*oapi.CreateApiKeyResponse), args.Error(1) -} - -func (m *oapiClientMock) DeleteApiKeyWithResponse( - ctx context.Context, - id string, - reqEditors ...oapi.RequestEditorFn, -) (*oapi.DeleteApiKeyResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*oapi.DeleteApiKeyResponse), args.Error(1) -} diff --git a/vendor/github.com/exoscale/egoscale/v2/database.go b/vendor/github.com/exoscale/egoscale/v2/database.go deleted file mode 100644 index 358ec6b2..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/database.go +++ /dev/null @@ -1,320 +0,0 @@ -package v2 - -import ( - "context" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// DatabaseBackupConfig represents a Database Backup configuration. -type DatabaseBackupConfig struct { - FrequentIntervalMinutes *int64 - FrequentOldestAgeMinutes *int64 - InfrequentIntervalMinutes *int64 - InfrequentOldestAgeMinutes *int64 - Interval *int64 - MaxCount *int64 - RecoveryMode *string -} - -func databaseBackupConfigFromAPI(c *oapi.DbaasBackupConfig) *DatabaseBackupConfig { - return &DatabaseBackupConfig{ - FrequentIntervalMinutes: c.FrequentIntervalMinutes, - FrequentOldestAgeMinutes: c.FrequentOldestAgeMinutes, - InfrequentIntervalMinutes: c.InfrequentIntervalMinutes, - InfrequentOldestAgeMinutes: c.InfrequentOldestAgeMinutes, - Interval: c.Interval, - MaxCount: c.MaxCount, - RecoveryMode: c.RecoveryMode, - } -} - -// DatabasePlan represents a Database Plan. -type DatabasePlan struct { - Authorized *bool - BackupConfig *DatabaseBackupConfig - DiskSpace *int64 - MaxMemoryPercent *int64 - Name *string - Nodes *int64 - NodeCPUs *int64 - NodeMemory *int64 -} - -func databasePlanFromAPI(p *oapi.DbaasPlan) *DatabasePlan { - return &DatabasePlan{ - Authorized: p.Authorized, - BackupConfig: databaseBackupConfigFromAPI(p.BackupConfig), - DiskSpace: p.DiskSpace, - MaxMemoryPercent: p.MaxMemoryPercent, - Name: p.Name, - Nodes: p.NodeCount, - NodeCPUs: p.NodeCpuCount, - NodeMemory: p.NodeMemory, - } -} - -// DatabaseServiceType represents a Database Service type. -type DatabaseServiceType struct { - AvailableVersions *[]string - DefaultVersion *string - Description *string - Name *string - Plans []*DatabasePlan -} - -func databaseServiceTypeFromAPI(t *oapi.DbaasServiceType) *DatabaseServiceType { - return &DatabaseServiceType{ - AvailableVersions: t.AvailableVersions, - DefaultVersion: t.DefaultVersion, - Description: t.Description, - Name: (*string)(t.Name), - Plans: func() []*DatabasePlan { - plans := make([]*DatabasePlan, 0) - if t.Plans != nil { - for _, plan := range *t.Plans { - plan := plan - plans = append(plans, databasePlanFromAPI(&plan)) - } - } - return plans - }(), - } -} - -// DatabaseServiceNotification represents a Database Service notification. -type DatabaseServiceNotification struct { - Level string - Message string - Type string -} - -func databaseServiceNotificationFromAPI(n *oapi.DbaasServiceNotification) *DatabaseServiceNotification { - return &DatabaseServiceNotification{ - Level: string(n.Level), - Message: n.Message, - Type: string(n.Type), - } -} - -// DatabaseServiceComponent represents a Database Service component. -type DatabaseServiceComponent struct { - Name *string - Info map[string]interface{} -} - -// DatabaseService represents a Database Service. -type DatabaseService struct { - CreatedAt *time.Time - DiskSize *int64 - Name *string `req-for:"delete"` - Nodes *int64 - NodeCPUs *int64 - NodeMemory *int64 - Notifications []*DatabaseServiceNotification - Plan *string - State *string - TerminationProtection *bool - Type *string - UpdatedAt *time.Time - Zone *string -} - -func databaseServiceFromAPI(s *oapi.DbaasServiceCommon, zone string) *DatabaseService { - return &DatabaseService{ - CreatedAt: s.CreatedAt, - DiskSize: s.DiskSize, - Name: (*string)(&s.Name), - Nodes: s.NodeCount, - NodeCPUs: s.NodeCpuCount, - NodeMemory: s.NodeMemory, - Notifications: func() []*DatabaseServiceNotification { - notifications := make([]*DatabaseServiceNotification, 0) - if s.Notifications != nil { - for _, n := range *s.Notifications { - notifications = append(notifications, databaseServiceNotificationFromAPI(&n)) - } - } - return notifications - }(), - Plan: &s.Plan, - State: (*string)(s.State), - TerminationProtection: s.TerminationProtection, - Type: (*string)(&s.Type), - UpdatedAt: s.UpdatedAt, - Zone: &zone, - } -} - -// DeleteDatabaseService deletes a Database Service. -func (c *Client) DeleteDatabaseService(ctx context.Context, zone string, databaseService *DatabaseService) error { - if err := validateOperationParams(databaseService, "delete"); err != nil { - return err - } - - _, err := c.DeleteDbaasServiceWithResponse(apiv2.WithZone(ctx, zone), *databaseService.Name) - if err != nil { - return err - } - - return nil -} - -// GetDatabaseCACertificate returns the CA certificate required to access Database Services using a TLS connection. -func (c *Client) GetDatabaseCACertificate(ctx context.Context, zone string) (string, error) { - resp, err := c.GetDbaasCaCertificateWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return "", err - } - - return *resp.JSON200.Certificate, nil -} - -// GetDatabaseServiceType returns the Database Service type corresponding to the specified name. -func (c *Client) GetDatabaseServiceType(ctx context.Context, zone, name string) (*DatabaseServiceType, error) { - resp, err := c.GetDbaasServiceTypeWithResponse(apiv2.WithZone(ctx, zone), name) - if err != nil { - return nil, err - } - - return databaseServiceTypeFromAPI(resp.JSON200), nil -} - -// ListDatabaseServiceTypes returns the list of existing Database Service types. -func (c *Client) ListDatabaseServiceTypes(ctx context.Context, zone string) ([]*DatabaseServiceType, error) { - list := make([]*DatabaseServiceType, 0) - - resp, err := c.ListDbaasServiceTypesWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.DbaasServiceTypes != nil { - for i := range *resp.JSON200.DbaasServiceTypes { - list = append(list, databaseServiceTypeFromAPI(&(*resp.JSON200.DbaasServiceTypes)[i])) - } - } - - return list, nil -} - -// FindDatabaseService attempts to find a Database service by name -func (c *Client) FindDatabaseService(ctx context.Context, zone, name string) (*DatabaseService, error) { - res, err := c.ListDatabaseServices(ctx, zone) - if err != nil { - return nil, err - } - - for _, d := range res { - if *d.Name == name { - return d, nil - } - } - - return nil, apiv2.ErrNotFound -} - -// ListDatabaseServices returns the list of Database Services. -func (c *Client) ListDatabaseServices(ctx context.Context, zone string) ([]*DatabaseService, error) { - list := make([]*DatabaseService, 0) - - resp, err := c.ListDbaasServicesWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.DbaasServices != nil { - for i := range *resp.JSON200.DbaasServices { - list = append(list, databaseServiceFromAPI(&(*resp.JSON200.DbaasServices)[i], zone)) - } - } - - return list, nil -} - -type DatabaseMigrationStatusDetailsStatus string - -const ( - DatabaseMigrationStatusDone DatabaseMigrationStatusDetailsStatus = "done" - DatabaseMigrationStatusFailed DatabaseMigrationStatusDetailsStatus = "failed" - DatabaseMigrationStatusRunning DatabaseMigrationStatusDetailsStatus = "running" - DatabaseMigrationStatusSyncing DatabaseMigrationStatusDetailsStatus = "syncing" -) - -type DatabaseMigrationRedisMasterLinkStatus string - -// Defines values for MasterLinkStatus. -const ( - MasterLinkStatusDown DatabaseMigrationRedisMasterLinkStatus = "down" - - MasterLinkStatusUp DatabaseMigrationRedisMasterLinkStatus = "up" -) - -type DatabaseMigrationStatusDetails struct { - // Migrated db name (PG) or number (Redis) - DBName *string - - // Error message in case that migration has failed - Error *string - - // Migration method - Method *string - Status *DatabaseMigrationStatusDetailsStatus -} - -type DatabaseMigrationStatus struct { - // Migration status per database - Details []DatabaseMigrationStatusDetails - - // Error message in case that migration has failed - Error *string - - // Redis only: how many seconds since last I/O with redis master - MasterLastIOSecondsAgo *int64 - MasterLinkStatus *DatabaseMigrationRedisMasterLinkStatus - - // Migration method. Empty in case of multiple methods or error - Method *string - - // Migration status - Status *string -} - -func databaseMigrationStatusFromAPI(in *oapi.DbaasMigrationStatus) *DatabaseMigrationStatus { - if in == nil { - return nil - } - - out := &DatabaseMigrationStatus{ - Details: []DatabaseMigrationStatusDetails{}, - Error: in.Error, - MasterLastIOSecondsAgo: in.MasterLastIoSecondsAgo, - MasterLinkStatus: (*DatabaseMigrationRedisMasterLinkStatus)(in.MasterLinkStatus), - Method: in.Method, - Status: in.Status, - } - - if in.Details != nil { - for _, d := range *in.Details { - out.Details = append(out.Details, DatabaseMigrationStatusDetails{ - DBName: d.Dbname, - Error: d.Error, - Method: d.Method, - Status: (*DatabaseMigrationStatusDetailsStatus)(d.Status), - }) - } - } - - return out -} - -func (c *Client) GetDatabaseMigrationStatus(ctx context.Context, zone string, name string) (*DatabaseMigrationStatus, error) { - resp, err := c.GetDbaasMigrationStatusWithResponse(apiv2.WithZone(ctx, zone), oapi.DbaasServiceName(name)) - if err != nil { - return nil, err - } - - return databaseMigrationStatusFromAPI(resp.JSON200), nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/database_mysql.go b/vendor/github.com/exoscale/egoscale/v2/database_mysql.go deleted file mode 100644 index 6d528549..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/database_mysql.go +++ /dev/null @@ -1,26 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// StopMysqlDatabaseMigration stops running Database migration. -func (c *Client) StopMysqlDatabaseMigration(ctx context.Context, zone string, name string) error { - resp, err := c.StopDbaasMysqlMigrationWithResponse(apiv2.WithZone(ctx, zone), oapi.DbaasServiceName(name)) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/database_pg.go b/vendor/github.com/exoscale/egoscale/v2/database_pg.go deleted file mode 100644 index 79c487ee..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/database_pg.go +++ /dev/null @@ -1,26 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// StopPgDatabaseMigration stops running Database migration. -func (c *Client) StopPgDatabaseMigration(ctx context.Context, zone string, name string) error { - resp, err := c.StopDbaasPgMigrationWithResponse(apiv2.WithZone(ctx, zone), oapi.DbaasServiceName(name)) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/database_redis.go b/vendor/github.com/exoscale/egoscale/v2/database_redis.go deleted file mode 100644 index e0cb1dce..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/database_redis.go +++ /dev/null @@ -1,26 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// StopRedisDatabaseMigration stops running Database migration. -func (c *Client) StopRedisDatabaseMigration(ctx context.Context, zone string, name string) error { - resp, err := c.StopDbaasRedisMigrationWithResponse(apiv2.WithZone(ctx, zone), oapi.DbaasServiceName(name)) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/deploy_target.go b/vendor/github.com/exoscale/egoscale/v2/deploy_target.go deleted file mode 100644 index 9f25c7dd..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/deploy_target.go +++ /dev/null @@ -1,71 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// DeployTarget represents a Deploy Target. -type DeployTarget struct { - Description *string - ID *string - Name *string - Type *string - Zone *string -} - -func deployTargetFromAPI(d *oapi.DeployTarget, zone string) *DeployTarget { - return &DeployTarget{ - Description: d.Description, - ID: &d.Id, - Name: d.Name, - Type: (*string)(d.Type), - Zone: &zone, - } -} - -// FindDeployTarget attempts to find a Deploy Target by name or ID. -func (c *Client) FindDeployTarget(ctx context.Context, zone, x string) (*DeployTarget, error) { - res, err := c.ListDeployTargets(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetDeployTarget(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetDeployTarget returns the Deploy Target corresponding to the specified ID. -func (c *Client) GetDeployTarget(ctx context.Context, zone, id string) (*DeployTarget, error) { - resp, err := c.GetDeployTargetWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return deployTargetFromAPI(resp.JSON200, zone), nil -} - -// ListDeployTargets returns the list of existing Deploy Targets. -func (c *Client) ListDeployTargets(ctx context.Context, zone string) ([]*DeployTarget, error) { - list := make([]*DeployTarget, 0) - - resp, err := c.ListDeployTargetsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.DeployTargets != nil { - for i := range *resp.JSON200.DeployTargets { - list = append(list, deployTargetFromAPI(&(*resp.JSON200.DeployTargets)[i], zone)) - } - } - - return list, nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/dns.go b/vendor/github.com/exoscale/egoscale/v2/dns.go deleted file mode 100644 index c2361862..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/dns.go +++ /dev/null @@ -1,260 +0,0 @@ -package v2 - -import ( - "context" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// DNSDomain represents a DNS domain. -type DNSDomain struct { - CreatedAt *time.Time - ID *string `req-for:"delete"` - UnicodeName *string `req-for:"create"` -} - -// DNSDomainRecord represents a DNS record. -type DNSDomainRecord struct { - Content *string `req-for:"create"` - CreatedAt *time.Time - ID *string `req-for:"delete,update"` - Name *string `req-for:"create"` - Priority *int64 - TTL *int64 - Type *string `req-for:"create"` - UpdatedAt *time.Time -} - -func dnsDomainFromAPI(d *oapi.DnsDomain) *DNSDomain { - return &DNSDomain{ - CreatedAt: d.CreatedAt, - ID: d.Id, - UnicodeName: d.UnicodeName, - } -} - -func dnsDomainRecordFromAPI(d *oapi.DnsDomainRecord) *DNSDomainRecord { - var t *string - if d.Type != nil { - x := string(*d.Type) - t = &x - } - return &DNSDomainRecord{ - Content: d.Content, - CreatedAt: d.CreatedAt, - ID: d.Id, - Name: d.Name, - Priority: d.Priority, - TTL: d.Ttl, - Type: t, - UpdatedAt: d.UpdatedAt, - } -} - -// ListDNSDomains returns the list of DNS domains. -func (c *Client) ListDNSDomains(ctx context.Context, zone string) ([]DNSDomain, error) { - var list []DNSDomain - - resp, err := c.ListDnsDomainsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.DnsDomains != nil { - for _, domain := range *resp.JSON200.DnsDomains { - list = append(list, *dnsDomainFromAPI(&domain)) - } - } - - return list, nil -} - -// GetDNSDomain returns DNS domain details. -func (c *Client) GetDNSDomain(ctx context.Context, zone, id string) (*DNSDomain, error) { - resp, err := c.GetDnsDomainWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return dnsDomainFromAPI(resp.JSON200), nil -} - -// DeleteDNSDomain deletes a DNS domain. -func (c *Client) DeleteDNSDomain(ctx context.Context, zone string, domain *DNSDomain) error { - if err := validateOperationParams(domain, "delete"); err != nil { - return err - } - - resp, err := c.DeleteDnsDomainWithResponse(apiv2.WithZone(ctx, zone), *domain.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// CreateDNSDomain adds a new DNS domain. -func (c *Client) CreateDNSDomain( - ctx context.Context, - zone string, - domain *DNSDomain, -) (*DNSDomain, error) { - if err := validateOperationParams(domain, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateDnsDomainWithResponse(apiv2.WithZone(ctx, zone), oapi.CreateDnsDomainJSONRequestBody{ - UnicodeName: domain.UnicodeName, - }) - if err != nil { - return nil, err - } - - r, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetDNSDomain(ctx, zone, *r.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// GetDNSDomainZoneFile returns zone file of a DNS domain. -func (c *Client) GetDNSDomainZoneFile(ctx context.Context, zone, id string) ([]byte, error) { - resp, err := c.GetDnsDomainZoneFileWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return resp.Body, nil -} - -// ListDNSDomainRecords returns the list of records for DNS domain. -func (c *Client) ListDNSDomainRecords(ctx context.Context, zone, id string) ([]DNSDomainRecord, error) { - var list []DNSDomainRecord - - resp, err := c.ListDnsDomainRecordsWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - if resp.JSON200.DnsDomainRecords != nil { - for _, record := range *resp.JSON200.DnsDomainRecords { - list = append(list, *dnsDomainRecordFromAPI(&record)) - } - } - - return list, nil -} - -// GetDNSDomainRecord returns a single DNS domain record. -func (c *Client) GetDNSDomainRecord(ctx context.Context, zone, domainID, recordID string) (*DNSDomainRecord, error) { - resp, err := c.GetDnsDomainRecordWithResponse(apiv2.WithZone(ctx, zone), domainID, recordID) - if err != nil { - return nil, err - } - - return dnsDomainRecordFromAPI(resp.JSON200), nil -} - -// CreateDNSDomainRecord adds a new DNS record for domain. -func (c *Client) CreateDNSDomainRecord( - ctx context.Context, - zone string, - domainID string, - record *DNSDomainRecord, -) (*DNSDomainRecord, error) { - if err := validateOperationParams(record, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateDnsDomainRecordWithResponse(apiv2.WithZone(ctx, zone), domainID, oapi.CreateDnsDomainRecordJSONRequestBody{ - Content: *record.Content, - Name: *record.Name, - Priority: record.Priority, - Ttl: record.TTL, - Type: oapi.CreateDnsDomainRecordJSONBodyType(*record.Type), - }) - if err != nil { - return nil, err - } - - r, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetDNSDomainRecord(ctx, zone, domainID, *r.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteDNSDomainRecord deletes a DNS domain record. -func (c *Client) DeleteDNSDomainRecord(ctx context.Context, zone, domainID string, record *DNSDomainRecord) error { - if err := validateOperationParams(record, "delete"); err != nil { - return err - } - - resp, err := c.DeleteDnsDomainRecordWithResponse(apiv2.WithZone(ctx, zone), domainID, *record.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateDNSDomainRecord updates existing DNS domain record. -func (c *Client) UpdateDNSDomainRecord(ctx context.Context, zone, domainID string, record *DNSDomainRecord) error { - if err := validateOperationParams(record, "update"); err != nil { - return err - } - - resp, err := c.UpdateDnsDomainRecordWithResponse(apiv2.WithZone(ctx, zone), domainID, *record.ID, oapi.UpdateDnsDomainRecordJSONRequestBody{ - Content: record.Content, - Name: record.Name, - Priority: record.Priority, - Ttl: record.TTL, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/elastic_ip.go b/vendor/github.com/exoscale/egoscale/v2/elastic_ip.go deleted file mode 100644 index 560b60c4..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/elastic_ip.go +++ /dev/null @@ -1,333 +0,0 @@ -package v2 - -import ( - "context" - "net" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// ElasticIPHealthcheck represents an Elastic IP healthcheck. -type ElasticIPHealthcheck struct { - Interval *time.Duration - Mode *string `req-for:"create,update"` - Port *uint16 `req-for:"create,update"` - StrikesFail *int64 - StrikesOK *int64 - TLSSNI *string - TLSSkipVerify *bool - Timeout *time.Duration - URI *string -} - -// ElasticIP represents an Elastic IP. -type ElasticIP struct { - Description *string - Healthcheck *ElasticIPHealthcheck - ID *string `req-for:"update,delete"` - IPAddress *net.IP - Labels *map[string]string - Zone *string - CIDR *string - AddressFamily *string -} - -func elasticIPFromAPI(e *oapi.ElasticIp, zone string) *ElasticIP { - ipAddress := net.ParseIP(*e.Ip) - - return &ElasticIP{ - Description: e.Description, - Healthcheck: func() *ElasticIPHealthcheck { - if hc := e.Healthcheck; hc != nil { - port := uint16(hc.Port) - interval := time.Duration(oapi.OptionalInt64(hc.Interval)) * time.Second - timeout := time.Duration(oapi.OptionalInt64(hc.Timeout)) * time.Second - - return &ElasticIPHealthcheck{ - Interval: &interval, - Mode: (*string)(&hc.Mode), - Port: &port, - StrikesFail: hc.StrikesFail, - StrikesOK: hc.StrikesOk, - TLSSNI: hc.TlsSni, - TLSSkipVerify: hc.TlsSkipVerify, - Timeout: &timeout, - URI: hc.Uri, - } - } - return nil - }(), - ID: e.Id, - IPAddress: &ipAddress, - Labels: func() (v *map[string]string) { - if e.Labels != nil && len(e.Labels.AdditionalProperties) > 0 { - v = &e.Labels.AdditionalProperties - } - return - }(), - Zone: &zone, - CIDR: e.Cidr, - AddressFamily: (*string)(e.Addressfamily), - } -} - -// CreateElasticIP creates an Elastic IP. -func (c *Client) CreateElasticIP(ctx context.Context, zone string, elasticIP *ElasticIP) (*ElasticIP, error) { - if err := validateOperationParams(elasticIP, "create"); err != nil { - return nil, err - } - if elasticIP.Healthcheck != nil { - if err := validateOperationParams(elasticIP.Healthcheck, "create"); err != nil { - return nil, err - } - } - - var addressFamily *oapi.CreateElasticIpJSONBodyAddressfamily - if elasticIP.AddressFamily != nil { - addressFamily = (*oapi.CreateElasticIpJSONBodyAddressfamily)(elasticIP.AddressFamily) - } - - resp, err := c.CreateElasticIpWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreateElasticIpJSONRequestBody{ - Description: elasticIP.Description, - Addressfamily: addressFamily, - Healthcheck: func() *oapi.ElasticIpHealthcheck { - if hc := elasticIP.Healthcheck; hc != nil { - var ( - port = int64(*hc.Port) - interval = int64(hc.Interval.Seconds()) - timeout = int64(hc.Timeout.Seconds()) - ) - - return &oapi.ElasticIpHealthcheck{ - Interval: &interval, - Mode: oapi.ElasticIpHealthcheckMode(*hc.Mode), - Port: port, - StrikesFail: hc.StrikesFail, - StrikesOk: hc.StrikesOK, - Timeout: &timeout, - TlsSkipVerify: hc.TLSSkipVerify, - TlsSni: hc.TLSSNI, - Uri: hc.URI, - } - } - return nil - }(), - Labels: func() (v *oapi.Labels) { - if elasticIP.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *elasticIP.Labels} - } - return - }(), - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetElasticIP(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteElasticIP deletes an Elastic IP. -func (c *Client) DeleteElasticIP(ctx context.Context, zone string, elasticIP *ElasticIP) error { - if err := validateOperationParams(elasticIP, "delete"); err != nil { - return err - } - - resp, err := c.DeleteElasticIpWithResponse(apiv2.WithZone(ctx, zone), *elasticIP.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindElasticIP attempts to find an Elastic IP by IP address or ID. -func (c *Client) FindElasticIP(ctx context.Context, zone, x string) (*ElasticIP, error) { - res, err := c.ListElasticIPs(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || r.IPAddress.String() == x { - return c.GetElasticIP(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetElasticIP returns the Elastic IP corresponding to the specified ID. -func (c *Client) GetElasticIP(ctx context.Context, zone, id string) (*ElasticIP, error) { - resp, err := c.GetElasticIpWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return elasticIPFromAPI(resp.JSON200, zone), nil -} - -// ListElasticIPs returns the list of existing Elastic IPs. -func (c *Client) ListElasticIPs(ctx context.Context, zone string) ([]*ElasticIP, error) { - list := make([]*ElasticIP, 0) - - resp, err := c.ListElasticIpsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.ElasticIps != nil { - for i := range *resp.JSON200.ElasticIps { - list = append(list, elasticIPFromAPI(&(*resp.JSON200.ElasticIps)[i], zone)) - } - } - - return list, nil -} - -// UpdateElasticIP updates an Elastic IP. -func (c *Client) UpdateElasticIP(ctx context.Context, zone string, elasticIP *ElasticIP) error { - if err := validateOperationParams(elasticIP, "update"); err != nil { - return err - } - if elasticIP.Healthcheck != nil { - if err := validateOperationParams(elasticIP.Healthcheck, "update"); err != nil { - return err - } - } - - resp, err := c.UpdateElasticIpWithResponse( - apiv2.WithZone(ctx, zone), - *elasticIP.ID, - oapi.UpdateElasticIpJSONRequestBody{ - Description: oapi.NilableString(elasticIP.Description), - Healthcheck: func() *oapi.ElasticIpHealthcheck { - if hc := elasticIP.Healthcheck; hc != nil { - port := int64(*hc.Port) - - return &oapi.ElasticIpHealthcheck{ - Interval: func() (v *int64) { - if hc.Interval != nil { - interval := int64(hc.Interval.Seconds()) - v = &interval - } - return - }(), - Mode: oapi.ElasticIpHealthcheckMode(*hc.Mode), - Port: port, - StrikesFail: hc.StrikesFail, - StrikesOk: hc.StrikesOK, - Timeout: func() (v *int64) { - if hc.Timeout != nil { - timeout := int64(hc.Timeout.Seconds()) - v = &timeout - } - return - }(), - TlsSkipVerify: hc.TLSSkipVerify, - TlsSni: hc.TLSSNI, - Uri: hc.URI, - } - } - return nil - }(), - Labels: func() (v *oapi.Labels) { - if elasticIP.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *elasticIP.Labels} - } - return - }(), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// GetElasticIPReverseDNS returns the Reverse DNS record corresponding to the specified Elastic IP ID. -func (c *Client) GetElasticIPReverseDNS(ctx context.Context, zone, id string) (string, error) { - resp, err := c.GetReverseDnsElasticIpWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return "", err - } - - if resp.JSON200 == nil || resp.JSON200.DomainName == nil { - return "", apiv2.ErrNotFound - } - - return string(*resp.JSON200.DomainName), nil -} - -// DeleteElasticIPReverseDNS deletes a Reverse DNS record of a Elastic IP. -func (c *Client) DeleteElasticIPReverseDNS(ctx context.Context, zone string, id string) error { - resp, err := c.DeleteReverseDnsElasticIpWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateElasticIPReverseDNS updates a Reverse DNS record for a ElasticIP. -func (c *Client) UpdateElasticIPReverseDNS(ctx context.Context, zone, id, domain string) error { - resp, err := c.UpdateReverseDnsElasticIpWithResponse( - apiv2.WithZone(ctx, zone), - id, - oapi.UpdateReverseDnsElasticIpJSONRequestBody{ - DomainName: &domain, - }, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/error.go b/vendor/github.com/exoscale/egoscale/v2/error.go deleted file mode 100644 index 2e20c8e1..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/error.go +++ /dev/null @@ -1,6 +0,0 @@ -package v2 - -import "errors" - -// ErrClientConfig represents a client configuration error. -var ErrClientConfig = errors.New("client configuration error") diff --git a/vendor/github.com/exoscale/egoscale/v2/iam.go b/vendor/github.com/exoscale/egoscale/v2/iam.go deleted file mode 100644 index 0aaff287..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/iam.go +++ /dev/null @@ -1,49 +0,0 @@ -package v2 - -import ( - "github.com/exoscale/egoscale/v2/oapi" -) - -// IAMPolicy represents an IAM policy resource. -type IAMPolicy struct { - DefaultServiceStrategy string - Services map[string]IAMPolicyService -} - -// IAMPolicyService represents a service of IAM policy. -type IAMPolicyService struct { - Type *string - Rules []IAMPolicyServiceRule -} - -// IamPolicyServiceRule represents service rule of IAM policy. -type IAMPolicyServiceRule struct { - Action *string - Expression *string - Resources []string -} - -func iamPolicyFromAPI(r *oapi.IamPolicy) *IAMPolicy { - services := make(map[string]IAMPolicyService, len(r.Services.AdditionalProperties)) - for name, service := range r.Services.AdditionalProperties { - rules := []IAMPolicyServiceRule{} - if service.Rules != nil && len(*service.Rules) > 0 { - for _, rule := range *service.Rules { - rules = append(rules, IAMPolicyServiceRule{ - Action: (*string)(rule.Action), - Expression: rule.Expression, - }) - } - } - - services[name] = IAMPolicyService{ - Type: (*string)(service.Type), - Rules: rules, - } - } - - return &IAMPolicy{ - DefaultServiceStrategy: string(r.DefaultServiceStrategy), - Services: services, - } -} diff --git a/vendor/github.com/exoscale/egoscale/v2/iam_access_key.go b/vendor/github.com/exoscale/egoscale/v2/iam_access_key.go deleted file mode 100644 index 0a1e7823..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/iam_access_key.go +++ /dev/null @@ -1,228 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// IAMAccessKeyResource represents an API resource accessible to an IAM access key. -type IAMAccessKeyResource struct { - Domain string - ResourceName string - ResourceType string -} - -func iamAccessKeyResourceFromAPI(r *oapi.AccessKeyResource) *IAMAccessKeyResource { - return &IAMAccessKeyResource{ - Domain: string(*r.Domain), - ResourceName: *r.ResourceName, - ResourceType: string(*r.ResourceType), - } -} - -// IAMAccessKeyOperation represents an API operation supported by an IAM access key. -type IAMAccessKeyOperation struct { - Name string - Tags []string -} - -func iamAccessKeyOperationFromAPI(o *oapi.AccessKeyOperation) *IAMAccessKeyOperation { - return &IAMAccessKeyOperation{ - Name: *o.Operation, - Tags: func() (v []string) { - if o.Tags != nil { - v = *o.Tags - } - return - }(), - } -} - -// CreateIAMAccessKeyOpt represents a CreateIAMAccessKey operation option. -type CreateIAMAccessKeyOpt func(*oapi.CreateAccessKeyJSONRequestBody) - -// CreateIAMAccessKeyWithOperations sets a restricted list of API operations to the IAM access key. -func CreateIAMAccessKeyWithOperations(v []string) CreateIAMAccessKeyOpt { - return func(b *oapi.CreateAccessKeyJSONRequestBody) { - if len(v) > 0 { - b.Operations = &v - } - } -} - -// CreateIAMAccessKeyWithResources sets a restricted list of API resources to the IAM access key. -func CreateIAMAccessKeyWithResources(v []IAMAccessKeyResource) CreateIAMAccessKeyOpt { - return func(b *oapi.CreateAccessKeyJSONRequestBody) { - if len(v) > 0 { - b.Resources = func() *[]oapi.AccessKeyResource { - list := make([]oapi.AccessKeyResource, len(v)) - for i, r := range v { - r := r - list[i] = oapi.AccessKeyResource{ - Domain: (*oapi.AccessKeyResourceDomain)(&r.Domain), - ResourceName: &r.ResourceName, - ResourceType: (*oapi.AccessKeyResourceResourceType)(&r.ResourceType), - } - } - return &list - }() - } - } -} - -// CreateIAMAccessKeyWithTags sets a restricted list of API operation tags to the IAM access key. -func CreateIAMAccessKeyWithTags(v []string) CreateIAMAccessKeyOpt { - return func(b *oapi.CreateAccessKeyJSONRequestBody) { - if len(v) > 0 { - b.Tags = &v - } - } -} - -// IAMAccessKey represents an IAM access key. -type IAMAccessKey struct { - Key *string `req-for:"delete"` - Name *string - Operations *[]string - Resources *[]IAMAccessKeyResource - Secret *string - Tags *[]string - Type *string - Version *string -} - -func iamAccessKeyFromAPI(k *oapi.AccessKey) *IAMAccessKey { - return &IAMAccessKey{ - Key: k.Key, - Name: k.Name, - Operations: k.Operations, - Resources: func() *[]IAMAccessKeyResource { - if k.Resources != nil { - list := make([]IAMAccessKeyResource, len(*k.Resources)) - for i, r := range *k.Resources { - list[i] = *iamAccessKeyResourceFromAPI(&r) - } - return &list - } - return nil - }(), - Secret: k.Secret, - Tags: k.Tags, - Type: (*string)(k.Type), - Version: (*string)(k.Version), - } -} - -// CreateIAMAccessKey creates a new IAM access key. -func (c *Client) CreateIAMAccessKey( - ctx context.Context, - zone string, - name string, - opts ...CreateIAMAccessKeyOpt, -) (*IAMAccessKey, error) { - body := oapi.CreateAccessKeyJSONRequestBody{Name: &name} - for _, opt := range opts { - opt(&body) - } - - res, err := c.CreateAccessKeyWithResponse(apiv2.WithZone(ctx, zone), body) - if err != nil { - return nil, err - } - - // Contrary to other CreateXXX() methods, we don't chain the CreateAccessKeyWithResponse - // call with GetAccessKeyWithResponse as the IAM access key secret is only returned once - // in the CreateAccessKeyResponse body, therefore we have to return it directly to the - // caller. - return iamAccessKeyFromAPI(res.JSON200), nil -} - -// GetIAMAccessKey returns the IAM access key corresponding to the specified key. -func (c *Client) GetIAMAccessKey(ctx context.Context, zone, key string) (*IAMAccessKey, error) { - resp, err := c.GetAccessKeyWithResponse(apiv2.WithZone(ctx, zone), key) - if err != nil { - return nil, err - } - - return iamAccessKeyFromAPI(resp.JSON200), nil -} - -// ListIAMAccessKeyOperations returns the list of all available API operations supported -// by IAM access keys. -func (c *Client) ListIAMAccessKeyOperations(ctx context.Context, zone string) ([]*IAMAccessKeyOperation, error) { - list := make([]*IAMAccessKeyOperation, 0) - - resp, err := c.ListAccessKeyKnownOperationsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.AccessKeyOperations != nil { - for i := range *resp.JSON200.AccessKeyOperations { - list = append(list, iamAccessKeyOperationFromAPI(&(*resp.JSON200.AccessKeyOperations)[i])) - } - } - - return list, nil -} - -// ListIAMAccessKeys returns the list of existing IAM access keys. -func (c *Client) ListIAMAccessKeys(ctx context.Context, zone string) ([]*IAMAccessKey, error) { - list := make([]*IAMAccessKey, 0) - - resp, err := c.ListAccessKeysWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.AccessKeys != nil { - for i := range *resp.JSON200.AccessKeys { - list = append(list, iamAccessKeyFromAPI(&(*resp.JSON200.AccessKeys)[i])) - } - } - - return list, nil -} - -// ListMyIAMAccessKeyOperations returns the list of operations the current API access key -// performing the request is restricted to. -func (c *Client) ListMyIAMAccessKeyOperations(ctx context.Context, zone string) ([]*IAMAccessKeyOperation, error) { - list := make([]*IAMAccessKeyOperation, 0) - - resp, err := c.ListAccessKeyOperationsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.AccessKeyOperations != nil { - for i := range *resp.JSON200.AccessKeyOperations { - list = append(list, iamAccessKeyOperationFromAPI(&(*resp.JSON200.AccessKeyOperations)[i])) - } - } - - return list, nil -} - -// RevokeIAMAccessKey revokes an IAM access key. -func (c *Client) RevokeIAMAccessKey(ctx context.Context, zone string, iamAccessKey *IAMAccessKey) error { - if err := validateOperationParams(iamAccessKey, "delete"); err != nil { - return err - } - - resp, err := c.RevokeAccessKeyWithResponse(apiv2.WithZone(ctx, zone), *iamAccessKey.Key) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/iam_api_key.go b/vendor/github.com/exoscale/egoscale/v2/iam_api_key.go deleted file mode 100644 index 1c8c1522..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/iam_api_key.go +++ /dev/null @@ -1,106 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// APIKey represents an IAM API Key resource. -type APIKey struct { - Key *string `req-for:"delete"` - Name *string `req-for:"create"` - RoleID *string `req-for:"create"` -} - -func apiKeyFromAPI(r *oapi.IamApiKey) *APIKey { - return &APIKey{ - Key: r.Key, - Name: r.Name, - RoleID: r.RoleId, - } -} - -// GetAPIKey returns the IAM API Key. -func (c *Client) GetAPIKey(ctx context.Context, zone, key string) (*APIKey, error) { - resp, err := c.GetApiKeyWithResponse(apiv2.WithZone(ctx, zone), key) - if err != nil { - return nil, err - } - - return apiKeyFromAPI(resp.JSON200), nil -} - -// ListAPIKeys returns the list of existing IAM API Keys. -func (c *Client) ListAPIKeys(ctx context.Context, zone string) ([]*APIKey, error) { - list := make([]*APIKey, 0) - - resp, err := c.ListApiKeysWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.ApiKeys != nil { - for i := range *resp.JSON200.ApiKeys { - list = append(list, apiKeyFromAPI(&(*resp.JSON200.ApiKeys)[i])) - } - } - - return list, nil -} - -// CreateAPIKey creates a IAM API Key. -func (c *Client) CreateAPIKey( - ctx context.Context, - zone string, - apiKey *APIKey, -) (key *APIKey, secret string, err error) { - if err = validateOperationParams(apiKey, "create"); err != nil { - return - } - - req := oapi.CreateApiKeyJSONRequestBody{ - Name: *apiKey.Name, - RoleId: *apiKey.RoleID, - } - - resp, err := c.CreateApiKeyWithResponse( - apiv2.WithZone(ctx, zone), - req, - ) - if err != nil { - return - } - - key = &APIKey{ - Key: resp.JSON200.Key, - Name: resp.JSON200.Name, - RoleID: resp.JSON200.RoleId, - } - secret = *resp.JSON200.Secret - - return -} - -// DeleteAPIKey deletes IAM API Key. -func (c *Client) DeleteAPIKey(ctx context.Context, zone string, apiKey *APIKey) error { - if err := validateOperationParams(apiKey, "delete"); err != nil { - return err - } - - resp, err := c.DeleteApiKeyWithResponse(apiv2.WithZone(ctx, zone), *apiKey.Key) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/iam_org_policy.go b/vendor/github.com/exoscale/egoscale/v2/iam_org_policy.go deleted file mode 100644 index 9b9666d4..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/iam_org_policy.go +++ /dev/null @@ -1,73 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// GetIAMOrgPolicy returns the IAM Organization policy. -func (c *Client) GetIAMOrgPolicy(ctx context.Context, zone string) (*IAMPolicy, error) { - resp, err := c.GetIamOrganizationPolicyWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - return iamPolicyFromAPI(resp.JSON200), nil -} - -// UpdateIAMOrgPolicy updates existing IAM Organization policy. -func (c *Client) UpdateIAMOrgPolicy(ctx context.Context, zone string, policy *IAMPolicy) error { - - req := oapi.UpdateIamOrganizationPolicyJSONRequestBody{ - DefaultServiceStrategy: oapi.IamPolicyDefaultServiceStrategy(policy.DefaultServiceStrategy), - Services: oapi.IamPolicy_Services{ - AdditionalProperties: map[string]oapi.IamServicePolicy{}, - }, - } - - if len(policy.Services) > 0 { - for name, service := range policy.Services { - t := oapi.IamServicePolicy{ - Type: (*oapi.IamServicePolicyType)(service.Type), - } - - if service.Rules != nil { - rules := []oapi.IamServicePolicyRule{} - - for _, rule := range service.Rules { - r := oapi.IamServicePolicyRule{ - Action: (*oapi.IamServicePolicyRuleAction)(rule.Action), - Expression: rule.Expression, - } - - rules = append(rules, r) - } - - t.Rules = &rules - } - - req.Services.AdditionalProperties[name] = t - - } - } - - resp, err := c.UpdateIamOrganizationPolicyWithResponse( - apiv2.WithZone(ctx, zone), - req, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/iam_role.go b/vendor/github.com/exoscale/egoscale/v2/iam_role.go deleted file mode 100644 index 77751f87..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/iam_role.go +++ /dev/null @@ -1,289 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// IAMRole represents an IAM Role resource. -type IAMRole struct { - ID *string `req-for:"delete,update"` - Description *string - Editable *bool - Labels map[string]string - Name *string `req-for:"create"` - Permissions []string - Policy *IAMPolicy -} - -func iamRoleFromAPI(r *oapi.IamRole) *IAMRole { - labels := map[string]string{} - if r.Labels != nil && r.Labels.AdditionalProperties != nil { - labels = r.Labels.AdditionalProperties - } - - permissions := []string{} - if r.Permissions != nil { - for _, p := range *r.Permissions { - permissions = append(permissions, string(p)) - } - } - - return &IAMRole{ - ID: r.Id, - Description: r.Description, - Editable: r.Editable, - Labels: labels, - Name: r.Name, - Permissions: permissions, - - Policy: iamPolicyFromAPI(r.Policy), - } -} - -// GetIAMRole returns the IAM Role. -func (c *Client) GetIAMRole(ctx context.Context, zone, id string) (*IAMRole, error) { - resp, err := c.GetIamRoleWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return iamRoleFromAPI(resp.JSON200), nil -} - -// ListIAMRoles returns the list of existing IAM Roles. -func (c *Client) ListIAMRoles(ctx context.Context, zone string) ([]*IAMRole, error) { - list := make([]*IAMRole, 0) - - resp, err := c.ListIamRolesWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.IamRoles != nil { - for i := range *resp.JSON200.IamRoles { - list = append(list, iamRoleFromAPI(&(*resp.JSON200.IamRoles)[i])) - } - } - - return list, nil -} - -// CreateIAMRole creates a IAM Role. -func (c *Client) CreateIAMRole( - ctx context.Context, - zone string, - role *IAMRole, -) (*IAMRole, error) { - if err := validateOperationParams(role, "create"); err != nil { - return nil, err - } - - req := oapi.CreateIamRoleJSONRequestBody{ - Name: *role.Name, - Description: role.Description, - Editable: role.Editable, - } - - if role.Labels != nil { - req.Labels = &oapi.Labels{ - AdditionalProperties: role.Labels, - } - } - - if role.Permissions != nil { - t := []oapi.CreateIamRoleJSONBodyPermissions{} - for _, p := range role.Permissions { - t = append(t, oapi.CreateIamRoleJSONBodyPermissions(p)) - } - - req.Permissions = &t - } - - if role.Policy != nil { - t := oapi.IamPolicy{ - DefaultServiceStrategy: oapi.IamPolicyDefaultServiceStrategy(role.Policy.DefaultServiceStrategy), - Services: oapi.IamPolicy_Services{ - AdditionalProperties: map[string]oapi.IamServicePolicy{}, - }, - } - - if len(role.Policy.Services) > 0 { - for name, service := range role.Policy.Services { - s := oapi.IamServicePolicy{ - Type: (*oapi.IamServicePolicyType)(service.Type), - } - - if service.Rules != nil { - rules := []oapi.IamServicePolicyRule{} - - for _, rule := range service.Rules { - r := oapi.IamServicePolicyRule{ - Action: (*oapi.IamServicePolicyRuleAction)(rule.Action), - Expression: rule.Expression, - } - - rules = append(rules, r) - } - - s.Rules = &rules - } - - t.Services.AdditionalProperties[name] = s - - } - } - - req.Policy = &t - } - - resp, err := c.CreateIamRoleWithResponse( - apiv2.WithZone(ctx, zone), - req, - ) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetIAMRole(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteIAMRole deletes IAM Role. -func (c *Client) DeleteIAMRole(ctx context.Context, zone string, role *IAMRole) error { - if err := validateOperationParams(role, "delete"); err != nil { - return err - } - - resp, err := c.DeleteIamRoleWithResponse(apiv2.WithZone(ctx, zone), *role.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateIAMRole updates existing IAM Role. -func (c *Client) UpdateIAMRole(ctx context.Context, zone string, role *IAMRole) error { - if err := validateOperationParams(role, "update"); err != nil { - return err - } - - req := oapi.UpdateIamRoleJSONRequestBody{ - Description: role.Description, - } - - if role.Labels != nil { - req.Labels = &oapi.Labels{ - AdditionalProperties: role.Labels, - } - } - - if role.Permissions != nil { - t := []oapi.UpdateIamRoleJSONBodyPermissions{} - for _, p := range role.Permissions { - t = append(t, oapi.UpdateIamRoleJSONBodyPermissions(p)) - } - - req.Permissions = &t - } - - resp, err := c.UpdateIamRoleWithResponse( - apiv2.WithZone(ctx, zone), - *role.ID, - req, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateIAMRolePolicy updates existing IAM Role policy. -func (c *Client) UpdateIAMRolePolicy(ctx context.Context, zone string, role *IAMRole) error { - if err := validateOperationParams(role, "update"); err != nil { - return err - } - - req := oapi.UpdateIamRolePolicyJSONRequestBody{ - DefaultServiceStrategy: oapi.IamPolicyDefaultServiceStrategy(role.Policy.DefaultServiceStrategy), - Services: oapi.IamPolicy_Services{ - AdditionalProperties: map[string]oapi.IamServicePolicy{}, - }, - } - - if len(role.Policy.Services) > 0 { - for name, service := range role.Policy.Services { - t := oapi.IamServicePolicy{ - Type: (*oapi.IamServicePolicyType)(service.Type), - } - - if service.Rules != nil { - rules := []oapi.IamServicePolicyRule{} - - for _, rule := range service.Rules { - r := oapi.IamServicePolicyRule{ - Action: (*oapi.IamServicePolicyRuleAction)(rule.Action), - Expression: rule.Expression, - } - - rules = append(rules, r) - } - - t.Rules = &rules - } - - req.Services.AdditionalProperties[name] = t - - } - } - - resp, err := c.UpdateIamRolePolicyWithResponse( - apiv2.WithZone(ctx, zone), - *role.ID, - req, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/instance.go b/vendor/github.com/exoscale/egoscale/v2/instance.go deleted file mode 100644 index d29248d7..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/instance.go +++ /dev/null @@ -1,912 +0,0 @@ -package v2 - -import ( - "context" - "net" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// InstanceManager represents a Compute instance manager. -type InstanceManager struct { - ID string - Type string -} - -// Instance represents a Compute instance. -type Instance struct { - AntiAffinityGroupIDs *[]string - CreatedAt *time.Time - DeployTargetID *string - DiskSize *int64 `req-for:"create"` - ElasticIPIDs *[]string - ID *string `req-for:"update,delete"` - IPv6Address *net.IP - IPv6Enabled *bool - InstanceTypeID *string `req-for:"create"` - Labels *map[string]string - Manager *InstanceManager - Name *string `req-for:"create"` - PrivateNetworkIDs *[]string - PublicIPAddress *net.IP - PublicIPAssignment *string - SSHKey *string - SecurityGroupIDs *[]string - SnapshotIDs *[]string - State *string - TemplateID *string `req-for:"create"` - UserData *string - Zone *string -} - -// AttachInstanceToPrivateNetworkOpt represents an AttachInstanceToPrivateNetwork operation option. -type AttachInstanceToPrivateNetworkOpt func(*oapi.AttachInstanceToPrivateNetworkJSONRequestBody) - -// AttachInstanceToPrivateNetworkWithIPAddress sets the Private Network lease IP address to -// request for the Compute instance. -func AttachInstanceToPrivateNetworkWithIPAddress(v net.IP) AttachInstanceToPrivateNetworkOpt { - return func(b *oapi.AttachInstanceToPrivateNetworkJSONRequestBody) { - if v != nil { - ip := v.String() - b.Ip = &ip - } - } -} - -// ListInstancesOpt represents a ListInstances operation option. -type ListInstancesOpt func(params *oapi.ListInstancesParams) - -// ListInstancesByManagerID sets a Compute instances listing filter based on a manager ID. -func ListInstancesByManagerID(v string) ListInstancesOpt { - return func(p *oapi.ListInstancesParams) { - if v != "" { - p.ManagerId = &v - } - } -} - -// ListInstancesByManagerType sets a Compute instances listing filter based on a manager type. -func ListInstancesByManagerType(v string) ListInstancesOpt { - return func(p *oapi.ListInstancesParams) { - if v != "" { - p.ManagerType = (*oapi.ListInstancesParamsManagerType)(&v) - } - } -} - -// ListInstancesByIpAddress sets a Compute instances listing filter based on an IP Address. -func ListInstancesByIpAddress(v string) ListInstancesOpt { //nolint:revive - return func(p *oapi.ListInstancesParams) { - if v != "" { - p.IpAddress = &v - } - } -} - -// ResetInstanceOpt represents a ResetInstance operation option. -type ResetInstanceOpt func(*oapi.ResetInstanceJSONRequestBody) - -// ResetInstanceWithDiskSize sets a new disk size to set the Compute instance. -func ResetInstanceWithDiskSize(v int64) ResetInstanceOpt { - return func(b *oapi.ResetInstanceJSONRequestBody) { - if v > 0 { - b.DiskSize = &v - } - } -} - -// ResetInstanceWithTemplate sets a template to reset the Compute instance to. -func ResetInstanceWithTemplate(v *Template) ResetInstanceOpt { - return func(b *oapi.ResetInstanceJSONRequestBody) { - if v != nil { - b.Template = &oapi.Template{Id: v.ID} - } - } -} - -// StartInstanceOpt represents a StartInstance operation option. -type StartInstanceOpt func(*oapi.StartInstanceJSONRequestBody) - -// StartInstanceWithRescueProfile sets the rescue profile to start a Compute instance with. -func StartInstanceWithRescueProfile(v string) StartInstanceOpt { - return func(b *oapi.StartInstanceJSONRequestBody) { - if v != "" { - b.RescueProfile = (*oapi.StartInstanceJSONBodyRescueProfile)(&v) - } - } -} - -func instanceFromAPI(i *oapi.Instance, zone string) *Instance { - return &Instance{ - AntiAffinityGroupIDs: func() (v *[]string) { - if i.AntiAffinityGroups != nil && len(*i.AntiAffinityGroups) > 0 { - ids := make([]string, len(*i.AntiAffinityGroups)) - for i, item := range *i.AntiAffinityGroups { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - CreatedAt: i.CreatedAt, - DeployTargetID: func() (v *string) { - if i.DeployTarget != nil { - v = &i.DeployTarget.Id - } - return - }(), - DiskSize: i.DiskSize, - ElasticIPIDs: func() (v *[]string) { - if i.ElasticIps != nil && len(*i.ElasticIps) > 0 { - ids := make([]string, len(*i.ElasticIps)) - for i, item := range *i.ElasticIps { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - ID: i.Id, - IPv6Address: func() (v *net.IP) { - if i.Ipv6Address != nil { - ip := net.ParseIP(*i.Ipv6Address) - v = &ip - } - return - }(), - IPv6Enabled: func() (v *bool) { - if i.Ipv6Address != nil { - ipv6Enabled := i.Ipv6Address != nil - v = &ipv6Enabled - } - return - }(), - InstanceTypeID: i.InstanceType.Id, - Labels: func() (v *map[string]string) { - if i.Labels != nil && len(i.Labels.AdditionalProperties) > 0 { - v = &i.Labels.AdditionalProperties - } - return - }(), - Manager: func() *InstanceManager { - if i.Manager != nil { - return &InstanceManager{ - ID: *i.Manager.Id, - Type: string(*i.Manager.Type), - } - } - return nil - }(), - Name: i.Name, - PrivateNetworkIDs: func() (v *[]string) { - if i.PrivateNetworks != nil && len(*i.PrivateNetworks) > 0 { - ids := make([]string, len(*i.PrivateNetworks)) - for i, item := range *i.PrivateNetworks { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - PublicIPAddress: func() (v *net.IP) { - if i.PublicIp != nil { - ip := net.ParseIP(*i.PublicIp) - v = &ip - } - return - }(), - PublicIPAssignment: (*string)(i.PublicIpAssignment), - SSHKey: func() (v *string) { - if i.SshKey != nil { - v = i.SshKey.Name - } - return - }(), - SecurityGroupIDs: func() (v *[]string) { - if i.SecurityGroups != nil && len(*i.SecurityGroups) > 0 { - ids := make([]string, len(*i.SecurityGroups)) - for i, item := range *i.SecurityGroups { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - SnapshotIDs: func() (v *[]string) { - if i.Snapshots != nil && len(*i.Snapshots) > 0 { - ids := make([]string, len(*i.Snapshots)) - for i, item := range *i.Snapshots { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - State: (*string)(i.State), - TemplateID: i.Template.Id, - UserData: i.UserData, - Zone: &zone, - } -} - -// AttachInstanceToElasticIP attaches a Compute instance to the specified Elastic IP. -func (c *Client) AttachInstanceToElasticIP( - ctx context.Context, - zone string, - instance *Instance, - elasticIP *ElasticIP, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(elasticIP, "update"); err != nil { - return err - } - - resp, err := c.AttachInstanceToElasticIpWithResponse( - apiv2.WithZone(ctx, zone), *elasticIP.ID, oapi.AttachInstanceToElasticIpJSONRequestBody{ - Instance: oapi.InstanceTarget{Id: instance.ID}, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// AttachInstanceToPrivateNetwork attaches a Compute instance to the specified Private Network. -func (c *Client) AttachInstanceToPrivateNetwork( - ctx context.Context, - zone string, - instance *Instance, - privateNetwork *PrivateNetwork, - opts ...AttachInstanceToPrivateNetworkOpt, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(privateNetwork, "update"); err != nil { - return err - } - - var body oapi.AttachInstanceToPrivateNetworkJSONRequestBody - for _, opt := range opts { - opt(&body) - } - - a := oapi.AttachInstanceToPrivateNetworkJSONBody{} - a.Instance.Id = instance.ID - body.Instance = a.Instance - - resp, err := c.AttachInstanceToPrivateNetworkWithResponse(apiv2.WithZone(ctx, zone), *privateNetwork.ID, body) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// AttachInstanceToSecurityGroup attaches a Compute instance to the specified Security Group. -func (c *Client) AttachInstanceToSecurityGroup( - ctx context.Context, - zone string, - instance *Instance, - securityGroup *SecurityGroup, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(securityGroup, "update"); err != nil { - return err - } - - resp, err := c.AttachInstanceToSecurityGroupWithResponse( - apiv2.WithZone(ctx, zone), *securityGroup.ID, oapi.AttachInstanceToSecurityGroupJSONRequestBody{ - Instance: oapi.Instance{Id: instance.ID}, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// CreateInstance creates a Compute instance. -func (c *Client) CreateInstance(ctx context.Context, zone string, instance *Instance) (*Instance, error) { - if err := validateOperationParams(instance, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateInstanceWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreateInstanceJSONRequestBody{ - AntiAffinityGroups: func() (v *[]oapi.AntiAffinityGroup) { - if instance.AntiAffinityGroupIDs != nil { - ids := make([]oapi.AntiAffinityGroup, len(*instance.AntiAffinityGroupIDs)) - for i, item := range *instance.AntiAffinityGroupIDs { - item := item - ids[i] = oapi.AntiAffinityGroup{Id: &item} - } - v = &ids - } - return - }(), - DeployTarget: func() (v *oapi.DeployTarget) { - if instance.DeployTargetID != nil { - v = &oapi.DeployTarget{Id: *instance.DeployTargetID} - } - return - }(), - DiskSize: *instance.DiskSize, - InstanceType: oapi.InstanceType{Id: instance.InstanceTypeID}, - Ipv6Enabled: instance.IPv6Enabled, - Labels: func() (v *oapi.Labels) { - if instance.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *instance.Labels} - } - return - }(), - Name: instance.Name, - PublicIpAssignment: (*oapi.PublicIpAssignment)(instance.PublicIPAssignment), - SecurityGroups: func() (v *[]oapi.SecurityGroup) { - if instance.SecurityGroupIDs != nil { - ids := make([]oapi.SecurityGroup, len(*instance.SecurityGroupIDs)) - for i, item := range *instance.SecurityGroupIDs { - item := item - ids[i] = oapi.SecurityGroup{Id: &item} - } - v = &ids - } - return - }(), - SshKey: func() (v *oapi.SshKey) { - if instance.SSHKey != nil { - v = &oapi.SshKey{Name: instance.SSHKey} - } - return - }(), - Template: oapi.Template{Id: instance.TemplateID}, - UserData: instance.UserData, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetInstance(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// CreateInstanceSnapshot creates a Snapshot of a Compute instance storage volume. -func (c *Client) CreateInstanceSnapshot(ctx context.Context, zone string, instance *Instance) (*Snapshot, error) { - if err := validateOperationParams(instance, "update"); err != nil { - return nil, err - } - - resp, err := c.CreateSnapshotWithResponse(apiv2.WithZone(ctx, zone), *instance.ID) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetSnapshot(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteInstance deletes a Compute instance. -func (c *Client) DeleteInstance(ctx context.Context, zone string, instance *Instance) error { - if err := validateOperationParams(instance, "delete"); err != nil { - return err - } - - resp, err := c.DeleteInstanceWithResponse(apiv2.WithZone(ctx, zone), *instance.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// DetachInstanceFromElasticIP detaches a Compute instance from the specified Elastic IP. -func (c *Client) DetachInstanceFromElasticIP( - ctx context.Context, - zone string, - instance *Instance, - elasticIP *ElasticIP, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(elasticIP, "update"); err != nil { - return err - } - - resp, err := c.DetachInstanceFromElasticIpWithResponse( - apiv2.WithZone(ctx, zone), *elasticIP.ID, oapi.DetachInstanceFromElasticIpJSONRequestBody{ - Instance: oapi.InstanceTarget{Id: instance.ID}, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// DetachInstanceFromPrivateNetwork detaches a Compute instance from the specified Private Network. -func (c *Client) DetachInstanceFromPrivateNetwork( - ctx context.Context, - zone string, - instance *Instance, - privateNetwork *PrivateNetwork, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(privateNetwork, "update"); err != nil { - return err - } - - resp, err := c.DetachInstanceFromPrivateNetworkWithResponse( - apiv2.WithZone(ctx, zone), *privateNetwork.ID, oapi.DetachInstanceFromPrivateNetworkJSONRequestBody{ - Instance: oapi.Instance{Id: instance.ID}, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// DetachInstanceFromSecurityGroup detaches a Compute instance from the specified Security Group. -func (c *Client) DetachInstanceFromSecurityGroup( - ctx context.Context, - zone string, - instance *Instance, - securityGroup *SecurityGroup, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(securityGroup, "update"); err != nil { - return err - } - - resp, err := c.DetachInstanceFromSecurityGroupWithResponse( - apiv2.WithZone(ctx, zone), *securityGroup.ID, oapi.DetachInstanceFromSecurityGroupJSONRequestBody{ - Instance: oapi.Instance{Id: instance.ID}, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindInstance attempts to find a Compute instance by name or ID. -// In case the identifier is a name and multiple resources match, an ErrTooManyFound error is returned. -func (c *Client) FindInstance(ctx context.Context, zone, x string) (*Instance, error) { - res, err := c.ListInstances(ctx, zone) - if err != nil { - return nil, err - } - - var found *Instance - for _, r := range res { - if *r.ID == x { - return c.GetInstance(ctx, zone, *r.ID) - } - - // Historically, the Exoscale API allowed users to create multiple Compute instances sharing a common name. - // This function being expected to return one resource at most, in case the specified identifier is a name - // we have to check that there aren't more than one matching result before returning it. - if *r.Name == x { - if found != nil { - return nil, apiv2.ErrTooManyFound - } - found = r - } - } - - if found != nil { - return c.GetInstance(ctx, zone, *found.ID) - } - - return nil, apiv2.ErrNotFound -} - -// GetInstance returns the Instance corresponding to the specified ID. -func (c *Client) GetInstance(ctx context.Context, zone, id string) (*Instance, error) { - resp, err := c.GetInstanceWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return instanceFromAPI(resp.JSON200, zone), nil -} - -// ListInstances returns the list of existing Compute instances. -func (c *Client) ListInstances(ctx context.Context, zone string, opts ...ListInstancesOpt) ([]*Instance, error) { - list := make([]*Instance, 0) - - var params oapi.ListInstancesParams - for _, opt := range opts { - opt(¶ms) - } - - resp, err := c.ListInstancesWithResponse(apiv2.WithZone(ctx, zone), ¶ms) - if err != nil { - return nil, err - } - - if resp.JSON200.Instances != nil { - for i := range *resp.JSON200.Instances { - list = append(list, instanceFromAPI(&(*resp.JSON200.Instances)[i], zone)) - } - } - - return list, nil -} - -// RebootInstance reboots a Compute instance. -func (c *Client) RebootInstance(ctx context.Context, zone string, instance *Instance) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - resp, err := c.RebootInstanceWithResponse(apiv2.WithZone(ctx, zone), *instance.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// ResetInstance resets a Compute instance to a base template state (the instance's current -// template if not specified). -func (c *Client) ResetInstance(ctx context.Context, zone string, instance *Instance, opts ...ResetInstanceOpt) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - var body oapi.ResetInstanceJSONRequestBody - for _, opt := range opts { - opt(&body) - } - - resp, err := c.ResetInstanceWithResponse(apiv2.WithZone(ctx, zone), *instance.ID, body) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// ResizeInstanceDisk resizes a Compute instance's disk to a larger size. -func (c *Client) ResizeInstanceDisk(ctx context.Context, zone string, instance *Instance, size int64) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - resp, err := c.ResizeInstanceDiskWithResponse( - apiv2.WithZone(ctx, zone), - *instance.ID, - oapi.ResizeInstanceDiskJSONRequestBody{DiskSize: size}) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// RevertInstanceToSnapshot reverts a Compute instance storage volume to the specified Snapshot. -func (c *Client) RevertInstanceToSnapshot( - ctx context.Context, - zone string, - instance *Instance, - snapshot *Snapshot, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(snapshot, "delete"); err != nil { - return err - } - - resp, err := c.RevertInstanceToSnapshotWithResponse( - apiv2.WithZone(ctx, zone), - *instance.ID, - oapi.RevertInstanceToSnapshotJSONRequestBody{Id: *snapshot.ID}) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// ScaleInstance scales a Compute instance type. -func (c *Client) ScaleInstance(ctx context.Context, zone string, instance *Instance, instanceType *InstanceType) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - resp, err := c.ScaleInstanceWithResponse( - apiv2.WithZone(ctx, zone), - *instance.ID, - oapi.ScaleInstanceJSONRequestBody{InstanceType: oapi.InstanceType{Id: instanceType.ID}}, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// StartInstance starts a Compute instance. -func (c *Client) StartInstance(ctx context.Context, zone string, instance *Instance, opts ...StartInstanceOpt) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - var body oapi.StartInstanceJSONRequestBody - for _, opt := range opts { - opt(&body) - } - - resp, err := c.StartInstanceWithResponse(apiv2.WithZone(ctx, zone), *instance.ID, body) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// StopInstance stops a Compute instance. -func (c *Client) StopInstance(ctx context.Context, zone string, instance *Instance) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - resp, err := c.StopInstanceWithResponse(apiv2.WithZone(ctx, zone), *instance.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// RevealInstancePassword retrieves a recently started instance's root password if possible. -func (c *Client) RevealInstancePassword(ctx context.Context, zone string, instance *Instance) (string, error) { - resp, err := c.RevealInstancePasswordWithResponse(apiv2.WithZone(ctx, zone), *instance.ID) - if err != nil { - return "", err - } - // If the password is unavailable, return an empty string - if resp.JSON200.Password == nil { - return "", nil - } - return *resp.JSON200.Password, nil -} - -// UpdateInstance updates a Compute instance. -func (c *Client) UpdateInstance(ctx context.Context, zone string, instance *Instance) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - - resp, err := c.UpdateInstanceWithResponse( - apiv2.WithZone(ctx, zone), - *instance.ID, - oapi.UpdateInstanceJSONRequestBody{ - Labels: func() (v *oapi.Labels) { - if instance.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *instance.Labels} - } - return - }(), - Name: instance.Name, - UserData: instance.UserData, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// GetInstanceReverseDNS returns the Reverse DNS record corresponding to the specified Instance ID. -func (c *Client) GetInstanceReverseDNS(ctx context.Context, zone, id string) (string, error) { - resp, err := c.GetReverseDnsInstanceWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return "", err - } - - if resp.JSON200 == nil || resp.JSON200.DomainName == nil { - return "", apiv2.ErrNotFound - } - - return string(*resp.JSON200.DomainName), nil -} - -// DeleteInstanceReverseDNS deletes a Reverse DNS record of a Compute Instance. -func (c *Client) DeleteInstanceReverseDNS(ctx context.Context, zone string, id string) error { - resp, err := c.DeleteReverseDnsInstanceWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateInstanceReverseDNS updates a Reverse DNS record for a Compute Instance. -func (c *Client) UpdateInstanceReverseDNS(ctx context.Context, zone, id, domain string) error { - resp, err := c.UpdateReverseDnsInstanceWithResponse( - apiv2.WithZone(ctx, zone), - id, - oapi.UpdateReverseDnsInstanceJSONRequestBody{ - DomainName: &domain, - }, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/instance_pool.go b/vendor/github.com/exoscale/egoscale/v2/instance_pool.go deleted file mode 100644 index 06547967..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/instance_pool.go +++ /dev/null @@ -1,491 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// InstancePoolManager represents an Instance Pool manager. -type InstancePoolManager struct { - ID string - Type string -} - -// InstancePool represents an Instance Pool. -type InstancePool struct { - AntiAffinityGroupIDs *[]string - DeployTargetID *string - Description *string - DiskSize *int64 `req-for:"create"` - ElasticIPIDs *[]string - ID *string `req-for:"update,delete"` - IPv6Enabled *bool - InstanceIDs *[]string - InstancePrefix *string - InstanceTypeID *string `req-for:"create"` - Labels *map[string]string - Manager *InstancePoolManager - Name *string `req-for:"create"` - PrivateNetworkIDs *[]string - SSHKey *string - SecurityGroupIDs *[]string - Size *int64 `req-for:"create"` - State *string - TemplateID *string `req-for:"create"` - UserData *string - Zone *string -} - -func instancePoolFromAPI(i *oapi.InstancePool, zone string) *InstancePool { - return &InstancePool{ - AntiAffinityGroupIDs: func() (v *[]string) { - if i.AntiAffinityGroups != nil && len(*i.AntiAffinityGroups) > 0 { - ids := make([]string, len(*i.AntiAffinityGroups)) - for i, item := range *i.AntiAffinityGroups { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - DeployTargetID: func() (v *string) { - if i.DeployTarget != nil { - v = &i.DeployTarget.Id - } - return - }(), - Description: i.Description, - DiskSize: i.DiskSize, - ElasticIPIDs: func() (v *[]string) { - if i.ElasticIps != nil && len(*i.ElasticIps) > 0 { - ids := make([]string, len(*i.ElasticIps)) - for i, item := range *i.ElasticIps { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - ID: i.Id, - IPv6Enabled: i.Ipv6Enabled, - InstanceIDs: func() (v *[]string) { - if i.Instances != nil && len(*i.Instances) > 0 { - ids := make([]string, len(*i.Instances)) - for i, item := range *i.Instances { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - InstancePrefix: i.InstancePrefix, - InstanceTypeID: i.InstanceType.Id, - Labels: func() (v *map[string]string) { - if i.Labels != nil && len(i.Labels.AdditionalProperties) > 0 { - v = &i.Labels.AdditionalProperties - } - return - }(), - Manager: func() *InstancePoolManager { - if i.Manager != nil { - return &InstancePoolManager{ - ID: *i.Manager.Id, - Type: string(*i.Manager.Type), - } - } - return nil - }(), - Name: i.Name, - PrivateNetworkIDs: func() (v *[]string) { - if i.PrivateNetworks != nil && len(*i.PrivateNetworks) > 0 { - ids := make([]string, len(*i.PrivateNetworks)) - for i, item := range *i.PrivateNetworks { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - SSHKey: func() (v *string) { - if i.SshKey != nil { - v = i.SshKey.Name - } - return - }(), - SecurityGroupIDs: func() (v *[]string) { - if i.SecurityGroups != nil && len(*i.SecurityGroups) > 0 { - ids := make([]string, len(*i.SecurityGroups)) - for i, item := range *i.SecurityGroups { - ids[i] = *item.Id - } - v = &ids - } - return - }(), - Size: i.Size, - State: (*string)(i.State), - TemplateID: i.Template.Id, - UserData: i.UserData, - Zone: &zone, - } -} - -// CreateInstancePool creates an Instance Pool. -func (c *Client) CreateInstancePool( - ctx context.Context, - zone string, - instancePool *InstancePool, -) (*InstancePool, error) { - if err := validateOperationParams(instancePool, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateInstancePoolWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreateInstancePoolJSONRequestBody{ - AntiAffinityGroups: func() (v *[]oapi.AntiAffinityGroup) { - if instancePool.AntiAffinityGroupIDs != nil { - ids := make([]oapi.AntiAffinityGroup, len(*instancePool.AntiAffinityGroupIDs)) - for i, item := range *instancePool.AntiAffinityGroupIDs { - item := item - ids[i] = oapi.AntiAffinityGroup{Id: &item} - } - v = &ids - } - return - }(), - DeployTarget: func() (v *oapi.DeployTarget) { - if instancePool.DeployTargetID != nil { - v = &oapi.DeployTarget{Id: *instancePool.DeployTargetID} - } - return - }(), - Description: instancePool.Description, - DiskSize: *instancePool.DiskSize, - ElasticIps: func() (v *[]oapi.ElasticIp) { - if instancePool.ElasticIPIDs != nil { - ids := make([]oapi.ElasticIp, len(*instancePool.ElasticIPIDs)) - for i, item := range *instancePool.ElasticIPIDs { - item := item - ids[i] = oapi.ElasticIp{Id: &item} - } - v = &ids - } - return - }(), - InstancePrefix: instancePool.InstancePrefix, - InstanceType: oapi.InstanceType{Id: instancePool.InstanceTypeID}, - Ipv6Enabled: instancePool.IPv6Enabled, - Labels: func() (v *oapi.Labels) { - if instancePool.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *instancePool.Labels} - } - return - }(), - Name: *instancePool.Name, - PrivateNetworks: func() (v *[]oapi.PrivateNetwork) { - if instancePool.PrivateNetworkIDs != nil { - ids := make([]oapi.PrivateNetwork, len(*instancePool.PrivateNetworkIDs)) - for i, item := range *instancePool.PrivateNetworkIDs { - item := item - ids[i] = oapi.PrivateNetwork{Id: &item} - } - v = &ids - } - return - }(), - SecurityGroups: func() (v *[]oapi.SecurityGroup) { - if instancePool.SecurityGroupIDs != nil { - ids := make([]oapi.SecurityGroup, len(*instancePool.SecurityGroupIDs)) - for i, item := range *instancePool.SecurityGroupIDs { - item := item - ids[i] = oapi.SecurityGroup{Id: &item} - } - v = &ids - } - return - }(), - Size: *instancePool.Size, - SshKey: func() (v *oapi.SshKey) { - if instancePool.SSHKey != nil { - v = &oapi.SshKey{Name: instancePool.SSHKey} - } - return - }(), - Template: oapi.Template{Id: instancePool.TemplateID}, - UserData: instancePool.UserData, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - instancePoolID := *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id - - return c.GetInstancePool(ctx, zone, instancePoolID) -} - -// DeleteInstancePool deletes an Instance Pool. -func (c *Client) DeleteInstancePool(ctx context.Context, zone string, instancePool *InstancePool) error { - if err := validateOperationParams(instancePool, "delete"); err != nil { - return err - } - - resp, err := c.DeleteInstancePoolWithResponse(apiv2.WithZone(ctx, zone), *instancePool.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// EvictInstancePoolMembers evicts the specified members (identified by their Compute instance ID) from the -// Instance Pool corresponding to the specified ID. -func (c *Client) EvictInstancePoolMembers( - ctx context.Context, - zone string, - instancePool *InstancePool, - members []string, -) error { - if err := validateOperationParams(instancePool, "update"); err != nil { - return err - } - - resp, err := c.EvictInstancePoolMembersWithResponse( - apiv2.WithZone(ctx, zone), - *instancePool.ID, - oapi.EvictInstancePoolMembersJSONRequestBody{Instances: &members}, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindInstancePool attempts to find an Instance Pool by name or ID. -func (c *Client) FindInstancePool(ctx context.Context, zone, x string) (*InstancePool, error) { - res, err := c.ListInstancePools(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetInstancePool(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetInstancePool returns the Instance Pool corresponding to the specified ID. -func (c *Client) GetInstancePool(ctx context.Context, zone, id string) (*InstancePool, error) { - resp, err := c.GetInstancePoolWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return instancePoolFromAPI(resp.JSON200, zone), nil -} - -// ListInstancePools returns the list of existing Instance Pools. -func (c *Client) ListInstancePools(ctx context.Context, zone string) ([]*InstancePool, error) { - list := make([]*InstancePool, 0) - - resp, err := c.ListInstancePoolsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.InstancePools != nil { - for i := range *resp.JSON200.InstancePools { - list = append(list, instancePoolFromAPI(&(*resp.JSON200.InstancePools)[i], zone)) - } - } - - return list, nil -} - -// ScaleInstancePool scales an Instance Pool. -func (c *Client) ScaleInstancePool(ctx context.Context, zone string, instancePool *InstancePool, size int64) error { - if err := validateOperationParams(instancePool, "update"); err != nil { - return err - } - - resp, err := c.ScaleInstancePoolWithResponse( - apiv2.WithZone(ctx, zone), - *instancePool.ID, - oapi.ScaleInstancePoolJSONRequestBody{Size: size}, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateInstancePool updates an Instance Pool. -func (c *Client) UpdateInstancePool(ctx context.Context, zone string, instancePool *InstancePool) error { - if err := validateOperationParams(instancePool, "update"); err != nil { - return err - } - - resp, err := c.UpdateInstancePoolWithResponse( - apiv2.WithZone(ctx, zone), - *instancePool.ID, - oapi.UpdateInstancePoolJSONRequestBody{ - AntiAffinityGroups: func() (v *[]oapi.AntiAffinityGroup) { - if instancePool.AntiAffinityGroupIDs != nil { - ids := make([]oapi.AntiAffinityGroup, len(*instancePool.AntiAffinityGroupIDs)) - for i, item := range *instancePool.AntiAffinityGroupIDs { - item := item - ids[i] = oapi.AntiAffinityGroup{Id: &item} - } - v = &ids - } - return - }(), - DeployTarget: func() (v *oapi.DeployTarget) { - if instancePool.DeployTargetID != nil { - v = &oapi.DeployTarget{Id: *instancePool.DeployTargetID} - } - return - }(), - Description: oapi.NilableString(instancePool.Description), - DiskSize: instancePool.DiskSize, - ElasticIps: func() (v *[]oapi.ElasticIp) { - if instancePool.ElasticIPIDs != nil { - ids := make([]oapi.ElasticIp, len(*instancePool.ElasticIPIDs)) - for i, item := range *instancePool.ElasticIPIDs { - item := item - ids[i] = oapi.ElasticIp{Id: &item} - } - v = &ids - } - return - }(), - InstancePrefix: instancePool.InstancePrefix, - InstanceType: func() (v *oapi.InstanceType) { - if instancePool.InstanceTypeID != nil { - v = &oapi.InstanceType{Id: instancePool.InstanceTypeID} - } - return - }(), - Ipv6Enabled: instancePool.IPv6Enabled, - Labels: func() (v *oapi.Labels) { - if instancePool.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *instancePool.Labels} - } - return - }(), - Name: instancePool.Name, - PrivateNetworks: func() (v *[]oapi.PrivateNetwork) { - if instancePool.PrivateNetworkIDs != nil { - ids := make([]oapi.PrivateNetwork, len(*instancePool.PrivateNetworkIDs)) - for i, item := range *instancePool.PrivateNetworkIDs { - item := item - ids[i] = oapi.PrivateNetwork{Id: &item} - } - v = &ids - } - return - }(), - SecurityGroups: func() (v *[]oapi.SecurityGroup) { - if instancePool.SecurityGroupIDs != nil { - ids := make([]oapi.SecurityGroup, len(*instancePool.SecurityGroupIDs)) - for i, item := range *instancePool.SecurityGroupIDs { - item := item - ids[i] = oapi.SecurityGroup{Id: &item} - } - v = &ids - } - return - }(), - SshKey: func() (v *oapi.SshKey) { - if instancePool.SSHKey != nil { - v = &oapi.SshKey{Name: instancePool.SSHKey} - } - return - }(), - Template: func() (v *oapi.Template) { - if instancePool.TemplateID != nil { - v = &oapi.Template{Id: instancePool.TemplateID} - } - return - }(), - UserData: oapi.NilableString(instancePool.UserData), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -func (c *Client) WaitInstancePoolConverged(ctx context.Context, zone string, instancePoolID string) error { - _, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, instancePoolPoller(c, zone, instancePoolID)) - return err -} - -func instancePoolPoller(client oapi.ClientWithResponsesInterface, zone string, id string) oapi.PollFunc { - return func(ctx context.Context) (bool, interface{}, error) { - resp, err := client.GetInstancePoolWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return true, nil, err - } - - if *resp.JSON200.Size != int64(len(*resp.JSON200.Instances)) { - return false, nil, nil - } - return true, nil, nil - } -} diff --git a/vendor/github.com/exoscale/egoscale/v2/instance_type.go b/vendor/github.com/exoscale/egoscale/v2/instance_type.go deleted file mode 100644 index d784c1d9..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/instance_type.go +++ /dev/null @@ -1,89 +0,0 @@ -package v2 - -import ( - "context" - "strings" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// InstanceType represents a Compute instance type. -type InstanceType struct { - Authorized *bool - CPUs *int64 - Family *string - GPUs *int64 - ID *string - Memory *int64 - Size *string -} - -func instanceTypeFromAPI(t *oapi.InstanceType) *InstanceType { - return &InstanceType{ - Authorized: t.Authorized, - CPUs: t.Cpus, - Family: (*string)(t.Family), - GPUs: t.Gpus, - ID: t.Id, - Memory: t.Memory, - Size: (*string)(t.Size), - } -} - -// ListInstanceTypes returns the list of existing Instance types. -func (c *Client) ListInstanceTypes(ctx context.Context, zone string) ([]*InstanceType, error) { - list := make([]*InstanceType, 0) - - resp, err := c.ListInstanceTypesWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.InstanceTypes != nil { - for i := range *resp.JSON200.InstanceTypes { - list = append(list, instanceTypeFromAPI(&(*resp.JSON200.InstanceTypes)[i])) - } - } - - return list, nil -} - -// GetInstanceType returns the Instance type corresponding to the specified ID. -func (c *Client) GetInstanceType(ctx context.Context, zone, id string) (*InstanceType, error) { - resp, err := c.GetInstanceTypeWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return instanceTypeFromAPI(resp.JSON200), nil -} - -// FindInstanceType attempts to find an Instance type by family+size or ID. -// To search by family+size, the expected format for v is "[FAMILY.]SIZE" (e.g. "large", "gpu.medium"), -// with family defaulting to "standard" if not specified. -func (c *Client) FindInstanceType(ctx context.Context, zone, x string) (*InstanceType, error) { - var typeFamily, typeSize string - - parts := strings.SplitN(x, ".", 2) - if l := len(parts); l > 0 { - if l == 1 { - typeFamily, typeSize = "standard", strings.ToLower(parts[0]) - } else { - typeFamily, typeSize = strings.ToLower(parts[0]), strings.ToLower(parts[1]) - } - } - - res, err := c.ListInstanceTypes(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || (*r.Family == typeFamily && *r.Size == typeSize) { - return c.GetInstanceType(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} diff --git a/vendor/github.com/exoscale/egoscale/v2/network_load_balancer.go b/vendor/github.com/exoscale/egoscale/v2/network_load_balancer.go deleted file mode 100644 index 1b6b5eba..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/network_load_balancer.go +++ /dev/null @@ -1,198 +0,0 @@ -package v2 - -import ( - "context" - "net" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// NetworkLoadBalancer represents a Network Load Balancer. -type NetworkLoadBalancer struct { - CreatedAt *time.Time - Description *string - ID *string `req-for:"update,delete"` - IPAddress *net.IP - Labels *map[string]string - Name *string `req-for:"create"` - Services []*NetworkLoadBalancerService - State *string - Zone *string -} - -func nlbFromAPI(nlb *oapi.LoadBalancer, zone string) *NetworkLoadBalancer { - return &NetworkLoadBalancer{ - CreatedAt: nlb.CreatedAt, - Description: nlb.Description, - ID: nlb.Id, - IPAddress: func() (v *net.IP) { - if nlb.Ip != nil { - ip := net.ParseIP(*nlb.Ip) - v = &ip - } - return - }(), - Labels: func() (v *map[string]string) { - if nlb.Labels != nil && len(nlb.Labels.AdditionalProperties) > 0 { - v = &nlb.Labels.AdditionalProperties - } - return - }(), - Name: nlb.Name, - Services: func() []*NetworkLoadBalancerService { - services := make([]*NetworkLoadBalancerService, 0) - if nlb.Services != nil { - for _, svc := range *nlb.Services { - svc := svc - services = append(services, nlbServiceFromAPI(&svc)) - } - } - return services - }(), - State: (*string)(nlb.State), - Zone: &zone, - } -} - -// CreateNetworkLoadBalancer creates a Network Load Balancer. -func (c *Client) CreateNetworkLoadBalancer( - ctx context.Context, - zone string, - nlb *NetworkLoadBalancer, -) (*NetworkLoadBalancer, error) { - if err := validateOperationParams(nlb, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateLoadBalancerWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreateLoadBalancerJSONRequestBody{ - Description: nlb.Description, - Labels: func() (v *oapi.Labels) { - if nlb.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *nlb.Labels} - } - return - }(), - Name: *nlb.Name, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetNetworkLoadBalancer(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteNetworkLoadBalancer deletes a Network Load Balancer. -func (c *Client) DeleteNetworkLoadBalancer(ctx context.Context, zone string, nlb *NetworkLoadBalancer) error { - if err := validateOperationParams(nlb, "delete"); err != nil { - return err - } - - resp, err := c.DeleteLoadBalancerWithResponse(apiv2.WithZone(ctx, zone), *nlb.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindNetworkLoadBalancer attempts to find a Network Load Balancer by name or ID. -func (c *Client) FindNetworkLoadBalancer(ctx context.Context, zone, x string) (*NetworkLoadBalancer, error) { - res, err := c.ListNetworkLoadBalancers(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetNetworkLoadBalancer(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetNetworkLoadBalancer returns the Network Load Balancer corresponding to the specified ID. -func (c *Client) GetNetworkLoadBalancer(ctx context.Context, zone, id string) (*NetworkLoadBalancer, error) { - resp, err := c.GetLoadBalancerWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return nlbFromAPI(resp.JSON200, zone), nil -} - -// ListNetworkLoadBalancers returns the list of existing Network Load Balancers in the specified zone. -func (c *Client) ListNetworkLoadBalancers(ctx context.Context, zone string) ([]*NetworkLoadBalancer, error) { - list := make([]*NetworkLoadBalancer, 0) - - resp, err := c.ListLoadBalancersWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.LoadBalancers != nil { - for i := range *resp.JSON200.LoadBalancers { - list = append(list, nlbFromAPI(&(*resp.JSON200.LoadBalancers)[i], zone)) - } - } - - return list, nil -} - -// UpdateNetworkLoadBalancer updates a Network Load Balancer. -func (c *Client) UpdateNetworkLoadBalancer(ctx context.Context, zone string, nlb *NetworkLoadBalancer) error { - if err := validateOperationParams(nlb, "update"); err != nil { - return err - } - - resp, err := c.UpdateLoadBalancerWithResponse( - apiv2.WithZone(ctx, zone), - *nlb.ID, - oapi.UpdateLoadBalancerJSONRequestBody{ - Description: oapi.NilableString(nlb.Description), - Labels: func() (v *oapi.Labels) { - if nlb.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *nlb.Labels} - } - return - }(), - Name: nlb.Name, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/network_load_balancer_service.go b/vendor/github.com/exoscale/egoscale/v2/network_load_balancer_service.go deleted file mode 100644 index 6985b3bf..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/network_load_balancer_service.go +++ /dev/null @@ -1,300 +0,0 @@ -package v2 - -import ( - "context" - "errors" - "net" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// NetworkLoadBalancerServerStatus represents a Network Load Balancer service target server status. -type NetworkLoadBalancerServerStatus struct { - InstanceIP *net.IP - Status *string -} - -func nlbServerStatusFromAPI(st *oapi.LoadBalancerServerStatus) *NetworkLoadBalancerServerStatus { - return &NetworkLoadBalancerServerStatus{ - InstanceIP: func() (v *net.IP) { - if st.PublicIp != nil { - ip := net.ParseIP(*st.PublicIp) - v = &ip - } - return - }(), - Status: (*string)(st.Status), - } -} - -// NetworkLoadBalancerServiceHealthcheck represents a Network Load Balancer service healthcheck. -type NetworkLoadBalancerServiceHealthcheck struct { - Interval *time.Duration `req-for:"create,update"` - Mode *string `req-for:"create,update"` - Port *uint16 `req-for:"create,update"` - Retries *int64 - TLSSNI *string - Timeout *time.Duration - URI *string -} - -// NetworkLoadBalancerService represents a Network Load Balancer service. -type NetworkLoadBalancerService struct { - Description *string - Healthcheck *NetworkLoadBalancerServiceHealthcheck `req-for:"create"` - HealthcheckStatus []*NetworkLoadBalancerServerStatus - ID *string `req-for:"update,delete"` - InstancePoolID *string `req-for:"create"` - Name *string `req-for:"create"` - Port *uint16 `req-for:"create"` - Protocol *string `req-for:"create"` - State *string - Strategy *string `req-for:"create"` - TargetPort *uint16 `req-for:"create"` -} - -func nlbServiceFromAPI(svc *oapi.LoadBalancerService) *NetworkLoadBalancerService { - var ( - port = uint16(*svc.Port) - targetPort = uint16(*svc.TargetPort) - hcPort = uint16(*svc.Healthcheck.Port) - hcInterval = time.Duration(*svc.Healthcheck.Interval) * time.Second - hcTimeout = time.Duration(*svc.Healthcheck.Timeout) * time.Second - ) - - return &NetworkLoadBalancerService{ - Description: svc.Description, - Healthcheck: &NetworkLoadBalancerServiceHealthcheck{ - Interval: &hcInterval, - Mode: (*string)(svc.Healthcheck.Mode), - Port: &hcPort, - Retries: svc.Healthcheck.Retries, - TLSSNI: svc.Healthcheck.TlsSni, - Timeout: &hcTimeout, - URI: svc.Healthcheck.Uri, - }, - HealthcheckStatus: func() []*NetworkLoadBalancerServerStatus { - statuses := make([]*NetworkLoadBalancerServerStatus, 0) - if svc.HealthcheckStatus != nil { - for _, st := range *svc.HealthcheckStatus { - st := st - statuses = append(statuses, nlbServerStatusFromAPI(&st)) - } - } - return statuses - }(), - ID: svc.Id, - InstancePoolID: svc.InstancePool.Id, - Name: svc.Name, - Port: &port, - Protocol: (*string)(svc.Protocol), - Strategy: (*string)(svc.Strategy), - TargetPort: &targetPort, - State: (*string)(svc.State), - } -} - -// CreateNetworkLoadBalancerService creates a Network Load Balancer service. -func (c *Client) CreateNetworkLoadBalancerService( - ctx context.Context, - zone string, - nlb *NetworkLoadBalancer, - service *NetworkLoadBalancerService, -) (*NetworkLoadBalancerService, error) { - if err := validateOperationParams(service, "create"); err != nil { - return nil, err - } - if err := validateOperationParams(service.Healthcheck, "create"); err != nil { - return nil, err - } - - var ( - port = int64(*service.Port) - targetPort = int64(*service.TargetPort) - healthcheckPort = int64(*service.Healthcheck.Port) - healthcheckInterval = int64(service.Healthcheck.Interval.Seconds()) - healthcheckTimeout = int64(service.Healthcheck.Timeout.Seconds()) - ) - - // The API doesn't return the NLB service created directly, so in order to return a - // *NetworkLoadBalancerService corresponding to the new service we have to manually - // compare the list of services on the NLB before and after the service creation, - // and identify the service that wasn't there before. - // Note: in case of multiple services creation in parallel this technique is subject - // to race condition as we could return an unrelated service. To prevent this, we - // also compare the name of the new service to the name specified in the service - // parameter. - services := make(map[string]struct{}) - for _, svc := range nlb.Services { - services[*svc.ID] = struct{}{} - } - - resp, err := c.AddServiceToLoadBalancerWithResponse( - apiv2.WithZone(ctx, zone), - *nlb.ID, - oapi.AddServiceToLoadBalancerJSONRequestBody{ - Description: service.Description, - Healthcheck: oapi.LoadBalancerServiceHealthcheck{ - Interval: &healthcheckInterval, - Mode: (*oapi.LoadBalancerServiceHealthcheckMode)(service.Healthcheck.Mode), - Port: &healthcheckPort, - Retries: service.Healthcheck.Retries, - Timeout: &healthcheckTimeout, - TlsSni: service.Healthcheck.TLSSNI, - Uri: service.Healthcheck.URI, - }, - InstancePool: oapi.InstancePool{Id: service.InstancePoolID}, - Name: *service.Name, - Port: port, - Protocol: oapi.AddServiceToLoadBalancerJSONBodyProtocol(*service.Protocol), - Strategy: oapi.AddServiceToLoadBalancerJSONBodyStrategy(*service.Strategy), - TargetPort: targetPort, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - nlbUpdated, err := c.GetNetworkLoadBalancer(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) - if err != nil { - return nil, err - } - - // Look for an unknown service: if we find one we hope it's the one we've just created. - for _, s := range nlbUpdated.Services { - if _, ok := services[*s.ID]; !ok && *s.Name == *service.Name { - return s, nil - } - } - - return nil, errors.New("unable to identify the service created") -} - -// DeleteNetworkLoadBalancerService deletes a Network Load Balancer service. -func (c *Client) DeleteNetworkLoadBalancerService( - ctx context.Context, - zone string, - nlb *NetworkLoadBalancer, - service *NetworkLoadBalancerService, -) error { - if err := validateOperationParams(nlb, "delete"); err != nil { - return err - } - if err := validateOperationParams(service, "delete"); err != nil { - return err - } - - resp, err := c.DeleteLoadBalancerServiceWithResponse( - apiv2.WithZone(ctx, zone), - *nlb.ID, - *service.ID, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateNetworkLoadBalancerService updates a Network Load Balancer service. -func (c *Client) UpdateNetworkLoadBalancerService( - ctx context.Context, - zone string, - nlb *NetworkLoadBalancer, - service *NetworkLoadBalancerService, -) error { - if err := validateOperationParams(service, "update"); err != nil { - return err - } - if service.Healthcheck != nil { - if err := validateOperationParams(service.Healthcheck, "update"); err != nil { - return err - } - } - - resp, err := c.UpdateLoadBalancerServiceWithResponse( - apiv2.WithZone(ctx, zone), - *nlb.ID, - *service.ID, - oapi.UpdateLoadBalancerServiceJSONRequestBody{ - Description: oapi.NilableString(service.Description), - Healthcheck: &oapi.LoadBalancerServiceHealthcheck{ - Interval: func() (v *int64) { - if service.Healthcheck.Interval != nil { - interval := int64(service.Healthcheck.Interval.Seconds()) - v = &interval - } - return - }(), - Mode: (*oapi.LoadBalancerServiceHealthcheckMode)(service.Healthcheck.Mode), - Port: func() (v *int64) { - if service.Healthcheck.Port != nil { - port := int64(*service.Healthcheck.Port) - v = &port - } - return - }(), - Retries: service.Healthcheck.Retries, - Timeout: func() (v *int64) { - if service.Healthcheck.Timeout != nil { - interval := int64(service.Healthcheck.Timeout.Seconds()) - v = &interval - } - return - }(), - TlsSni: service.Healthcheck.TLSSNI, - Uri: service.Healthcheck.URI, - }, - Name: service.Name, - Port: func() (v *int64) { - if service.Port != nil { - port := int64(*service.Port) - v = &port - } - return - }(), - Protocol: (*oapi.UpdateLoadBalancerServiceJSONBodyProtocol)(service.Protocol), - Strategy: (*oapi.UpdateLoadBalancerServiceJSONBodyStrategy)(service.Strategy), - TargetPort: func() (v *int64) { - if service.TargetPort != nil { - port := int64(*service.TargetPort) - v = &port - } - return - }(), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/.gitignore b/vendor/github.com/exoscale/egoscale/v2/oapi/.gitignore deleted file mode 100644 index 07fb01ac..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/.gitignore +++ /dev/null @@ -1 +0,0 @@ -source.json diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/async.go b/vendor/github.com/exoscale/egoscale/v2/oapi/async.go deleted file mode 100644 index 55da3715..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/async.go +++ /dev/null @@ -1,124 +0,0 @@ -package oapi - -import ( - "context" - "errors" - "fmt" - "net/http" - "time" - - v2 "github.com/exoscale/egoscale/v2/api" -) - -const ( - // DefaultPollingInterval represents the default polling interval used in Poller. - DefaultPollingInterval = 3 * time.Second - - operationStatePending = "pending" - operationStateSuccess = "success" - operationStateFailure = "failure" - operationStateTimeout = "timeout" -) - -// PollFunc represents a function invoked periodically in a polling loop. It returns a boolean flag -// true if the job is completed or false if polling must continue, and any error that occurred -// during the polling (which interrupts the polling regardless of the boolean flag value). -// Upon successful completion, an interface descring an opaque operation can be returned to the -// caller, which will have to perform type assertion depending on the PollFunc implementation. -type PollFunc func(ctx context.Context) (bool, interface{}, error) - -// Poller represents a poller instance. -type Poller struct { - interval time.Duration - timeout time.Duration -} - -// NewPoller returns a Poller instance. -func NewPoller() *Poller { - return &Poller{ - interval: DefaultPollingInterval, - } -} - -// WithInterval sets the interval at which the polling function will be executed (default: 3s). -func (p *Poller) WithInterval(interval time.Duration) *Poller { - if interval > 0 { - p.interval = interval - } - - return p -} - -// WithTimeout sets the time out value after which the polling routine will be cancelled -// (default: no time out). -func (p *Poller) WithTimeout(timeout time.Duration) *Poller { - if timeout > 0 { - p.timeout = timeout - } - - return p -} - -// Poll starts the polling routine, executing the provided polling function at the configured -// polling interval. Upon successful polling, an opaque operation is returned to the caller, which -// actual type has to asserted depending on the PollFunc executed. -func (p *Poller) Poll(ctx context.Context, pf PollFunc) (interface{}, error) { - if p.timeout > 0 { - ctxWithTimeout, cancel := context.WithTimeout(ctx, p.timeout) - defer cancel() - ctx = ctxWithTimeout - } - - ticker := time.NewTicker(p.interval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - done, res, err := pf(ctx) - if err != nil { - return nil, err - } - if !done { - continue - } - - return res, nil - - case <-ctx.Done(): - return nil, ctx.Err() - } - } -} - -// OperationPoller returns a PollFunc function which queries the state of the specified job. -// Upon successful job completion, the type of the interface{} returned by the PollFunc is a -// pointer to a Resource object (*Resource). -func OperationPoller(client ClientWithResponsesInterface, zone string, id string) PollFunc { - return func(ctx context.Context) (bool, interface{}, error) { - resp, err := client.GetOperationWithResponse(v2.WithZone(ctx, zone), id) - if err != nil { - return true, nil, err - } - if resp.StatusCode() != http.StatusOK { - return true, nil, fmt.Errorf("unexpected response from API: %s", resp.Status()) - } - - switch *resp.JSON200.State { - case operationStatePending: - return false, nil, nil - - case operationStateSuccess: - return true, resp.JSON200.Reference, nil - - case operationStateFailure: - return true, nil, errors.New("job failed") - - case operationStateTimeout: - return true, nil, errors.New("job timed out") - - default: - return true, nil, fmt.Errorf("unknown job state: %s", *resp.JSON200.State) - } - } -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.gen.go b/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.gen.go deleted file mode 100644 index f8c85eaf..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.gen.go +++ /dev/null @@ -1,34495 +0,0 @@ -// Package oapi provides primitives to interact with the openapi HTTP API. -// -// Code generated by github.com/deepmap/oapi-codegen version v1.9.1 DO NOT EDIT. -package oapi - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "strings" - "time" - - "github.com/deepmap/oapi-codegen/pkg/runtime" -) - -// Defines values for AccessKeyType. -const ( - AccessKeyTypeRestricted AccessKeyType = "restricted" - - AccessKeyTypeUnrestricted AccessKeyType = "unrestricted" -) - -// Defines values for AccessKeyVersion. -const ( - AccessKeyVersionV1 AccessKeyVersion = "v1" - - AccessKeyVersionV2 AccessKeyVersion = "v2" -) - -// Defines values for AccessKeyResourceDomain. -const ( - AccessKeyResourceDomainPartner AccessKeyResourceDomain = "partner" - - AccessKeyResourceDomainSos AccessKeyResourceDomain = "sos" -) - -// Defines values for AccessKeyResourceResourceType. -const ( - AccessKeyResourceResourceTypeBucket AccessKeyResourceResourceType = "bucket" - - AccessKeyResourceResourceTypeProduct AccessKeyResourceResourceType = "product" -) - -// Defines values for DbaasKafkaSchemaRegistryAclEntryPermission. -const ( - DbaasKafkaSchemaRegistryAclEntryPermissionSchemaRegistryRead DbaasKafkaSchemaRegistryAclEntryPermission = "schema_registry_read" - - DbaasKafkaSchemaRegistryAclEntryPermissionSchemaRegistryWrite DbaasKafkaSchemaRegistryAclEntryPermission = "schema_registry_write" -) - -// Defines values for DbaasKafkaTopicAclEntryPermission. -const ( - DbaasKafkaTopicAclEntryPermissionAdmin DbaasKafkaTopicAclEntryPermission = "admin" - - DbaasKafkaTopicAclEntryPermissionRead DbaasKafkaTopicAclEntryPermission = "read" - - DbaasKafkaTopicAclEntryPermissionReadwrite DbaasKafkaTopicAclEntryPermission = "readwrite" - - DbaasKafkaTopicAclEntryPermissionWrite DbaasKafkaTopicAclEntryPermission = "write" -) - -// Defines values for DbaasNodeStateRole. -const ( - DbaasNodeStateRoleMaster DbaasNodeStateRole = "master" - - DbaasNodeStateRoleReadReplica DbaasNodeStateRole = "read-replica" - - DbaasNodeStateRoleStandby DbaasNodeStateRole = "standby" -) - -// Defines values for DbaasNodeStateState. -const ( - DbaasNodeStateStateLeaving DbaasNodeStateState = "leaving" - - DbaasNodeStateStateRunning DbaasNodeStateState = "running" - - DbaasNodeStateStateSettingUpVm DbaasNodeStateState = "setting_up_vm" - - DbaasNodeStateStateSyncingData DbaasNodeStateState = "syncing_data" - - DbaasNodeStateStateUnknown DbaasNodeStateState = "unknown" -) - -// Defines values for DbaasNodeStateProgressUpdatePhase. -const ( - DbaasNodeStateProgressUpdatePhaseBasebackup DbaasNodeStateProgressUpdatePhase = "basebackup" - - DbaasNodeStateProgressUpdatePhaseFinalize DbaasNodeStateProgressUpdatePhase = "finalize" - - DbaasNodeStateProgressUpdatePhasePrepare DbaasNodeStateProgressUpdatePhase = "prepare" - - DbaasNodeStateProgressUpdatePhaseStream DbaasNodeStateProgressUpdatePhase = "stream" -) - -// Defines values for DbaasServiceMaintenanceDow. -const ( - DbaasServiceMaintenanceDowFriday DbaasServiceMaintenanceDow = "friday" - - DbaasServiceMaintenanceDowMonday DbaasServiceMaintenanceDow = "monday" - - DbaasServiceMaintenanceDowNever DbaasServiceMaintenanceDow = "never" - - DbaasServiceMaintenanceDowSaturday DbaasServiceMaintenanceDow = "saturday" - - DbaasServiceMaintenanceDowSunday DbaasServiceMaintenanceDow = "sunday" - - DbaasServiceMaintenanceDowThursday DbaasServiceMaintenanceDow = "thursday" - - DbaasServiceMaintenanceDowTuesday DbaasServiceMaintenanceDow = "tuesday" - - DbaasServiceMaintenanceDowWednesday DbaasServiceMaintenanceDow = "wednesday" -) - -// Defines values for DbaasServiceNotificationLevel. -const ( - DbaasServiceNotificationLevelNotice DbaasServiceNotificationLevel = "notice" - - DbaasServiceNotificationLevelWarning DbaasServiceNotificationLevel = "warning" -) - -// Defines values for DbaasServiceNotificationType. -const ( - DbaasServiceNotificationTypeServiceEndOfLife DbaasServiceNotificationType = "service_end_of_life" - - DbaasServiceNotificationTypeServicePoweredOffRemoval DbaasServiceNotificationType = "service_powered_off_removal" -) - -// Defines values for DbaasServiceOpensearchIndexPatternsSortingAlgorithm. -const ( - DbaasServiceOpensearchIndexPatternsSortingAlgorithmAlphabetical DbaasServiceOpensearchIndexPatternsSortingAlgorithm = "alphabetical" - - DbaasServiceOpensearchIndexPatternsSortingAlgorithmCreationDate DbaasServiceOpensearchIndexPatternsSortingAlgorithm = "creation_date" -) - -// Defines values for DeployTargetType. -const ( - DeployTargetTypeDedicated DeployTargetType = "dedicated" - - DeployTargetTypeEdge DeployTargetType = "edge" -) - -// Defines values for DnsDomainRecordType. -const ( - DnsDomainRecordTypeA DnsDomainRecordType = "A" - - DnsDomainRecordTypeAAAA DnsDomainRecordType = "AAAA" - - DnsDomainRecordTypeALIAS DnsDomainRecordType = "ALIAS" - - DnsDomainRecordTypeCAA DnsDomainRecordType = "CAA" - - DnsDomainRecordTypeCNAME DnsDomainRecordType = "CNAME" - - DnsDomainRecordTypeHINFO DnsDomainRecordType = "HINFO" - - DnsDomainRecordTypeMX DnsDomainRecordType = "MX" - - DnsDomainRecordTypeNAPTR DnsDomainRecordType = "NAPTR" - - DnsDomainRecordTypeNS DnsDomainRecordType = "NS" - - DnsDomainRecordTypePOOL DnsDomainRecordType = "POOL" - - DnsDomainRecordTypeSOA DnsDomainRecordType = "SOA" - - DnsDomainRecordTypeSPF DnsDomainRecordType = "SPF" - - DnsDomainRecordTypeSRV DnsDomainRecordType = "SRV" - - DnsDomainRecordTypeSSHFP DnsDomainRecordType = "SSHFP" - - DnsDomainRecordTypeTXT DnsDomainRecordType = "TXT" - - DnsDomainRecordTypeURL DnsDomainRecordType = "URL" -) - -// Defines values for ElasticIpAddressfamily. -const ( - ElasticIpAddressfamilyInet4 ElasticIpAddressfamily = "inet4" - - ElasticIpAddressfamilyInet6 ElasticIpAddressfamily = "inet6" -) - -// Defines values for ElasticIpHealthcheckMode. -const ( - ElasticIpHealthcheckModeHttp ElasticIpHealthcheckMode = "http" - - ElasticIpHealthcheckModeHttps ElasticIpHealthcheckMode = "https" - - ElasticIpHealthcheckModeTcp ElasticIpHealthcheckMode = "tcp" -) - -// Defines values for EnumComponentRoute. -const ( - EnumComponentRouteDynamic EnumComponentRoute = "dynamic" - - EnumComponentRoutePrivate EnumComponentRoute = "private" - - EnumComponentRoutePrivatelink EnumComponentRoute = "privatelink" - - EnumComponentRoutePublic EnumComponentRoute = "public" -) - -// Defines values for EnumComponentUsage. -const ( - EnumComponentUsagePrimary EnumComponentUsage = "primary" - - EnumComponentUsageReplica EnumComponentUsage = "replica" -) - -// Defines values for EnumIntegrationTypes. -const ( - EnumIntegrationTypesDatasource EnumIntegrationTypes = "datasource" - - EnumIntegrationTypesLogs EnumIntegrationTypes = "logs" - - EnumIntegrationTypesMetrics EnumIntegrationTypes = "metrics" -) - -// Defines values for EnumKafkaAuthMethod. -const ( - EnumKafkaAuthMethodCertificate EnumKafkaAuthMethod = "certificate" - - EnumKafkaAuthMethodSasl EnumKafkaAuthMethod = "sasl" -) - -// Defines values for EnumMasterLinkStatus. -const ( - EnumMasterLinkStatusDown EnumMasterLinkStatus = "down" - - EnumMasterLinkStatusUp EnumMasterLinkStatus = "up" -) - -// Defines values for EnumMigrationMethod. -const ( - EnumMigrationMethodDump EnumMigrationMethod = "dump" - - EnumMigrationMethodReplication EnumMigrationMethod = "replication" -) - -// Defines values for EnumMigrationStatus. -const ( - EnumMigrationStatusDone EnumMigrationStatus = "done" - - EnumMigrationStatusFailed EnumMigrationStatus = "failed" - - EnumMigrationStatusRunning EnumMigrationStatus = "running" - - EnumMigrationStatusSyncing EnumMigrationStatus = "syncing" -) - -// Defines values for EnumMysqlAuthenticationPlugin. -const ( - EnumMysqlAuthenticationPluginCachingSha2Password EnumMysqlAuthenticationPlugin = "caching_sha2_password" - - EnumMysqlAuthenticationPluginMysqlNativePassword EnumMysqlAuthenticationPlugin = "mysql_native_password" -) - -// Defines values for EnumOpensearchRulePermission. -const ( - EnumOpensearchRulePermissionAdmin EnumOpensearchRulePermission = "admin" - - EnumOpensearchRulePermissionDeny EnumOpensearchRulePermission = "deny" - - EnumOpensearchRulePermissionRead EnumOpensearchRulePermission = "read" - - EnumOpensearchRulePermissionReadwrite EnumOpensearchRulePermission = "readwrite" - - EnumOpensearchRulePermissionWrite EnumOpensearchRulePermission = "write" -) - -// Defines values for EnumPgPoolMode. -const ( - EnumPgPoolModeSession EnumPgPoolMode = "session" - - EnumPgPoolModeStatement EnumPgPoolMode = "statement" - - EnumPgPoolModeTransaction EnumPgPoolMode = "transaction" -) - -// Defines values for EnumPgSynchronousReplication. -const ( - EnumPgSynchronousReplicationOff EnumPgSynchronousReplication = "off" - - EnumPgSynchronousReplicationQuorum EnumPgSynchronousReplication = "quorum" -) - -// Defines values for EnumPgVariant. -const ( - EnumPgVariantAiven EnumPgVariant = "aiven" - - EnumPgVariantTimescale EnumPgVariant = "timescale" -) - -// Defines values for EnumServiceState. -const ( - EnumServiceStatePoweroff EnumServiceState = "poweroff" - - EnumServiceStateRebalancing EnumServiceState = "rebalancing" - - EnumServiceStateRebuilding EnumServiceState = "rebuilding" - - EnumServiceStateRunning EnumServiceState = "running" -) - -// Defines values for EnumSortOrder. -const ( - EnumSortOrderAsc EnumSortOrder = "asc" - - EnumSortOrderDesc EnumSortOrder = "desc" -) - -// Defines values for IamPolicyDefaultServiceStrategy. -const ( - IamPolicyDefaultServiceStrategyAllow IamPolicyDefaultServiceStrategy = "allow" - - IamPolicyDefaultServiceStrategyDeny IamPolicyDefaultServiceStrategy = "deny" -) - -// Defines values for IamRolePermissions. -const ( - IamRolePermissionsBypassGovernanceRetention IamRolePermissions = "bypass-governance-retention" -) - -// Defines values for IamServicePolicyType. -const ( - IamServicePolicyTypeAllow IamServicePolicyType = "allow" - - IamServicePolicyTypeDeny IamServicePolicyType = "deny" - - IamServicePolicyTypeRules IamServicePolicyType = "rules" -) - -// Defines values for IamServicePolicyRuleAction. -const ( - IamServicePolicyRuleActionAllow IamServicePolicyRuleAction = "allow" - - IamServicePolicyRuleActionDeny IamServicePolicyRuleAction = "deny" -) - -// Defines values for InstancePoolState. -const ( - InstancePoolStateCreating InstancePoolState = "creating" - - InstancePoolStateDestroying InstancePoolState = "destroying" - - InstancePoolStateRunning InstancePoolState = "running" - - InstancePoolStateScalingDown InstancePoolState = "scaling-down" - - InstancePoolStateScalingUp InstancePoolState = "scaling-up" - - InstancePoolStateSuspended InstancePoolState = "suspended" - - InstancePoolStateUpdating InstancePoolState = "updating" -) - -// Defines values for InstanceState. -const ( - InstanceStateDestroyed InstanceState = "destroyed" - - InstanceStateDestroying InstanceState = "destroying" - - InstanceStateError InstanceState = "error" - - InstanceStateExpunging InstanceState = "expunging" - - InstanceStateMigrating InstanceState = "migrating" - - InstanceStateRunning InstanceState = "running" - - InstanceStateStarting InstanceState = "starting" - - InstanceStateStopped InstanceState = "stopped" - - InstanceStateStopping InstanceState = "stopping" -) - -// Defines values for InstanceTypeFamily. -const ( - InstanceTypeFamilyColossus InstanceTypeFamily = "colossus" - - InstanceTypeFamilyCpu InstanceTypeFamily = "cpu" - - InstanceTypeFamilyGpu InstanceTypeFamily = "gpu" - - InstanceTypeFamilyGpu2 InstanceTypeFamily = "gpu2" - - InstanceTypeFamilyGpu3 InstanceTypeFamily = "gpu3" - - InstanceTypeFamilyMemory InstanceTypeFamily = "memory" - - InstanceTypeFamilyStandard InstanceTypeFamily = "standard" - - InstanceTypeFamilyStorage InstanceTypeFamily = "storage" -) - -// Defines values for InstanceTypeSize. -const ( - InstanceTypeSizeColossus InstanceTypeSize = "colossus" - - InstanceTypeSizeExtraLarge InstanceTypeSize = "extra-large" - - InstanceTypeSizeHuge InstanceTypeSize = "huge" - - InstanceTypeSizeJumbo InstanceTypeSize = "jumbo" - - InstanceTypeSizeLarge InstanceTypeSize = "large" - - InstanceTypeSizeMedium InstanceTypeSize = "medium" - - InstanceTypeSizeMega InstanceTypeSize = "mega" - - InstanceTypeSizeMicro InstanceTypeSize = "micro" - - InstanceTypeSizeSmall InstanceTypeSize = "small" - - InstanceTypeSizeTiny InstanceTypeSize = "tiny" - - InstanceTypeSizeTitan InstanceTypeSize = "titan" -) - -// Defines values for LoadBalancerState. -const ( - LoadBalancerStateCreating LoadBalancerState = "creating" - - LoadBalancerStateDeleting LoadBalancerState = "deleting" - - LoadBalancerStateError LoadBalancerState = "error" - - LoadBalancerStateMigrated LoadBalancerState = "migrated" - - LoadBalancerStateMigrating LoadBalancerState = "migrating" - - LoadBalancerStateRunning LoadBalancerState = "running" -) - -// Defines values for LoadBalancerServerStatusStatus. -const ( - LoadBalancerServerStatusStatusFailure LoadBalancerServerStatusStatus = "failure" - - LoadBalancerServerStatusStatusSuccess LoadBalancerServerStatusStatus = "success" -) - -// Defines values for LoadBalancerServiceProtocol. -const ( - LoadBalancerServiceProtocolTcp LoadBalancerServiceProtocol = "tcp" - - LoadBalancerServiceProtocolUdp LoadBalancerServiceProtocol = "udp" -) - -// Defines values for LoadBalancerServiceState. -const ( - LoadBalancerServiceStateCreating LoadBalancerServiceState = "creating" - - LoadBalancerServiceStateDeleting LoadBalancerServiceState = "deleting" - - LoadBalancerServiceStateError LoadBalancerServiceState = "error" - - LoadBalancerServiceStateRunning LoadBalancerServiceState = "running" - - LoadBalancerServiceStateUpdating LoadBalancerServiceState = "updating" -) - -// Defines values for LoadBalancerServiceStrategy. -const ( - LoadBalancerServiceStrategyRoundRobin LoadBalancerServiceStrategy = "round-robin" - - LoadBalancerServiceStrategySourceHash LoadBalancerServiceStrategy = "source-hash" -) - -// Defines values for LoadBalancerServiceHealthcheckMode. -const ( - LoadBalancerServiceHealthcheckModeHttp LoadBalancerServiceHealthcheckMode = "http" - - LoadBalancerServiceHealthcheckModeHttps LoadBalancerServiceHealthcheckMode = "https" - - LoadBalancerServiceHealthcheckModeTcp LoadBalancerServiceHealthcheckMode = "tcp" -) - -// Defines values for ManagerType. -const ( - ManagerTypeInstancePool ManagerType = "instance-pool" - - ManagerTypeSksNodepool ManagerType = "sks-nodepool" -) - -// Defines values for OperationReason. -const ( - OperationReasonBusy OperationReason = "busy" - - OperationReasonConflict OperationReason = "conflict" - - OperationReasonFault OperationReason = "fault" - - OperationReasonForbidden OperationReason = "forbidden" - - OperationReasonIncorrect OperationReason = "incorrect" - - OperationReasonInterrupted OperationReason = "interrupted" - - OperationReasonNotFound OperationReason = "not-found" - - OperationReasonPartial OperationReason = "partial" - - OperationReasonUnavailable OperationReason = "unavailable" - - OperationReasonUnknown OperationReason = "unknown" - - OperationReasonUnsupported OperationReason = "unsupported" -) - -// Defines values for OperationState. -const ( - OperationStateFailure OperationState = "failure" - - OperationStatePending OperationState = "pending" - - OperationStateSuccess OperationState = "success" - - OperationStateTimeout OperationState = "timeout" -) - -// Defines values for PublicIpAssignment. -const ( - PublicIpAssignmentDual PublicIpAssignment = "dual" - - PublicIpAssignmentInet4 PublicIpAssignment = "inet4" - - PublicIpAssignmentNone PublicIpAssignment = "none" -) - -// Defines values for SecurityGroupResourceVisibility. -const ( - SecurityGroupResourceVisibilityPrivate SecurityGroupResourceVisibility = "private" - - SecurityGroupResourceVisibilityPublic SecurityGroupResourceVisibility = "public" -) - -// Defines values for SecurityGroupRuleFlowDirection. -const ( - SecurityGroupRuleFlowDirectionEgress SecurityGroupRuleFlowDirection = "egress" - - SecurityGroupRuleFlowDirectionIngress SecurityGroupRuleFlowDirection = "ingress" -) - -// Defines values for SecurityGroupRuleProtocol. -const ( - SecurityGroupRuleProtocolAh SecurityGroupRuleProtocol = "ah" - - SecurityGroupRuleProtocolEsp SecurityGroupRuleProtocol = "esp" - - SecurityGroupRuleProtocolGre SecurityGroupRuleProtocol = "gre" - - SecurityGroupRuleProtocolIcmp SecurityGroupRuleProtocol = "icmp" - - SecurityGroupRuleProtocolIcmpv6 SecurityGroupRuleProtocol = "icmpv6" - - SecurityGroupRuleProtocolIpip SecurityGroupRuleProtocol = "ipip" - - SecurityGroupRuleProtocolTcp SecurityGroupRuleProtocol = "tcp" - - SecurityGroupRuleProtocolUdp SecurityGroupRuleProtocol = "udp" -) - -// Defines values for SksClusterAddons. -const ( - SksClusterAddonsExoscaleCloudController SksClusterAddons = "exoscale-cloud-controller" - - SksClusterAddonsMetricsServer SksClusterAddons = "metrics-server" -) - -// Defines values for SksClusterCni. -const ( - SksClusterCniCalico SksClusterCni = "calico" - - SksClusterCniCilium SksClusterCni = "cilium" -) - -// Defines values for SksClusterLevel. -const ( - SksClusterLevelPro SksClusterLevel = "pro" - - SksClusterLevelStarter SksClusterLevel = "starter" -) - -// Defines values for SksClusterState. -const ( - SksClusterStateCreating SksClusterState = "creating" - - SksClusterStateDeleting SksClusterState = "deleting" - - SksClusterStateError SksClusterState = "error" - - SksClusterStateRotatingCcmCredentials SksClusterState = "rotating-ccm-credentials" - - SksClusterStateRunning SksClusterState = "running" - - SksClusterStateSuspending SksClusterState = "suspending" - - SksClusterStateUpdating SksClusterState = "updating" - - SksClusterStateUpgrading SksClusterState = "upgrading" -) - -// Defines values for SksNodepoolAddons. -const ( - SksNodepoolAddonsStorageLvm SksNodepoolAddons = "storage-lvm" -) - -// Defines values for SksNodepoolState. -const ( - SksNodepoolStateCreating SksNodepoolState = "creating" - - SksNodepoolStateDeleting SksNodepoolState = "deleting" - - SksNodepoolStateError SksNodepoolState = "error" - - SksNodepoolStateRenewingToken SksNodepoolState = "renewing-token" - - SksNodepoolStateRunning SksNodepoolState = "running" - - SksNodepoolStateScaling SksNodepoolState = "scaling" - - SksNodepoolStateUpdating SksNodepoolState = "updating" -) - -// Defines values for SksNodepoolTaintEffect. -const ( - SksNodepoolTaintEffectNoExecute SksNodepoolTaintEffect = "NoExecute" - - SksNodepoolTaintEffectNoSchedule SksNodepoolTaintEffect = "NoSchedule" - - SksNodepoolTaintEffectPreferNoSchedule SksNodepoolTaintEffect = "PreferNoSchedule" -) - -// Defines values for SnapshotState. -const ( - SnapshotStateDeleted SnapshotState = "deleted" - - SnapshotStateDeleting SnapshotState = "deleting" - - SnapshotStateError SnapshotState = "error" - - SnapshotStateExported SnapshotState = "exported" - - SnapshotStateExporting SnapshotState = "exporting" - - SnapshotStateReady SnapshotState = "ready" - - SnapshotStateSnapshotting SnapshotState = "snapshotting" -) - -// Defines values for TemplateBootMode. -const ( - TemplateBootModeLegacy TemplateBootMode = "legacy" - - TemplateBootModeUefi TemplateBootMode = "uefi" -) - -// Defines values for TemplateVisibility. -const ( - TemplateVisibilityPrivate TemplateVisibility = "private" - - TemplateVisibilityPublic TemplateVisibility = "public" -) - -// Defines values for ZoneName. -const ( - ZoneNameAtVie1 ZoneName = "at-vie-1" - - ZoneNameAtVie2 ZoneName = "at-vie-2" - - ZoneNameBgSof1 ZoneName = "bg-sof-1" - - ZoneNameChDk2 ZoneName = "ch-dk-2" - - ZoneNameChGva2 ZoneName = "ch-gva-2" - - ZoneNameDeFra1 ZoneName = "de-fra-1" - - ZoneNameDeMuc1 ZoneName = "de-muc-1" -) - -// IAM Access Key -type AccessKey struct { - // IAM Access Key - Key *string `json:"key,omitempty"` - - // IAM Access Key name - Name *string `json:"name,omitempty"` - - // IAM Access Key operations - Operations *[]string `json:"operations,omitempty"` - - // IAM Access Key Resources - Resources *[]AccessKeyResource `json:"resources,omitempty"` - - // IAM Access Key Secret - Secret *string `json:"secret,omitempty"` - - // IAM Access Key tags - Tags *[]string `json:"tags,omitempty"` - - // IAM Access Key type - Type *AccessKeyType `json:"type,omitempty"` - - // IAM Access Key version - Version *AccessKeyVersion `json:"version,omitempty"` -} - -// IAM Access Key type -type AccessKeyType string - -// IAM Access Key version -type AccessKeyVersion string - -// Access key operation -type AccessKeyOperation struct { - // Name of the operation - Operation *string `json:"operation,omitempty"` - - // Tags associated with the operation - Tags *[]string `json:"tags,omitempty"` -} - -// Access key resource -type AccessKeyResource struct { - // Resource domain - Domain *AccessKeyResourceDomain `json:"domain,omitempty"` - - // Resource name - ResourceName *string `json:"resource-name,omitempty"` - - // Resource type - ResourceType *AccessKeyResourceResourceType `json:"resource-type,omitempty"` -} - -// Resource domain -type AccessKeyResourceDomain string - -// Resource type -type AccessKeyResourceResourceType string - -// Anti-affinity Group -type AntiAffinityGroup struct { - // Anti-affinity Group description - Description *string `json:"description,omitempty"` - - // Anti-affinity Group ID - Id *string `json:"id,omitempty"` - - // Anti-affinity Group instances - Instances *[]Instance `json:"instances,omitempty"` - - // Anti-affinity Group name - Name *string `json:"name,omitempty"` -} - -// DBaaS plan backup config -type DbaasBackupConfig struct { - // Interval of taking a frequent backup in service types supporting different backup schedules - FrequentIntervalMinutes *int64 `json:"frequent-interval-minutes,omitempty"` - - // Maximum age of the oldest frequent backup in service types supporting different backup schedules - FrequentOldestAgeMinutes *int64 `json:"frequent-oldest-age-minutes,omitempty"` - - // Interval of taking a frequent backup in service types supporting different backup schedules - InfrequentIntervalMinutes *int64 `json:"infrequent-interval-minutes,omitempty"` - - // Maximum age of the oldest infrequent backup in service types supporting different backup schedules - InfrequentOldestAgeMinutes *int64 `json:"infrequent-oldest-age-minutes,omitempty"` - - // The interval, in hours, at which backups are generated. - // For some services, like PostgreSQL, this is the interval - // at which full snapshots are taken and continuous incremental - // backup stream is maintained in addition to that. - Interval *int64 `json:"interval,omitempty"` - - // Maximum number of backups to keep. Zero when no backups are created. - MaxCount *int64 `json:"max-count,omitempty"` - - // Mechanism how backups can be restored. 'regular' - // means a backup is restored as is so that the system - // is restored to the state it was when the backup was generated. - // 'pitr' means point-in-time-recovery, which allows restoring - // the system to any state since the first available full snapshot. - RecoveryMode *string `json:"recovery-mode,omitempty"` -} - -// DbaasDatabaseName defines model for dbaas-database-name. -type DbaasDatabaseName string - -// DbaasIntegration defines model for dbaas-integration. -type DbaasIntegration struct { - // Description of the integration - Description *string `json:"description,omitempty"` - - // Destination service name - Dest *string `json:"dest,omitempty"` - - // Integration id - Id *string `json:"id,omitempty"` - - // Whether the integration is active or not - IsActive *bool `json:"is-active,omitempty"` - - // Whether the integration is enabled or not - IsEnabled *bool `json:"is-enabled,omitempty"` - - // Integration settings - Settings *map[string]interface{} `json:"settings,omitempty"` - - // Source service name - Source *string `json:"source,omitempty"` - - // Integration status - Status *string `json:"status,omitempty"` - - // Integration type - Type *string `json:"type,omitempty"` -} - -// DbaasIntegrationType defines model for dbaas-integration-type. -type DbaasIntegrationType struct { - // The description of the destination service types. - DestDescription *string `json:"dest-description,omitempty"` - - // A list of the destination service types the integration supports. - DestServiceTypes *[]string `json:"dest-service-types,omitempty"` - - // A JSON schema of additional settings of the integration. - Settings *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"settings,omitempty"` - - // The description of the source service types. - SourceDescription *string `json:"source-description,omitempty"` - - // A list of the source service types the integration supports. - SourceServiceTypes *[]string `json:"source-service-types,omitempty"` - - // The type of the integration. - Type *string `json:"type,omitempty"` -} - -// DbaasKafkaAclId defines model for dbaas-kafka-acl-id. -type DbaasKafkaAclId string - -// DbaasKafkaAcls defines model for dbaas-kafka-acls. -type DbaasKafkaAcls struct { - SchemaRegistryAcl *[]DbaasKafkaSchemaRegistryAclEntry `json:"schema-registry-acl,omitempty"` - TopicAcl *[]DbaasKafkaTopicAclEntry `json:"topic-acl,omitempty"` -} - -// DbaasKafkaSchemaRegistryAclEntry defines model for dbaas-kafka-schema-registry-acl-entry. -type DbaasKafkaSchemaRegistryAclEntry struct { - Id *DbaasKafkaAclId `json:"id,omitempty"` - - // Kafka Schema Registry permission - Permission DbaasKafkaSchemaRegistryAclEntryPermission `json:"permission"` - - // Kafka Schema Registry name or pattern - Resource string `json:"resource"` - - // Kafka username or username pattern - Username string `json:"username"` -} - -// Kafka Schema Registry permission -type DbaasKafkaSchemaRegistryAclEntryPermission string - -// DbaasKafkaTopicAclEntry defines model for dbaas-kafka-topic-acl-entry. -type DbaasKafkaTopicAclEntry struct { - Id *DbaasKafkaAclId `json:"id,omitempty"` - - // Kafka permission - Permission DbaasKafkaTopicAclEntryPermission `json:"permission"` - - // Kafka topic name or pattern - Topic string `json:"topic"` - - // Kafka username or username pattern - Username string `json:"username"` -} - -// Kafka permission -type DbaasKafkaTopicAclEntryPermission string - -// DbaasMigrationStatus defines model for dbaas-migration-status. -type DbaasMigrationStatus struct { - // Migration status per database - Details *[]struct { - // Migrated db name (PG) or number (Redis) - Dbname *string `json:"dbname,omitempty"` - - // Error message in case that migration has failed - Error *string `json:"error,omitempty"` - - // Migration method - Method *string `json:"method,omitempty"` - Status *EnumMigrationStatus `json:"status,omitempty"` - } `json:"details,omitempty"` - - // Error message in case that migration has failed - Error *string `json:"error,omitempty"` - - // Redis only: how many seconds since last I/O with redis master - MasterLastIoSecondsAgo *int64 `json:"master-last-io-seconds-ago,omitempty"` - MasterLinkStatus *EnumMasterLinkStatus `json:"master-link-status,omitempty"` - - // Migration method. Empty in case of multiple methods or error - Method *string `json:"method,omitempty"` - - // Migration status - Status *string `json:"status,omitempty"` -} - -// DbaasMysqlDatabaseName defines model for dbaas-mysql-database-name. -type DbaasMysqlDatabaseName string - -// Automatic maintenance settings -type DbaasNodeState struct { - // Name of the service node - Name string `json:"name"` - - // Extra information regarding the progress for current state - ProgressUpdates *[]DbaasNodeStateProgressUpdate `json:"progress-updates,omitempty"` - - // Role of this node. Only returned for a subset of service types - Role *DbaasNodeStateRole `json:"role,omitempty"` - - // Current state of the service node - State DbaasNodeStateState `json:"state"` -} - -// Role of this node. Only returned for a subset of service types -type DbaasNodeStateRole string - -// Current state of the service node -type DbaasNodeStateState string - -// Extra information regarding the progress for current state -type DbaasNodeStateProgressUpdate struct { - // Indicates whether this phase has been completed or not - Completed bool `json:"completed"` - - // Current progress for this phase. May be missing or null. - Current *int64 `json:"current,omitempty"` - - // Maximum progress value for this phase. May be missing or null. May change. - Max *int64 `json:"max,omitempty"` - - // Minimum progress value for this phase. May be missing or null. - Min *int64 `json:"min,omitempty"` - - // Key identifying this phase - Phase DbaasNodeStateProgressUpdatePhase `json:"phase"` - - // Unit for current/min/max values. New units may be added. - // If null should be treated as generic unit - Unit *string `json:"unit,omitempty"` -} - -// Key identifying this phase -type DbaasNodeStateProgressUpdatePhase string - -// DbaasOpensearchAclConfig defines model for dbaas-opensearch-acl-config. -type DbaasOpensearchAclConfig struct { - // Enable OpenSearch ACLs. When disabled authenticated service users have unrestricted access. - AclEnabled *bool `json:"acl-enabled,omitempty"` - - // List of OpenSearch ACLs - Acls *[]struct { - Rules *[]struct { - // OpenSearch index pattern - Index string `json:"index"` - Permission *EnumOpensearchRulePermission `json:"permission,omitempty"` - } `json:"rules,omitempty"` - Username *DbaasUserUsername `json:"username,omitempty"` - } `json:"acls,omitempty"` - - // Enable to enforce index rules in a limited fashion for requests that use the _mget, _msearch, and _bulk APIs - ExtendedAclEnabled *bool `json:"extended-acl-enabled,omitempty"` -} - -// DbaasPgDatabaseName defines model for dbaas-pg-database-name. -type DbaasPgDatabaseName string - -// DbaasPgPoolName defines model for dbaas-pg-pool-name. -type DbaasPgPoolName string - -// DbaasPgPoolSize defines model for dbaas-pg-pool-size. -type DbaasPgPoolSize int64 - -// DbaasPgPoolUsername defines model for dbaas-pg-pool-username. -type DbaasPgPoolUsername string - -// DBaaS plan -type DbaasPlan struct { - // Requires authorization or publicly available - Authorized *bool `json:"authorized,omitempty"` - - // DBaaS plan backup config - BackupConfig *DbaasBackupConfig `json:"backup-config,omitempty"` - - // DBaaS plan disk space - DiskSpace *int64 `json:"disk-space,omitempty"` - - // DBaaS plan max memory allocated percentage - MaxMemoryPercent *int64 `json:"max-memory-percent,omitempty"` - - // DBaaS plan name - Name *string `json:"name,omitempty"` - - // DBaaS plan node count - NodeCount *int64 `json:"node-count,omitempty"` - - // DBaaS plan CPU count per node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // DBaaS plan memory count per node - NodeMemory *int64 `json:"node-memory,omitempty"` -} - -// DbaasPostgresUsers defines model for dbaas-postgres-users. -type DbaasPostgresUsers struct { - Users *[]struct { - AllowReplication *bool `json:"allow-replication,omitempty"` - Username DbaasUserUsername `json:"username"` - } `json:"users,omitempty"` -} - -// List of backups for the service -type DbaasServiceBackup struct { - // Internal name of this backup - BackupName string `json:"backup-name"` - - // Backup timestamp (ISO 8601) - BackupTime time.Time `json:"backup-time"` - - // Backup's original size before compression - DataSize int64 `json:"data-size"` -} - -// DbaasServiceCommon defines model for dbaas-service-common. -type DbaasServiceCommon struct { - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DbaasServiceGrafana defines model for dbaas-service-grafana. -type DbaasServiceGrafana struct { - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // Grafana connection information properties - ConnectionInfo *struct { - Password *string `json:"password,omitempty"` - Uri *string `json:"uri,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"connection-info,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // DbaaS service description - Description *string `json:"description,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Grafana specific settings - GrafanaSettings *map[string]interface{} `json:"grafana-settings,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - Password *string `json:"password,omitempty"` - Type *string `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"users,omitempty"` - - // Grafana version - Version *string `json:"version,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DbaasServiceKafka defines model for dbaas-service-kafka. -type DbaasServiceKafka struct { - // Kafka authentication methods - AuthenticationMethods *struct { - // Whether certificate/SSL authentication is enabled - Certificate *bool `json:"certificate,omitempty"` - - // Whether SASL authentication is enabled - Sasl *bool `json:"sasl,omitempty"` - } `json:"authentication-methods,omitempty"` - - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - KafkaAuthenticationMethod *EnumKafkaAuthMethod `json:"kafka-authentication-method,omitempty"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // Kafka connection information properties - ConnectionInfo *struct { - AccessCert *string `json:"access-cert,omitempty"` - AccessKey *string `json:"access-key,omitempty"` - ConnectUri *string `json:"connect-uri,omitempty"` - Nodes *[]string `json:"nodes,omitempty"` - RegistryUri *string `json:"registry-uri,omitempty"` - RestUri *string `json:"rest-uri,omitempty"` - } `json:"connection-info,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Whether Kafka Connect is enabled - KafkaConnectEnabled *bool `json:"kafka-connect-enabled,omitempty"` - - // Kafka Connect configuration values - KafkaConnectSettings *map[string]interface{} `json:"kafka-connect-settings,omitempty"` - - // Whether Kafka REST is enabled - KafkaRestEnabled *bool `json:"kafka-rest-enabled,omitempty"` - - // Kafka REST configuration - KafkaRestSettings *map[string]interface{} `json:"kafka-rest-settings,omitempty"` - - // Kafka-specific settings - KafkaSettings *map[string]interface{} `json:"kafka-settings,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Whether Schema-Registry is enabled - SchemaRegistryEnabled *bool `json:"schema-registry-enabled,omitempty"` - - // Schema Registry configuration - SchemaRegistrySettings *map[string]interface{} `json:"schema-registry-settings,omitempty"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - AccessCert *string `json:"access-cert,omitempty"` - AccessCertExpiry *time.Time `json:"access-cert-expiry,omitempty"` - AccessKey *string `json:"access-key,omitempty"` - Password *string `json:"password,omitempty"` - Type *string `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"users,omitempty"` - - // Kafka version - Version *string `json:"version,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DbaasServiceLogs defines model for dbaas-service-logs. -type DbaasServiceLogs struct { - FirstLogOffset *string `json:"first-log-offset,omitempty"` - Logs *[]struct { - Message *string `json:"message,omitempty"` - Node *string `json:"node,omitempty"` - Time *string `json:"time,omitempty"` - Unit *string `json:"unit,omitempty"` - } `json:"logs,omitempty"` - Offset *string `json:"offset,omitempty"` -} - -// Automatic maintenance settings -type DbaasServiceMaintenance struct { - // Day of week for installing updates - Dow DbaasServiceMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - - // List of updates waiting to be installed - Updates []DbaasServiceUpdate `json:"updates"` -} - -// Day of week for installing updates -type DbaasServiceMaintenanceDow string - -// DbaasServiceMysql defines model for dbaas-service-mysql. -type DbaasServiceMysql struct { - // Backup schedule - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // MySQL connection information properties - ConnectionInfo *struct { - Params *[]struct { - AdditionalProperties map[string]string `json:"-"` - } `json:"params,omitempty"` - Standby *[]string `json:"standby,omitempty"` - Uri *[]string `json:"uri,omitempty"` - } `json:"connection-info,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // List of MySQL databases - Databases *[]DbaasMysqlDatabaseName `json:"databases,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - - // MySQL-specific settings - MysqlSettings *map[string]interface{} `json:"mysql-settings,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - Authentication *string `json:"authentication,omitempty"` - Password *string `json:"password,omitempty"` - Type *string `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"users,omitempty"` - - // MySQL version - Version *string `json:"version,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DbaasServiceName defines model for dbaas-service-name. -type DbaasServiceName string - -// Service notifications -type DbaasServiceNotification struct { - // Notification level - Level DbaasServiceNotificationLevel `json:"level"` - - // Human notification message - Message string `json:"message"` - - // Notification type - Metadata map[string]interface{} `json:"metadata"` - - // Notification type - Type DbaasServiceNotificationType `json:"type"` -} - -// Notification level -type DbaasServiceNotificationLevel string - -// Notification type -type DbaasServiceNotificationType string - -// DbaasServiceOpensearch defines model for dbaas-service-opensearch. -type DbaasServiceOpensearch struct { - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // Opensearch connection information properties - ConnectionInfo *struct { - DashboardUri *string `json:"dashboard-uri,omitempty"` - Password *string `json:"password,omitempty"` - Uri *[]string `json:"uri,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"connection-info,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // DbaaS service description - Description *string `json:"description,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Allows you to create glob style patterns and set a max number of indexes matching this pattern you want to keep. Creating indexes exceeding this value will cause the oldest one to get deleted. You could for example create a pattern looking like 'logs.?' and then create index logs.1, logs.2 etc, it will delete logs.1 once you create logs.6. Do note 'logs.?' does not apply to logs.10. Note: Setting max_index_count to 0 will do nothing and the pattern gets ignored. - IndexPatterns *[]struct { - // Maximum number of indexes to keep - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - - // fnmatch pattern - Pattern *string `json:"pattern,omitempty"` - - // Deletion sorting algorithm - SortingAlgorithm *DbaasServiceOpensearchIndexPatternsSortingAlgorithm `json:"sorting-algorithm,omitempty"` - } `json:"index-patterns,omitempty"` - - // Template settings for all new indexes - IndexTemplate *struct { - // The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. Default is 10000. - MappingNestedObjectsLimit *int64 `json:"mapping-nested-objects-limit,omitempty"` - - // The number of replicas each primary shard has. - NumberOfReplicas *int64 `json:"number-of-replicas,omitempty"` - - // The number of primary shards that an index should have. - NumberOfShards *int64 `json:"number-of-shards,omitempty"` - } `json:"index-template,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Aiven automation resets index.refresh_interval to default value for every index to be sure that indices are always visible to search. If it doesn't fit your case, you can disable this by setting up this flag to true. - KeepIndexRefreshInterval *bool `json:"keep-index-refresh-interval,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - - // Maximum number of indexes to keep before deleting the oldest one - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // OpenSearch Dashboards settings - OpensearchDashboards *struct { - // Enable or disable OpenSearch Dashboards (default: true) - Enabled *bool `json:"enabled,omitempty"` - - // Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. (default: 128) - MaxOldSpaceSize *int64 `json:"max-old-space-size,omitempty"` - - // Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch (default: 30000) - OpensearchRequestTimeout *int64 `json:"opensearch-request-timeout,omitempty"` - } `json:"opensearch-dashboards,omitempty"` - - // OpenSearch-specific settings - OpensearchSettings *map[string]interface{} `json:"opensearch-settings,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - Password *string `json:"password,omitempty"` - Type *string `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"users,omitempty"` - - // OpenSearch version - Version *string `json:"version,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// Deletion sorting algorithm -type DbaasServiceOpensearchIndexPatternsSortingAlgorithm string - -// DbaasServicePg defines model for dbaas-service-pg. -type DbaasServicePg struct { - // Backup schedule - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // PG connection information properties - ConnectionInfo *struct { - Params *[]struct { - AdditionalProperties map[string]string `json:"-"` - } `json:"params,omitempty"` - Standby *[]string `json:"standby,omitempty"` - Syncing *[]string `json:"syncing,omitempty"` - Uri *[]string `json:"uri,omitempty"` - } `json:"connection-info,omitempty"` - - // PostgreSQL PGBouncer connection pools - ConnectionPools *[]struct { - // Connection URI for the DB pool - ConnectionUri string `json:"connection-uri"` - Database DbaasDatabaseName `json:"database"` - Mode EnumPgPoolMode `json:"mode"` - Name DbaasPgPoolName `json:"name"` - Size DbaasPgPoolSize `json:"size"` - Username DbaasPgPoolUsername `json:"username"` - } `json:"connection-pools,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // List of PostgreSQL databases - Databases *[]DbaasDatabaseName `json:"databases,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - - // Maximum number of connections allowed to an instance - MaxConnections *int64 `json:"max-connections,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // PostgreSQL-specific settings - PgSettings *map[string]interface{} `json:"pg-settings,omitempty"` - - // PGBouncer connection pooling settings - PgbouncerSettings *map[string]interface{} `json:"pgbouncer-settings,omitempty"` - - // PGLookout settings - PglookoutSettings *map[string]interface{} `json:"pglookout-settings,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value. - SharedBuffersPercentage *int64 `json:"shared-buffers-percentage,omitempty"` - State *EnumServiceState `json:"state,omitempty"` - SynchronousReplication *EnumPgSynchronousReplication `json:"synchronous-replication,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // TimescaleDB extension configuration values - TimescaledbSettings *map[string]interface{} `json:"timescaledb-settings,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - AllowReplication *bool `json:"allow-replication,omitempty"` - - // Account password. A missing field indicates a user overridden password. - Password *string `json:"password,omitempty"` - - // Account type - Type string `json:"type"` - - // Account username - Username string `json:"username"` - } `json:"users,omitempty"` - - // PostgreSQL version - Version *string `json:"version,omitempty"` - - // Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB). - WorkMem *int64 `json:"work-mem,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DbaasServiceRedis defines model for dbaas-service-redis. -type DbaasServiceRedis struct { - // List of backups for the service - Backups *[]DbaasServiceBackup `json:"backups,omitempty"` - - // Service component information objects - Components *[]struct { - // Service component name - Component string `json:"component"` - - // DNS name for connecting to the service component - Host string `json:"host"` - - // Port number for connecting to the service component - Port int64 `json:"port"` - Route EnumComponentRoute `json:"route"` - - // Whether the endpoint is encrypted or accepts plaintext. - // By default endpoints are always encrypted and - // this property is only included for service components that may disable encryption. - Ssl *bool `json:"ssl,omitempty"` - Usage EnumComponentUsage `json:"usage"` - } `json:"components,omitempty"` - - // Redis connection information properties - ConnectionInfo *struct { - Password *string `json:"password,omitempty"` - Slave *[]string `json:"slave,omitempty"` - Uri *[]string `json:"uri,omitempty"` - } `json:"connection-info,omitempty"` - - // Service creation timestamp (ISO 8601) - CreatedAt *time.Time `json:"created-at,omitempty"` - - // TODO UNIT disk space for data storage - DiskSize *int64 `json:"disk-size,omitempty"` - - // Service integrations - Integrations *[]DbaasIntegration `json:"integrations,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *DbaasServiceMaintenance `json:"maintenance,omitempty"` - Name DbaasServiceName `json:"name"` - - // Number of service nodes in the active plan - NodeCount *int64 `json:"node-count,omitempty"` - - // Number of CPUs for each node - NodeCpuCount *int64 `json:"node-cpu-count,omitempty"` - - // TODO UNIT of memory for each node - NodeMemory *int64 `json:"node-memory,omitempty"` - - // State of individual service nodes - NodeStates *[]DbaasNodeState `json:"node-states,omitempty"` - - // Service notifications - Notifications *[]DbaasServiceNotification `json:"notifications,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Redis-specific settings - RedisSettings *map[string]interface{} `json:"redis-settings,omitempty"` - State *EnumServiceState `json:"state,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - Type DbaasServiceTypeName `json:"type"` - - // Service last update timestamp (ISO 8601) - UpdatedAt *time.Time `json:"updated-at,omitempty"` - - // URI for connecting to the service (may be absent) - Uri *string `json:"uri,omitempty"` - - // service_uri parameterized into key-value pairs - UriParams *map[string]interface{} `json:"uri-params,omitempty"` - - // List of service users - Users *[]struct { - AccessControl *struct { - Categories *[]string `json:"categories,omitempty"` - Channels *[]string `json:"channels,omitempty"` - Commands *[]string `json:"commands,omitempty"` - Keys *[]string `json:"keys,omitempty"` - } `json:"access-control,omitempty"` - Password *string `json:"password,omitempty"` - Type *string `json:"type,omitempty"` - Username *string `json:"username,omitempty"` - } `json:"users,omitempty"` - - // Redis version - Version *string `json:"version,omitempty"` - - // The zone where the service is running - Zone *string `json:"zone,omitempty"` -} - -// DBaaS service -type DbaasServiceType struct { - // DbaaS service available versions - AvailableVersions *[]string `json:"available-versions,omitempty"` - - // DbaaS service default version - DefaultVersion *string `json:"default-version,omitempty"` - - // DbaaS service description - Description *string `json:"description,omitempty"` - Name *DbaasServiceTypeName `json:"name,omitempty"` - - // DbaaS service plans - Plans *[]DbaasPlan `json:"plans,omitempty"` -} - -// DbaasServiceTypeName defines model for dbaas-service-type-name. -type DbaasServiceTypeName string - -// Update waiting to be installed -type DbaasServiceUpdate struct { - // Deadline for installing the update - Deadline *time.Time `json:"deadline,omitempty"` - - // Description of the update - Description *string `json:"description,omitempty"` - - // The earliest time the update will be automatically applied - StartAfter *time.Time `json:"start-after,omitempty"` - - // The time when the update will be automatically applied - StartAt *time.Time `json:"start-at,omitempty"` -} - -// DbaasTask defines model for dbaas-task. -type DbaasTask struct { - CreateTime *time.Time `json:"create-time,omitempty"` - Id *string `json:"id,omitempty"` - Result *string `json:"result,omitempty"` - ResultCodes *[]struct { - Code *string `json:"code,omitempty"` - Dbname *string `json:"dbname,omitempty"` - } `json:"result-codes,omitempty"` - Success *bool `json:"success,omitempty"` - TaskType *string `json:"task-type,omitempty"` -} - -// DbaasUserPassword defines model for dbaas-user-password. -type DbaasUserPassword string - -// DbaasUserUsername defines model for dbaas-user-username. -type DbaasUserUsername string - -// Deploy target -type DeployTarget struct { - // Deploy Target description - Description *string `json:"description,omitempty"` - - // Deploy Target ID - Id string `json:"id"` - - // Deploy Target name - Name *string `json:"name,omitempty"` - - // Deploy Target type - Type *DeployTargetType `json:"type,omitempty"` -} - -// Deploy Target type -type DeployTargetType string - -// DNS domain -type DnsDomain struct { - // DNS domain creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // DNS domain ID - Id *string `json:"id,omitempty"` - - // DNS domain unicode name - UnicodeName *string `json:"unicode-name,omitempty"` -} - -// DNS domain record -type DnsDomainRecord struct { - // DNS domain record content - Content *string `json:"content,omitempty"` - - // DNS domain record creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // DNS domain record ID - Id *string `json:"id,omitempty"` - - // DNS domain record name - Name *string `json:"name,omitempty"` - - // DNS domain record priority - Priority *int64 `json:"priority,omitempty"` - - // DNS domain record TTL - Ttl *int64 `json:"ttl,omitempty"` - - // DNS domain record type - Type *DnsDomainRecordType `json:"type,omitempty"` - - // DNS domain record update date - UpdatedAt *time.Time `json:"updated-at,omitempty"` -} - -// DNS domain record type -type DnsDomainRecordType string - -// DomainName defines model for domain-name. -type DomainName string - -// Elastic IP -type ElasticIp struct { - // Elastic IP address family - Addressfamily *ElasticIpAddressfamily `json:"addressfamily,omitempty"` - - // Elastic IP cidr - Cidr *string `json:"cidr,omitempty"` - - // Elastic IP description - Description *string `json:"description,omitempty"` - - // Elastic IP address healthcheck - Healthcheck *ElasticIpHealthcheck `json:"healthcheck,omitempty"` - - // Elastic IP ID - Id *string `json:"id,omitempty"` - - // Elastic IP address - Ip *string `json:"ip,omitempty"` - Labels *Labels `json:"labels,omitempty"` -} - -// Elastic IP address family -type ElasticIpAddressfamily string - -// Elastic IP address healthcheck -type ElasticIpHealthcheck struct { - // Interval between the checks in seconds (default: 10) - Interval *int64 `json:"interval,omitempty"` - - // Health check mode - Mode ElasticIpHealthcheckMode `json:"mode"` - - // Health check port - Port int64 `json:"port"` - - // Number of attempts before considering the target unhealthy (default: 3) - StrikesFail *int64 `json:"strikes-fail,omitempty"` - - // Number of attempts before considering the target healthy (default: 2) - StrikesOk *int64 `json:"strikes-ok,omitempty"` - - // Health check timeout value in seconds (default: 2) - Timeout *int64 `json:"timeout,omitempty"` - - // Skip TLS verification - TlsSkipVerify *bool `json:"tls-skip-verify,omitempty"` - - // An optional domain or subdomain to check TLS against - TlsSni *string `json:"tls-sni,omitempty"` - - // An endpoint to use for the health check, for example '/status' - Uri *string `json:"uri,omitempty"` -} - -// Health check mode -type ElasticIpHealthcheckMode string - -// EnumComponentRoute defines model for enum-component-route. -type EnumComponentRoute string - -// EnumComponentUsage defines model for enum-component-usage. -type EnumComponentUsage string - -// EnumIntegrationTypes defines model for enum-integration-types. -type EnumIntegrationTypes string - -// EnumKafkaAuthMethod defines model for enum-kafka-auth-method. -type EnumKafkaAuthMethod string - -// EnumMasterLinkStatus defines model for enum-master-link-status. -type EnumMasterLinkStatus string - -// EnumMigrationMethod defines model for enum-migration-method. -type EnumMigrationMethod string - -// EnumMigrationStatus defines model for enum-migration-status. -type EnumMigrationStatus string - -// EnumMysqlAuthenticationPlugin defines model for enum-mysql-authentication-plugin. -type EnumMysqlAuthenticationPlugin string - -// EnumOpensearchRulePermission defines model for enum-opensearch-rule-permission. -type EnumOpensearchRulePermission string - -// EnumPgPoolMode defines model for enum-pg-pool-mode. -type EnumPgPoolMode string - -// EnumPgSynchronousReplication defines model for enum-pg-synchronous-replication. -type EnumPgSynchronousReplication string - -// EnumPgVariant defines model for enum-pg-variant. -type EnumPgVariant string - -// EnumServiceState defines model for enum-service-state. -type EnumServiceState string - -// EnumSortOrder defines model for enum-sort-order. -type EnumSortOrder string - -// A notable Mutation Event which happened on the infrastructure -type Event struct { - // Body parameters (free form map) - BodyParams *map[string]interface{} `json:"body-params,omitempty"` - - // Operation processing time - ElapsedMs *int64 `json:"elapsed-ms,omitempty"` - - // Query string parameters (free form map) - GetParams *map[string]interface{} `json:"get-params,omitempty"` - - // Operation handler name - Handler *string `json:"handler,omitempty"` - - // Operation message - Message *string `json:"message,omitempty"` - - // URI path parameters (free form map) - PathParams *map[string]interface{} `json:"path-params,omitempty"` - - // Client IP address - RemoteAddr *string `json:"remote-addr,omitempty"` - - // Operation unique identifier - RequestId *string `json:"request-id,omitempty"` - - // Operation HTTP status - Status *int64 `json:"status,omitempty"` - - // Time at which the event happened, millisecond resolution - Timestamp *time.Time `json:"timestamp,omitempty"` - - // Operation request URI - Uri *string `json:"uri,omitempty"` - - // Operation targeted zone - Zone *string `json:"zone,omitempty"` -} - -// IAM API Key -type IamApiKey struct { - // IAM API Key - Key *string `json:"key,omitempty"` - - // IAM API Key name - Name *string `json:"name,omitempty"` - - // IAM API Key Role ID - RoleId *string `json:"role-id,omitempty"` -} - -// IAM API Key -type IamApiKeyCreated struct { - // IAM API Key - Key *string `json:"key,omitempty"` - - // IAM API Key name - Name *string `json:"name,omitempty"` - - // IAM API Key Role ID - RoleId *string `json:"role-id,omitempty"` - - // IAM API Key Secret - Secret *string `json:"secret,omitempty"` -} - -// Policy -type IamPolicy struct { - // IAM default service strategy - DefaultServiceStrategy IamPolicyDefaultServiceStrategy `json:"default-service-strategy"` - - // IAM services - Services IamPolicy_Services `json:"services"` -} - -// IAM default service strategy -type IamPolicyDefaultServiceStrategy string - -// IAM services -type IamPolicy_Services struct { - AdditionalProperties map[string]IamServicePolicy `json:"-"` -} - -// IAM Role -type IamRole struct { - // IAM Role description - Description *string `json:"description,omitempty"` - - // IAM Role mutability - Editable *bool `json:"editable,omitempty"` - - // IAM Role ID - Id *string `json:"id,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // IAM Role name - Name *string `json:"name,omitempty"` - - // IAM Role permissions - Permissions *[]IamRolePermissions `json:"permissions,omitempty"` - - // Policy - Policy *IamPolicy `json:"policy,omitempty"` -} - -// IamRolePermissions defines model for IamRole.Permissions. -type IamRolePermissions string - -// IamServicePolicy defines model for iam-service-policy. -type IamServicePolicy struct { - Rules *[]IamServicePolicyRule `json:"rules,omitempty"` - Type *IamServicePolicyType `json:"type,omitempty"` -} - -// IamServicePolicyType defines model for IamServicePolicy.Type. -type IamServicePolicyType string - -// IamServicePolicyRule defines model for iam-service-policy-rule. -type IamServicePolicyRule struct { - Action *IamServicePolicyRuleAction `json:"action,omitempty"` - Expression *string `json:"expression,omitempty"` - Resources *[]string `json:"resources,omitempty"` -} - -// IamServicePolicyRuleAction defines model for IamServicePolicyRule.Action. -type IamServicePolicyRuleAction string - -// Instance -type Instance struct { - // Instance Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Instance creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Instance disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Instance Elastic IPs - ElasticIps *[]ElasticIp `json:"elastic-ips,omitempty"` - - // Instance ID - Id *string `json:"id,omitempty"` - - // Compute instance type - InstanceType *InstanceType `json:"instance-type,omitempty"` - - // Instance IPv6 address - Ipv6Address *string `json:"ipv6-address,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Resource manager - Manager *Manager `json:"manager,omitempty"` - - // Instance name - Name *string `json:"name,omitempty"` - - // Instance Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - - // Instance public IPv4 address - PublicIp *string `json:"public-ip,omitempty"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // Instance Snapshots - Snapshots *[]Snapshot `json:"snapshots,omitempty"` - - // SSH key - SshKey *SshKey `json:"ssh-key,omitempty"` - - // Instance SSH Keys - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - State *InstanceState `json:"state,omitempty"` - - // Instance template - Template *Template `json:"template,omitempty"` - - // Instance Cloud-init user-data (base64 encoded) - UserData *string `json:"user-data,omitempty"` -} - -// Instance password -type InstancePassword struct { - // Password - Password *string `json:"password,omitempty"` -} - -// Instance Pool -type InstancePool struct { - // Instance Pool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Instance Pool description - Description *string `json:"description,omitempty"` - - // Instances disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Instances Elastic IPs - ElasticIps *[]ElasticIp `json:"elastic-ips,omitempty"` - - // Instance Pool ID - Id *string `json:"id,omitempty"` - - // The instances created by the Instance Pool will be prefixed with this value (default: pool) - InstancePrefix *string `json:"instance-prefix,omitempty"` - - // Compute instance type - InstanceType *InstanceType `json:"instance-type,omitempty"` - - // Instances - Instances *[]Instance `json:"instances,omitempty"` - - // Enable IPv6 for instances - Ipv6Enabled *bool `json:"ipv6-enabled,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Resource manager - Manager *Manager `json:"manager,omitempty"` - - // Minimum number of running instances - MinAvailable *int64 `json:"min-available,omitempty"` - - // Instance Pool name - Name *string `json:"name,omitempty"` - - // Instance Pool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Pool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // Number of instances - Size *int64 `json:"size,omitempty"` - - // SSH key - SshKey *SshKey `json:"ssh-key,omitempty"` - - // Instances SSH keys - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - - // Instance Pool state - State *InstancePoolState `json:"state,omitempty"` - - // Instance template - Template *Template `json:"template,omitempty"` - - // Instances Cloud-init user-data - UserData *string `json:"user-data,omitempty"` -} - -// Instance Pool state -type InstancePoolState string - -// InstanceState defines model for instance-state. -type InstanceState string - -// Target Instance -type InstanceTarget struct { - // Instance ID - Id *string `json:"id,omitempty"` -} - -// Compute instance type -type InstanceType struct { - // Requires authorization or publicly available - Authorized *bool `json:"authorized,omitempty"` - - // CPU count - Cpus *int64 `json:"cpus,omitempty"` - - // Instance type family - Family *InstanceTypeFamily `json:"family,omitempty"` - - // GPU count - Gpus *int64 `json:"gpus,omitempty"` - - // Instance type ID - Id *string `json:"id,omitempty"` - - // Available memory - Memory *int64 `json:"memory,omitempty"` - - // Instance type size - Size *InstanceTypeSize `json:"size,omitempty"` - - // Instance Type available zones - Zones *[]ZoneName `json:"zones,omitempty"` -} - -// Instance type family -type InstanceTypeFamily string - -// Instance type size -type InstanceTypeSize string - -// Kubelet image GC options -type KubeletImageGc struct { - HighThreshold *int64 `json:"high-threshold,omitempty"` - LowThreshold *int64 `json:"low-threshold,omitempty"` - MinAge *string `json:"min-age,omitempty"` -} - -// Labels defines model for labels. -type Labels struct { - AdditionalProperties map[string]string `json:"-"` -} - -// Load Balancer -type LoadBalancer struct { - // Load Balancer creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Load Balancer description - Description *string `json:"description,omitempty"` - - // Load Balancer ID - Id *string `json:"id,omitempty"` - - // Load Balancer public IP - Ip *string `json:"ip,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Load Balancer name - Name *string `json:"name,omitempty"` - - // Load Balancer Services - Services *[]LoadBalancerService `json:"services,omitempty"` - - // Load Balancer state - State *LoadBalancerState `json:"state,omitempty"` -} - -// Load Balancer state -type LoadBalancerState string - -// Load Balancer Service status -type LoadBalancerServerStatus struct { - // Backend server public IP - PublicIp *string `json:"public-ip,omitempty"` - - // Status of the instance's healthcheck - Status *LoadBalancerServerStatusStatus `json:"status,omitempty"` -} - -// Status of the instance's healthcheck -type LoadBalancerServerStatusStatus string - -// Load Balancer Service -type LoadBalancerService struct { - // Load Balancer Service description - Description *string `json:"description,omitempty"` - - // Load Balancer Service healthcheck - Healthcheck *LoadBalancerServiceHealthcheck `json:"healthcheck,omitempty"` - - // Healthcheck status per backend server - HealthcheckStatus *[]LoadBalancerServerStatus `json:"healthcheck-status,omitempty"` - - // Load Balancer Service ID - Id *string `json:"id,omitempty"` - - // Instance Pool - InstancePool *InstancePool `json:"instance-pool,omitempty"` - - // Load Balancer Service name - Name *string `json:"name,omitempty"` - - // Port exposed on the Load Balancer's public IP - Port *int64 `json:"port,omitempty"` - - // Network traffic protocol - Protocol *LoadBalancerServiceProtocol `json:"protocol,omitempty"` - - // Load Balancer Service state - State *LoadBalancerServiceState `json:"state,omitempty"` - - // Load balancing strategy - Strategy *LoadBalancerServiceStrategy `json:"strategy,omitempty"` - - // Port on which the network traffic will be forwarded to on the receiving instance - TargetPort *int64 `json:"target-port,omitempty"` -} - -// Network traffic protocol -type LoadBalancerServiceProtocol string - -// Load Balancer Service state -type LoadBalancerServiceState string - -// Load balancing strategy -type LoadBalancerServiceStrategy string - -// Load Balancer Service healthcheck -type LoadBalancerServiceHealthcheck struct { - // Healthcheck interval (default: 10). Must be greater than or equal to Timeout - Interval *int64 `json:"interval,omitempty"` - - // Healthcheck mode - Mode *LoadBalancerServiceHealthcheckMode `json:"mode,omitempty"` - - // Healthcheck port - Port *int64 `json:"port,omitempty"` - - // Number of retries before considering a Service failed - Retries *int64 `json:"retries,omitempty"` - - // Healthcheck timeout value (default: 2). Must be lower than or equal to Interval - Timeout *int64 `json:"timeout,omitempty"` - - // SNI domain for HTTPS healthchecks - TlsSni *string `json:"tls-sni,omitempty"` - - // An endpoint to use for the HTTP healthcheck, e.g. '/status' - Uri *string `json:"uri,omitempty"` -} - -// Healthcheck mode -type LoadBalancerServiceHealthcheckMode string - -// Resource manager -type Manager struct { - // Manager ID - Id *string `json:"id,omitempty"` - - // Manager type - Type *ManagerType `json:"type,omitempty"` -} - -// Manager type -type ManagerType string - -// Operation -type Operation struct { - // Operation ID - Id *string `json:"id,omitempty"` - - // Operation message - Message *string `json:"message,omitempty"` - - // Operation failure reason - Reason *OperationReason `json:"reason,omitempty"` - - // Related resource reference - Reference *struct { - // Command name - Command *string `json:"command,omitempty"` - - // Reference ID - Id *string `json:"id,omitempty"` - - // Link to the referenced resource - Link *string `json:"link,omitempty"` - } `json:"reference,omitempty"` - - // Operation status - State *OperationState `json:"state,omitempty"` -} - -// Operation failure reason -type OperationReason string - -// Operation status -type OperationState string - -// Private Network -type PrivateNetwork struct { - // Private Network description - Description *string `json:"description,omitempty"` - - // Private Network end IP address - EndIp *string `json:"end-ip,omitempty"` - - // Private Network ID - Id *string `json:"id,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Private Network leased IP addresses - Leases *[]PrivateNetworkLease `json:"leases,omitempty"` - - // Private Network name - Name *string `json:"name,omitempty"` - - // Private Network netmask - Netmask *string `json:"netmask,omitempty"` - - // Private Network start IP address - StartIp *string `json:"start-ip,omitempty"` -} - -// Private Network leased IP address -type PrivateNetworkLease struct { - // Attached instance ID - InstanceId *string `json:"instance-id,omitempty"` - - // Private Network IP address - Ip *string `json:"ip,omitempty"` -} - -// PublicIpAssignment defines model for public-ip-assignment. -type PublicIpAssignment string - -// Organization Quota -type Quota struct { - // Resource Limit. -1 for Unlimited - Limit *int64 `json:"limit,omitempty"` - - // Resource Name - Resource *string `json:"resource,omitempty"` - - // Resource Usage - Usage *int64 `json:"usage,omitempty"` -} - -// ReverseDnsRecord defines model for reverse-dns-record. -type ReverseDnsRecord struct { - DomainName *DomainName `json:"domain-name,omitempty"` -} - -// Security Group -type SecurityGroup struct { - // Security Group description - Description *string `json:"description,omitempty"` - - // Security Group external sources - ExternalSources *[]string `json:"external-sources,omitempty"` - - // Security Group ID - Id *string `json:"id,omitempty"` - - // Security Group name - Name *string `json:"name,omitempty"` - - // Security Group rules - Rules *[]SecurityGroupRule `json:"rules,omitempty"` -} - -// Security Group -type SecurityGroupResource struct { - // Security Group ID - Id *string `json:"id,omitempty"` - - // Security Group name - Name *string `json:"name,omitempty"` - - // Whether this points to a public security group. This is only valid when in the context of - // a rule addition which uses a public security group as a source or destination. - Visibility *SecurityGroupResourceVisibility `json:"visibility,omitempty"` -} - -// Whether this points to a public security group. This is only valid when in the context of -// -// a rule addition which uses a public security group as a source or destination. -type SecurityGroupResourceVisibility string - -// Security Group rule -type SecurityGroupRule struct { - // Security Group rule description - Description *string `json:"description,omitempty"` - - // End port of the range - EndPort *int64 `json:"end-port,omitempty"` - - // Network flow direction to match - FlowDirection *SecurityGroupRuleFlowDirection `json:"flow-direction,omitempty"` - - // ICMP details - Icmp *struct { - Code *int64 `json:"code,omitempty"` - Type *int64 `json:"type,omitempty"` - } `json:"icmp,omitempty"` - - // Security Group rule ID - Id *string `json:"id,omitempty"` - - // CIDR-formatted network allowed - Network *string `json:"network,omitempty"` - - // Network protocol - Protocol *SecurityGroupRuleProtocol `json:"protocol,omitempty"` - - // Security Group - SecurityGroup *SecurityGroupResource `json:"security-group,omitempty"` - - // Start port of the range - StartPort *int64 `json:"start-port,omitempty"` -} - -// Network flow direction to match -type SecurityGroupRuleFlowDirection string - -// Network protocol -type SecurityGroupRuleProtocol string - -// SKS Cluster -type SksCluster struct { - // Cluster addons - Addons *[]SksClusterAddons `json:"addons,omitempty"` - - // Enable auto upgrade of the control plane to the latest patch version available - AutoUpgrade *bool `json:"auto-upgrade,omitempty"` - - // Cluster CNI - Cni *SksClusterCni `json:"cni,omitempty"` - - // Cluster creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Cluster description - Description *string `json:"description,omitempty"` - - // Cluster endpoint - Endpoint *string `json:"endpoint,omitempty"` - - // Cluster ID - Id *string `json:"id,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Cluster level - Level *SksClusterLevel `json:"level,omitempty"` - - // Cluster name - Name *string `json:"name,omitempty"` - - // Cluster Nodepools - Nodepools *[]SksNodepool `json:"nodepools,omitempty"` - - // Cluster state - State *SksClusterState `json:"state,omitempty"` - - // Control plane Kubernetes version - Version *string `json:"version,omitempty"` -} - -// SksClusterAddons defines model for SksCluster.Addons. -type SksClusterAddons string - -// Cluster CNI -type SksClusterCni string - -// Cluster level -type SksClusterLevel string - -// Cluster state -type SksClusterState string - -// SksClusterDeprecatedResource defines model for sks-cluster-deprecated-resource. -type SksClusterDeprecatedResource struct { - AdditionalProperties map[string]string `json:"-"` -} - -// Kubeconfig request for a SKS cluster -type SksKubeconfigRequest struct { - // List of roles. The certificate present in the Kubeconfig will have these roles set in the Org field. - Groups *[]string `json:"groups,omitempty"` - - // Validity in seconds of the Kubeconfig user certificate (default: 30 days) - Ttl *int64 `json:"ttl,omitempty"` - - // User name in the generated Kubeconfig. The certificate present in the Kubeconfig will also have this name set for the CN field. - User *string `json:"user,omitempty"` -} - -// SKS Nodepool -type SksNodepool struct { - // Nodepool addons - Addons *[]SksNodepoolAddons `json:"addons,omitempty"` - - // Nodepool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Nodepool creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Nodepool description - Description *string `json:"description,omitempty"` - - // Nodepool instances disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Nodepool ID - Id *string `json:"id,omitempty"` - - // Instance Pool - InstancePool *InstancePool `json:"instance-pool,omitempty"` - - // The instances created by the Nodepool will be prefixed with this value (default: pool) - InstancePrefix *string `json:"instance-prefix,omitempty"` - - // Compute instance type - InstanceType *InstanceType `json:"instance-type,omitempty"` - - // Kubelet image GC options - KubeletImageGc *KubeletImageGc `json:"kubelet-image-gc,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Nodepool name - Name *string `json:"name,omitempty"` - - // Nodepool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - - // Nodepool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // Number of instances - Size *int64 `json:"size,omitempty"` - - // Nodepool state - State *SksNodepoolState `json:"state,omitempty"` - Taints *SksNodepoolTaints `json:"taints,omitempty"` - - // Instance template - Template *Template `json:"template,omitempty"` - - // Nodepool version - Version *string `json:"version,omitempty"` -} - -// SksNodepoolAddons defines model for SksNodepool.Addons. -type SksNodepoolAddons string - -// Nodepool state -type SksNodepoolState string - -// Nodepool taint -type SksNodepoolTaint struct { - // Nodepool taint effect - Effect SksNodepoolTaintEffect `json:"effect"` - - // Nodepool taint value - Value string `json:"value"` -} - -// Nodepool taint effect -type SksNodepoolTaintEffect string - -// SksNodepoolTaints defines model for sks-nodepool-taints. -type SksNodepoolTaints struct { - AdditionalProperties map[string]SksNodepoolTaint `json:"-"` -} - -// SKS Cluster OpenID config map -type SksOidc struct { - // OpenID client ID - ClientId string `json:"client-id"` - - // JWT claim to use as the user's group - GroupsClaim *string `json:"groups-claim,omitempty"` - - // Prefix prepended to group claims - GroupsPrefix *string `json:"groups-prefix,omitempty"` - - // OpenID provider URL - IssuerUrl string `json:"issuer-url"` - - // A key value map that describes a required claim in the ID Token - RequiredClaim *SksOidc_RequiredClaim `json:"required-claim,omitempty"` - - // JWT claim to use as the user name - UsernameClaim *string `json:"username-claim,omitempty"` - - // Prefix prepended to username claims - UsernamePrefix *string `json:"username-prefix,omitempty"` -} - -// A key value map that describes a required claim in the ID Token -type SksOidc_RequiredClaim struct { - AdditionalProperties map[string]string `json:"-"` -} - -// Snapshot -type Snapshot struct { - // Snapshot creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Exported snapshot information - Export *struct { - // Exported snapshot disk file MD5 checksum - Md5sum *string `json:"md5sum,omitempty"` - - // Exported snapshot disk file pre-signed URL - PresignedUrl *string `json:"presigned-url,omitempty"` - } `json:"export,omitempty"` - - // Snapshot ID - Id *string `json:"id,omitempty"` - - // Instance - Instance *Instance `json:"instance,omitempty"` - - // Snapshot name - Name *string `json:"name,omitempty"` - - // Snapshot size in GB - Size *int64 `json:"size,omitempty"` - - // Snapshot state - State *SnapshotState `json:"state,omitempty"` -} - -// Snapshot state -type SnapshotState string - -// SOS Bucket usage -type SosBucketUsage struct { - // SOS Bucket creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // SOS Bucket name - Name *string `json:"name,omitempty"` - - // SOS Bucket size in B - Size *int64 `json:"size,omitempty"` - ZoneName *ZoneName `json:"zone-name,omitempty"` -} - -// SSH key -type SshKey struct { - // SSH key fingerprint - Fingerprint *string `json:"fingerprint,omitempty"` - - // SSH key name - Name *string `json:"name,omitempty"` -} - -// Instance template -type Template struct { - // Boot mode (default: legacy) - BootMode *TemplateBootMode `json:"boot-mode,omitempty"` - - // Template build - Build *string `json:"build,omitempty"` - - // Template MD5 checksum - Checksum *string `json:"checksum,omitempty"` - - // Template creation date - CreatedAt *time.Time `json:"created-at,omitempty"` - - // Template default user - DefaultUser *string `json:"default-user,omitempty"` - - // Template description - Description *string `json:"description,omitempty"` - - // Template family - Family *string `json:"family,omitempty"` - - // Template ID - Id *string `json:"id,omitempty"` - - // Template maintainer - Maintainer *string `json:"maintainer,omitempty"` - - // Template name - Name *string `json:"name,omitempty"` - - // Enable password-based login - PasswordEnabled *bool `json:"password-enabled,omitempty"` - - // Template size - Size *int64 `json:"size,omitempty"` - - // Enable SSH key-based login - SshKeyEnabled *bool `json:"ssh-key-enabled,omitempty"` - - // Template source URL - Url *string `json:"url,omitempty"` - - // Template version - Version *string `json:"version,omitempty"` - - // Template visibility - Visibility *TemplateVisibility `json:"visibility,omitempty"` - - // Zones availability - Zones *[]ZoneName `json:"zones,omitempty"` -} - -// Boot mode (default: legacy) -type TemplateBootMode string - -// Template visibility -type TemplateVisibility string - -// Zone -type Zone struct { - Name *ZoneName `json:"name,omitempty"` -} - -// ZoneName defines model for zone-name. -type ZoneName string - -// CreateAccessKeyJSONBody defines parameters for CreateAccessKey. -type CreateAccessKeyJSONBody struct { - // IAM Access Key name - Name *string `json:"name,omitempty"` - - // IAM Access Key operations - Operations *[]string `json:"operations,omitempty"` - - // IAM Access Key Resources - Resources *[]AccessKeyResource `json:"resources,omitempty"` - - // IAM Access Key tags - Tags *[]string `json:"tags,omitempty"` -} - -// CreateAntiAffinityGroupJSONBody defines parameters for CreateAntiAffinityGroup. -type CreateAntiAffinityGroupJSONBody struct { - // Anti-affinity Group description - Description *string `json:"description,omitempty"` - - // Anti-affinity Group name - Name string `json:"name"` -} - -// CreateApiKeyJSONBody defines parameters for CreateApiKey. -type CreateApiKeyJSONBody struct { - // IAM API Key Name - Name string `json:"name"` - - // IAM API Key Role ID - RoleId string `json:"role-id"` -} - -// CreateDbaasServiceGrafanaJSONBody defines parameters for CreateDbaasServiceGrafana. -type CreateDbaasServiceGrafanaJSONBody struct { - ForkFromService *DbaasServiceName `json:"fork-from-service,omitempty"` - - // Grafana specific settings - GrafanaSettings *map[string]interface{} `json:"grafana-settings,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServiceGrafanaJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// CreateDbaasServiceGrafanaJSONBodyMaintenanceDow defines parameters for CreateDbaasServiceGrafana. -type CreateDbaasServiceGrafanaJSONBodyMaintenanceDow string - -// UpdateDbaasServiceGrafanaJSONBody defines parameters for UpdateDbaasServiceGrafana. -type UpdateDbaasServiceGrafanaJSONBody struct { - // Grafana specific settings - GrafanaSettings *map[string]interface{} `json:"grafana-settings,omitempty"` - - // Allowed CIDR address blocks for incoming connections - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServiceGrafanaJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// UpdateDbaasServiceGrafanaJSONBodyMaintenanceDow defines parameters for UpdateDbaasServiceGrafana. -type UpdateDbaasServiceGrafanaJSONBodyMaintenanceDow string - -// CreateDbaasIntegrationJSONBody defines parameters for CreateDbaasIntegration. -type CreateDbaasIntegrationJSONBody struct { - DestService DbaasServiceName `json:"dest-service"` - IntegrationType EnumIntegrationTypes `json:"integration-type"` - - // Integration settings - Settings *map[string]interface{} `json:"settings,omitempty"` - SourceService DbaasServiceName `json:"source-service"` -} - -// UpdateDbaasIntegrationJSONBody defines parameters for UpdateDbaasIntegration. -type UpdateDbaasIntegrationJSONBody struct { - // Integration settings - Settings map[string]interface{} `json:"settings"` -} - -// CreateDbaasServiceKafkaJSONBody defines parameters for CreateDbaasServiceKafka. -type CreateDbaasServiceKafkaJSONBody struct { - // Kafka authentication methods - AuthenticationMethods *struct { - // Enable certificate/SSL authentication - Certificate *bool `json:"certificate,omitempty"` - - // Enable SASL authentication - Sasl *bool `json:"sasl,omitempty"` - } `json:"authentication-methods,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Allow clients to connect to kafka_connect from the public internet for service nodes that are in a project VPC or another type of private network - KafkaConnectEnabled *bool `json:"kafka-connect-enabled,omitempty"` - - // Kafka Connect configuration values - KafkaConnectSettings *map[string]interface{} `json:"kafka-connect-settings,omitempty"` - - // Enable Kafka-REST service - KafkaRestEnabled *bool `json:"kafka-rest-enabled,omitempty"` - - // Kafka REST configuration - KafkaRestSettings *map[string]interface{} `json:"kafka-rest-settings,omitempty"` - - // Kafka-specific settings - KafkaSettings *map[string]interface{} `json:"kafka-settings,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServiceKafkaJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Enable Schema-Registry service - SchemaRegistryEnabled *bool `json:"schema-registry-enabled,omitempty"` - - // Schema Registry configuration - SchemaRegistrySettings *map[string]interface{} `json:"schema-registry-settings,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // Kafka major version - Version *string `json:"version,omitempty"` -} - -// CreateDbaasServiceKafkaJSONBodyMaintenanceDow defines parameters for CreateDbaasServiceKafka. -type CreateDbaasServiceKafkaJSONBodyMaintenanceDow string - -// UpdateDbaasServiceKafkaJSONBody defines parameters for UpdateDbaasServiceKafka. -type UpdateDbaasServiceKafkaJSONBody struct { - // Kafka authentication methods - AuthenticationMethods *struct { - // Enable certificate/SSL authentication - Certificate *bool `json:"certificate,omitempty"` - - // Enable SASL authentication - Sasl *bool `json:"sasl,omitempty"` - } `json:"authentication-methods,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Allow clients to connect to kafka_connect from the public internet for service nodes that are in a project VPC or another type of private network - KafkaConnectEnabled *bool `json:"kafka-connect-enabled,omitempty"` - - // Kafka Connect configuration values - KafkaConnectSettings *map[string]interface{} `json:"kafka-connect-settings,omitempty"` - - // Enable Kafka-REST service - KafkaRestEnabled *bool `json:"kafka-rest-enabled,omitempty"` - - // Kafka REST configuration - KafkaRestSettings *map[string]interface{} `json:"kafka-rest-settings,omitempty"` - - // Kafka-specific settings - KafkaSettings *map[string]interface{} `json:"kafka-settings,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServiceKafkaJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Enable Schema-Registry service - SchemaRegistryEnabled *bool `json:"schema-registry-enabled,omitempty"` - - // Schema Registry configuration - SchemaRegistrySettings *map[string]interface{} `json:"schema-registry-settings,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// UpdateDbaasServiceKafkaJSONBodyMaintenanceDow defines parameters for UpdateDbaasServiceKafka. -type UpdateDbaasServiceKafkaJSONBodyMaintenanceDow string - -// CreateDbaasKafkaSchemaRegistryAclConfigJSONBody defines parameters for CreateDbaasKafkaSchemaRegistryAclConfig. -type CreateDbaasKafkaSchemaRegistryAclConfigJSONBody DbaasKafkaSchemaRegistryAclEntry - -// CreateDbaasKafkaTopicAclConfigJSONBody defines parameters for CreateDbaasKafkaTopicAclConfig. -type CreateDbaasKafkaTopicAclConfigJSONBody DbaasKafkaTopicAclEntry - -// CreateDbaasKafkaUserJSONBody defines parameters for CreateDbaasKafkaUser. -type CreateDbaasKafkaUserJSONBody struct { - Username DbaasUserUsername `json:"username"` -} - -// ResetDbaasKafkaUserPasswordJSONBody defines parameters for ResetDbaasKafkaUserPassword. -type ResetDbaasKafkaUserPasswordJSONBody struct { - Password *DbaasUserPassword `json:"password,omitempty"` -} - -// CreateDbaasServiceMysqlJSONBody defines parameters for CreateDbaasServiceMysql. -type CreateDbaasServiceMysqlJSONBody struct { - // Custom password for admin user. Defaults to random string. This must be set only when a new service is being created. - AdminPassword *string `json:"admin-password,omitempty"` - - // Custom username for admin user. This must be set only when a new service is being created. - AdminUsername *string `json:"admin-username,omitempty"` - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - - // The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector. - BinlogRetentionPeriod *int64 `json:"binlog-retention-period,omitempty"` - ForkFromService *DbaasServiceName `json:"fork-from-service,omitempty"` - - // Service integrations to be enabled when creating the service. - Integrations *[]struct { - DestService *DbaasServiceName `json:"dest-service,omitempty"` - - // Integration settings - Settings *map[string]interface{} `json:"settings,omitempty"` - SourceService *DbaasServiceName `json:"source-service,omitempty"` - - // Integration type - Type CreateDbaasServiceMysqlJSONBodyIntegrationsType `json:"type"` - } `json:"integrations,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServiceMysqlJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // MySQL-specific settings - MysqlSettings *map[string]interface{} `json:"mysql-settings,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // ISO time of a backup to recover from for services that support arbitrary times - RecoveryBackupTime *string `json:"recovery-backup-time,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // MySQL major version - Version *string `json:"version,omitempty"` -} - -// CreateDbaasServiceMysqlJSONBodyIntegrationsType defines parameters for CreateDbaasServiceMysql. -type CreateDbaasServiceMysqlJSONBodyIntegrationsType string - -// CreateDbaasServiceMysqlJSONBodyMaintenanceDow defines parameters for CreateDbaasServiceMysql. -type CreateDbaasServiceMysqlJSONBodyMaintenanceDow string - -// UpdateDbaasServiceMysqlJSONBody defines parameters for UpdateDbaasServiceMysql. -type UpdateDbaasServiceMysqlJSONBody struct { - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - - // The minimum amount of time in seconds to keep binlog entries before deletion. This may be extended for services that require binlog entries for longer than the default for example if using the MySQL Debezium Kafka connector. - BinlogRetentionPeriod *int64 `json:"binlog-retention-period,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServiceMysqlJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // MySQL-specific settings - MysqlSettings *map[string]interface{} `json:"mysql-settings,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// UpdateDbaasServiceMysqlJSONBodyMaintenanceDow defines parameters for UpdateDbaasServiceMysql. -type UpdateDbaasServiceMysqlJSONBodyMaintenanceDow string - -// CreateDbaasMysqlDatabaseJSONBody defines parameters for CreateDbaasMysqlDatabase. -type CreateDbaasMysqlDatabaseJSONBody struct { - DatabaseName DbaasDatabaseName `json:"database-name"` -} - -// CreateDbaasMysqlUserJSONBody defines parameters for CreateDbaasMysqlUser. -type CreateDbaasMysqlUserJSONBody struct { - Authentication *EnumMysqlAuthenticationPlugin `json:"authentication,omitempty"` - Username DbaasUserUsername `json:"username"` -} - -// ResetDbaasMysqlUserPasswordJSONBody defines parameters for ResetDbaasMysqlUserPassword. -type ResetDbaasMysqlUserPasswordJSONBody struct { - Authentication *EnumMysqlAuthenticationPlugin `json:"authentication,omitempty"` - Password *DbaasUserPassword `json:"password,omitempty"` -} - -// CreateDbaasServiceOpensearchJSONBody defines parameters for CreateDbaasServiceOpensearch. -type CreateDbaasServiceOpensearchJSONBody struct { - ForkFromService *DbaasServiceName `json:"fork-from-service,omitempty"` - - // Allows you to create glob style patterns and set a max number of indexes matching this pattern you want to keep. Creating indexes exceeding this value will cause the oldest one to get deleted. You could for example create a pattern looking like 'logs.?' and then create index logs.1, logs.2 etc, it will delete logs.1 once you create logs.6. Do note 'logs.?' does not apply to logs.10. Note: Setting max_index_count to 0 will do nothing and the pattern gets ignored. - IndexPatterns *[]struct { - // Maximum number of indexes to keep - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - - // fnmatch pattern - Pattern *string `json:"pattern,omitempty"` - - // Deletion sorting algorithm - SortingAlgorithm *CreateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm `json:"sorting-algorithm,omitempty"` - } `json:"index-patterns,omitempty"` - - // Template settings for all new indexes - IndexTemplate *struct { - // The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. Default is 10000. - MappingNestedObjectsLimit *int64 `json:"mapping-nested-objects-limit,omitempty"` - - // The number of replicas each primary shard has. - NumberOfReplicas *int64 `json:"number-of-replicas,omitempty"` - - // The number of primary shards that an index should have. - NumberOfShards *int64 `json:"number-of-shards,omitempty"` - } `json:"index-template,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Aiven automation resets index.refresh_interval to default value for every index to be sure that indices are always visible to search. If it doesn't fit your case, you can disable this by setting up this flag to true. - KeepIndexRefreshInterval *bool `json:"keep-index-refresh-interval,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServiceOpensearchJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Maximum number of indexes to keep before deleting the oldest one - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - - // OpenSearch Dashboards settings - OpensearchDashboards *struct { - // Enable or disable OpenSearch Dashboards (default: true) - Enabled *bool `json:"enabled,omitempty"` - - // Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. (default: 128) - MaxOldSpaceSize *int64 `json:"max-old-space-size,omitempty"` - - // Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch (default: 30000) - OpensearchRequestTimeout *int64 `json:"opensearch-request-timeout,omitempty"` - } `json:"opensearch-dashboards,omitempty"` - - // OpenSearch-specific settings - OpensearchSettings *map[string]interface{} `json:"opensearch-settings,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Name of a backup to recover from for services that support backup names - RecoveryBackupName *string `json:"recovery-backup-name,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // OpenSearch major version - Version *string `json:"version,omitempty"` -} - -// CreateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm defines parameters for CreateDbaasServiceOpensearch. -type CreateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm string - -// CreateDbaasServiceOpensearchJSONBodyMaintenanceDow defines parameters for CreateDbaasServiceOpensearch. -type CreateDbaasServiceOpensearchJSONBodyMaintenanceDow string - -// UpdateDbaasServiceOpensearchJSONBody defines parameters for UpdateDbaasServiceOpensearch. -type UpdateDbaasServiceOpensearchJSONBody struct { - // Allows you to create glob style patterns and set a max number of indexes matching this pattern you want to keep. Creating indexes exceeding this value will cause the oldest one to get deleted. You could for example create a pattern looking like 'logs.?' and then create index logs.1, logs.2 etc, it will delete logs.1 once you create logs.6. Do note 'logs.?' does not apply to logs.10. Note: Setting max_index_count to 0 will do nothing and the pattern gets ignored. - IndexPatterns *[]struct { - // Maximum number of indexes to keep - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - - // fnmatch pattern - Pattern *string `json:"pattern,omitempty"` - - // Deletion sorting algorithm - SortingAlgorithm *UpdateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm `json:"sorting-algorithm,omitempty"` - } `json:"index-patterns,omitempty"` - - // Template settings for all new indexes - IndexTemplate *struct { - // The maximum number of nested JSON objects that a single document can contain across all nested types. This limit helps to prevent out of memory errors when a document contains too many nested objects. Default is 10000. - MappingNestedObjectsLimit *int64 `json:"mapping-nested-objects-limit,omitempty"` - - // The number of replicas each primary shard has. - NumberOfReplicas *int64 `json:"number-of-replicas,omitempty"` - - // The number of primary shards that an index should have. - NumberOfShards *int64 `json:"number-of-shards,omitempty"` - } `json:"index-template,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Aiven automation resets index.refresh_interval to default value for every index to be sure that indices are always visible to search. If it doesn't fit your case, you can disable this by setting up this flag to true. - KeepIndexRefreshInterval *bool `json:"keep-index-refresh-interval,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServiceOpensearchJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Maximum number of indexes to keep before deleting the oldest one - MaxIndexCount *int64 `json:"max-index-count,omitempty"` - - // OpenSearch Dashboards settings - OpensearchDashboards *struct { - // Enable or disable OpenSearch Dashboards (default: true) - Enabled *bool `json:"enabled,omitempty"` - - // Limits the maximum amount of memory (in MiB) the OpenSearch Dashboards process can use. This sets the max_old_space_size option of the nodejs running the OpenSearch Dashboards. Note: the memory reserved by OpenSearch Dashboards is not available for OpenSearch. (default: 128) - MaxOldSpaceSize *int64 `json:"max-old-space-size,omitempty"` - - // Timeout in milliseconds for requests made by OpenSearch Dashboards towards OpenSearch (default: 30000) - OpensearchRequestTimeout *int64 `json:"opensearch-request-timeout,omitempty"` - } `json:"opensearch-dashboards,omitempty"` - - // OpenSearch-specific settings - OpensearchSettings *map[string]interface{} `json:"opensearch-settings,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // Version - Version *string `json:"version,omitempty"` -} - -// UpdateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm defines parameters for UpdateDbaasServiceOpensearch. -type UpdateDbaasServiceOpensearchJSONBodyIndexPatternsSortingAlgorithm string - -// UpdateDbaasServiceOpensearchJSONBodyMaintenanceDow defines parameters for UpdateDbaasServiceOpensearch. -type UpdateDbaasServiceOpensearchJSONBodyMaintenanceDow string - -// UpdateDbaasOpensearchAclConfigJSONBody defines parameters for UpdateDbaasOpensearchAclConfig. -type UpdateDbaasOpensearchAclConfigJSONBody DbaasOpensearchAclConfig - -// CreateDbaasOpensearchUserJSONBody defines parameters for CreateDbaasOpensearchUser. -type CreateDbaasOpensearchUserJSONBody struct { - Username DbaasUserUsername `json:"username"` -} - -// ResetDbaasOpensearchUserPasswordJSONBody defines parameters for ResetDbaasOpensearchUserPassword. -type ResetDbaasOpensearchUserPasswordJSONBody struct { - Password *DbaasUserPassword `json:"password,omitempty"` -} - -// CreateDbaasServicePgJSONBody defines parameters for CreateDbaasServicePg. -type CreateDbaasServicePgJSONBody struct { - // Custom password for admin user. Defaults to random string. This must be set only when a new service is being created. - AdminPassword *string `json:"admin-password,omitempty"` - - // Custom username for admin user. This must be set only when a new service is being created. - AdminUsername *string `json:"admin-username,omitempty"` - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - ForkFromService *DbaasServiceName `json:"fork-from-service,omitempty"` - - // Service integrations to be enabled when creating the service. - Integrations *[]struct { - DestService *DbaasServiceName `json:"dest-service,omitempty"` - - // Integration settings - Settings *map[string]interface{} `json:"settings,omitempty"` - SourceService *DbaasServiceName `json:"source-service,omitempty"` - - // Integration type - Type CreateDbaasServicePgJSONBodyIntegrationsType `json:"type"` - } `json:"integrations,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServicePgJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // PostgreSQL-specific settings - PgSettings *map[string]interface{} `json:"pg-settings,omitempty"` - - // PGBouncer connection pooling settings - PgbouncerSettings *map[string]interface{} `json:"pgbouncer-settings,omitempty"` - - // PGLookout settings - PglookoutSettings *map[string]interface{} `json:"pglookout-settings,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // ISO time of a backup to recover from for services that support arbitrary times - RecoveryBackupTime *string `json:"recovery-backup-time,omitempty"` - - // Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value. - SharedBuffersPercentage *int64 `json:"shared-buffers-percentage,omitempty"` - SynchronousReplication *EnumPgSynchronousReplication `json:"synchronous-replication,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // TimescaleDB extension configuration values - TimescaledbSettings *map[string]interface{} `json:"timescaledb-settings,omitempty"` - Variant *EnumPgVariant `json:"variant,omitempty"` - - // PostgreSQL major version - Version *string `json:"version,omitempty"` - - // Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB). - WorkMem *int64 `json:"work-mem,omitempty"` -} - -// CreateDbaasServicePgJSONBodyIntegrationsType defines parameters for CreateDbaasServicePg. -type CreateDbaasServicePgJSONBodyIntegrationsType string - -// CreateDbaasServicePgJSONBodyMaintenanceDow defines parameters for CreateDbaasServicePg. -type CreateDbaasServicePgJSONBodyMaintenanceDow string - -// UpdateDbaasServicePgJSONBody defines parameters for UpdateDbaasServicePg. -type UpdateDbaasServicePgJSONBody struct { - BackupSchedule *struct { - // The hour of day (in UTC) when backup for the service is started. New backup is only started if previous backup has already completed. - BackupHour *int64 `json:"backup-hour,omitempty"` - - // The minute of an hour when backup for the service is started. New backup is only started if previous backup has already completed. - BackupMinute *int64 `json:"backup-minute,omitempty"` - } `json:"backup-schedule,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServicePgJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // PostgreSQL-specific settings - PgSettings *map[string]interface{} `json:"pg-settings,omitempty"` - - // PGBouncer connection pooling settings - PgbouncerSettings *map[string]interface{} `json:"pgbouncer-settings,omitempty"` - - // PGLookout settings - PglookoutSettings *map[string]interface{} `json:"pglookout-settings,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Percentage of total RAM that the database server uses for shared memory buffers. Valid range is 20-60 (float), which corresponds to 20% - 60%. This setting adjusts the shared_buffers configuration value. - SharedBuffersPercentage *int64 `json:"shared-buffers-percentage,omitempty"` - SynchronousReplication *EnumPgSynchronousReplication `json:"synchronous-replication,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` - - // TimescaleDB extension configuration values - TimescaledbSettings *map[string]interface{} `json:"timescaledb-settings,omitempty"` - Variant *EnumPgVariant `json:"variant,omitempty"` - - // Version - Version *string `json:"version,omitempty"` - - // Sets the maximum amount of memory to be used by a query operation (such as a sort or hash table) before writing to temporary disk files, in MB. Default is 1MB + 0.075% of total RAM (up to 32MB). - WorkMem *int64 `json:"work-mem,omitempty"` -} - -// UpdateDbaasServicePgJSONBodyMaintenanceDow defines parameters for UpdateDbaasServicePg. -type UpdateDbaasServicePgJSONBodyMaintenanceDow string - -// CreateDbaasPgConnectionPoolJSONBody defines parameters for CreateDbaasPgConnectionPool. -type CreateDbaasPgConnectionPoolJSONBody struct { - DatabaseName DbaasDatabaseName `json:"database-name"` - Mode *EnumPgPoolMode `json:"mode,omitempty"` - Name DbaasPgPoolName `json:"name"` - Size *DbaasPgPoolSize `json:"size,omitempty"` - Username *DbaasPgPoolUsername `json:"username,omitempty"` -} - -// UpdateDbaasPgConnectionPoolJSONBody defines parameters for UpdateDbaasPgConnectionPool. -type UpdateDbaasPgConnectionPoolJSONBody struct { - DatabaseName *DbaasDatabaseName `json:"database-name,omitempty"` - Mode *EnumPgPoolMode `json:"mode,omitempty"` - Size *DbaasPgPoolSize `json:"size,omitempty"` - Username *DbaasPgPoolUsername `json:"username,omitempty"` -} - -// CreateDbaasPgDatabaseJSONBody defines parameters for CreateDbaasPgDatabase. -type CreateDbaasPgDatabaseJSONBody struct { - DatabaseName DbaasDatabaseName `json:"database-name"` - - // Default string sort order (LC_COLLATE) for PostgreSQL database - LcCollate *string `json:"lc-collate,omitempty"` - - // Default character classification (LC_CTYPE) for PostgreSQL database - LcCtype *string `json:"lc-ctype,omitempty"` -} - -// CreateDbaasPostgresUserJSONBody defines parameters for CreateDbaasPostgresUser. -type CreateDbaasPostgresUserJSONBody struct { - AllowReplication *bool `json:"allow-replication,omitempty"` - Username DbaasUserUsername `json:"username"` -} - -// UpdateDbaasPostgresAllowReplicationJSONBody defines parameters for UpdateDbaasPostgresAllowReplication. -type UpdateDbaasPostgresAllowReplicationJSONBody struct { - AllowReplication *bool `json:"allow-replication,omitempty"` -} - -// ResetDbaasPostgresUserPasswordJSONBody defines parameters for ResetDbaasPostgresUserPassword. -type ResetDbaasPostgresUserPasswordJSONBody struct { - Password *DbaasUserPassword `json:"password,omitempty"` -} - -// CreateDbaasPgUpgradeCheckJSONBody defines parameters for CreateDbaasPgUpgradeCheck. -type CreateDbaasPgUpgradeCheckJSONBody struct { - // Target version for upgrade - TargetVersion CreateDbaasPgUpgradeCheckJSONBodyTargetVersion `json:"target-version"` -} - -// CreateDbaasPgUpgradeCheckJSONBodyTargetVersion defines parameters for CreateDbaasPgUpgradeCheck. -type CreateDbaasPgUpgradeCheckJSONBodyTargetVersion string - -// CreateDbaasServiceRedisJSONBody defines parameters for CreateDbaasServiceRedis. -type CreateDbaasServiceRedisJSONBody struct { - ForkFromService *DbaasServiceName `json:"fork-from-service,omitempty"` - - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow CreateDbaasServiceRedisJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // Subscription plan - Plan string `json:"plan"` - - // Name of a backup to recover from for services that support backup names - RecoveryBackupName *string `json:"recovery-backup-name,omitempty"` - - // Redis.conf settings - RedisSettings *map[string]interface{} `json:"redis-settings,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// CreateDbaasServiceRedisJSONBodyMaintenanceDow defines parameters for CreateDbaasServiceRedis. -type CreateDbaasServiceRedisJSONBodyMaintenanceDow string - -// UpdateDbaasServiceRedisJSONBody defines parameters for UpdateDbaasServiceRedis. -type UpdateDbaasServiceRedisJSONBody struct { - // Allow incoming connections from CIDR address block, e.g. '10.20.0.0/16' - IpFilter *[]string `json:"ip-filter,omitempty"` - - // Automatic maintenance settings - Maintenance *struct { - // Day of week for installing updates - Dow UpdateDbaasServiceRedisJSONBodyMaintenanceDow `json:"dow"` - - // Time for installing updates, UTC - Time string `json:"time"` - } `json:"maintenance,omitempty"` - - // Migrate data from existing server - Migration *struct { - // Database name for bootstrapping the initial connection - Dbname *string `json:"dbname,omitempty"` - - // Hostname or IP address of the server where to migrate data from - Host string `json:"host"` - - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Password for authentication with the server where to migrate data from - Password *string `json:"password,omitempty"` - - // Port number of the server where to migrate data from - Port int64 `json:"port"` - - // The server where to migrate data from is secured with SSL - Ssl *bool `json:"ssl,omitempty"` - - // User name for authentication with the server where to migrate data from - Username *string `json:"username,omitempty"` - } `json:"migration,omitempty"` - - // Subscription plan - Plan *string `json:"plan,omitempty"` - - // Redis.conf settings - RedisSettings *map[string]interface{} `json:"redis-settings,omitempty"` - - // Service is protected against termination and powering off - TerminationProtection *bool `json:"termination-protection,omitempty"` -} - -// UpdateDbaasServiceRedisJSONBodyMaintenanceDow defines parameters for UpdateDbaasServiceRedis. -type UpdateDbaasServiceRedisJSONBodyMaintenanceDow string - -// GetDbaasServiceLogsJSONBody defines parameters for GetDbaasServiceLogs. -type GetDbaasServiceLogsJSONBody struct { - // How many log entries to receive at most, up to 500 (default: 100) - Limit *int64 `json:"limit,omitempty"` - - // Opaque offset identifier - Offset *string `json:"offset,omitempty"` - SortOrder *EnumSortOrder `json:"sort-order,omitempty"` -} - -// GetDbaasServiceMetricsJSONBody defines parameters for GetDbaasServiceMetrics. -type GetDbaasServiceMetricsJSONBody struct { - // Metrics time period (default: hour) - Period *GetDbaasServiceMetricsJSONBodyPeriod `json:"period,omitempty"` -} - -// GetDbaasServiceMetricsJSONBodyPeriod defines parameters for GetDbaasServiceMetrics. -type GetDbaasServiceMetricsJSONBodyPeriod string - -// CreateDbaasTaskMigrationCheckJSONBody defines parameters for CreateDbaasTaskMigrationCheck. -type CreateDbaasTaskMigrationCheckJSONBody struct { - // Comma-separated list of databases, which should be ignored during migration (supported by MySQL only at the moment) - IgnoreDbs *string `json:"ignore-dbs,omitempty"` - Method *EnumMigrationMethod `json:"method,omitempty"` - - // Service URI of the source MySQL or PostgreSQL database with admin credentials. - SourceServiceUri string `json:"source-service-uri"` -} - -// CreateDnsDomainJSONBody defines parameters for CreateDnsDomain. -type CreateDnsDomainJSONBody struct { - // Domain name - UnicodeName *string `json:"unicode-name,omitempty"` -} - -// CreateDnsDomainRecordJSONBody defines parameters for CreateDnsDomainRecord. -type CreateDnsDomainRecordJSONBody struct { - // DNS domain record content - Content string `json:"content"` - - // DNS domain record name - Name string `json:"name"` - - // DNS domain record priority - Priority *int64 `json:"priority,omitempty"` - - // DNS domain record TTL - Ttl *int64 `json:"ttl,omitempty"` - - // DNS domain record type - Type CreateDnsDomainRecordJSONBodyType `json:"type"` -} - -// CreateDnsDomainRecordJSONBodyType defines parameters for CreateDnsDomainRecord. -type CreateDnsDomainRecordJSONBodyType string - -// UpdateDnsDomainRecordJSONBody defines parameters for UpdateDnsDomainRecord. -type UpdateDnsDomainRecordJSONBody struct { - // DNS domain record content - Content *string `json:"content,omitempty"` - - // DNS domain record name - Name *string `json:"name,omitempty"` - - // DNS domain record priority - Priority *int64 `json:"priority,omitempty"` - - // DNS domain record TTL - Ttl *int64 `json:"ttl,omitempty"` -} - -// CreateElasticIpJSONBody defines parameters for CreateElasticIp. -type CreateElasticIpJSONBody struct { - // Elastic IP address family (default: :inet4) - Addressfamily *CreateElasticIpJSONBodyAddressfamily `json:"addressfamily,omitempty"` - - // Elastic IP description - Description *string `json:"description,omitempty"` - - // Elastic IP address healthcheck - Healthcheck *ElasticIpHealthcheck `json:"healthcheck,omitempty"` - Labels *Labels `json:"labels,omitempty"` -} - -// CreateElasticIpJSONBodyAddressfamily defines parameters for CreateElasticIp. -type CreateElasticIpJSONBodyAddressfamily string - -// UpdateElasticIpJSONBody defines parameters for UpdateElasticIp. -type UpdateElasticIpJSONBody struct { - // Elastic IP description - Description *string `json:"description,omitempty"` - - // Elastic IP address healthcheck - Healthcheck *ElasticIpHealthcheck `json:"healthcheck,omitempty"` - Labels *Labels `json:"labels,omitempty"` -} - -// ResetElasticIpFieldParamsField defines parameters for ResetElasticIpField. -type ResetElasticIpFieldParamsField string - -// AttachInstanceToElasticIpJSONBody defines parameters for AttachInstanceToElasticIp. -type AttachInstanceToElasticIpJSONBody struct { - // Target Instance - Instance InstanceTarget `json:"instance"` -} - -// DetachInstanceFromElasticIpJSONBody defines parameters for DetachInstanceFromElasticIp. -type DetachInstanceFromElasticIpJSONBody struct { - // Target Instance - Instance InstanceTarget `json:"instance"` -} - -// ListEventsParams defines parameters for ListEvents. -type ListEventsParams struct { - From *time.Time `json:"from,omitempty"` - To *time.Time `json:"to,omitempty"` -} - -// UpdateIamOrganizationPolicyJSONBody defines parameters for UpdateIamOrganizationPolicy. -type UpdateIamOrganizationPolicyJSONBody IamPolicy - -// CreateIamRoleJSONBody defines parameters for CreateIamRole. -type CreateIamRoleJSONBody struct { - // IAM Role description - Description *string `json:"description,omitempty"` - - // Sets if the IAM Role Policy is editable or not (default: true). This setting cannot be changed after creation - Editable *bool `json:"editable,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // IAM Role name - Name string `json:"name"` - - // IAM Role permissions - Permissions *[]CreateIamRoleJSONBodyPermissions `json:"permissions,omitempty"` - - // Policy - Policy *IamPolicy `json:"policy,omitempty"` -} - -// CreateIamRoleJSONBodyPermissions defines parameters for CreateIamRole. -type CreateIamRoleJSONBodyPermissions string - -// UpdateIamRoleJSONBody defines parameters for UpdateIamRole. -type UpdateIamRoleJSONBody struct { - // IAM Role description - Description *string `json:"description,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // IAM Role permissions - Permissions *[]UpdateIamRoleJSONBodyPermissions `json:"permissions,omitempty"` -} - -// UpdateIamRoleJSONBodyPermissions defines parameters for UpdateIamRole. -type UpdateIamRoleJSONBodyPermissions string - -// UpdateIamRolePolicyJSONBody defines parameters for UpdateIamRolePolicy. -type UpdateIamRolePolicyJSONBody IamPolicy - -// ListInstancesParams defines parameters for ListInstances. -type ListInstancesParams struct { - ManagerId *string `json:"manager-id,omitempty"` - ManagerType *ListInstancesParamsManagerType `json:"manager-type,omitempty"` - IpAddress *string `json:"ip-address,omitempty"` -} - -// ListInstancesParamsManagerType defines parameters for ListInstances. -type ListInstancesParamsManagerType string - -// CreateInstanceJSONBody defines parameters for CreateInstance. -type CreateInstanceJSONBody struct { - // Instance Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Start Instance on creation (default: true) - AutoStart *bool `json:"auto-start,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Instance disk size in GB - DiskSize int64 `json:"disk-size"` - - // Compute instance type - InstanceType InstanceType `json:"instance-type"` - - // Enable IPv6. DEPRECATED: use `public-ip-assignments`. - Ipv6Enabled *bool `json:"ipv6-enabled,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Instance name - Name *string `json:"name,omitempty"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // SSH key - SshKey *SshKey `json:"ssh-key,omitempty"` - - // Instance SSH Keys - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - - // Instance template - Template Template `json:"template"` - - // Instance Cloud-init user-data - UserData *string `json:"user-data,omitempty"` -} - -// CreateInstancePoolJSONBody defines parameters for CreateInstancePool. -type CreateInstancePoolJSONBody struct { - // Instance Pool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Instance Pool description - Description *string `json:"description,omitempty"` - - // Instances disk size in GB - DiskSize int64 `json:"disk-size"` - - // Instances Elastic IPs - ElasticIps *[]ElasticIp `json:"elastic-ips,omitempty"` - - // Prefix to apply to Instances names (default: pool) - InstancePrefix *string `json:"instance-prefix,omitempty"` - - // Compute instance type - InstanceType InstanceType `json:"instance-type"` - - // Enable IPv6. DEPRECATED: use `public-ip-assignments`. - Ipv6Enabled *bool `json:"ipv6-enabled,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Minimum number of running Instances - MinAvailable *int64 `json:"min-available,omitempty"` - - // Instance Pool name - Name string `json:"name"` - - // Instance Pool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Pool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // Number of Instances - Size int64 `json:"size"` - - // SSH key - SshKey *SshKey `json:"ssh-key,omitempty"` - - // Instances SSH Keys - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - - // Instance template - Template Template `json:"template"` - - // Instances Cloud-init user-data - UserData *string `json:"user-data,omitempty"` -} - -// UpdateInstancePoolJSONBody defines parameters for UpdateInstancePool. -type UpdateInstancePoolJSONBody struct { - // Instance Pool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Instance Pool description - Description *string `json:"description,omitempty"` - - // Instances disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Instances Elastic IPs - ElasticIps *[]ElasticIp `json:"elastic-ips"` - - // Prefix to apply to Instances names (default: pool) - InstancePrefix *string `json:"instance-prefix"` - - // Compute instance type - InstanceType *InstanceType `json:"instance-type,omitempty"` - - // Enable IPv6. DEPRECATED: use `public-ip-assignments`. - Ipv6Enabled *bool `json:"ipv6-enabled,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Minimum number of running Instances - MinAvailable *int64 `json:"min-available"` - - // Instance Pool name - Name *string `json:"name,omitempty"` - - // Instance Pool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Pool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups"` - - // SSH key - SshKey *SshKey `json:"ssh-key,omitempty"` - - // Instances SSH keys - SshKeys *[]SshKey `json:"ssh-keys"` - - // Instance template - Template *Template `json:"template,omitempty"` - - // Instances Cloud-init user-data - UserData *string `json:"user-data"` -} - -// ResetInstancePoolFieldParamsField defines parameters for ResetInstancePoolField. -type ResetInstancePoolFieldParamsField string - -// EvictInstancePoolMembersJSONBody defines parameters for EvictInstancePoolMembers. -type EvictInstancePoolMembersJSONBody struct { - Instances *[]string `json:"instances,omitempty"` -} - -// ScaleInstancePoolJSONBody defines parameters for ScaleInstancePool. -type ScaleInstancePoolJSONBody struct { - // Number of managed Instances - Size int64 `json:"size"` -} - -// UpdateInstanceJSONBody defines parameters for UpdateInstance. -type UpdateInstanceJSONBody struct { - Labels *Labels `json:"labels,omitempty"` - - // Instance name - Name *string `json:"name,omitempty"` - PublicIpAssignment *PublicIpAssignment `json:"public-ip-assignment,omitempty"` - - // Instance Cloud-init user-data - UserData *string `json:"user-data,omitempty"` -} - -// ResetInstanceFieldParamsField defines parameters for ResetInstanceField. -type ResetInstanceFieldParamsField string - -// ResetInstanceJSONBody defines parameters for ResetInstance. -type ResetInstanceJSONBody struct { - // Instance disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Instance template - Template *Template `json:"template,omitempty"` -} - -// ResizeInstanceDiskJSONBody defines parameters for ResizeInstanceDisk. -type ResizeInstanceDiskJSONBody struct { - // Instance disk size in GB - DiskSize int64 `json:"disk-size"` -} - -// ScaleInstanceJSONBody defines parameters for ScaleInstance. -type ScaleInstanceJSONBody struct { - // Compute instance type - InstanceType InstanceType `json:"instance-type"` -} - -// StartInstanceJSONBody defines parameters for StartInstance. -type StartInstanceJSONBody struct { - // Boot in Rescue Mode, using named profile (supported: netboot, netboot-efi) - RescueProfile *StartInstanceJSONBodyRescueProfile `json:"rescue-profile,omitempty"` -} - -// StartInstanceJSONBodyRescueProfile defines parameters for StartInstance. -type StartInstanceJSONBodyRescueProfile string - -// RevertInstanceToSnapshotJSONBody defines parameters for RevertInstanceToSnapshot. -type RevertInstanceToSnapshotJSONBody struct { - // Snapshot ID - Id string `json:"id"` -} - -// CreateLoadBalancerJSONBody defines parameters for CreateLoadBalancer. -type CreateLoadBalancerJSONBody struct { - // Load Balancer description - Description *string `json:"description,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Load Balancer name - Name string `json:"name"` -} - -// UpdateLoadBalancerJSONBody defines parameters for UpdateLoadBalancer. -type UpdateLoadBalancerJSONBody struct { - // Load Balancer description - Description *string `json:"description,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Load Balancer name - Name *string `json:"name,omitempty"` -} - -// AddServiceToLoadBalancerJSONBody defines parameters for AddServiceToLoadBalancer. -type AddServiceToLoadBalancerJSONBody struct { - // Load Balancer Service description - Description *string `json:"description,omitempty"` - - // Load Balancer Service healthcheck - Healthcheck LoadBalancerServiceHealthcheck `json:"healthcheck"` - - // Instance Pool - InstancePool InstancePool `json:"instance-pool"` - - // Load Balancer Service name - Name string `json:"name"` - - // Port exposed on the Load Balancer's public IP - Port int64 `json:"port"` - - // Network traffic protocol - Protocol AddServiceToLoadBalancerJSONBodyProtocol `json:"protocol"` - - // Load balancing strategy - Strategy AddServiceToLoadBalancerJSONBodyStrategy `json:"strategy"` - - // Port on which the network traffic will be forwarded to on the receiving instance - TargetPort int64 `json:"target-port"` -} - -// AddServiceToLoadBalancerJSONBodyProtocol defines parameters for AddServiceToLoadBalancer. -type AddServiceToLoadBalancerJSONBodyProtocol string - -// AddServiceToLoadBalancerJSONBodyStrategy defines parameters for AddServiceToLoadBalancer. -type AddServiceToLoadBalancerJSONBodyStrategy string - -// UpdateLoadBalancerServiceJSONBody defines parameters for UpdateLoadBalancerService. -type UpdateLoadBalancerServiceJSONBody struct { - // Load Balancer Service description - Description *string `json:"description,omitempty"` - - // Load Balancer Service healthcheck - Healthcheck *LoadBalancerServiceHealthcheck `json:"healthcheck,omitempty"` - - // Load Balancer Service name - Name *string `json:"name,omitempty"` - - // Port exposed on the Load Balancer's public IP - Port *int64 `json:"port,omitempty"` - - // Network traffic protocol - Protocol *UpdateLoadBalancerServiceJSONBodyProtocol `json:"protocol,omitempty"` - - // Load balancing strategy - Strategy *UpdateLoadBalancerServiceJSONBodyStrategy `json:"strategy,omitempty"` - - // Port on which the network traffic will be forwarded to on the receiving instance - TargetPort *int64 `json:"target-port,omitempty"` -} - -// UpdateLoadBalancerServiceJSONBodyProtocol defines parameters for UpdateLoadBalancerService. -type UpdateLoadBalancerServiceJSONBodyProtocol string - -// UpdateLoadBalancerServiceJSONBodyStrategy defines parameters for UpdateLoadBalancerService. -type UpdateLoadBalancerServiceJSONBodyStrategy string - -// ResetLoadBalancerServiceFieldParamsField defines parameters for ResetLoadBalancerServiceField. -type ResetLoadBalancerServiceFieldParamsField string - -// ResetLoadBalancerFieldParamsField defines parameters for ResetLoadBalancerField. -type ResetLoadBalancerFieldParamsField string - -// CreatePrivateNetworkJSONBody defines parameters for CreatePrivateNetwork. -type CreatePrivateNetworkJSONBody struct { - // Private Network description - Description *string `json:"description,omitempty"` - - // Private Network end IP address - EndIp *string `json:"end-ip,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Private Network name - Name string `json:"name"` - - // Private Network netmask - Netmask *string `json:"netmask,omitempty"` - - // Private Network start IP address - StartIp *string `json:"start-ip,omitempty"` -} - -// UpdatePrivateNetworkJSONBody defines parameters for UpdatePrivateNetwork. -type UpdatePrivateNetworkJSONBody struct { - // Private Network description - Description *string `json:"description,omitempty"` - - // Private Network end IP address - EndIp *string `json:"end-ip,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Private Network name - Name *string `json:"name,omitempty"` - - // Private Network netmask - Netmask *string `json:"netmask,omitempty"` - - // Private Network start IP address - StartIp *string `json:"start-ip,omitempty"` -} - -// ResetPrivateNetworkFieldParamsField defines parameters for ResetPrivateNetworkField. -type ResetPrivateNetworkFieldParamsField string - -// AttachInstanceToPrivateNetworkJSONBody defines parameters for AttachInstanceToPrivateNetwork. -type AttachInstanceToPrivateNetworkJSONBody struct { - // Compute instance - Instance struct { - // Instance ID - Id *string `json:"id,omitempty"` - } `json:"instance"` - - // Static IP address lease for the corresponding network interface - Ip *string `json:"ip,omitempty"` -} - -// DetachInstanceFromPrivateNetworkJSONBody defines parameters for DetachInstanceFromPrivateNetwork. -type DetachInstanceFromPrivateNetworkJSONBody struct { - // Instance - Instance Instance `json:"instance"` -} - -// UpdatePrivateNetworkInstanceIpJSONBody defines parameters for UpdatePrivateNetworkInstanceIp. -type UpdatePrivateNetworkInstanceIpJSONBody struct { - // Instance - Instance Instance `json:"instance"` - - // Static IP address lease for the corresponding network interface - Ip *string `json:"ip,omitempty"` -} - -// UpdateReverseDnsElasticIpJSONBody defines parameters for UpdateReverseDnsElasticIp. -type UpdateReverseDnsElasticIpJSONBody struct { - DomainName *string `json:"domain-name,omitempty"` -} - -// UpdateReverseDnsInstanceJSONBody defines parameters for UpdateReverseDnsInstance. -type UpdateReverseDnsInstanceJSONBody struct { - DomainName *string `json:"domain-name,omitempty"` -} - -// ListSecurityGroupsParams defines parameters for ListSecurityGroups. -type ListSecurityGroupsParams struct { - Visibility *ListSecurityGroupsParamsVisibility `json:"visibility,omitempty"` -} - -// ListSecurityGroupsParamsVisibility defines parameters for ListSecurityGroups. -type ListSecurityGroupsParamsVisibility string - -// CreateSecurityGroupJSONBody defines parameters for CreateSecurityGroup. -type CreateSecurityGroupJSONBody struct { - // Security Group description - Description *string `json:"description,omitempty"` - - // Security Group name - Name string `json:"name"` -} - -// AddRuleToSecurityGroupJSONBody defines parameters for AddRuleToSecurityGroup. -type AddRuleToSecurityGroupJSONBody struct { - // Security Group rule description - Description *string `json:"description,omitempty"` - - // End port of the range - EndPort *int64 `json:"end-port,omitempty"` - - // Network flow direction to match - FlowDirection AddRuleToSecurityGroupJSONBodyFlowDirection `json:"flow-direction"` - - // ICMP details (default: -1 (ANY)) - Icmp *struct { - Code *int64 `json:"code,omitempty"` - Type *int64 `json:"type,omitempty"` - } `json:"icmp,omitempty"` - - // CIDR-formatted network allowed - Network *string `json:"network,omitempty"` - - // Network protocol - Protocol AddRuleToSecurityGroupJSONBodyProtocol `json:"protocol"` - - // Security Group - SecurityGroup *SecurityGroupResource `json:"security-group,omitempty"` - - // Start port of the range - StartPort *int64 `json:"start-port,omitempty"` -} - -// AddRuleToSecurityGroupJSONBodyFlowDirection defines parameters for AddRuleToSecurityGroup. -type AddRuleToSecurityGroupJSONBodyFlowDirection string - -// AddRuleToSecurityGroupJSONBodyProtocol defines parameters for AddRuleToSecurityGroup. -type AddRuleToSecurityGroupJSONBodyProtocol string - -// AddExternalSourceToSecurityGroupJSONBody defines parameters for AddExternalSourceToSecurityGroup. -type AddExternalSourceToSecurityGroupJSONBody struct { - // CIDR-formatted network to add - Cidr string `json:"cidr"` -} - -// AttachInstanceToSecurityGroupJSONBody defines parameters for AttachInstanceToSecurityGroup. -type AttachInstanceToSecurityGroupJSONBody struct { - // Instance - Instance Instance `json:"instance"` -} - -// DetachInstanceFromSecurityGroupJSONBody defines parameters for DetachInstanceFromSecurityGroup. -type DetachInstanceFromSecurityGroupJSONBody struct { - // Instance - Instance Instance `json:"instance"` -} - -// RemoveExternalSourceFromSecurityGroupJSONBody defines parameters for RemoveExternalSourceFromSecurityGroup. -type RemoveExternalSourceFromSecurityGroupJSONBody struct { - // CIDR-formatted network to remove - Cidr string `json:"cidr"` -} - -// CreateSksClusterJSONBody defines parameters for CreateSksCluster. -type CreateSksClusterJSONBody struct { - // Cluster addons - Addons *[]CreateSksClusterJSONBodyAddons `json:"addons,omitempty"` - - // Enable auto upgrade of the control plane to the latest patch version available - AutoUpgrade *bool `json:"auto-upgrade,omitempty"` - - // Cluster CNI - Cni *CreateSksClusterJSONBodyCni `json:"cni,omitempty"` - - // Cluster description - Description *string `json:"description,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Cluster service level - Level CreateSksClusterJSONBodyLevel `json:"level"` - - // Cluster name - Name string `json:"name"` - - // SKS Cluster OpenID config map - Oidc *SksOidc `json:"oidc,omitempty"` - - // Control plane Kubernetes version - Version string `json:"version"` -} - -// CreateSksClusterJSONBodyAddons defines parameters for CreateSksCluster. -type CreateSksClusterJSONBodyAddons string - -// CreateSksClusterJSONBodyCni defines parameters for CreateSksCluster. -type CreateSksClusterJSONBodyCni string - -// CreateSksClusterJSONBodyLevel defines parameters for CreateSksCluster. -type CreateSksClusterJSONBodyLevel string - -// GenerateSksClusterKubeconfigJSONBody defines parameters for GenerateSksClusterKubeconfig. -type GenerateSksClusterKubeconfigJSONBody SksKubeconfigRequest - -// ListSksClusterVersionsParams defines parameters for ListSksClusterVersions. -type ListSksClusterVersionsParams struct { - IncludeDeprecated *string `json:"include-deprecated,omitempty"` -} - -// UpdateSksClusterJSONBody defines parameters for UpdateSksCluster. -type UpdateSksClusterJSONBody struct { - // Cluster addons - Addons *[]UpdateSksClusterJSONBodyAddons `json:"addons,omitempty"` - - // Enable auto upgrade of the control plane to the latest patch version available - AutoUpgrade *bool `json:"auto-upgrade,omitempty"` - - // Cluster description - Description *string `json:"description,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Cluster name - Name *string `json:"name,omitempty"` - - // SKS Cluster OpenID config map - Oidc *SksOidc `json:"oidc,omitempty"` -} - -// UpdateSksClusterJSONBodyAddons defines parameters for UpdateSksCluster. -type UpdateSksClusterJSONBodyAddons string - -// GetSksClusterAuthorityCertParamsAuthority defines parameters for GetSksClusterAuthorityCert. -type GetSksClusterAuthorityCertParamsAuthority string - -// CreateSksNodepoolJSONBody defines parameters for CreateSksNodepool. -type CreateSksNodepoolJSONBody struct { - // Nodepool addons - Addons *[]CreateSksNodepoolJSONBodyAddons `json:"addons,omitempty"` - - // Nodepool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Nodepool description - Description *string `json:"description,omitempty"` - - // Nodepool instances disk size in GB - DiskSize int64 `json:"disk-size"` - - // Prefix to apply to instances names (default: pool) - InstancePrefix *string `json:"instance-prefix,omitempty"` - - // Compute instance type - InstanceType InstanceType `json:"instance-type"` - - // Kubelet image GC options - KubeletImageGc *KubeletImageGc `json:"kubelet-image-gc,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Nodepool name - Name string `json:"name"` - - // Nodepool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - - // Nodepool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - - // Number of instances - Size int64 `json:"size"` - Taints *SksNodepoolTaints `json:"taints,omitempty"` -} - -// CreateSksNodepoolJSONBodyAddons defines parameters for CreateSksNodepool. -type CreateSksNodepoolJSONBodyAddons string - -// UpdateSksNodepoolJSONBody defines parameters for UpdateSksNodepool. -type UpdateSksNodepoolJSONBody struct { - // Nodepool Anti-affinity Groups - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - - // Deploy target - DeployTarget *DeployTarget `json:"deploy-target,omitempty"` - - // Nodepool description - Description *string `json:"description,omitempty"` - - // Nodepool instances disk size in GB - DiskSize *int64 `json:"disk-size,omitempty"` - - // Prefix to apply to managed instances names (default: pool) - InstancePrefix *string `json:"instance-prefix,omitempty"` - - // Compute instance type - InstanceType *InstanceType `json:"instance-type,omitempty"` - Labels *Labels `json:"labels,omitempty"` - - // Nodepool name - Name *string `json:"name,omitempty"` - - // Nodepool Private Networks - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - - // Nodepool Security Groups - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - Taints *SksNodepoolTaints `json:"taints,omitempty"` -} - -// ResetSksNodepoolFieldParamsField defines parameters for ResetSksNodepoolField. -type ResetSksNodepoolFieldParamsField string - -// EvictSksNodepoolMembersJSONBody defines parameters for EvictSksNodepoolMembers. -type EvictSksNodepoolMembersJSONBody struct { - Instances *[]string `json:"instances,omitempty"` -} - -// ScaleSksNodepoolJSONBody defines parameters for ScaleSksNodepool. -type ScaleSksNodepoolJSONBody struct { - // Number of instances - Size int64 `json:"size"` -} - -// UpgradeSksClusterJSONBody defines parameters for UpgradeSksCluster. -type UpgradeSksClusterJSONBody struct { - // Control plane Kubernetes version - Version string `json:"version"` -} - -// ResetSksClusterFieldParamsField defines parameters for ResetSksClusterField. -type ResetSksClusterFieldParamsField string - -// PromoteSnapshotToTemplateJSONBody defines parameters for PromoteSnapshotToTemplate. -type PromoteSnapshotToTemplateJSONBody struct { - // Template default user - DefaultUser *string `json:"default-user,omitempty"` - - // Template description - Description *string `json:"description,omitempty"` - - // Template name - Name string `json:"name"` - - // Enable password-based login in the template - PasswordEnabled *bool `json:"password-enabled,omitempty"` - - // Enable SSH key-based login in the template - SshKeyEnabled *bool `json:"ssh-key-enabled,omitempty"` -} - -// GetSosPresignedUrlParams defines parameters for GetSosPresignedUrl. -type GetSosPresignedUrlParams struct { - Key *string `json:"key,omitempty"` -} - -// RegisterSshKeyJSONBody defines parameters for RegisterSshKey. -type RegisterSshKeyJSONBody struct { - // Private Network name - Name string `json:"name"` - - // Public key value - PublicKey string `json:"public-key"` -} - -// ListTemplatesParams defines parameters for ListTemplates. -type ListTemplatesParams struct { - Visibility *ListTemplatesParamsVisibility `json:"visibility,omitempty"` - Family *string `json:"family,omitempty"` -} - -// ListTemplatesParamsVisibility defines parameters for ListTemplates. -type ListTemplatesParamsVisibility string - -// RegisterTemplateJSONBody defines parameters for RegisterTemplate. -type RegisterTemplateJSONBody struct { - // Boot mode (default: legacy) - BootMode *RegisterTemplateJSONBodyBootMode `json:"boot-mode,omitempty"` - - // Template build - Build *string `json:"build,omitempty"` - - // Template MD5 checksum - Checksum string `json:"checksum"` - - // Template default user - DefaultUser *string `json:"default-user,omitempty"` - - // Template description - Description *string `json:"description,omitempty"` - - // Template maintainer - Maintainer *string `json:"maintainer,omitempty"` - - // Template name - Name string `json:"name"` - - // Enable password-based login - PasswordEnabled bool `json:"password-enabled"` - - // Template size - Size *int64 `json:"size,omitempty"` - - // Enable SSH key-based login - SshKeyEnabled bool `json:"ssh-key-enabled"` - - // Template source URL - Url string `json:"url"` - - // Template version - Version *string `json:"version,omitempty"` -} - -// RegisterTemplateJSONBodyBootMode defines parameters for RegisterTemplate. -type RegisterTemplateJSONBodyBootMode string - -// CopyTemplateJSONBody defines parameters for CopyTemplate. -type CopyTemplateJSONBody struct { - // Zone - TargetZone Zone `json:"target-zone"` -} - -// UpdateTemplateJSONBody defines parameters for UpdateTemplate. -type UpdateTemplateJSONBody struct { - // Template Description - Description *string `json:"description,omitempty"` - - // Template name - Name *string `json:"name,omitempty"` -} - -// CreateAccessKeyJSONRequestBody defines body for CreateAccessKey for application/json ContentType. -type CreateAccessKeyJSONRequestBody CreateAccessKeyJSONBody - -// CreateAntiAffinityGroupJSONRequestBody defines body for CreateAntiAffinityGroup for application/json ContentType. -type CreateAntiAffinityGroupJSONRequestBody CreateAntiAffinityGroupJSONBody - -// CreateApiKeyJSONRequestBody defines body for CreateApiKey for application/json ContentType. -type CreateApiKeyJSONRequestBody CreateApiKeyJSONBody - -// CreateDbaasServiceGrafanaJSONRequestBody defines body for CreateDbaasServiceGrafana for application/json ContentType. -type CreateDbaasServiceGrafanaJSONRequestBody CreateDbaasServiceGrafanaJSONBody - -// UpdateDbaasServiceGrafanaJSONRequestBody defines body for UpdateDbaasServiceGrafana for application/json ContentType. -type UpdateDbaasServiceGrafanaJSONRequestBody UpdateDbaasServiceGrafanaJSONBody - -// CreateDbaasIntegrationJSONRequestBody defines body for CreateDbaasIntegration for application/json ContentType. -type CreateDbaasIntegrationJSONRequestBody CreateDbaasIntegrationJSONBody - -// UpdateDbaasIntegrationJSONRequestBody defines body for UpdateDbaasIntegration for application/json ContentType. -type UpdateDbaasIntegrationJSONRequestBody UpdateDbaasIntegrationJSONBody - -// CreateDbaasServiceKafkaJSONRequestBody defines body for CreateDbaasServiceKafka for application/json ContentType. -type CreateDbaasServiceKafkaJSONRequestBody CreateDbaasServiceKafkaJSONBody - -// UpdateDbaasServiceKafkaJSONRequestBody defines body for UpdateDbaasServiceKafka for application/json ContentType. -type UpdateDbaasServiceKafkaJSONRequestBody UpdateDbaasServiceKafkaJSONBody - -// CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody defines body for CreateDbaasKafkaSchemaRegistryAclConfig for application/json ContentType. -type CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody CreateDbaasKafkaSchemaRegistryAclConfigJSONBody - -// CreateDbaasKafkaTopicAclConfigJSONRequestBody defines body for CreateDbaasKafkaTopicAclConfig for application/json ContentType. -type CreateDbaasKafkaTopicAclConfigJSONRequestBody CreateDbaasKafkaTopicAclConfigJSONBody - -// CreateDbaasKafkaUserJSONRequestBody defines body for CreateDbaasKafkaUser for application/json ContentType. -type CreateDbaasKafkaUserJSONRequestBody CreateDbaasKafkaUserJSONBody - -// ResetDbaasKafkaUserPasswordJSONRequestBody defines body for ResetDbaasKafkaUserPassword for application/json ContentType. -type ResetDbaasKafkaUserPasswordJSONRequestBody ResetDbaasKafkaUserPasswordJSONBody - -// CreateDbaasServiceMysqlJSONRequestBody defines body for CreateDbaasServiceMysql for application/json ContentType. -type CreateDbaasServiceMysqlJSONRequestBody CreateDbaasServiceMysqlJSONBody - -// UpdateDbaasServiceMysqlJSONRequestBody defines body for UpdateDbaasServiceMysql for application/json ContentType. -type UpdateDbaasServiceMysqlJSONRequestBody UpdateDbaasServiceMysqlJSONBody - -// CreateDbaasMysqlDatabaseJSONRequestBody defines body for CreateDbaasMysqlDatabase for application/json ContentType. -type CreateDbaasMysqlDatabaseJSONRequestBody CreateDbaasMysqlDatabaseJSONBody - -// CreateDbaasMysqlUserJSONRequestBody defines body for CreateDbaasMysqlUser for application/json ContentType. -type CreateDbaasMysqlUserJSONRequestBody CreateDbaasMysqlUserJSONBody - -// ResetDbaasMysqlUserPasswordJSONRequestBody defines body for ResetDbaasMysqlUserPassword for application/json ContentType. -type ResetDbaasMysqlUserPasswordJSONRequestBody ResetDbaasMysqlUserPasswordJSONBody - -// CreateDbaasServiceOpensearchJSONRequestBody defines body for CreateDbaasServiceOpensearch for application/json ContentType. -type CreateDbaasServiceOpensearchJSONRequestBody CreateDbaasServiceOpensearchJSONBody - -// UpdateDbaasServiceOpensearchJSONRequestBody defines body for UpdateDbaasServiceOpensearch for application/json ContentType. -type UpdateDbaasServiceOpensearchJSONRequestBody UpdateDbaasServiceOpensearchJSONBody - -// UpdateDbaasOpensearchAclConfigJSONRequestBody defines body for UpdateDbaasOpensearchAclConfig for application/json ContentType. -type UpdateDbaasOpensearchAclConfigJSONRequestBody UpdateDbaasOpensearchAclConfigJSONBody - -// CreateDbaasOpensearchUserJSONRequestBody defines body for CreateDbaasOpensearchUser for application/json ContentType. -type CreateDbaasOpensearchUserJSONRequestBody CreateDbaasOpensearchUserJSONBody - -// ResetDbaasOpensearchUserPasswordJSONRequestBody defines body for ResetDbaasOpensearchUserPassword for application/json ContentType. -type ResetDbaasOpensearchUserPasswordJSONRequestBody ResetDbaasOpensearchUserPasswordJSONBody - -// CreateDbaasServicePgJSONRequestBody defines body for CreateDbaasServicePg for application/json ContentType. -type CreateDbaasServicePgJSONRequestBody CreateDbaasServicePgJSONBody - -// UpdateDbaasServicePgJSONRequestBody defines body for UpdateDbaasServicePg for application/json ContentType. -type UpdateDbaasServicePgJSONRequestBody UpdateDbaasServicePgJSONBody - -// CreateDbaasPgConnectionPoolJSONRequestBody defines body for CreateDbaasPgConnectionPool for application/json ContentType. -type CreateDbaasPgConnectionPoolJSONRequestBody CreateDbaasPgConnectionPoolJSONBody - -// UpdateDbaasPgConnectionPoolJSONRequestBody defines body for UpdateDbaasPgConnectionPool for application/json ContentType. -type UpdateDbaasPgConnectionPoolJSONRequestBody UpdateDbaasPgConnectionPoolJSONBody - -// CreateDbaasPgDatabaseJSONRequestBody defines body for CreateDbaasPgDatabase for application/json ContentType. -type CreateDbaasPgDatabaseJSONRequestBody CreateDbaasPgDatabaseJSONBody - -// CreateDbaasPostgresUserJSONRequestBody defines body for CreateDbaasPostgresUser for application/json ContentType. -type CreateDbaasPostgresUserJSONRequestBody CreateDbaasPostgresUserJSONBody - -// UpdateDbaasPostgresAllowReplicationJSONRequestBody defines body for UpdateDbaasPostgresAllowReplication for application/json ContentType. -type UpdateDbaasPostgresAllowReplicationJSONRequestBody UpdateDbaasPostgresAllowReplicationJSONBody - -// ResetDbaasPostgresUserPasswordJSONRequestBody defines body for ResetDbaasPostgresUserPassword for application/json ContentType. -type ResetDbaasPostgresUserPasswordJSONRequestBody ResetDbaasPostgresUserPasswordJSONBody - -// CreateDbaasPgUpgradeCheckJSONRequestBody defines body for CreateDbaasPgUpgradeCheck for application/json ContentType. -type CreateDbaasPgUpgradeCheckJSONRequestBody CreateDbaasPgUpgradeCheckJSONBody - -// CreateDbaasServiceRedisJSONRequestBody defines body for CreateDbaasServiceRedis for application/json ContentType. -type CreateDbaasServiceRedisJSONRequestBody CreateDbaasServiceRedisJSONBody - -// UpdateDbaasServiceRedisJSONRequestBody defines body for UpdateDbaasServiceRedis for application/json ContentType. -type UpdateDbaasServiceRedisJSONRequestBody UpdateDbaasServiceRedisJSONBody - -// GetDbaasServiceLogsJSONRequestBody defines body for GetDbaasServiceLogs for application/json ContentType. -type GetDbaasServiceLogsJSONRequestBody GetDbaasServiceLogsJSONBody - -// GetDbaasServiceMetricsJSONRequestBody defines body for GetDbaasServiceMetrics for application/json ContentType. -type GetDbaasServiceMetricsJSONRequestBody GetDbaasServiceMetricsJSONBody - -// CreateDbaasTaskMigrationCheckJSONRequestBody defines body for CreateDbaasTaskMigrationCheck for application/json ContentType. -type CreateDbaasTaskMigrationCheckJSONRequestBody CreateDbaasTaskMigrationCheckJSONBody - -// CreateDnsDomainJSONRequestBody defines body for CreateDnsDomain for application/json ContentType. -type CreateDnsDomainJSONRequestBody CreateDnsDomainJSONBody - -// CreateDnsDomainRecordJSONRequestBody defines body for CreateDnsDomainRecord for application/json ContentType. -type CreateDnsDomainRecordJSONRequestBody CreateDnsDomainRecordJSONBody - -// UpdateDnsDomainRecordJSONRequestBody defines body for UpdateDnsDomainRecord for application/json ContentType. -type UpdateDnsDomainRecordJSONRequestBody UpdateDnsDomainRecordJSONBody - -// CreateElasticIpJSONRequestBody defines body for CreateElasticIp for application/json ContentType. -type CreateElasticIpJSONRequestBody CreateElasticIpJSONBody - -// UpdateElasticIpJSONRequestBody defines body for UpdateElasticIp for application/json ContentType. -type UpdateElasticIpJSONRequestBody UpdateElasticIpJSONBody - -// AttachInstanceToElasticIpJSONRequestBody defines body for AttachInstanceToElasticIp for application/json ContentType. -type AttachInstanceToElasticIpJSONRequestBody AttachInstanceToElasticIpJSONBody - -// DetachInstanceFromElasticIpJSONRequestBody defines body for DetachInstanceFromElasticIp for application/json ContentType. -type DetachInstanceFromElasticIpJSONRequestBody DetachInstanceFromElasticIpJSONBody - -// UpdateIamOrganizationPolicyJSONRequestBody defines body for UpdateIamOrganizationPolicy for application/json ContentType. -type UpdateIamOrganizationPolicyJSONRequestBody UpdateIamOrganizationPolicyJSONBody - -// CreateIamRoleJSONRequestBody defines body for CreateIamRole for application/json ContentType. -type CreateIamRoleJSONRequestBody CreateIamRoleJSONBody - -// UpdateIamRoleJSONRequestBody defines body for UpdateIamRole for application/json ContentType. -type UpdateIamRoleJSONRequestBody UpdateIamRoleJSONBody - -// UpdateIamRolePolicyJSONRequestBody defines body for UpdateIamRolePolicy for application/json ContentType. -type UpdateIamRolePolicyJSONRequestBody UpdateIamRolePolicyJSONBody - -// CreateInstanceJSONRequestBody defines body for CreateInstance for application/json ContentType. -type CreateInstanceJSONRequestBody CreateInstanceJSONBody - -// CreateInstancePoolJSONRequestBody defines body for CreateInstancePool for application/json ContentType. -type CreateInstancePoolJSONRequestBody CreateInstancePoolJSONBody - -// UpdateInstancePoolJSONRequestBody defines body for UpdateInstancePool for application/json ContentType. -type UpdateInstancePoolJSONRequestBody UpdateInstancePoolJSONBody - -// EvictInstancePoolMembersJSONRequestBody defines body for EvictInstancePoolMembers for application/json ContentType. -type EvictInstancePoolMembersJSONRequestBody EvictInstancePoolMembersJSONBody - -// ScaleInstancePoolJSONRequestBody defines body for ScaleInstancePool for application/json ContentType. -type ScaleInstancePoolJSONRequestBody ScaleInstancePoolJSONBody - -// UpdateInstanceJSONRequestBody defines body for UpdateInstance for application/json ContentType. -type UpdateInstanceJSONRequestBody UpdateInstanceJSONBody - -// ResetInstanceJSONRequestBody defines body for ResetInstance for application/json ContentType. -type ResetInstanceJSONRequestBody ResetInstanceJSONBody - -// ResizeInstanceDiskJSONRequestBody defines body for ResizeInstanceDisk for application/json ContentType. -type ResizeInstanceDiskJSONRequestBody ResizeInstanceDiskJSONBody - -// ScaleInstanceJSONRequestBody defines body for ScaleInstance for application/json ContentType. -type ScaleInstanceJSONRequestBody ScaleInstanceJSONBody - -// StartInstanceJSONRequestBody defines body for StartInstance for application/json ContentType. -type StartInstanceJSONRequestBody StartInstanceJSONBody - -// RevertInstanceToSnapshotJSONRequestBody defines body for RevertInstanceToSnapshot for application/json ContentType. -type RevertInstanceToSnapshotJSONRequestBody RevertInstanceToSnapshotJSONBody - -// CreateLoadBalancerJSONRequestBody defines body for CreateLoadBalancer for application/json ContentType. -type CreateLoadBalancerJSONRequestBody CreateLoadBalancerJSONBody - -// UpdateLoadBalancerJSONRequestBody defines body for UpdateLoadBalancer for application/json ContentType. -type UpdateLoadBalancerJSONRequestBody UpdateLoadBalancerJSONBody - -// AddServiceToLoadBalancerJSONRequestBody defines body for AddServiceToLoadBalancer for application/json ContentType. -type AddServiceToLoadBalancerJSONRequestBody AddServiceToLoadBalancerJSONBody - -// UpdateLoadBalancerServiceJSONRequestBody defines body for UpdateLoadBalancerService for application/json ContentType. -type UpdateLoadBalancerServiceJSONRequestBody UpdateLoadBalancerServiceJSONBody - -// CreatePrivateNetworkJSONRequestBody defines body for CreatePrivateNetwork for application/json ContentType. -type CreatePrivateNetworkJSONRequestBody CreatePrivateNetworkJSONBody - -// UpdatePrivateNetworkJSONRequestBody defines body for UpdatePrivateNetwork for application/json ContentType. -type UpdatePrivateNetworkJSONRequestBody UpdatePrivateNetworkJSONBody - -// AttachInstanceToPrivateNetworkJSONRequestBody defines body for AttachInstanceToPrivateNetwork for application/json ContentType. -type AttachInstanceToPrivateNetworkJSONRequestBody AttachInstanceToPrivateNetworkJSONBody - -// DetachInstanceFromPrivateNetworkJSONRequestBody defines body for DetachInstanceFromPrivateNetwork for application/json ContentType. -type DetachInstanceFromPrivateNetworkJSONRequestBody DetachInstanceFromPrivateNetworkJSONBody - -// UpdatePrivateNetworkInstanceIpJSONRequestBody defines body for UpdatePrivateNetworkInstanceIp for application/json ContentType. -type UpdatePrivateNetworkInstanceIpJSONRequestBody UpdatePrivateNetworkInstanceIpJSONBody - -// UpdateReverseDnsElasticIpJSONRequestBody defines body for UpdateReverseDnsElasticIp for application/json ContentType. -type UpdateReverseDnsElasticIpJSONRequestBody UpdateReverseDnsElasticIpJSONBody - -// UpdateReverseDnsInstanceJSONRequestBody defines body for UpdateReverseDnsInstance for application/json ContentType. -type UpdateReverseDnsInstanceJSONRequestBody UpdateReverseDnsInstanceJSONBody - -// CreateSecurityGroupJSONRequestBody defines body for CreateSecurityGroup for application/json ContentType. -type CreateSecurityGroupJSONRequestBody CreateSecurityGroupJSONBody - -// AddRuleToSecurityGroupJSONRequestBody defines body for AddRuleToSecurityGroup for application/json ContentType. -type AddRuleToSecurityGroupJSONRequestBody AddRuleToSecurityGroupJSONBody - -// AddExternalSourceToSecurityGroupJSONRequestBody defines body for AddExternalSourceToSecurityGroup for application/json ContentType. -type AddExternalSourceToSecurityGroupJSONRequestBody AddExternalSourceToSecurityGroupJSONBody - -// AttachInstanceToSecurityGroupJSONRequestBody defines body for AttachInstanceToSecurityGroup for application/json ContentType. -type AttachInstanceToSecurityGroupJSONRequestBody AttachInstanceToSecurityGroupJSONBody - -// DetachInstanceFromSecurityGroupJSONRequestBody defines body for DetachInstanceFromSecurityGroup for application/json ContentType. -type DetachInstanceFromSecurityGroupJSONRequestBody DetachInstanceFromSecurityGroupJSONBody - -// RemoveExternalSourceFromSecurityGroupJSONRequestBody defines body for RemoveExternalSourceFromSecurityGroup for application/json ContentType. -type RemoveExternalSourceFromSecurityGroupJSONRequestBody RemoveExternalSourceFromSecurityGroupJSONBody - -// CreateSksClusterJSONRequestBody defines body for CreateSksCluster for application/json ContentType. -type CreateSksClusterJSONRequestBody CreateSksClusterJSONBody - -// GenerateSksClusterKubeconfigJSONRequestBody defines body for GenerateSksClusterKubeconfig for application/json ContentType. -type GenerateSksClusterKubeconfigJSONRequestBody GenerateSksClusterKubeconfigJSONBody - -// UpdateSksClusterJSONRequestBody defines body for UpdateSksCluster for application/json ContentType. -type UpdateSksClusterJSONRequestBody UpdateSksClusterJSONBody - -// CreateSksNodepoolJSONRequestBody defines body for CreateSksNodepool for application/json ContentType. -type CreateSksNodepoolJSONRequestBody CreateSksNodepoolJSONBody - -// UpdateSksNodepoolJSONRequestBody defines body for UpdateSksNodepool for application/json ContentType. -type UpdateSksNodepoolJSONRequestBody UpdateSksNodepoolJSONBody - -// EvictSksNodepoolMembersJSONRequestBody defines body for EvictSksNodepoolMembers for application/json ContentType. -type EvictSksNodepoolMembersJSONRequestBody EvictSksNodepoolMembersJSONBody - -// ScaleSksNodepoolJSONRequestBody defines body for ScaleSksNodepool for application/json ContentType. -type ScaleSksNodepoolJSONRequestBody ScaleSksNodepoolJSONBody - -// UpgradeSksClusterJSONRequestBody defines body for UpgradeSksCluster for application/json ContentType. -type UpgradeSksClusterJSONRequestBody UpgradeSksClusterJSONBody - -// PromoteSnapshotToTemplateJSONRequestBody defines body for PromoteSnapshotToTemplate for application/json ContentType. -type PromoteSnapshotToTemplateJSONRequestBody PromoteSnapshotToTemplateJSONBody - -// RegisterSshKeyJSONRequestBody defines body for RegisterSshKey for application/json ContentType. -type RegisterSshKeyJSONRequestBody RegisterSshKeyJSONBody - -// RegisterTemplateJSONRequestBody defines body for RegisterTemplate for application/json ContentType. -type RegisterTemplateJSONRequestBody RegisterTemplateJSONBody - -// CopyTemplateJSONRequestBody defines body for CopyTemplate for application/json ContentType. -type CopyTemplateJSONRequestBody CopyTemplateJSONBody - -// UpdateTemplateJSONRequestBody defines body for UpdateTemplate for application/json ContentType. -type UpdateTemplateJSONRequestBody UpdateTemplateJSONBody - -// Getter for additional properties for IamPolicy_Services. Returns the specified -// element and whether it was found -func (a IamPolicy_Services) Get(fieldName string) (value IamServicePolicy, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for IamPolicy_Services -func (a *IamPolicy_Services) Set(fieldName string, value IamServicePolicy) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]IamServicePolicy) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for IamPolicy_Services to handle AdditionalProperties -func (a *IamPolicy_Services) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]IamServicePolicy) - for fieldName, fieldBuf := range object { - var fieldVal IamServicePolicy - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for IamPolicy_Services to handle AdditionalProperties -func (a IamPolicy_Services) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for Labels. Returns the specified -// element and whether it was found -func (a Labels) Get(fieldName string) (value string, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for Labels -func (a *Labels) Set(fieldName string, value string) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]string) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for Labels to handle AdditionalProperties -func (a *Labels) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]string) - for fieldName, fieldBuf := range object { - var fieldVal string - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for Labels to handle AdditionalProperties -func (a Labels) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for SksClusterDeprecatedResource. Returns the specified -// element and whether it was found -func (a SksClusterDeprecatedResource) Get(fieldName string) (value string, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for SksClusterDeprecatedResource -func (a *SksClusterDeprecatedResource) Set(fieldName string, value string) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]string) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for SksClusterDeprecatedResource to handle AdditionalProperties -func (a *SksClusterDeprecatedResource) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]string) - for fieldName, fieldBuf := range object { - var fieldVal string - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for SksClusterDeprecatedResource to handle AdditionalProperties -func (a SksClusterDeprecatedResource) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for SksNodepoolTaints. Returns the specified -// element and whether it was found -func (a SksNodepoolTaints) Get(fieldName string) (value SksNodepoolTaint, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for SksNodepoolTaints -func (a *SksNodepoolTaints) Set(fieldName string, value SksNodepoolTaint) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]SksNodepoolTaint) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for SksNodepoolTaints to handle AdditionalProperties -func (a *SksNodepoolTaints) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]SksNodepoolTaint) - for fieldName, fieldBuf := range object { - var fieldVal SksNodepoolTaint - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for SksNodepoolTaints to handle AdditionalProperties -func (a SksNodepoolTaints) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// Getter for additional properties for SksOidc_RequiredClaim. Returns the specified -// element and whether it was found -func (a SksOidc_RequiredClaim) Get(fieldName string) (value string, found bool) { - if a.AdditionalProperties != nil { - value, found = a.AdditionalProperties[fieldName] - } - return -} - -// Setter for additional properties for SksOidc_RequiredClaim -func (a *SksOidc_RequiredClaim) Set(fieldName string, value string) { - if a.AdditionalProperties == nil { - a.AdditionalProperties = make(map[string]string) - } - a.AdditionalProperties[fieldName] = value -} - -// Override default JSON handling for SksOidc_RequiredClaim to handle AdditionalProperties -func (a *SksOidc_RequiredClaim) UnmarshalJSON(b []byte) error { - object := make(map[string]json.RawMessage) - err := json.Unmarshal(b, &object) - if err != nil { - return err - } - - if len(object) != 0 { - a.AdditionalProperties = make(map[string]string) - for fieldName, fieldBuf := range object { - var fieldVal string - err := json.Unmarshal(fieldBuf, &fieldVal) - if err != nil { - return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) - } - a.AdditionalProperties[fieldName] = fieldVal - } - } - return nil -} - -// Override default JSON handling for SksOidc_RequiredClaim to handle AdditionalProperties -func (a SksOidc_RequiredClaim) MarshalJSON() ([]byte, error) { - var err error - object := make(map[string]json.RawMessage) - - for fieldName, field := range a.AdditionalProperties { - object[fieldName], err = json.Marshal(field) - if err != nil { - return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) - } - } - return json.Marshal(object) -} - -// RequestEditorFn is the function signature for the RequestEditor callback function -type RequestEditorFn func(ctx context.Context, req *http.Request) error - -// Doer performs HTTP requests. -// -// The standard http.Client implements this interface. -type HttpRequestDoer interface { - Do(req *http.Request) (*http.Response, error) -} - -// Client which conforms to the OpenAPI3 specification for this service. -type Client struct { - // The endpoint of the server conforming to this interface, with scheme, - // https://api.deepmap.com for example. This can contain a path relative - // to the server, such as https://api.deepmap.com/dev-test, and all the - // paths in the swagger spec will be appended to the server. - Server string - - // Doer for performing requests, typically a *http.Client with any - // customized settings, such as certificate chains. - Client HttpRequestDoer - - // A list of callbacks for modifying requests which are generated before sending over - // the network. - RequestEditors []RequestEditorFn -} - -// ClientOption allows setting custom parameters during construction -type ClientOption func(*Client) error - -// Creates a new Client, with reasonable defaults -func NewClient(server string, opts ...ClientOption) (*Client, error) { - // create a client with sane default values - client := Client{ - Server: server, - } - // mutate client and add all optional params - for _, o := range opts { - if err := o(&client); err != nil { - return nil, err - } - } - // ensure the server URL always has a trailing slash - if !strings.HasSuffix(client.Server, "/") { - client.Server += "/" - } - // create httpClient, if not already present - if client.Client == nil { - client.Client = &http.Client{} - } - return &client, nil -} - -// WithHTTPClient allows overriding the default Doer, which is -// automatically created using http.Client. This is useful for tests. -func WithHTTPClient(doer HttpRequestDoer) ClientOption { - return func(c *Client) error { - c.Client = doer - return nil - } -} - -// WithRequestEditorFn allows setting up a callback function, which will be -// called right before sending the request. This can be used to mutate the request. -func WithRequestEditorFn(fn RequestEditorFn) ClientOption { - return func(c *Client) error { - c.RequestEditors = append(c.RequestEditors, fn) - return nil - } -} - -// The interface specification for the client above. -type ClientInterface interface { - // ListAccessKeys request - ListAccessKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateAccessKey request with any body - CreateAccessKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateAccessKey(ctx context.Context, body CreateAccessKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListAccessKeyKnownOperations request - ListAccessKeyKnownOperations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListAccessKeyOperations request - ListAccessKeyOperations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RevokeAccessKey request - RevokeAccessKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetAccessKey request - GetAccessKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListAntiAffinityGroups request - ListAntiAffinityGroups(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateAntiAffinityGroup request with any body - CreateAntiAffinityGroupWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateAntiAffinityGroup(ctx context.Context, body CreateAntiAffinityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteAntiAffinityGroup request - DeleteAntiAffinityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetAntiAffinityGroup request - GetAntiAffinityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListApiKeys request - ListApiKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateApiKey request with any body - CreateApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateApiKey(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteApiKey request - DeleteApiKey(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetApiKey request - GetApiKey(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasCaCertificate request - GetDbaasCaCertificate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServiceGrafana request - DeleteDbaasServiceGrafana(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceGrafana request - GetDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServiceGrafana request with any body - CreateDbaasServiceGrafanaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServiceGrafana request with any body - UpdateDbaasServiceGrafanaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasGrafanaMaintenance request - StartDbaasGrafanaMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasIntegration request with any body - CreateDbaasIntegrationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasIntegration(ctx context.Context, body CreateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDbaasIntegrationSettings request - ListDbaasIntegrationSettings(ctx context.Context, integrationType string, sourceType string, destType string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDbaasIntegrationTypes request - ListDbaasIntegrationTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasIntegration request - DeleteDbaasIntegration(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasIntegration request - GetDbaasIntegration(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasIntegration request with any body - UpdateDbaasIntegrationWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasIntegration(ctx context.Context, id string, body UpdateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServiceKafka request - DeleteDbaasServiceKafka(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceKafka request - GetDbaasServiceKafka(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServiceKafka request with any body - CreateDbaasServiceKafkaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServiceKafka(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServiceKafka request with any body - UpdateDbaasServiceKafkaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServiceKafka(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasKafkaAclConfig request - GetDbaasKafkaAclConfig(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasKafkaMaintenance request - StartDbaasKafkaMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasKafkaSchemaRegistryAclConfig request with any body - CreateDbaasKafkaSchemaRegistryAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasKafkaSchemaRegistryAclConfig(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasKafkaSchemaRegistryAclConfig request - DeleteDbaasKafkaSchemaRegistryAclConfig(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasKafkaTopicAclConfig request with any body - CreateDbaasKafkaTopicAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasKafkaTopicAclConfig(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaTopicAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasKafkaTopicAclConfig request - DeleteDbaasKafkaTopicAclConfig(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasKafkaUser request with any body - CreateDbaasKafkaUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasKafkaUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasKafkaUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasKafkaUser request - DeleteDbaasKafkaUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetDbaasKafkaUserPassword request with any body - ResetDbaasKafkaUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResetDbaasKafkaUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasKafkaUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasMigrationStatus request - GetDbaasMigrationStatus(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServiceMysql request - DeleteDbaasServiceMysql(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceMysql request - GetDbaasServiceMysql(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServiceMysql request with any body - CreateDbaasServiceMysqlWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServiceMysql(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServiceMysql request with any body - UpdateDbaasServiceMysqlWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServiceMysql(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasMysqlMaintenance request - StartDbaasMysqlMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StopDbaasMysqlMigration request - StopDbaasMysqlMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasMysqlDatabase request with any body - CreateDbaasMysqlDatabaseWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasMysqlDatabase(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasMysqlDatabase request - DeleteDbaasMysqlDatabase(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasMysqlDatabaseName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasMysqlUser request with any body - CreateDbaasMysqlUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasMysqlUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasMysqlUser request - DeleteDbaasMysqlUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetDbaasMysqlUserPassword request with any body - ResetDbaasMysqlUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResetDbaasMysqlUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasMysqlUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServiceOpensearch request - DeleteDbaasServiceOpensearch(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceOpensearch request - GetDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServiceOpensearch request with any body - CreateDbaasServiceOpensearchWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServiceOpensearch request with any body - UpdateDbaasServiceOpensearchWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasOpensearchAclConfig request - GetDbaasOpensearchAclConfig(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasOpensearchAclConfig request with any body - UpdateDbaasOpensearchAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasOpensearchAclConfig(ctx context.Context, name DbaasServiceName, body UpdateDbaasOpensearchAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasOpensearchMaintenance request - StartDbaasOpensearchMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasOpensearchUser request with any body - CreateDbaasOpensearchUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasOpensearchUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasOpensearchUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasOpensearchUser request - DeleteDbaasOpensearchUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetDbaasOpensearchUserPassword request with any body - ResetDbaasOpensearchUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResetDbaasOpensearchUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasOpensearchUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServicePg request - DeleteDbaasServicePg(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServicePg request - GetDbaasServicePg(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServicePg request with any body - CreateDbaasServicePgWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServicePg(ctx context.Context, name DbaasServiceName, body CreateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServicePg request with any body - UpdateDbaasServicePgWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServicePg(ctx context.Context, name DbaasServiceName, body UpdateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasPgMaintenance request - StartDbaasPgMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StopDbaasPgMigration request - StopDbaasPgMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasPgConnectionPool request with any body - CreateDbaasPgConnectionPoolWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasPgConnectionPool request - DeleteDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasPgConnectionPool request with any body - UpdateDbaasPgConnectionPoolWithBody(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, body UpdateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasPgDatabase request with any body - CreateDbaasPgDatabaseWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasPgDatabase(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasPgDatabase request - DeleteDbaasPgDatabase(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasPgDatabaseName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasPostgresUser request with any body - CreateDbaasPostgresUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasPostgresUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPostgresUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasPostgresUser request - DeleteDbaasPostgresUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasPostgresAllowReplication request with any body - UpdateDbaasPostgresAllowReplicationWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasPostgresAllowReplication(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body UpdateDbaasPostgresAllowReplicationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetDbaasPostgresUserPassword request with any body - ResetDbaasPostgresUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResetDbaasPostgresUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasPostgresUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasPgUpgradeCheck request with any body - CreateDbaasPgUpgradeCheckWithBody(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasPgUpgradeCheck(ctx context.Context, service DbaasServiceName, body CreateDbaasPgUpgradeCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasServiceRedis request - DeleteDbaasServiceRedis(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceRedis request - GetDbaasServiceRedis(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasServiceRedis request with any body - CreateDbaasServiceRedisWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasServiceRedis(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDbaasServiceRedis request with any body - UpdateDbaasServiceRedisWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDbaasServiceRedis(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartDbaasRedisMaintenance request - StartDbaasRedisMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StopDbaasRedisMigration request - StopDbaasRedisMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDbaasServices request - ListDbaasServices(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceLogs request with any body - GetDbaasServiceLogsWithBody(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - GetDbaasServiceLogs(ctx context.Context, serviceName string, body GetDbaasServiceLogsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceMetrics request with any body - GetDbaasServiceMetricsWithBody(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - GetDbaasServiceMetrics(ctx context.Context, serviceName string, body GetDbaasServiceMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDbaasServiceTypes request - ListDbaasServiceTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasServiceType request - GetDbaasServiceType(ctx context.Context, serviceTypeName string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDbaasService request - DeleteDbaasService(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsGrafana request - GetDbaasSettingsGrafana(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsKafka request - GetDbaasSettingsKafka(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsMysql request - GetDbaasSettingsMysql(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsOpensearch request - GetDbaasSettingsOpensearch(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsPg request - GetDbaasSettingsPg(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasSettingsRedis request - GetDbaasSettingsRedis(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDbaasTaskMigrationCheck request with any body - CreateDbaasTaskMigrationCheckWithBody(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDbaasTaskMigrationCheck(ctx context.Context, service DbaasServiceName, body CreateDbaasTaskMigrationCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDbaasTask request - GetDbaasTask(ctx context.Context, service DbaasServiceName, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDeployTargets request - ListDeployTargets(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDeployTarget request - GetDeployTarget(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDnsDomains request - ListDnsDomains(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDnsDomain request with any body - CreateDnsDomainWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDnsDomain(ctx context.Context, body CreateDnsDomainJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListDnsDomainRecords request - ListDnsDomainRecords(ctx context.Context, domainId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateDnsDomainRecord request with any body - CreateDnsDomainRecordWithBody(ctx context.Context, domainId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateDnsDomainRecord(ctx context.Context, domainId string, body CreateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDnsDomainRecord request - DeleteDnsDomainRecord(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDnsDomainRecord request - GetDnsDomainRecord(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateDnsDomainRecord request with any body - UpdateDnsDomainRecordWithBody(ctx context.Context, domainId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateDnsDomainRecord(ctx context.Context, domainId string, recordId string, body UpdateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteDnsDomain request - DeleteDnsDomain(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDnsDomain request - GetDnsDomain(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetDnsDomainZoneFile request - GetDnsDomainZoneFile(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListElasticIps request - ListElasticIps(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateElasticIp request with any body - CreateElasticIpWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateElasticIp(ctx context.Context, body CreateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteElasticIp request - DeleteElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetElasticIp request - GetElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateElasticIp request with any body - UpdateElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateElasticIp(ctx context.Context, id string, body UpdateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetElasticIpField request - ResetElasticIpField(ctx context.Context, id string, field ResetElasticIpFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AttachInstanceToElasticIp request with any body - AttachInstanceToElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AttachInstanceToElasticIp(ctx context.Context, id string, body AttachInstanceToElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DetachInstanceFromElasticIp request with any body - DetachInstanceFromElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - DetachInstanceFromElasticIp(ctx context.Context, id string, body DetachInstanceFromElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListEvents request - ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetIamOrganizationPolicy request - GetIamOrganizationPolicy(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateIamOrganizationPolicy request with any body - UpdateIamOrganizationPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateIamOrganizationPolicy(ctx context.Context, body UpdateIamOrganizationPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListIamRoles request - ListIamRoles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateIamRole request with any body - CreateIamRoleWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateIamRole(ctx context.Context, body CreateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteIamRole request - DeleteIamRole(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetIamRole request - GetIamRole(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateIamRole request with any body - UpdateIamRoleWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateIamRole(ctx context.Context, id string, body UpdateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateIamRolePolicy request with any body - UpdateIamRolePolicyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateIamRolePolicy(ctx context.Context, id string, body UpdateIamRolePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListInstances request - ListInstances(ctx context.Context, params *ListInstancesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateInstance request with any body - CreateInstanceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateInstance(ctx context.Context, body CreateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListInstancePools request - ListInstancePools(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateInstancePool request with any body - CreateInstancePoolWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateInstancePool(ctx context.Context, body CreateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteInstancePool request - DeleteInstancePool(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetInstancePool request - GetInstancePool(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateInstancePool request with any body - UpdateInstancePoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateInstancePool(ctx context.Context, id string, body UpdateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetInstancePoolField request - ResetInstancePoolField(ctx context.Context, id string, field ResetInstancePoolFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // EvictInstancePoolMembers request with any body - EvictInstancePoolMembersWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - EvictInstancePoolMembers(ctx context.Context, id string, body EvictInstancePoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ScaleInstancePool request with any body - ScaleInstancePoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ScaleInstancePool(ctx context.Context, id string, body ScaleInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListInstanceTypes request - ListInstanceTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetInstanceType request - GetInstanceType(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteInstance request - DeleteInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetInstance request - GetInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateInstance request with any body - UpdateInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateInstance(ctx context.Context, id string, body UpdateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetInstanceField request - ResetInstanceField(ctx context.Context, id string, field ResetInstanceFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddInstanceProtection request - AddInstanceProtection(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateSnapshot request - CreateSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RevealInstancePassword request - RevealInstancePassword(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RebootInstance request - RebootInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RemoveInstanceProtection request - RemoveInstanceProtection(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetInstance request with any body - ResetInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResetInstance(ctx context.Context, id string, body ResetInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetInstancePassword request - ResetInstancePassword(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResizeInstanceDisk request with any body - ResizeInstanceDiskWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ResizeInstanceDisk(ctx context.Context, id string, body ResizeInstanceDiskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ScaleInstance request with any body - ScaleInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ScaleInstance(ctx context.Context, id string, body ScaleInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StartInstance request with any body - StartInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - StartInstance(ctx context.Context, id string, body StartInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // StopInstance request - StopInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RevertInstanceToSnapshot request with any body - RevertInstanceToSnapshotWithBody(ctx context.Context, instanceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - RevertInstanceToSnapshot(ctx context.Context, instanceId string, body RevertInstanceToSnapshotJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListLoadBalancers request - ListLoadBalancers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateLoadBalancer request with any body - CreateLoadBalancerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateLoadBalancer(ctx context.Context, body CreateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteLoadBalancer request - DeleteLoadBalancer(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLoadBalancer request - GetLoadBalancer(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateLoadBalancer request with any body - UpdateLoadBalancerWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateLoadBalancer(ctx context.Context, id string, body UpdateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddServiceToLoadBalancer request with any body - AddServiceToLoadBalancerWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AddServiceToLoadBalancer(ctx context.Context, id string, body AddServiceToLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteLoadBalancerService request - DeleteLoadBalancerService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetLoadBalancerService request - GetLoadBalancerService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateLoadBalancerService request with any body - UpdateLoadBalancerServiceWithBody(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateLoadBalancerService(ctx context.Context, id string, serviceId string, body UpdateLoadBalancerServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetLoadBalancerServiceField request - ResetLoadBalancerServiceField(ctx context.Context, id string, serviceId string, field ResetLoadBalancerServiceFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetLoadBalancerField request - ResetLoadBalancerField(ctx context.Context, id string, field ResetLoadBalancerFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetOperation request - GetOperation(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListPrivateNetworks request - ListPrivateNetworks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreatePrivateNetwork request with any body - CreatePrivateNetworkWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreatePrivateNetwork(ctx context.Context, body CreatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeletePrivateNetwork request - DeletePrivateNetwork(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetPrivateNetwork request - GetPrivateNetwork(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdatePrivateNetwork request with any body - UpdatePrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdatePrivateNetwork(ctx context.Context, id string, body UpdatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetPrivateNetworkField request - ResetPrivateNetworkField(ctx context.Context, id string, field ResetPrivateNetworkFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AttachInstanceToPrivateNetwork request with any body - AttachInstanceToPrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AttachInstanceToPrivateNetwork(ctx context.Context, id string, body AttachInstanceToPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DetachInstanceFromPrivateNetwork request with any body - DetachInstanceFromPrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - DetachInstanceFromPrivateNetwork(ctx context.Context, id string, body DetachInstanceFromPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdatePrivateNetworkInstanceIp request with any body - UpdatePrivateNetworkInstanceIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdatePrivateNetworkInstanceIp(ctx context.Context, id string, body UpdatePrivateNetworkInstanceIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListQuotas request - ListQuotas(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetQuota request - GetQuota(ctx context.Context, entity string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteReverseDnsElasticIp request - DeleteReverseDnsElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetReverseDnsElasticIp request - GetReverseDnsElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateReverseDnsElasticIp request with any body - UpdateReverseDnsElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateReverseDnsElasticIp(ctx context.Context, id string, body UpdateReverseDnsElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteReverseDnsInstance request - DeleteReverseDnsInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetReverseDnsInstance request - GetReverseDnsInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateReverseDnsInstance request with any body - UpdateReverseDnsInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateReverseDnsInstance(ctx context.Context, id string, body UpdateReverseDnsInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSecurityGroups request - ListSecurityGroups(ctx context.Context, params *ListSecurityGroupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateSecurityGroup request with any body - CreateSecurityGroupWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateSecurityGroup(ctx context.Context, body CreateSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSecurityGroup request - DeleteSecurityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSecurityGroup request - GetSecurityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddRuleToSecurityGroup request with any body - AddRuleToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AddRuleToSecurityGroup(ctx context.Context, id string, body AddRuleToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteRuleFromSecurityGroup request - DeleteRuleFromSecurityGroup(ctx context.Context, id string, ruleId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AddExternalSourceToSecurityGroup request with any body - AddExternalSourceToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AddExternalSourceToSecurityGroup(ctx context.Context, id string, body AddExternalSourceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // AttachInstanceToSecurityGroup request with any body - AttachInstanceToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - AttachInstanceToSecurityGroup(ctx context.Context, id string, body AttachInstanceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DetachInstanceFromSecurityGroup request with any body - DetachInstanceFromSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - DetachInstanceFromSecurityGroup(ctx context.Context, id string, body DetachInstanceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RemoveExternalSourceFromSecurityGroup request with any body - RemoveExternalSourceFromSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - RemoveExternalSourceFromSecurityGroup(ctx context.Context, id string, body RemoveExternalSourceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSksClusters request - ListSksClusters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateSksCluster request with any body - CreateSksClusterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateSksCluster(ctx context.Context, body CreateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSksClusterDeprecatedResources request - ListSksClusterDeprecatedResources(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GenerateSksClusterKubeconfig request with any body - GenerateSksClusterKubeconfigWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - GenerateSksClusterKubeconfig(ctx context.Context, id string, body GenerateSksClusterKubeconfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSksClusterVersions request - ListSksClusterVersions(ctx context.Context, params *ListSksClusterVersionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSksCluster request - DeleteSksCluster(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSksCluster request - GetSksCluster(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateSksCluster request with any body - UpdateSksClusterWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateSksCluster(ctx context.Context, id string, body UpdateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSksClusterAuthorityCert request - GetSksClusterAuthorityCert(ctx context.Context, id string, authority GetSksClusterAuthorityCertParamsAuthority, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CreateSksNodepool request with any body - CreateSksNodepoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CreateSksNodepool(ctx context.Context, id string, body CreateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSksNodepool request - DeleteSksNodepool(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSksNodepool request - GetSksNodepool(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateSksNodepool request with any body - UpdateSksNodepoolWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateSksNodepool(ctx context.Context, id string, sksNodepoolId string, body UpdateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetSksNodepoolField request - ResetSksNodepoolField(ctx context.Context, id string, sksNodepoolId string, field ResetSksNodepoolFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // EvictSksNodepoolMembers request with any body - EvictSksNodepoolMembersWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - EvictSksNodepoolMembers(ctx context.Context, id string, sksNodepoolId string, body EvictSksNodepoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ScaleSksNodepool request with any body - ScaleSksNodepoolWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - ScaleSksNodepool(ctx context.Context, id string, sksNodepoolId string, body ScaleSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RotateSksCcmCredentials request - RotateSksCcmCredentials(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RotateSksOperatorsCa request - RotateSksOperatorsCa(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpgradeSksCluster request with any body - UpgradeSksClusterWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpgradeSksCluster(ctx context.Context, id string, body UpgradeSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpgradeSksClusterServiceLevel request - UpgradeSksClusterServiceLevel(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ResetSksClusterField request - ResetSksClusterField(ctx context.Context, id string, field ResetSksClusterFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSnapshots request - ListSnapshots(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSnapshot request - DeleteSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSnapshot request - GetSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ExportSnapshot request - ExportSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // PromoteSnapshotToTemplate request with any body - PromoteSnapshotToTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - PromoteSnapshotToTemplate(ctx context.Context, id string, body PromoteSnapshotToTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSosBucketsUsage request - ListSosBucketsUsage(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSosPresignedUrl request - GetSosPresignedUrl(ctx context.Context, bucket string, params *GetSosPresignedUrlParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListSshKeys request - ListSshKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RegisterSshKey request with any body - RegisterSshKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - RegisterSshKey(ctx context.Context, body RegisterSshKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteSshKey request - DeleteSshKey(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetSshKey request - GetSshKey(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListTemplates request - ListTemplates(ctx context.Context, params *ListTemplatesParams, reqEditors ...RequestEditorFn) (*http.Response, error) - - // RegisterTemplate request with any body - RegisterTemplateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - RegisterTemplate(ctx context.Context, body RegisterTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // DeleteTemplate request - DeleteTemplate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // GetTemplate request - GetTemplate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) - - // CopyTemplate request with any body - CopyTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - CopyTemplate(ctx context.Context, id string, body CopyTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // UpdateTemplate request with any body - UpdateTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - - UpdateTemplate(ctx context.Context, id string, body UpdateTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) - - // ListZones request - ListZones(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) -} - -func (c *Client) ListAccessKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAccessKeysRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateAccessKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAccessKeyRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateAccessKey(ctx context.Context, body CreateAccessKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAccessKeyRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListAccessKeyKnownOperations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAccessKeyKnownOperationsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListAccessKeyOperations(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAccessKeyOperationsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RevokeAccessKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRevokeAccessKeyRequest(c.Server, key) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetAccessKey(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetAccessKeyRequest(c.Server, key) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListAntiAffinityGroups(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListAntiAffinityGroupsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateAntiAffinityGroupWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAntiAffinityGroupRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateAntiAffinityGroup(ctx context.Context, body CreateAntiAffinityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateAntiAffinityGroupRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteAntiAffinityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteAntiAffinityGroupRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetAntiAffinityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetAntiAffinityGroupRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListApiKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListApiKeysRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateApiKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateApiKeyRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateApiKey(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateApiKeyRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteApiKey(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteApiKeyRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetApiKey(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetApiKeyRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasCaCertificate(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasCaCertificateRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServiceGrafana(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceGrafanaRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceGrafanaRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceGrafanaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceGrafanaRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceGrafanaRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceGrafanaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceGrafanaRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceGrafana(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceGrafanaRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasGrafanaMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasGrafanaMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasIntegrationWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasIntegrationRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasIntegration(ctx context.Context, body CreateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasIntegrationRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDbaasIntegrationSettings(ctx context.Context, integrationType string, sourceType string, destType string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDbaasIntegrationSettingsRequest(c.Server, integrationType, sourceType, destType) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDbaasIntegrationTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDbaasIntegrationTypesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasIntegration(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasIntegrationRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasIntegration(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasIntegrationRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasIntegrationWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasIntegrationRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasIntegration(ctx context.Context, id string, body UpdateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasIntegrationRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServiceKafka(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceKafkaRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceKafka(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceKafkaRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceKafkaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceKafkaRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceKafka(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceKafkaRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceKafkaWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceKafkaRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceKafka(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceKafkaRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasKafkaAclConfig(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasKafkaAclConfigRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasKafkaMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasKafkaMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaSchemaRegistryAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaSchemaRegistryAclConfigRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaSchemaRegistryAclConfig(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaSchemaRegistryAclConfigRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasKafkaSchemaRegistryAclConfig(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasKafkaSchemaRegistryAclConfigRequest(c.Server, name, aclId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaTopicAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaTopicAclConfigRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaTopicAclConfig(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaTopicAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaTopicAclConfigRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasKafkaTopicAclConfig(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasKafkaTopicAclConfigRequest(c.Server, name, aclId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaUserRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasKafkaUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasKafkaUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasKafkaUserRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasKafkaUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasKafkaUserRequest(c.Server, serviceName, username) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasKafkaUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasKafkaUserPasswordRequestWithBody(c.Server, serviceName, username, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasKafkaUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasKafkaUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasKafkaUserPasswordRequest(c.Server, serviceName, username, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasMigrationStatus(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasMigrationStatusRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServiceMysql(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceMysqlRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceMysql(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceMysqlRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceMysqlWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceMysqlRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceMysql(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceMysqlRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceMysqlWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceMysqlRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceMysql(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceMysqlRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasMysqlMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasMysqlMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StopDbaasMysqlMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStopDbaasMysqlMigrationRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasMysqlDatabaseWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasMysqlDatabaseRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasMysqlDatabase(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasMysqlDatabaseRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasMysqlDatabase(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasMysqlDatabaseName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasMysqlDatabaseRequest(c.Server, serviceName, databaseName) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasMysqlUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasMysqlUserRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasMysqlUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasMysqlUserRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasMysqlUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasMysqlUserRequest(c.Server, serviceName, username) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasMysqlUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasMysqlUserPasswordRequestWithBody(c.Server, serviceName, username, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasMysqlUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasMysqlUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasMysqlUserPasswordRequest(c.Server, serviceName, username, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServiceOpensearch(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceOpensearchRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceOpensearchRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceOpensearchWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceOpensearchRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceOpensearchRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceOpensearchWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceOpensearchRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceOpensearch(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceOpensearchRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasOpensearchAclConfig(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasOpensearchAclConfigRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasOpensearchAclConfigWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasOpensearchAclConfigRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasOpensearchAclConfig(ctx context.Context, name DbaasServiceName, body UpdateDbaasOpensearchAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasOpensearchAclConfigRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasOpensearchMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasOpensearchMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasOpensearchUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasOpensearchUserRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasOpensearchUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasOpensearchUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasOpensearchUserRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasOpensearchUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasOpensearchUserRequest(c.Server, serviceName, username) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasOpensearchUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasOpensearchUserPasswordRequestWithBody(c.Server, serviceName, username, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasOpensearchUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasOpensearchUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasOpensearchUserPasswordRequest(c.Server, serviceName, username, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServicePg(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServicePgRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServicePg(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServicePgRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServicePgWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServicePgRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServicePg(ctx context.Context, name DbaasServiceName, body CreateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServicePgRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServicePgWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServicePgRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServicePg(ctx context.Context, name DbaasServiceName, body UpdateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServicePgRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasPgMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasPgMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StopDbaasPgMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStopDbaasPgMigrationRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgConnectionPoolWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgConnectionPoolRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgConnectionPoolRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasPgConnectionPoolRequest(c.Server, serviceName, connectionPoolName) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasPgConnectionPoolWithBody(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasPgConnectionPoolRequestWithBody(c.Server, serviceName, connectionPoolName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasPgConnectionPool(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, body UpdateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasPgConnectionPoolRequest(c.Server, serviceName, connectionPoolName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgDatabaseWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgDatabaseRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgDatabase(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgDatabaseRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasPgDatabase(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasPgDatabaseName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasPgDatabaseRequest(c.Server, serviceName, databaseName) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPostgresUserWithBody(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPostgresUserRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPostgresUser(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPostgresUserJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPostgresUserRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasPostgresUser(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasPostgresUserRequest(c.Server, serviceName, username) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasPostgresAllowReplicationWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasPostgresAllowReplicationRequestWithBody(c.Server, serviceName, username, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasPostgresAllowReplication(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body UpdateDbaasPostgresAllowReplicationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasPostgresAllowReplicationRequest(c.Server, serviceName, username, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasPostgresUserPasswordWithBody(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasPostgresUserPasswordRequestWithBody(c.Server, serviceName, username, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetDbaasPostgresUserPassword(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasPostgresUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetDbaasPostgresUserPasswordRequest(c.Server, serviceName, username, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgUpgradeCheckWithBody(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgUpgradeCheckRequestWithBody(c.Server, service, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasPgUpgradeCheck(ctx context.Context, service DbaasServiceName, body CreateDbaasPgUpgradeCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasPgUpgradeCheckRequest(c.Server, service, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasServiceRedis(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceRedisRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceRedis(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceRedisRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceRedisWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceRedisRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasServiceRedis(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasServiceRedisRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceRedisWithBody(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceRedisRequestWithBody(c.Server, name, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDbaasServiceRedis(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDbaasServiceRedisRequest(c.Server, name, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartDbaasRedisMaintenance(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartDbaasRedisMaintenanceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StopDbaasRedisMigration(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStopDbaasRedisMigrationRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDbaasServices(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDbaasServicesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceLogsWithBody(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceLogsRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceLogs(ctx context.Context, serviceName string, body GetDbaasServiceLogsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceLogsRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceMetricsWithBody(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceMetricsRequestWithBody(c.Server, serviceName, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceMetrics(ctx context.Context, serviceName string, body GetDbaasServiceMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceMetricsRequest(c.Server, serviceName, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDbaasServiceTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDbaasServiceTypesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasServiceType(ctx context.Context, serviceTypeName string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasServiceTypeRequest(c.Server, serviceTypeName) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDbaasService(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDbaasServiceRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsGrafana(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsGrafanaRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsKafka(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsKafkaRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsMysql(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsMysqlRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsOpensearch(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsOpensearchRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsPg(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsPgRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasSettingsRedis(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasSettingsRedisRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasTaskMigrationCheckWithBody(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasTaskMigrationCheckRequestWithBody(c.Server, service, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDbaasTaskMigrationCheck(ctx context.Context, service DbaasServiceName, body CreateDbaasTaskMigrationCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDbaasTaskMigrationCheckRequest(c.Server, service, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDbaasTask(ctx context.Context, service DbaasServiceName, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDbaasTaskRequest(c.Server, service, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDeployTargets(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDeployTargetsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDeployTarget(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDeployTargetRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDnsDomains(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDnsDomainsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDnsDomainWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDnsDomainRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDnsDomain(ctx context.Context, body CreateDnsDomainJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDnsDomainRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListDnsDomainRecords(ctx context.Context, domainId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListDnsDomainRecordsRequest(c.Server, domainId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDnsDomainRecordWithBody(ctx context.Context, domainId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDnsDomainRecordRequestWithBody(c.Server, domainId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateDnsDomainRecord(ctx context.Context, domainId string, body CreateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateDnsDomainRecordRequest(c.Server, domainId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDnsDomainRecord(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDnsDomainRecordRequest(c.Server, domainId, recordId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDnsDomainRecord(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDnsDomainRecordRequest(c.Server, domainId, recordId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDnsDomainRecordWithBody(ctx context.Context, domainId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDnsDomainRecordRequestWithBody(c.Server, domainId, recordId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateDnsDomainRecord(ctx context.Context, domainId string, recordId string, body UpdateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateDnsDomainRecordRequest(c.Server, domainId, recordId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteDnsDomain(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteDnsDomainRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDnsDomain(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDnsDomainRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetDnsDomainZoneFile(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetDnsDomainZoneFileRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListElasticIps(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListElasticIpsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateElasticIpWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateElasticIpRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateElasticIp(ctx context.Context, body CreateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateElasticIpRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteElasticIpRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetElasticIpRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateElasticIpRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateElasticIp(ctx context.Context, id string, body UpdateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateElasticIpRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetElasticIpField(ctx context.Context, id string, field ResetElasticIpFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetElasticIpFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToElasticIpRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToElasticIp(ctx context.Context, id string, body AttachInstanceToElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToElasticIpRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromElasticIpRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromElasticIp(ctx context.Context, id string, body DetachInstanceFromElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromElasticIpRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListEvents(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListEventsRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetIamOrganizationPolicy(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetIamOrganizationPolicyRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamOrganizationPolicyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamOrganizationPolicyRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamOrganizationPolicy(ctx context.Context, body UpdateIamOrganizationPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamOrganizationPolicyRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListIamRoles(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListIamRolesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateIamRoleWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateIamRoleRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateIamRole(ctx context.Context, body CreateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateIamRoleRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteIamRole(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteIamRoleRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetIamRole(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetIamRoleRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamRoleWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamRoleRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamRole(ctx context.Context, id string, body UpdateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamRoleRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamRolePolicyWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamRolePolicyRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateIamRolePolicy(ctx context.Context, id string, body UpdateIamRolePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateIamRolePolicyRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListInstances(ctx context.Context, params *ListInstancesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListInstancesRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateInstanceWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateInstanceRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateInstance(ctx context.Context, body CreateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateInstanceRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListInstancePools(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListInstancePoolsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateInstancePoolWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateInstancePoolRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateInstancePool(ctx context.Context, body CreateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateInstancePoolRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteInstancePool(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteInstancePoolRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetInstancePool(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetInstancePoolRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateInstancePoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateInstancePoolRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateInstancePool(ctx context.Context, id string, body UpdateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateInstancePoolRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetInstancePoolField(ctx context.Context, id string, field ResetInstancePoolFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetInstancePoolFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) EvictInstancePoolMembersWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewEvictInstancePoolMembersRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) EvictInstancePoolMembers(ctx context.Context, id string, body EvictInstancePoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewEvictInstancePoolMembersRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleInstancePoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleInstancePoolRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleInstancePool(ctx context.Context, id string, body ScaleInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleInstancePoolRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListInstanceTypes(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListInstanceTypesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetInstanceType(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetInstanceTypeRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateInstanceRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateInstance(ctx context.Context, id string, body UpdateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateInstanceRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetInstanceField(ctx context.Context, id string, field ResetInstanceFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetInstanceFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddInstanceProtection(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddInstanceProtectionRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSnapshotRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RevealInstancePassword(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRevealInstancePasswordRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RebootInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRebootInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RemoveInstanceProtection(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRemoveInstanceProtectionRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetInstanceRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetInstance(ctx context.Context, id string, body ResetInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetInstanceRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetInstancePassword(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetInstancePasswordRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResizeInstanceDiskWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResizeInstanceDiskRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResizeInstanceDisk(ctx context.Context, id string, body ResizeInstanceDiskJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResizeInstanceDiskRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleInstanceRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleInstance(ctx context.Context, id string, body ScaleInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleInstanceRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartInstanceRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StartInstance(ctx context.Context, id string, body StartInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStartInstanceRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) StopInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewStopInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RevertInstanceToSnapshotWithBody(ctx context.Context, instanceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRevertInstanceToSnapshotRequestWithBody(c.Server, instanceId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RevertInstanceToSnapshot(ctx context.Context, instanceId string, body RevertInstanceToSnapshotJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRevertInstanceToSnapshotRequest(c.Server, instanceId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListLoadBalancers(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListLoadBalancersRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateLoadBalancerWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateLoadBalancerRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateLoadBalancer(ctx context.Context, body CreateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateLoadBalancerRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteLoadBalancer(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteLoadBalancerRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLoadBalancer(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLoadBalancerRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateLoadBalancerWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateLoadBalancerRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateLoadBalancer(ctx context.Context, id string, body UpdateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateLoadBalancerRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddServiceToLoadBalancerWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddServiceToLoadBalancerRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddServiceToLoadBalancer(ctx context.Context, id string, body AddServiceToLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddServiceToLoadBalancerRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteLoadBalancerService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteLoadBalancerServiceRequest(c.Server, id, serviceId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetLoadBalancerService(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetLoadBalancerServiceRequest(c.Server, id, serviceId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateLoadBalancerServiceWithBody(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateLoadBalancerServiceRequestWithBody(c.Server, id, serviceId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateLoadBalancerService(ctx context.Context, id string, serviceId string, body UpdateLoadBalancerServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateLoadBalancerServiceRequest(c.Server, id, serviceId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetLoadBalancerServiceField(ctx context.Context, id string, serviceId string, field ResetLoadBalancerServiceFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetLoadBalancerServiceFieldRequest(c.Server, id, serviceId, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetLoadBalancerField(ctx context.Context, id string, field ResetLoadBalancerFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetLoadBalancerFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetOperation(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetOperationRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListPrivateNetworks(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListPrivateNetworksRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreatePrivateNetworkWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreatePrivateNetworkRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreatePrivateNetwork(ctx context.Context, body CreatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreatePrivateNetworkRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeletePrivateNetwork(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeletePrivateNetworkRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetPrivateNetwork(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetPrivateNetworkRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdatePrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdatePrivateNetworkRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdatePrivateNetwork(ctx context.Context, id string, body UpdatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdatePrivateNetworkRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetPrivateNetworkField(ctx context.Context, id string, field ResetPrivateNetworkFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetPrivateNetworkFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToPrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToPrivateNetworkRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToPrivateNetwork(ctx context.Context, id string, body AttachInstanceToPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToPrivateNetworkRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromPrivateNetworkWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromPrivateNetworkRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromPrivateNetwork(ctx context.Context, id string, body DetachInstanceFromPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromPrivateNetworkRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdatePrivateNetworkInstanceIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdatePrivateNetworkInstanceIpRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdatePrivateNetworkInstanceIp(ctx context.Context, id string, body UpdatePrivateNetworkInstanceIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdatePrivateNetworkInstanceIpRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListQuotas(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListQuotasRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetQuota(ctx context.Context, entity string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetQuotaRequest(c.Server, entity) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteReverseDnsElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteReverseDnsElasticIpRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetReverseDnsElasticIp(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetReverseDnsElasticIpRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateReverseDnsElasticIpWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateReverseDnsElasticIpRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateReverseDnsElasticIp(ctx context.Context, id string, body UpdateReverseDnsElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateReverseDnsElasticIpRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteReverseDnsInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteReverseDnsInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetReverseDnsInstance(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetReverseDnsInstanceRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateReverseDnsInstanceWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateReverseDnsInstanceRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateReverseDnsInstance(ctx context.Context, id string, body UpdateReverseDnsInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateReverseDnsInstanceRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSecurityGroups(ctx context.Context, params *ListSecurityGroupsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSecurityGroupsRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSecurityGroupWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSecurityGroupRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSecurityGroup(ctx context.Context, body CreateSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSecurityGroupRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteSecurityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSecurityGroupRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSecurityGroup(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSecurityGroupRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddRuleToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddRuleToSecurityGroupRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddRuleToSecurityGroup(ctx context.Context, id string, body AddRuleToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddRuleToSecurityGroupRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteRuleFromSecurityGroup(ctx context.Context, id string, ruleId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteRuleFromSecurityGroupRequest(c.Server, id, ruleId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddExternalSourceToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddExternalSourceToSecurityGroupRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AddExternalSourceToSecurityGroup(ctx context.Context, id string, body AddExternalSourceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAddExternalSourceToSecurityGroupRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToSecurityGroupRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) AttachInstanceToSecurityGroup(ctx context.Context, id string, body AttachInstanceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewAttachInstanceToSecurityGroupRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromSecurityGroupRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DetachInstanceFromSecurityGroup(ctx context.Context, id string, body DetachInstanceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDetachInstanceFromSecurityGroupRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RemoveExternalSourceFromSecurityGroupWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRemoveExternalSourceFromSecurityGroupRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RemoveExternalSourceFromSecurityGroup(ctx context.Context, id string, body RemoveExternalSourceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRemoveExternalSourceFromSecurityGroupRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSksClusters(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSksClustersRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSksClusterWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSksClusterRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSksCluster(ctx context.Context, body CreateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSksClusterRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSksClusterDeprecatedResources(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSksClusterDeprecatedResourcesRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GenerateSksClusterKubeconfigWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGenerateSksClusterKubeconfigRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GenerateSksClusterKubeconfig(ctx context.Context, id string, body GenerateSksClusterKubeconfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGenerateSksClusterKubeconfigRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSksClusterVersions(ctx context.Context, params *ListSksClusterVersionsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSksClusterVersionsRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteSksCluster(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSksClusterRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSksCluster(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSksClusterRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateSksClusterWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateSksClusterRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateSksCluster(ctx context.Context, id string, body UpdateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateSksClusterRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSksClusterAuthorityCert(ctx context.Context, id string, authority GetSksClusterAuthorityCertParamsAuthority, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSksClusterAuthorityCertRequest(c.Server, id, authority) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSksNodepoolWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSksNodepoolRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CreateSksNodepool(ctx context.Context, id string, body CreateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCreateSksNodepoolRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteSksNodepool(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSksNodepoolRequest(c.Server, id, sksNodepoolId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSksNodepool(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSksNodepoolRequest(c.Server, id, sksNodepoolId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateSksNodepoolWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateSksNodepoolRequestWithBody(c.Server, id, sksNodepoolId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateSksNodepool(ctx context.Context, id string, sksNodepoolId string, body UpdateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateSksNodepoolRequest(c.Server, id, sksNodepoolId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetSksNodepoolField(ctx context.Context, id string, sksNodepoolId string, field ResetSksNodepoolFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetSksNodepoolFieldRequest(c.Server, id, sksNodepoolId, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) EvictSksNodepoolMembersWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewEvictSksNodepoolMembersRequestWithBody(c.Server, id, sksNodepoolId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) EvictSksNodepoolMembers(ctx context.Context, id string, sksNodepoolId string, body EvictSksNodepoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewEvictSksNodepoolMembersRequest(c.Server, id, sksNodepoolId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleSksNodepoolWithBody(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleSksNodepoolRequestWithBody(c.Server, id, sksNodepoolId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ScaleSksNodepool(ctx context.Context, id string, sksNodepoolId string, body ScaleSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewScaleSksNodepoolRequest(c.Server, id, sksNodepoolId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RotateSksCcmCredentials(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRotateSksCcmCredentialsRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RotateSksOperatorsCa(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRotateSksOperatorsCaRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpgradeSksClusterWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpgradeSksClusterRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpgradeSksCluster(ctx context.Context, id string, body UpgradeSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpgradeSksClusterRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpgradeSksClusterServiceLevel(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpgradeSksClusterServiceLevelRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ResetSksClusterField(ctx context.Context, id string, field ResetSksClusterFieldParamsField, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewResetSksClusterFieldRequest(c.Server, id, field) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSnapshots(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSnapshotsRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSnapshotRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSnapshotRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ExportSnapshot(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewExportSnapshotRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) PromoteSnapshotToTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPromoteSnapshotToTemplateRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) PromoteSnapshotToTemplate(ctx context.Context, id string, body PromoteSnapshotToTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewPromoteSnapshotToTemplateRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSosBucketsUsage(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSosBucketsUsageRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSosPresignedUrl(ctx context.Context, bucket string, params *GetSosPresignedUrlParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSosPresignedUrlRequest(c.Server, bucket, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListSshKeys(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListSshKeysRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RegisterSshKeyWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRegisterSshKeyRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RegisterSshKey(ctx context.Context, body RegisterSshKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRegisterSshKeyRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteSshKey(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteSshKeyRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetSshKey(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetSshKeyRequest(c.Server, name) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListTemplates(ctx context.Context, params *ListTemplatesParams, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListTemplatesRequest(c.Server, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RegisterTemplateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRegisterTemplateRequestWithBody(c.Server, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) RegisterTemplate(ctx context.Context, body RegisterTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewRegisterTemplateRequest(c.Server, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) DeleteTemplate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewDeleteTemplateRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) GetTemplate(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewGetTemplateRequest(c.Server, id) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CopyTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCopyTemplateRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) CopyTemplate(ctx context.Context, id string, body CopyTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewCopyTemplateRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateTemplateWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateTemplateRequestWithBody(c.Server, id, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) UpdateTemplate(ctx context.Context, id string, body UpdateTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewUpdateTemplateRequest(c.Server, id, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -func (c *Client) ListZones(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewListZonesRequest(c.Server) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - if err := c.applyEditors(ctx, req, reqEditors); err != nil { - return nil, err - } - return c.Client.Do(req) -} - -// NewListAccessKeysRequest generates requests for ListAccessKeys -func NewListAccessKeysRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateAccessKeyRequest calls the generic CreateAccessKey builder with application/json body -func NewCreateAccessKeyRequest(server string, body CreateAccessKeyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateAccessKeyRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateAccessKeyRequestWithBody generates requests for CreateAccessKey with any type of body -func NewCreateAccessKeyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListAccessKeyKnownOperationsRequest generates requests for ListAccessKeyKnownOperations -func NewListAccessKeyKnownOperationsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key-known-operations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListAccessKeyOperationsRequest generates requests for ListAccessKeyOperations -func NewListAccessKeyOperationsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key-operations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRevokeAccessKeyRequest generates requests for RevokeAccessKey -func NewRevokeAccessKeyRequest(server string, key string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "key", runtime.ParamLocationPath, key) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetAccessKeyRequest generates requests for GetAccessKey -func NewGetAccessKeyRequest(server string, key string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "key", runtime.ParamLocationPath, key) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/access-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListAntiAffinityGroupsRequest generates requests for ListAntiAffinityGroups -func NewListAntiAffinityGroupsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/anti-affinity-group") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateAntiAffinityGroupRequest calls the generic CreateAntiAffinityGroup builder with application/json body -func NewCreateAntiAffinityGroupRequest(server string, body CreateAntiAffinityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateAntiAffinityGroupRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateAntiAffinityGroupRequestWithBody generates requests for CreateAntiAffinityGroup with any type of body -func NewCreateAntiAffinityGroupRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/anti-affinity-group") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteAntiAffinityGroupRequest generates requests for DeleteAntiAffinityGroup -func NewDeleteAntiAffinityGroupRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/anti-affinity-group/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetAntiAffinityGroupRequest generates requests for GetAntiAffinityGroup -func NewGetAntiAffinityGroupRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/anti-affinity-group/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListApiKeysRequest generates requests for ListApiKeys -func NewListApiKeysRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/api-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateApiKeyRequest calls the generic CreateApiKey builder with application/json body -func NewCreateApiKeyRequest(server string, body CreateApiKeyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateApiKeyRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateApiKeyRequestWithBody generates requests for CreateApiKey with any type of body -func NewCreateApiKeyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/api-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteApiKeyRequest generates requests for DeleteApiKey -func NewDeleteApiKeyRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/api-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetApiKeyRequest generates requests for GetApiKey -func NewGetApiKeyRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/api-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasCaCertificateRequest generates requests for GetDbaasCaCertificate -func NewGetDbaasCaCertificateRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-ca-certificate") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteDbaasServiceGrafanaRequest generates requests for DeleteDbaasServiceGrafana -func NewDeleteDbaasServiceGrafanaRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-grafana/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceGrafanaRequest generates requests for GetDbaasServiceGrafana -func NewGetDbaasServiceGrafanaRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-grafana/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServiceGrafanaRequest calls the generic CreateDbaasServiceGrafana builder with application/json body -func NewCreateDbaasServiceGrafanaRequest(server string, name DbaasServiceName, body CreateDbaasServiceGrafanaJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServiceGrafanaRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServiceGrafanaRequestWithBody generates requests for CreateDbaasServiceGrafana with any type of body -func NewCreateDbaasServiceGrafanaRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-grafana/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServiceGrafanaRequest calls the generic UpdateDbaasServiceGrafana builder with application/json body -func NewUpdateDbaasServiceGrafanaRequest(server string, name DbaasServiceName, body UpdateDbaasServiceGrafanaJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServiceGrafanaRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServiceGrafanaRequestWithBody generates requests for UpdateDbaasServiceGrafana with any type of body -func NewUpdateDbaasServiceGrafanaRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-grafana/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartDbaasGrafanaMaintenanceRequest generates requests for StartDbaasGrafanaMaintenance -func NewStartDbaasGrafanaMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-grafana/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasIntegrationRequest calls the generic CreateDbaasIntegration builder with application/json body -func NewCreateDbaasIntegrationRequest(server string, body CreateDbaasIntegrationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasIntegrationRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateDbaasIntegrationRequestWithBody generates requests for CreateDbaasIntegration with any type of body -func NewCreateDbaasIntegrationRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListDbaasIntegrationSettingsRequest generates requests for ListDbaasIntegrationSettings -func NewListDbaasIntegrationSettingsRequest(server string, integrationType string, sourceType string, destType string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "integration-type", runtime.ParamLocationPath, integrationType) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "source-type", runtime.ParamLocationPath, sourceType) - if err != nil { - return nil, err - } - - var pathParam2 string - - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "dest-type", runtime.ParamLocationPath, destType) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration-settings/%s/%s/%s", pathParam0, pathParam1, pathParam2) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListDbaasIntegrationTypesRequest generates requests for ListDbaasIntegrationTypes -func NewListDbaasIntegrationTypesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration-types") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteDbaasIntegrationRequest generates requests for DeleteDbaasIntegration -func NewDeleteDbaasIntegrationRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasIntegrationRequest generates requests for GetDbaasIntegration -func NewGetDbaasIntegrationRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateDbaasIntegrationRequest calls the generic UpdateDbaasIntegration builder with application/json body -func NewUpdateDbaasIntegrationRequest(server string, id string, body UpdateDbaasIntegrationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasIntegrationRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateDbaasIntegrationRequestWithBody generates requests for UpdateDbaasIntegration with any type of body -func NewUpdateDbaasIntegrationRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-integration/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasServiceKafkaRequest generates requests for DeleteDbaasServiceKafka -func NewDeleteDbaasServiceKafkaRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceKafkaRequest generates requests for GetDbaasServiceKafka -func NewGetDbaasServiceKafkaRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServiceKafkaRequest calls the generic CreateDbaasServiceKafka builder with application/json body -func NewCreateDbaasServiceKafkaRequest(server string, name DbaasServiceName, body CreateDbaasServiceKafkaJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServiceKafkaRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServiceKafkaRequestWithBody generates requests for CreateDbaasServiceKafka with any type of body -func NewCreateDbaasServiceKafkaRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServiceKafkaRequest calls the generic UpdateDbaasServiceKafka builder with application/json body -func NewUpdateDbaasServiceKafkaRequest(server string, name DbaasServiceName, body UpdateDbaasServiceKafkaJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServiceKafkaRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServiceKafkaRequestWithBody generates requests for UpdateDbaasServiceKafka with any type of body -func NewUpdateDbaasServiceKafkaRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetDbaasKafkaAclConfigRequest generates requests for GetDbaasKafkaAclConfig -func NewGetDbaasKafkaAclConfigRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/acl-config", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewStartDbaasKafkaMaintenanceRequest generates requests for StartDbaasKafkaMaintenance -func NewStartDbaasKafkaMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasKafkaSchemaRegistryAclConfigRequest calls the generic CreateDbaasKafkaSchemaRegistryAclConfig builder with application/json body -func NewCreateDbaasKafkaSchemaRegistryAclConfigRequest(server string, name DbaasServiceName, body CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasKafkaSchemaRegistryAclConfigRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasKafkaSchemaRegistryAclConfigRequestWithBody generates requests for CreateDbaasKafkaSchemaRegistryAclConfig with any type of body -func NewCreateDbaasKafkaSchemaRegistryAclConfigRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/schema-registry/acl-config", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasKafkaSchemaRegistryAclConfigRequest generates requests for DeleteDbaasKafkaSchemaRegistryAclConfig -func NewDeleteDbaasKafkaSchemaRegistryAclConfigRequest(server string, name DbaasServiceName, aclId DbaasKafkaAclId) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "acl-id", runtime.ParamLocationPath, aclId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/schema-registry/acl-config/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasKafkaTopicAclConfigRequest calls the generic CreateDbaasKafkaTopicAclConfig builder with application/json body -func NewCreateDbaasKafkaTopicAclConfigRequest(server string, name DbaasServiceName, body CreateDbaasKafkaTopicAclConfigJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasKafkaTopicAclConfigRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasKafkaTopicAclConfigRequestWithBody generates requests for CreateDbaasKafkaTopicAclConfig with any type of body -func NewCreateDbaasKafkaTopicAclConfigRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/topic/acl-config", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasKafkaTopicAclConfigRequest generates requests for DeleteDbaasKafkaTopicAclConfig -func NewDeleteDbaasKafkaTopicAclConfigRequest(server string, name DbaasServiceName, aclId DbaasKafkaAclId) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "acl-id", runtime.ParamLocationPath, aclId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/topic/acl-config/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasKafkaUserRequest calls the generic CreateDbaasKafkaUser builder with application/json body -func NewCreateDbaasKafkaUserRequest(server string, serviceName DbaasServiceName, body CreateDbaasKafkaUserJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasKafkaUserRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasKafkaUserRequestWithBody generates requests for CreateDbaasKafkaUser with any type of body -func NewCreateDbaasKafkaUserRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/user", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasKafkaUserRequest generates requests for DeleteDbaasKafkaUser -func NewDeleteDbaasKafkaUserRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/user/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetDbaasKafkaUserPasswordRequest calls the generic ResetDbaasKafkaUserPassword builder with application/json body -func NewResetDbaasKafkaUserPasswordRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasKafkaUserPasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResetDbaasKafkaUserPasswordRequestWithBody(server, serviceName, username, "application/json", bodyReader) -} - -// NewResetDbaasKafkaUserPasswordRequestWithBody generates requests for ResetDbaasKafkaUserPassword with any type of body -func NewResetDbaasKafkaUserPasswordRequestWithBody(server string, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-kafka/%s/user/%s/password/reset", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetDbaasMigrationStatusRequest generates requests for GetDbaasMigrationStatus -func NewGetDbaasMigrationStatusRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-migration-status/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteDbaasServiceMysqlRequest generates requests for DeleteDbaasServiceMysql -func NewDeleteDbaasServiceMysqlRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceMysqlRequest generates requests for GetDbaasServiceMysql -func NewGetDbaasServiceMysqlRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServiceMysqlRequest calls the generic CreateDbaasServiceMysql builder with application/json body -func NewCreateDbaasServiceMysqlRequest(server string, name DbaasServiceName, body CreateDbaasServiceMysqlJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServiceMysqlRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServiceMysqlRequestWithBody generates requests for CreateDbaasServiceMysql with any type of body -func NewCreateDbaasServiceMysqlRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServiceMysqlRequest calls the generic UpdateDbaasServiceMysql builder with application/json body -func NewUpdateDbaasServiceMysqlRequest(server string, name DbaasServiceName, body UpdateDbaasServiceMysqlJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServiceMysqlRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServiceMysqlRequestWithBody generates requests for UpdateDbaasServiceMysql with any type of body -func NewUpdateDbaasServiceMysqlRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartDbaasMysqlMaintenanceRequest generates requests for StartDbaasMysqlMaintenance -func NewStartDbaasMysqlMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewStopDbaasMysqlMigrationRequest generates requests for StopDbaasMysqlMigration -func NewStopDbaasMysqlMigrationRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/migration/stop", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasMysqlDatabaseRequest calls the generic CreateDbaasMysqlDatabase builder with application/json body -func NewCreateDbaasMysqlDatabaseRequest(server string, serviceName DbaasServiceName, body CreateDbaasMysqlDatabaseJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasMysqlDatabaseRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasMysqlDatabaseRequestWithBody generates requests for CreateDbaasMysqlDatabase with any type of body -func NewCreateDbaasMysqlDatabaseRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/database", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasMysqlDatabaseRequest generates requests for DeleteDbaasMysqlDatabase -func NewDeleteDbaasMysqlDatabaseRequest(server string, serviceName DbaasServiceName, databaseName DbaasMysqlDatabaseName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "database-name", runtime.ParamLocationPath, databaseName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/database/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasMysqlUserRequest calls the generic CreateDbaasMysqlUser builder with application/json body -func NewCreateDbaasMysqlUserRequest(server string, serviceName DbaasServiceName, body CreateDbaasMysqlUserJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasMysqlUserRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasMysqlUserRequestWithBody generates requests for CreateDbaasMysqlUser with any type of body -func NewCreateDbaasMysqlUserRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/user", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasMysqlUserRequest generates requests for DeleteDbaasMysqlUser -func NewDeleteDbaasMysqlUserRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/user/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetDbaasMysqlUserPasswordRequest calls the generic ResetDbaasMysqlUserPassword builder with application/json body -func NewResetDbaasMysqlUserPasswordRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasMysqlUserPasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResetDbaasMysqlUserPasswordRequestWithBody(server, serviceName, username, "application/json", bodyReader) -} - -// NewResetDbaasMysqlUserPasswordRequestWithBody generates requests for ResetDbaasMysqlUserPassword with any type of body -func NewResetDbaasMysqlUserPasswordRequestWithBody(server string, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-mysql/%s/user/%s/password/reset", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasServiceOpensearchRequest generates requests for DeleteDbaasServiceOpensearch -func NewDeleteDbaasServiceOpensearchRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceOpensearchRequest generates requests for GetDbaasServiceOpensearch -func NewGetDbaasServiceOpensearchRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServiceOpensearchRequest calls the generic CreateDbaasServiceOpensearch builder with application/json body -func NewCreateDbaasServiceOpensearchRequest(server string, name DbaasServiceName, body CreateDbaasServiceOpensearchJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServiceOpensearchRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServiceOpensearchRequestWithBody generates requests for CreateDbaasServiceOpensearch with any type of body -func NewCreateDbaasServiceOpensearchRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServiceOpensearchRequest calls the generic UpdateDbaasServiceOpensearch builder with application/json body -func NewUpdateDbaasServiceOpensearchRequest(server string, name DbaasServiceName, body UpdateDbaasServiceOpensearchJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServiceOpensearchRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServiceOpensearchRequestWithBody generates requests for UpdateDbaasServiceOpensearch with any type of body -func NewUpdateDbaasServiceOpensearchRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetDbaasOpensearchAclConfigRequest generates requests for GetDbaasOpensearchAclConfig -func NewGetDbaasOpensearchAclConfigRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/acl-config", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateDbaasOpensearchAclConfigRequest calls the generic UpdateDbaasOpensearchAclConfig builder with application/json body -func NewUpdateDbaasOpensearchAclConfigRequest(server string, name DbaasServiceName, body UpdateDbaasOpensearchAclConfigJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasOpensearchAclConfigRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasOpensearchAclConfigRequestWithBody generates requests for UpdateDbaasOpensearchAclConfig with any type of body -func NewUpdateDbaasOpensearchAclConfigRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/acl-config", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartDbaasOpensearchMaintenanceRequest generates requests for StartDbaasOpensearchMaintenance -func NewStartDbaasOpensearchMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasOpensearchUserRequest calls the generic CreateDbaasOpensearchUser builder with application/json body -func NewCreateDbaasOpensearchUserRequest(server string, serviceName DbaasServiceName, body CreateDbaasOpensearchUserJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasOpensearchUserRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasOpensearchUserRequestWithBody generates requests for CreateDbaasOpensearchUser with any type of body -func NewCreateDbaasOpensearchUserRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/user", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasOpensearchUserRequest generates requests for DeleteDbaasOpensearchUser -func NewDeleteDbaasOpensearchUserRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/user/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetDbaasOpensearchUserPasswordRequest calls the generic ResetDbaasOpensearchUserPassword builder with application/json body -func NewResetDbaasOpensearchUserPasswordRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasOpensearchUserPasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResetDbaasOpensearchUserPasswordRequestWithBody(server, serviceName, username, "application/json", bodyReader) -} - -// NewResetDbaasOpensearchUserPasswordRequestWithBody generates requests for ResetDbaasOpensearchUserPassword with any type of body -func NewResetDbaasOpensearchUserPasswordRequestWithBody(server string, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-opensearch/%s/user/%s/password/reset", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasServicePgRequest generates requests for DeleteDbaasServicePg -func NewDeleteDbaasServicePgRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServicePgRequest generates requests for GetDbaasServicePg -func NewGetDbaasServicePgRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServicePgRequest calls the generic CreateDbaasServicePg builder with application/json body -func NewCreateDbaasServicePgRequest(server string, name DbaasServiceName, body CreateDbaasServicePgJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServicePgRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServicePgRequestWithBody generates requests for CreateDbaasServicePg with any type of body -func NewCreateDbaasServicePgRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServicePgRequest calls the generic UpdateDbaasServicePg builder with application/json body -func NewUpdateDbaasServicePgRequest(server string, name DbaasServiceName, body UpdateDbaasServicePgJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServicePgRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServicePgRequestWithBody generates requests for UpdateDbaasServicePg with any type of body -func NewUpdateDbaasServicePgRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartDbaasPgMaintenanceRequest generates requests for StartDbaasPgMaintenance -func NewStartDbaasPgMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewStopDbaasPgMigrationRequest generates requests for StopDbaasPgMigration -func NewStopDbaasPgMigrationRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/migration/stop", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasPgConnectionPoolRequest calls the generic CreateDbaasPgConnectionPool builder with application/json body -func NewCreateDbaasPgConnectionPoolRequest(server string, serviceName DbaasServiceName, body CreateDbaasPgConnectionPoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasPgConnectionPoolRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasPgConnectionPoolRequestWithBody generates requests for CreateDbaasPgConnectionPool with any type of body -func NewCreateDbaasPgConnectionPoolRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/connection-pool", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasPgConnectionPoolRequest generates requests for DeleteDbaasPgConnectionPool -func NewDeleteDbaasPgConnectionPoolRequest(server string, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "connection-pool-name", runtime.ParamLocationPath, connectionPoolName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/connection-pool/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateDbaasPgConnectionPoolRequest calls the generic UpdateDbaasPgConnectionPool builder with application/json body -func NewUpdateDbaasPgConnectionPoolRequest(server string, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, body UpdateDbaasPgConnectionPoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasPgConnectionPoolRequestWithBody(server, serviceName, connectionPoolName, "application/json", bodyReader) -} - -// NewUpdateDbaasPgConnectionPoolRequestWithBody generates requests for UpdateDbaasPgConnectionPool with any type of body -func NewUpdateDbaasPgConnectionPoolRequestWithBody(server string, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "connection-pool-name", runtime.ParamLocationPath, connectionPoolName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/connection-pool/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewCreateDbaasPgDatabaseRequest calls the generic CreateDbaasPgDatabase builder with application/json body -func NewCreateDbaasPgDatabaseRequest(server string, serviceName DbaasServiceName, body CreateDbaasPgDatabaseJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasPgDatabaseRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasPgDatabaseRequestWithBody generates requests for CreateDbaasPgDatabase with any type of body -func NewCreateDbaasPgDatabaseRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/database", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasPgDatabaseRequest generates requests for DeleteDbaasPgDatabase -func NewDeleteDbaasPgDatabaseRequest(server string, serviceName DbaasServiceName, databaseName DbaasPgDatabaseName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "database-name", runtime.ParamLocationPath, databaseName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/database/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasPostgresUserRequest calls the generic CreateDbaasPostgresUser builder with application/json body -func NewCreateDbaasPostgresUserRequest(server string, serviceName DbaasServiceName, body CreateDbaasPostgresUserJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasPostgresUserRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewCreateDbaasPostgresUserRequestWithBody generates requests for CreateDbaasPostgresUser with any type of body -func NewCreateDbaasPostgresUserRequestWithBody(server string, serviceName DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/user", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasPostgresUserRequest generates requests for DeleteDbaasPostgresUser -func NewDeleteDbaasPostgresUserRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/user/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateDbaasPostgresAllowReplicationRequest calls the generic UpdateDbaasPostgresAllowReplication builder with application/json body -func NewUpdateDbaasPostgresAllowReplicationRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername, body UpdateDbaasPostgresAllowReplicationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasPostgresAllowReplicationRequestWithBody(server, serviceName, username, "application/json", bodyReader) -} - -// NewUpdateDbaasPostgresAllowReplicationRequestWithBody generates requests for UpdateDbaasPostgresAllowReplication with any type of body -func NewUpdateDbaasPostgresAllowReplicationRequestWithBody(server string, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/user/%s/allow-replication", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetDbaasPostgresUserPasswordRequest calls the generic ResetDbaasPostgresUserPassword builder with application/json body -func NewResetDbaasPostgresUserPasswordRequest(server string, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasPostgresUserPasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResetDbaasPostgresUserPasswordRequestWithBody(server, serviceName, username, "application/json", bodyReader) -} - -// NewResetDbaasPostgresUserPasswordRequestWithBody generates requests for ResetDbaasPostgresUserPassword with any type of body -func NewResetDbaasPostgresUserPasswordRequestWithBody(server string, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "username", runtime.ParamLocationPath, username) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/user/%s/password/reset", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewCreateDbaasPgUpgradeCheckRequest calls the generic CreateDbaasPgUpgradeCheck builder with application/json body -func NewCreateDbaasPgUpgradeCheckRequest(server string, service DbaasServiceName, body CreateDbaasPgUpgradeCheckJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasPgUpgradeCheckRequestWithBody(server, service, "application/json", bodyReader) -} - -// NewCreateDbaasPgUpgradeCheckRequestWithBody generates requests for CreateDbaasPgUpgradeCheck with any type of body -func NewCreateDbaasPgUpgradeCheckRequestWithBody(server string, service DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service", runtime.ParamLocationPath, service) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-postgres/%s/upgrade-check", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDbaasServiceRedisRequest generates requests for DeleteDbaasServiceRedis -func NewDeleteDbaasServiceRedisRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceRedisRequest generates requests for GetDbaasServiceRedis -func NewGetDbaasServiceRedisRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasServiceRedisRequest calls the generic CreateDbaasServiceRedis builder with application/json body -func NewCreateDbaasServiceRedisRequest(server string, name DbaasServiceName, body CreateDbaasServiceRedisJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasServiceRedisRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewCreateDbaasServiceRedisRequestWithBody generates requests for CreateDbaasServiceRedis with any type of body -func NewCreateDbaasServiceRedisRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateDbaasServiceRedisRequest calls the generic UpdateDbaasServiceRedis builder with application/json body -func NewUpdateDbaasServiceRedisRequest(server string, name DbaasServiceName, body UpdateDbaasServiceRedisJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDbaasServiceRedisRequestWithBody(server, name, "application/json", bodyReader) -} - -// NewUpdateDbaasServiceRedisRequestWithBody generates requests for UpdateDbaasServiceRedis with any type of body -func NewUpdateDbaasServiceRedisRequestWithBody(server string, name DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartDbaasRedisMaintenanceRequest generates requests for StartDbaasRedisMaintenance -func NewStartDbaasRedisMaintenanceRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s/maintenance/start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewStopDbaasRedisMigrationRequest generates requests for StopDbaasRedisMigration -func NewStopDbaasRedisMigrationRequest(server string, name DbaasServiceName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-redis/%s/migration/stop", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListDbaasServicesRequest generates requests for ListDbaasServices -func NewListDbaasServicesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceLogsRequest calls the generic GetDbaasServiceLogs builder with application/json body -func NewGetDbaasServiceLogsRequest(server string, serviceName string, body GetDbaasServiceLogsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewGetDbaasServiceLogsRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewGetDbaasServiceLogsRequestWithBody generates requests for GetDbaasServiceLogs with any type of body -func NewGetDbaasServiceLogsRequestWithBody(server string, serviceName string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service-logs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetDbaasServiceMetricsRequest calls the generic GetDbaasServiceMetrics builder with application/json body -func NewGetDbaasServiceMetricsRequest(server string, serviceName string, body GetDbaasServiceMetricsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewGetDbaasServiceMetricsRequestWithBody(server, serviceName, "application/json", bodyReader) -} - -// NewGetDbaasServiceMetricsRequestWithBody generates requests for GetDbaasServiceMetrics with any type of body -func NewGetDbaasServiceMetricsRequestWithBody(server string, serviceName string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-name", runtime.ParamLocationPath, serviceName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service-metrics/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListDbaasServiceTypesRequest generates requests for ListDbaasServiceTypes -func NewListDbaasServiceTypesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service-type") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasServiceTypeRequest generates requests for GetDbaasServiceType -func NewGetDbaasServiceTypeRequest(server string, serviceTypeName string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service-type-name", runtime.ParamLocationPath, serviceTypeName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service-type/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteDbaasServiceRequest generates requests for DeleteDbaasService -func NewDeleteDbaasServiceRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-service/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsGrafanaRequest generates requests for GetDbaasSettingsGrafana -func NewGetDbaasSettingsGrafanaRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-grafana") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsKafkaRequest generates requests for GetDbaasSettingsKafka -func NewGetDbaasSettingsKafkaRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-kafka") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsMysqlRequest generates requests for GetDbaasSettingsMysql -func NewGetDbaasSettingsMysqlRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-mysql") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsOpensearchRequest generates requests for GetDbaasSettingsOpensearch -func NewGetDbaasSettingsOpensearchRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-opensearch") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsPgRequest generates requests for GetDbaasSettingsPg -func NewGetDbaasSettingsPgRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-pg") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDbaasSettingsRedisRequest generates requests for GetDbaasSettingsRedis -func NewGetDbaasSettingsRedisRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-settings-redis") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDbaasTaskMigrationCheckRequest calls the generic CreateDbaasTaskMigrationCheck builder with application/json body -func NewCreateDbaasTaskMigrationCheckRequest(server string, service DbaasServiceName, body CreateDbaasTaskMigrationCheckJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDbaasTaskMigrationCheckRequestWithBody(server, service, "application/json", bodyReader) -} - -// NewCreateDbaasTaskMigrationCheckRequestWithBody generates requests for CreateDbaasTaskMigrationCheck with any type of body -func NewCreateDbaasTaskMigrationCheckRequestWithBody(server string, service DbaasServiceName, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service", runtime.ParamLocationPath, service) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-task-migration-check/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetDbaasTaskRequest generates requests for GetDbaasTask -func NewGetDbaasTaskRequest(server string, service DbaasServiceName, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "service", runtime.ParamLocationPath, service) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbaas-task/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListDeployTargetsRequest generates requests for ListDeployTargets -func NewListDeployTargetsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/deploy-target") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDeployTargetRequest generates requests for GetDeployTarget -func NewGetDeployTargetRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/deploy-target/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListDnsDomainsRequest generates requests for ListDnsDomains -func NewListDnsDomainsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDnsDomainRequest calls the generic CreateDnsDomain builder with application/json body -func NewCreateDnsDomainRequest(server string, body CreateDnsDomainJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDnsDomainRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateDnsDomainRequestWithBody generates requests for CreateDnsDomain with any type of body -func NewCreateDnsDomainRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListDnsDomainRecordsRequest generates requests for ListDnsDomainRecords -func NewListDnsDomainRecordsRequest(server string, domainId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "domain-id", runtime.ParamLocationPath, domainId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/record", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateDnsDomainRecordRequest calls the generic CreateDnsDomainRecord builder with application/json body -func NewCreateDnsDomainRecordRequest(server string, domainId string, body CreateDnsDomainRecordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateDnsDomainRecordRequestWithBody(server, domainId, "application/json", bodyReader) -} - -// NewCreateDnsDomainRecordRequestWithBody generates requests for CreateDnsDomainRecord with any type of body -func NewCreateDnsDomainRecordRequestWithBody(server string, domainId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "domain-id", runtime.ParamLocationPath, domainId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/record", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDnsDomainRecordRequest generates requests for DeleteDnsDomainRecord -func NewDeleteDnsDomainRecordRequest(server string, domainId string, recordId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "domain-id", runtime.ParamLocationPath, domainId) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "record-id", runtime.ParamLocationPath, recordId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/record/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDnsDomainRecordRequest generates requests for GetDnsDomainRecord -func NewGetDnsDomainRecordRequest(server string, domainId string, recordId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "domain-id", runtime.ParamLocationPath, domainId) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "record-id", runtime.ParamLocationPath, recordId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/record/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateDnsDomainRecordRequest calls the generic UpdateDnsDomainRecord builder with application/json body -func NewUpdateDnsDomainRecordRequest(server string, domainId string, recordId string, body UpdateDnsDomainRecordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateDnsDomainRecordRequestWithBody(server, domainId, recordId, "application/json", bodyReader) -} - -// NewUpdateDnsDomainRecordRequestWithBody generates requests for UpdateDnsDomainRecord with any type of body -func NewUpdateDnsDomainRecordRequestWithBody(server string, domainId string, recordId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "domain-id", runtime.ParamLocationPath, domainId) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "record-id", runtime.ParamLocationPath, recordId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/record/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteDnsDomainRequest generates requests for DeleteDnsDomain -func NewDeleteDnsDomainRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDnsDomainRequest generates requests for GetDnsDomain -func NewGetDnsDomainRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetDnsDomainZoneFileRequest generates requests for GetDnsDomainZoneFile -func NewGetDnsDomainZoneFileRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dns-domain/%s/zone", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListElasticIpsRequest generates requests for ListElasticIps -func NewListElasticIpsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateElasticIpRequest calls the generic CreateElasticIp builder with application/json body -func NewCreateElasticIpRequest(server string, body CreateElasticIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateElasticIpRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateElasticIpRequestWithBody generates requests for CreateElasticIp with any type of body -func NewCreateElasticIpRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteElasticIpRequest generates requests for DeleteElasticIp -func NewDeleteElasticIpRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetElasticIpRequest generates requests for GetElasticIp -func NewGetElasticIpRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateElasticIpRequest calls the generic UpdateElasticIp builder with application/json body -func NewUpdateElasticIpRequest(server string, id string, body UpdateElasticIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateElasticIpRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateElasticIpRequestWithBody generates requests for UpdateElasticIp with any type of body -func NewUpdateElasticIpRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetElasticIpFieldRequest generates requests for ResetElasticIpField -func NewResetElasticIpFieldRequest(server string, id string, field ResetElasticIpFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewAttachInstanceToElasticIpRequest calls the generic AttachInstanceToElasticIp builder with application/json body -func NewAttachInstanceToElasticIpRequest(server string, id string, body AttachInstanceToElasticIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAttachInstanceToElasticIpRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAttachInstanceToElasticIpRequestWithBody generates requests for AttachInstanceToElasticIp with any type of body -func NewAttachInstanceToElasticIpRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s:attach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDetachInstanceFromElasticIpRequest calls the generic DetachInstanceFromElasticIp builder with application/json body -func NewDetachInstanceFromElasticIpRequest(server string, id string, body DetachInstanceFromElasticIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewDetachInstanceFromElasticIpRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewDetachInstanceFromElasticIpRequestWithBody generates requests for DetachInstanceFromElasticIp with any type of body -func NewDetachInstanceFromElasticIpRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/elastic-ip/%s:detach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListEventsRequest generates requests for ListEvents -func NewListEventsRequest(server string, params *ListEventsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/event") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.From != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "from", runtime.ParamLocationQuery, *params.From); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.To != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "to", runtime.ParamLocationQuery, *params.To); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetIamOrganizationPolicyRequest generates requests for GetIamOrganizationPolicy -func NewGetIamOrganizationPolicyRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-organization-policy") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateIamOrganizationPolicyRequest calls the generic UpdateIamOrganizationPolicy builder with application/json body -func NewUpdateIamOrganizationPolicyRequest(server string, body UpdateIamOrganizationPolicyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateIamOrganizationPolicyRequestWithBody(server, "application/json", bodyReader) -} - -// NewUpdateIamOrganizationPolicyRequestWithBody generates requests for UpdateIamOrganizationPolicy with any type of body -func NewUpdateIamOrganizationPolicyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-organization-policy") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListIamRolesRequest generates requests for ListIamRoles -func NewListIamRolesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateIamRoleRequest calls the generic CreateIamRole builder with application/json body -func NewCreateIamRoleRequest(server string, body CreateIamRoleJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateIamRoleRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateIamRoleRequestWithBody generates requests for CreateIamRole with any type of body -func NewCreateIamRoleRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteIamRoleRequest generates requests for DeleteIamRole -func NewDeleteIamRoleRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetIamRoleRequest generates requests for GetIamRole -func NewGetIamRoleRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateIamRoleRequest calls the generic UpdateIamRole builder with application/json body -func NewUpdateIamRoleRequest(server string, id string, body UpdateIamRoleJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateIamRoleRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateIamRoleRequestWithBody generates requests for UpdateIamRole with any type of body -func NewUpdateIamRoleRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateIamRolePolicyRequest calls the generic UpdateIamRolePolicy builder with application/json body -func NewUpdateIamRolePolicyRequest(server string, id string, body UpdateIamRolePolicyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateIamRolePolicyRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateIamRolePolicyRequestWithBody generates requests for UpdateIamRolePolicy with any type of body -func NewUpdateIamRolePolicyRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/iam-role/%s:policy", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListInstancesRequest generates requests for ListInstances -func NewListInstancesRequest(server string, params *ListInstancesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.ManagerId != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "manager-id", runtime.ParamLocationQuery, *params.ManagerId); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.ManagerType != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "manager-type", runtime.ParamLocationQuery, *params.ManagerType); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.IpAddress != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "ip-address", runtime.ParamLocationQuery, *params.IpAddress); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateInstanceRequest calls the generic CreateInstance builder with application/json body -func NewCreateInstanceRequest(server string, body CreateInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateInstanceRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateInstanceRequestWithBody generates requests for CreateInstance with any type of body -func NewCreateInstanceRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListInstancePoolsRequest generates requests for ListInstancePools -func NewListInstancePoolsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateInstancePoolRequest calls the generic CreateInstancePool builder with application/json body -func NewCreateInstancePoolRequest(server string, body CreateInstancePoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateInstancePoolRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateInstancePoolRequestWithBody generates requests for CreateInstancePool with any type of body -func NewCreateInstancePoolRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteInstancePoolRequest generates requests for DeleteInstancePool -func NewDeleteInstancePoolRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetInstancePoolRequest generates requests for GetInstancePool -func NewGetInstancePoolRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateInstancePoolRequest calls the generic UpdateInstancePool builder with application/json body -func NewUpdateInstancePoolRequest(server string, id string, body UpdateInstancePoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateInstancePoolRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateInstancePoolRequestWithBody generates requests for UpdateInstancePool with any type of body -func NewUpdateInstancePoolRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetInstancePoolFieldRequest generates requests for ResetInstancePoolField -func NewResetInstancePoolFieldRequest(server string, id string, field ResetInstancePoolFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewEvictInstancePoolMembersRequest calls the generic EvictInstancePoolMembers builder with application/json body -func NewEvictInstancePoolMembersRequest(server string, id string, body EvictInstancePoolMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewEvictInstancePoolMembersRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewEvictInstancePoolMembersRequestWithBody generates requests for EvictInstancePoolMembers with any type of body -func NewEvictInstancePoolMembersRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s:evict", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewScaleInstancePoolRequest calls the generic ScaleInstancePool builder with application/json body -func NewScaleInstancePoolRequest(server string, id string, body ScaleInstancePoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewScaleInstancePoolRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewScaleInstancePoolRequestWithBody generates requests for ScaleInstancePool with any type of body -func NewScaleInstancePoolRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-pool/%s:scale", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListInstanceTypesRequest generates requests for ListInstanceTypes -func NewListInstanceTypesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-type") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetInstanceTypeRequest generates requests for GetInstanceType -func NewGetInstanceTypeRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance-type/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteInstanceRequest generates requests for DeleteInstance -func NewDeleteInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetInstanceRequest generates requests for GetInstance -func NewGetInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateInstanceRequest calls the generic UpdateInstance builder with application/json body -func NewUpdateInstanceRequest(server string, id string, body UpdateInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateInstanceRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateInstanceRequestWithBody generates requests for UpdateInstance with any type of body -func NewUpdateInstanceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetInstanceFieldRequest generates requests for ResetInstanceField -func NewResetInstanceFieldRequest(server string, id string, field ResetInstanceFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewAddInstanceProtectionRequest generates requests for AddInstanceProtection -func NewAddInstanceProtectionRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:add-protection", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateSnapshotRequest generates requests for CreateSnapshot -func NewCreateSnapshotRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:create-snapshot", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRevealInstancePasswordRequest generates requests for RevealInstancePassword -func NewRevealInstancePasswordRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:password", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRebootInstanceRequest generates requests for RebootInstance -func NewRebootInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:reboot", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRemoveInstanceProtectionRequest generates requests for RemoveInstanceProtection -func NewRemoveInstanceProtectionRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:remove-protection", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetInstanceRequest calls the generic ResetInstance builder with application/json body -func NewResetInstanceRequest(server string, id string, body ResetInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResetInstanceRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewResetInstanceRequestWithBody generates requests for ResetInstance with any type of body -func NewResetInstanceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:reset", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetInstancePasswordRequest generates requests for ResetInstancePassword -func NewResetInstancePasswordRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:reset-password", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResizeInstanceDiskRequest calls the generic ResizeInstanceDisk builder with application/json body -func NewResizeInstanceDiskRequest(server string, id string, body ResizeInstanceDiskJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewResizeInstanceDiskRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewResizeInstanceDiskRequestWithBody generates requests for ResizeInstanceDisk with any type of body -func NewResizeInstanceDiskRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:resize-disk", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewScaleInstanceRequest calls the generic ScaleInstance builder with application/json body -func NewScaleInstanceRequest(server string, id string, body ScaleInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewScaleInstanceRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewScaleInstanceRequestWithBody generates requests for ScaleInstance with any type of body -func NewScaleInstanceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:scale", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStartInstanceRequest calls the generic StartInstance builder with application/json body -func NewStartInstanceRequest(server string, id string, body StartInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewStartInstanceRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewStartInstanceRequestWithBody generates requests for StartInstance with any type of body -func NewStartInstanceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:start", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewStopInstanceRequest generates requests for StopInstance -func NewStopInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:stop", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRevertInstanceToSnapshotRequest calls the generic RevertInstanceToSnapshot builder with application/json body -func NewRevertInstanceToSnapshotRequest(server string, instanceId string, body RevertInstanceToSnapshotJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewRevertInstanceToSnapshotRequestWithBody(server, instanceId, "application/json", bodyReader) -} - -// NewRevertInstanceToSnapshotRequestWithBody generates requests for RevertInstanceToSnapshot with any type of body -func NewRevertInstanceToSnapshotRequestWithBody(server string, instanceId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "instance-id", runtime.ParamLocationPath, instanceId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/instance/%s:revert-snapshot", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListLoadBalancersRequest generates requests for ListLoadBalancers -func NewListLoadBalancersRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateLoadBalancerRequest calls the generic CreateLoadBalancer builder with application/json body -func NewCreateLoadBalancerRequest(server string, body CreateLoadBalancerJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateLoadBalancerRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateLoadBalancerRequestWithBody generates requests for CreateLoadBalancer with any type of body -func NewCreateLoadBalancerRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteLoadBalancerRequest generates requests for DeleteLoadBalancer -func NewDeleteLoadBalancerRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLoadBalancerRequest generates requests for GetLoadBalancer -func NewGetLoadBalancerRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateLoadBalancerRequest calls the generic UpdateLoadBalancer builder with application/json body -func NewUpdateLoadBalancerRequest(server string, id string, body UpdateLoadBalancerJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateLoadBalancerRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateLoadBalancerRequestWithBody generates requests for UpdateLoadBalancer with any type of body -func NewUpdateLoadBalancerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewAddServiceToLoadBalancerRequest calls the generic AddServiceToLoadBalancer builder with application/json body -func NewAddServiceToLoadBalancerRequest(server string, id string, body AddServiceToLoadBalancerJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAddServiceToLoadBalancerRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAddServiceToLoadBalancerRequestWithBody generates requests for AddServiceToLoadBalancer with any type of body -func NewAddServiceToLoadBalancerRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/service", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteLoadBalancerServiceRequest generates requests for DeleteLoadBalancerService -func NewDeleteLoadBalancerServiceRequest(server string, id string, serviceId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "service-id", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/service/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetLoadBalancerServiceRequest generates requests for GetLoadBalancerService -func NewGetLoadBalancerServiceRequest(server string, id string, serviceId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "service-id", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/service/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateLoadBalancerServiceRequest calls the generic UpdateLoadBalancerService builder with application/json body -func NewUpdateLoadBalancerServiceRequest(server string, id string, serviceId string, body UpdateLoadBalancerServiceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateLoadBalancerServiceRequestWithBody(server, id, serviceId, "application/json", bodyReader) -} - -// NewUpdateLoadBalancerServiceRequestWithBody generates requests for UpdateLoadBalancerService with any type of body -func NewUpdateLoadBalancerServiceRequestWithBody(server string, id string, serviceId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "service-id", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/service/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetLoadBalancerServiceFieldRequest generates requests for ResetLoadBalancerServiceField -func NewResetLoadBalancerServiceFieldRequest(server string, id string, serviceId string, field ResetLoadBalancerServiceFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "service-id", runtime.ParamLocationPath, serviceId) - if err != nil { - return nil, err - } - - var pathParam2 string - - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/service/%s/%s", pathParam0, pathParam1, pathParam2) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetLoadBalancerFieldRequest generates requests for ResetLoadBalancerField -func NewResetLoadBalancerFieldRequest(server string, id string, field ResetLoadBalancerFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/load-balancer/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetOperationRequest generates requests for GetOperation -func NewGetOperationRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/operation/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListPrivateNetworksRequest generates requests for ListPrivateNetworks -func NewListPrivateNetworksRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreatePrivateNetworkRequest calls the generic CreatePrivateNetwork builder with application/json body -func NewCreatePrivateNetworkRequest(server string, body CreatePrivateNetworkJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreatePrivateNetworkRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreatePrivateNetworkRequestWithBody generates requests for CreatePrivateNetwork with any type of body -func NewCreatePrivateNetworkRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeletePrivateNetworkRequest generates requests for DeletePrivateNetwork -func NewDeletePrivateNetworkRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetPrivateNetworkRequest generates requests for GetPrivateNetwork -func NewGetPrivateNetworkRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdatePrivateNetworkRequest calls the generic UpdatePrivateNetwork builder with application/json body -func NewUpdatePrivateNetworkRequest(server string, id string, body UpdatePrivateNetworkJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdatePrivateNetworkRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdatePrivateNetworkRequestWithBody generates requests for UpdatePrivateNetwork with any type of body -func NewUpdatePrivateNetworkRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetPrivateNetworkFieldRequest generates requests for ResetPrivateNetworkField -func NewResetPrivateNetworkFieldRequest(server string, id string, field ResetPrivateNetworkFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewAttachInstanceToPrivateNetworkRequest calls the generic AttachInstanceToPrivateNetwork builder with application/json body -func NewAttachInstanceToPrivateNetworkRequest(server string, id string, body AttachInstanceToPrivateNetworkJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAttachInstanceToPrivateNetworkRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAttachInstanceToPrivateNetworkRequestWithBody generates requests for AttachInstanceToPrivateNetwork with any type of body -func NewAttachInstanceToPrivateNetworkRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s:attach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDetachInstanceFromPrivateNetworkRequest calls the generic DetachInstanceFromPrivateNetwork builder with application/json body -func NewDetachInstanceFromPrivateNetworkRequest(server string, id string, body DetachInstanceFromPrivateNetworkJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewDetachInstanceFromPrivateNetworkRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewDetachInstanceFromPrivateNetworkRequestWithBody generates requests for DetachInstanceFromPrivateNetwork with any type of body -func NewDetachInstanceFromPrivateNetworkRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s:detach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdatePrivateNetworkInstanceIpRequest calls the generic UpdatePrivateNetworkInstanceIp builder with application/json body -func NewUpdatePrivateNetworkInstanceIpRequest(server string, id string, body UpdatePrivateNetworkInstanceIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdatePrivateNetworkInstanceIpRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdatePrivateNetworkInstanceIpRequestWithBody generates requests for UpdatePrivateNetworkInstanceIp with any type of body -func NewUpdatePrivateNetworkInstanceIpRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/private-network/%s:update-ip", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListQuotasRequest generates requests for ListQuotas -func NewListQuotasRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/quota") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetQuotaRequest generates requests for GetQuota -func NewGetQuotaRequest(server string, entity string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "entity", runtime.ParamLocationPath, entity) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/quota/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteReverseDnsElasticIpRequest generates requests for DeleteReverseDnsElasticIp -func NewDeleteReverseDnsElasticIpRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetReverseDnsElasticIpRequest generates requests for GetReverseDnsElasticIp -func NewGetReverseDnsElasticIpRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateReverseDnsElasticIpRequest calls the generic UpdateReverseDnsElasticIp builder with application/json body -func NewUpdateReverseDnsElasticIpRequest(server string, id string, body UpdateReverseDnsElasticIpJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateReverseDnsElasticIpRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateReverseDnsElasticIpRequestWithBody generates requests for UpdateReverseDnsElasticIp with any type of body -func NewUpdateReverseDnsElasticIpRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/elastic-ip/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteReverseDnsInstanceRequest generates requests for DeleteReverseDnsInstance -func NewDeleteReverseDnsInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetReverseDnsInstanceRequest generates requests for GetReverseDnsInstance -func NewGetReverseDnsInstanceRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateReverseDnsInstanceRequest calls the generic UpdateReverseDnsInstance builder with application/json body -func NewUpdateReverseDnsInstanceRequest(server string, id string, body UpdateReverseDnsInstanceJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateReverseDnsInstanceRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateReverseDnsInstanceRequestWithBody generates requests for UpdateReverseDnsInstance with any type of body -func NewUpdateReverseDnsInstanceRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/reverse-dns/instance/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListSecurityGroupsRequest generates requests for ListSecurityGroups -func NewListSecurityGroupsRequest(server string, params *ListSecurityGroupsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Visibility != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "visibility", runtime.ParamLocationQuery, *params.Visibility); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateSecurityGroupRequest calls the generic CreateSecurityGroup builder with application/json body -func NewCreateSecurityGroupRequest(server string, body CreateSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateSecurityGroupRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateSecurityGroupRequestWithBody generates requests for CreateSecurityGroup with any type of body -func NewCreateSecurityGroupRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteSecurityGroupRequest generates requests for DeleteSecurityGroup -func NewDeleteSecurityGroupRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSecurityGroupRequest generates requests for GetSecurityGroup -func NewGetSecurityGroupRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewAddRuleToSecurityGroupRequest calls the generic AddRuleToSecurityGroup builder with application/json body -func NewAddRuleToSecurityGroupRequest(server string, id string, body AddRuleToSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAddRuleToSecurityGroupRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAddRuleToSecurityGroupRequestWithBody generates requests for AddRuleToSecurityGroup with any type of body -func NewAddRuleToSecurityGroupRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s/rules", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteRuleFromSecurityGroupRequest generates requests for DeleteRuleFromSecurityGroup -func NewDeleteRuleFromSecurityGroupRequest(server string, id string, ruleId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "rule-id", runtime.ParamLocationPath, ruleId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s/rules/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewAddExternalSourceToSecurityGroupRequest calls the generic AddExternalSourceToSecurityGroup builder with application/json body -func NewAddExternalSourceToSecurityGroupRequest(server string, id string, body AddExternalSourceToSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAddExternalSourceToSecurityGroupRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAddExternalSourceToSecurityGroupRequestWithBody generates requests for AddExternalSourceToSecurityGroup with any type of body -func NewAddExternalSourceToSecurityGroupRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s:add-source", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewAttachInstanceToSecurityGroupRequest calls the generic AttachInstanceToSecurityGroup builder with application/json body -func NewAttachInstanceToSecurityGroupRequest(server string, id string, body AttachInstanceToSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewAttachInstanceToSecurityGroupRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewAttachInstanceToSecurityGroupRequestWithBody generates requests for AttachInstanceToSecurityGroup with any type of body -func NewAttachInstanceToSecurityGroupRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s:attach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDetachInstanceFromSecurityGroupRequest calls the generic DetachInstanceFromSecurityGroup builder with application/json body -func NewDetachInstanceFromSecurityGroupRequest(server string, id string, body DetachInstanceFromSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewDetachInstanceFromSecurityGroupRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewDetachInstanceFromSecurityGroupRequestWithBody generates requests for DetachInstanceFromSecurityGroup with any type of body -func NewDetachInstanceFromSecurityGroupRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s:detach", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewRemoveExternalSourceFromSecurityGroupRequest calls the generic RemoveExternalSourceFromSecurityGroup builder with application/json body -func NewRemoveExternalSourceFromSecurityGroupRequest(server string, id string, body RemoveExternalSourceFromSecurityGroupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewRemoveExternalSourceFromSecurityGroupRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewRemoveExternalSourceFromSecurityGroupRequestWithBody generates requests for RemoveExternalSourceFromSecurityGroup with any type of body -func NewRemoveExternalSourceFromSecurityGroupRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/security-group/%s:remove-source", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListSksClustersRequest generates requests for ListSksClusters -func NewListSksClustersRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateSksClusterRequest calls the generic CreateSksCluster builder with application/json body -func NewCreateSksClusterRequest(server string, body CreateSksClusterJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateSksClusterRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateSksClusterRequestWithBody generates requests for CreateSksCluster with any type of body -func NewCreateSksClusterRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListSksClusterDeprecatedResourcesRequest generates requests for ListSksClusterDeprecatedResources -func NewListSksClusterDeprecatedResourcesRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster-deprecated-resources/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGenerateSksClusterKubeconfigRequest calls the generic GenerateSksClusterKubeconfig builder with application/json body -func NewGenerateSksClusterKubeconfigRequest(server string, id string, body GenerateSksClusterKubeconfigJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewGenerateSksClusterKubeconfigRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewGenerateSksClusterKubeconfigRequestWithBody generates requests for GenerateSksClusterKubeconfig with any type of body -func NewGenerateSksClusterKubeconfigRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster-kubeconfig/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListSksClusterVersionsRequest generates requests for ListSksClusterVersions -func NewListSksClusterVersionsRequest(server string, params *ListSksClusterVersionsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster-version") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.IncludeDeprecated != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "include-deprecated", runtime.ParamLocationQuery, *params.IncludeDeprecated); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteSksClusterRequest generates requests for DeleteSksCluster -func NewDeleteSksClusterRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSksClusterRequest generates requests for GetSksCluster -func NewGetSksClusterRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateSksClusterRequest calls the generic UpdateSksCluster builder with application/json body -func NewUpdateSksClusterRequest(server string, id string, body UpdateSksClusterJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateSksClusterRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateSksClusterRequestWithBody generates requests for UpdateSksCluster with any type of body -func NewUpdateSksClusterRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewGetSksClusterAuthorityCertRequest generates requests for GetSksClusterAuthorityCert -func NewGetSksClusterAuthorityCertRequest(server string, id string, authority GetSksClusterAuthorityCertParamsAuthority) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "authority", runtime.ParamLocationPath, authority) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/authority/%s/cert", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateSksNodepoolRequest calls the generic CreateSksNodepool builder with application/json body -func NewCreateSksNodepoolRequest(server string, id string, body CreateSksNodepoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateSksNodepoolRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewCreateSksNodepoolRequestWithBody generates requests for CreateSksNodepool with any type of body -func NewCreateSksNodepoolRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteSksNodepoolRequest generates requests for DeleteSksNodepool -func NewDeleteSksNodepoolRequest(server string, id string, sksNodepoolId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSksNodepoolRequest generates requests for GetSksNodepool -func NewGetSksNodepoolRequest(server string, id string, sksNodepoolId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateSksNodepoolRequest calls the generic UpdateSksNodepool builder with application/json body -func NewUpdateSksNodepoolRequest(server string, id string, sksNodepoolId string, body UpdateSksNodepoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateSksNodepoolRequestWithBody(server, id, sksNodepoolId, "application/json", bodyReader) -} - -// NewUpdateSksNodepoolRequestWithBody generates requests for UpdateSksNodepool with any type of body -func NewUpdateSksNodepoolRequestWithBody(server string, id string, sksNodepoolId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewResetSksNodepoolFieldRequest generates requests for ResetSksNodepoolField -func NewResetSksNodepoolFieldRequest(server string, id string, sksNodepoolId string, field ResetSksNodepoolFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - var pathParam2 string - - pathParam2, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s/%s", pathParam0, pathParam1, pathParam2) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewEvictSksNodepoolMembersRequest calls the generic EvictSksNodepoolMembers builder with application/json body -func NewEvictSksNodepoolMembersRequest(server string, id string, sksNodepoolId string, body EvictSksNodepoolMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewEvictSksNodepoolMembersRequestWithBody(server, id, sksNodepoolId, "application/json", bodyReader) -} - -// NewEvictSksNodepoolMembersRequestWithBody generates requests for EvictSksNodepoolMembers with any type of body -func NewEvictSksNodepoolMembersRequestWithBody(server string, id string, sksNodepoolId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s:evict", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewScaleSksNodepoolRequest calls the generic ScaleSksNodepool builder with application/json body -func NewScaleSksNodepoolRequest(server string, id string, sksNodepoolId string, body ScaleSksNodepoolJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewScaleSksNodepoolRequestWithBody(server, id, sksNodepoolId, "application/json", bodyReader) -} - -// NewScaleSksNodepoolRequestWithBody generates requests for ScaleSksNodepool with any type of body -func NewScaleSksNodepoolRequestWithBody(server string, id string, sksNodepoolId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sks-nodepool-id", runtime.ParamLocationPath, sksNodepoolId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/nodepool/%s:scale", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewRotateSksCcmCredentialsRequest generates requests for RotateSksCcmCredentials -func NewRotateSksCcmCredentialsRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/rotate-ccm-credentials", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRotateSksOperatorsCaRequest generates requests for RotateSksOperatorsCa -func NewRotateSksOperatorsCaRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/rotate-operators-ca", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpgradeSksClusterRequest calls the generic UpgradeSksCluster builder with application/json body -func NewUpgradeSksClusterRequest(server string, id string, body UpgradeSksClusterJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpgradeSksClusterRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpgradeSksClusterRequestWithBody generates requests for UpgradeSksCluster with any type of body -func NewUpgradeSksClusterRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/upgrade", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpgradeSksClusterServiceLevelRequest generates requests for UpgradeSksClusterServiceLevel -func NewUpgradeSksClusterServiceLevelRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/upgrade-service-level", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewResetSksClusterFieldRequest generates requests for ResetSksClusterField -func NewResetSksClusterFieldRequest(server string, id string, field ResetSksClusterFieldParamsField) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "field", runtime.ParamLocationPath, field) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sks-cluster/%s/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListSnapshotsRequest generates requests for ListSnapshots -func NewListSnapshotsRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/snapshot") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewDeleteSnapshotRequest generates requests for DeleteSnapshot -func NewDeleteSnapshotRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/snapshot/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSnapshotRequest generates requests for GetSnapshot -func NewGetSnapshotRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/snapshot/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewExportSnapshotRequest generates requests for ExportSnapshot -func NewExportSnapshotRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/snapshot/%s:export", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewPromoteSnapshotToTemplateRequest calls the generic PromoteSnapshotToTemplate builder with application/json body -func NewPromoteSnapshotToTemplateRequest(server string, id string, body PromoteSnapshotToTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPromoteSnapshotToTemplateRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewPromoteSnapshotToTemplateRequestWithBody generates requests for PromoteSnapshotToTemplate with any type of body -func NewPromoteSnapshotToTemplateRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/snapshot/%s:promote", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListSosBucketsUsageRequest generates requests for ListSosBucketsUsage -func NewListSosBucketsUsageRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sos-buckets-usage") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSosPresignedUrlRequest generates requests for GetSosPresignedUrl -func NewGetSosPresignedUrlRequest(server string, bucket string, params *GetSosPresignedUrlParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucket", runtime.ParamLocationPath, bucket) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sos/%s/presigned-url", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Key != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "key", runtime.ParamLocationQuery, *params.Key); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListSshKeysRequest generates requests for ListSshKeys -func NewListSshKeysRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ssh-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRegisterSshKeyRequest calls the generic RegisterSshKey builder with application/json body -func NewRegisterSshKeyRequest(server string, body RegisterSshKeyJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewRegisterSshKeyRequestWithBody(server, "application/json", bodyReader) -} - -// NewRegisterSshKeyRequestWithBody generates requests for RegisterSshKey with any type of body -func NewRegisterSshKeyRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ssh-key") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteSshKeyRequest generates requests for DeleteSshKey -func NewDeleteSshKeyRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ssh-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetSshKeyRequest generates requests for GetSshKey -func NewGetSshKeyRequest(server string, name string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ssh-key/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListTemplatesRequest generates requests for ListTemplates -func NewListTemplatesRequest(server string, params *ListTemplatesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Visibility != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "visibility", runtime.ParamLocationQuery, *params.Visibility); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Family != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "family", runtime.ParamLocationQuery, *params.Family); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewRegisterTemplateRequest calls the generic RegisterTemplate builder with application/json body -func NewRegisterTemplateRequest(server string, body RegisterTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewRegisterTemplateRequestWithBody(server, "application/json", bodyReader) -} - -// NewRegisterTemplateRequestWithBody generates requests for RegisterTemplate with any type of body -func NewRegisterTemplateRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteTemplateRequest generates requests for DeleteTemplate -func NewDeleteTemplateRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetTemplateRequest generates requests for GetTemplate -func NewGetTemplateRequest(server string, id string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCopyTemplateRequest calls the generic CopyTemplate builder with application/json body -func NewCopyTemplateRequest(server string, id string, body CopyTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCopyTemplateRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewCopyTemplateRequestWithBody generates requests for CopyTemplate with any type of body -func NewCopyTemplateRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUpdateTemplateRequest calls the generic UpdateTemplate builder with application/json body -func NewUpdateTemplateRequest(server string, id string, body UpdateTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateTemplateRequestWithBody(server, id, "application/json", bodyReader) -} - -// NewUpdateTemplateRequestWithBody generates requests for UpdateTemplate with any type of body -func NewUpdateTemplateRequestWithBody(server string, id string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/template/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewListZonesRequest generates requests for ListZones -func NewListZonesRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/zone") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { - for _, r := range c.RequestEditors { - if err := r(ctx, req); err != nil { - return err - } - } - for _, r := range additionalEditors { - if err := r(ctx, req); err != nil { - return err - } - } - return nil -} - -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface -} - -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { - client, err := NewClient(server, opts...) - if err != nil { - return nil, err - } - return &ClientWithResponses{client}, nil -} - -// WithBaseURL overrides the baseURL. -func WithBaseURL(baseURL string) ClientOption { - return func(c *Client) error { - newBaseURL, err := url.Parse(baseURL) - if err != nil { - return err - } - c.Server = newBaseURL.String() - return nil - } -} - -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { - // ListAccessKeys request - ListAccessKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeysResponse, error) - - // CreateAccessKey request with any body - CreateAccessKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAccessKeyResponse, error) - - CreateAccessKeyWithResponse(ctx context.Context, body CreateAccessKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAccessKeyResponse, error) - - // ListAccessKeyKnownOperations request - ListAccessKeyKnownOperationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeyKnownOperationsResponse, error) - - // ListAccessKeyOperations request - ListAccessKeyOperationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeyOperationsResponse, error) - - // RevokeAccessKey request - RevokeAccessKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*RevokeAccessKeyResponse, error) - - // GetAccessKey request - GetAccessKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetAccessKeyResponse, error) - - // ListAntiAffinityGroups request - ListAntiAffinityGroupsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAntiAffinityGroupsResponse, error) - - // CreateAntiAffinityGroup request with any body - CreateAntiAffinityGroupWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAntiAffinityGroupResponse, error) - - CreateAntiAffinityGroupWithResponse(ctx context.Context, body CreateAntiAffinityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAntiAffinityGroupResponse, error) - - // DeleteAntiAffinityGroup request - DeleteAntiAffinityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteAntiAffinityGroupResponse, error) - - // GetAntiAffinityGroup request - GetAntiAffinityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetAntiAffinityGroupResponse, error) - - // ListApiKeys request - ListApiKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListApiKeysResponse, error) - - // CreateApiKey request with any body - CreateApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) - - CreateApiKeyWithResponse(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) - - // DeleteApiKey request - DeleteApiKeyWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error) - - // GetApiKey request - GetApiKeyWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetApiKeyResponse, error) - - // GetDbaasCaCertificate request - GetDbaasCaCertificateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasCaCertificateResponse, error) - - // DeleteDbaasServiceGrafana request - DeleteDbaasServiceGrafanaWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceGrafanaResponse, error) - - // GetDbaasServiceGrafana request - GetDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceGrafanaResponse, error) - - // CreateDbaasServiceGrafana request with any body - CreateDbaasServiceGrafanaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceGrafanaResponse, error) - - CreateDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceGrafanaResponse, error) - - // UpdateDbaasServiceGrafana request with any body - UpdateDbaasServiceGrafanaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceGrafanaResponse, error) - - UpdateDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceGrafanaResponse, error) - - // StartDbaasGrafanaMaintenance request - StartDbaasGrafanaMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasGrafanaMaintenanceResponse, error) - - // CreateDbaasIntegration request with any body - CreateDbaasIntegrationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasIntegrationResponse, error) - - CreateDbaasIntegrationWithResponse(ctx context.Context, body CreateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasIntegrationResponse, error) - - // ListDbaasIntegrationSettings request - ListDbaasIntegrationSettingsWithResponse(ctx context.Context, integrationType string, sourceType string, destType string, reqEditors ...RequestEditorFn) (*ListDbaasIntegrationSettingsResponse, error) - - // ListDbaasIntegrationTypes request - ListDbaasIntegrationTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasIntegrationTypesResponse, error) - - // DeleteDbaasIntegration request - DeleteDbaasIntegrationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteDbaasIntegrationResponse, error) - - // GetDbaasIntegration request - GetDbaasIntegrationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDbaasIntegrationResponse, error) - - // UpdateDbaasIntegration request with any body - UpdateDbaasIntegrationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasIntegrationResponse, error) - - UpdateDbaasIntegrationWithResponse(ctx context.Context, id string, body UpdateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasIntegrationResponse, error) - - // DeleteDbaasServiceKafka request - DeleteDbaasServiceKafkaWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceKafkaResponse, error) - - // GetDbaasServiceKafka request - GetDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceKafkaResponse, error) - - // CreateDbaasServiceKafka request with any body - CreateDbaasServiceKafkaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceKafkaResponse, error) - - CreateDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceKafkaResponse, error) - - // UpdateDbaasServiceKafka request with any body - UpdateDbaasServiceKafkaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceKafkaResponse, error) - - UpdateDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceKafkaResponse, error) - - // GetDbaasKafkaAclConfig request - GetDbaasKafkaAclConfigWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasKafkaAclConfigResponse, error) - - // StartDbaasKafkaMaintenance request - StartDbaasKafkaMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasKafkaMaintenanceResponse, error) - - // CreateDbaasKafkaSchemaRegistryAclConfig request with any body - CreateDbaasKafkaSchemaRegistryAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaSchemaRegistryAclConfigResponse, error) - - CreateDbaasKafkaSchemaRegistryAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaSchemaRegistryAclConfigResponse, error) - - // DeleteDbaasKafkaSchemaRegistryAclConfig request - DeleteDbaasKafkaSchemaRegistryAclConfigWithResponse(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaSchemaRegistryAclConfigResponse, error) - - // CreateDbaasKafkaTopicAclConfig request with any body - CreateDbaasKafkaTopicAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaTopicAclConfigResponse, error) - - CreateDbaasKafkaTopicAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaTopicAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaTopicAclConfigResponse, error) - - // DeleteDbaasKafkaTopicAclConfig request - DeleteDbaasKafkaTopicAclConfigWithResponse(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaTopicAclConfigResponse, error) - - // CreateDbaasKafkaUser request with any body - CreateDbaasKafkaUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaUserResponse, error) - - CreateDbaasKafkaUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasKafkaUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaUserResponse, error) - - // DeleteDbaasKafkaUser request - DeleteDbaasKafkaUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaUserResponse, error) - - // ResetDbaasKafkaUserPassword request with any body - ResetDbaasKafkaUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasKafkaUserPasswordResponse, error) - - ResetDbaasKafkaUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasKafkaUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasKafkaUserPasswordResponse, error) - - // GetDbaasMigrationStatus request - GetDbaasMigrationStatusWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasMigrationStatusResponse, error) - - // DeleteDbaasServiceMysql request - DeleteDbaasServiceMysqlWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceMysqlResponse, error) - - // GetDbaasServiceMysql request - GetDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceMysqlResponse, error) - - // CreateDbaasServiceMysql request with any body - CreateDbaasServiceMysqlWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceMysqlResponse, error) - - CreateDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceMysqlResponse, error) - - // UpdateDbaasServiceMysql request with any body - UpdateDbaasServiceMysqlWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceMysqlResponse, error) - - UpdateDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceMysqlResponse, error) - - // StartDbaasMysqlMaintenance request - StartDbaasMysqlMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasMysqlMaintenanceResponse, error) - - // StopDbaasMysqlMigration request - StopDbaasMysqlMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasMysqlMigrationResponse, error) - - // CreateDbaasMysqlDatabase request with any body - CreateDbaasMysqlDatabaseWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlDatabaseResponse, error) - - CreateDbaasMysqlDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlDatabaseResponse, error) - - // DeleteDbaasMysqlDatabase request - DeleteDbaasMysqlDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasMysqlDatabaseName, reqEditors ...RequestEditorFn) (*DeleteDbaasMysqlDatabaseResponse, error) - - // CreateDbaasMysqlUser request with any body - CreateDbaasMysqlUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlUserResponse, error) - - CreateDbaasMysqlUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlUserResponse, error) - - // DeleteDbaasMysqlUser request - DeleteDbaasMysqlUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasMysqlUserResponse, error) - - // ResetDbaasMysqlUserPassword request with any body - ResetDbaasMysqlUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasMysqlUserPasswordResponse, error) - - ResetDbaasMysqlUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasMysqlUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasMysqlUserPasswordResponse, error) - - // DeleteDbaasServiceOpensearch request - DeleteDbaasServiceOpensearchWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceOpensearchResponse, error) - - // GetDbaasServiceOpensearch request - GetDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceOpensearchResponse, error) - - // CreateDbaasServiceOpensearch request with any body - CreateDbaasServiceOpensearchWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceOpensearchResponse, error) - - CreateDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceOpensearchResponse, error) - - // UpdateDbaasServiceOpensearch request with any body - UpdateDbaasServiceOpensearchWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceOpensearchResponse, error) - - UpdateDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceOpensearchResponse, error) - - // GetDbaasOpensearchAclConfig request - GetDbaasOpensearchAclConfigWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasOpensearchAclConfigResponse, error) - - // UpdateDbaasOpensearchAclConfig request with any body - UpdateDbaasOpensearchAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasOpensearchAclConfigResponse, error) - - UpdateDbaasOpensearchAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasOpensearchAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasOpensearchAclConfigResponse, error) - - // StartDbaasOpensearchMaintenance request - StartDbaasOpensearchMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasOpensearchMaintenanceResponse, error) - - // CreateDbaasOpensearchUser request with any body - CreateDbaasOpensearchUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasOpensearchUserResponse, error) - - CreateDbaasOpensearchUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasOpensearchUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasOpensearchUserResponse, error) - - // DeleteDbaasOpensearchUser request - DeleteDbaasOpensearchUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasOpensearchUserResponse, error) - - // ResetDbaasOpensearchUserPassword request with any body - ResetDbaasOpensearchUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasOpensearchUserPasswordResponse, error) - - ResetDbaasOpensearchUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasOpensearchUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasOpensearchUserPasswordResponse, error) - - // DeleteDbaasServicePg request - DeleteDbaasServicePgWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServicePgResponse, error) - - // GetDbaasServicePg request - GetDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServicePgResponse, error) - - // CreateDbaasServicePg request with any body - CreateDbaasServicePgWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServicePgResponse, error) - - CreateDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServicePgResponse, error) - - // UpdateDbaasServicePg request with any body - UpdateDbaasServicePgWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServicePgResponse, error) - - UpdateDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServicePgResponse, error) - - // StartDbaasPgMaintenance request - StartDbaasPgMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasPgMaintenanceResponse, error) - - // StopDbaasPgMigration request - StopDbaasPgMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasPgMigrationResponse, error) - - // CreateDbaasPgConnectionPool request with any body - CreateDbaasPgConnectionPoolWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgConnectionPoolResponse, error) - - CreateDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgConnectionPoolResponse, error) - - // DeleteDbaasPgConnectionPool request - DeleteDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, reqEditors ...RequestEditorFn) (*DeleteDbaasPgConnectionPoolResponse, error) - - // UpdateDbaasPgConnectionPool request with any body - UpdateDbaasPgConnectionPoolWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasPgConnectionPoolResponse, error) - - UpdateDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, body UpdateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasPgConnectionPoolResponse, error) - - // CreateDbaasPgDatabase request with any body - CreateDbaasPgDatabaseWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgDatabaseResponse, error) - - CreateDbaasPgDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgDatabaseResponse, error) - - // DeleteDbaasPgDatabase request - DeleteDbaasPgDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasPgDatabaseName, reqEditors ...RequestEditorFn) (*DeleteDbaasPgDatabaseResponse, error) - - // CreateDbaasPostgresUser request with any body - CreateDbaasPostgresUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPostgresUserResponse, error) - - CreateDbaasPostgresUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPostgresUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPostgresUserResponse, error) - - // DeleteDbaasPostgresUser request - DeleteDbaasPostgresUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasPostgresUserResponse, error) - - // UpdateDbaasPostgresAllowReplication request with any body - UpdateDbaasPostgresAllowReplicationWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasPostgresAllowReplicationResponse, error) - - UpdateDbaasPostgresAllowReplicationWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body UpdateDbaasPostgresAllowReplicationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasPostgresAllowReplicationResponse, error) - - // ResetDbaasPostgresUserPassword request with any body - ResetDbaasPostgresUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasPostgresUserPasswordResponse, error) - - ResetDbaasPostgresUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasPostgresUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasPostgresUserPasswordResponse, error) - - // CreateDbaasPgUpgradeCheck request with any body - CreateDbaasPgUpgradeCheckWithBodyWithResponse(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgUpgradeCheckResponse, error) - - CreateDbaasPgUpgradeCheckWithResponse(ctx context.Context, service DbaasServiceName, body CreateDbaasPgUpgradeCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgUpgradeCheckResponse, error) - - // DeleteDbaasServiceRedis request - DeleteDbaasServiceRedisWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceRedisResponse, error) - - // GetDbaasServiceRedis request - GetDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceRedisResponse, error) - - // CreateDbaasServiceRedis request with any body - CreateDbaasServiceRedisWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceRedisResponse, error) - - CreateDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceRedisResponse, error) - - // UpdateDbaasServiceRedis request with any body - UpdateDbaasServiceRedisWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceRedisResponse, error) - - UpdateDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceRedisResponse, error) - - // StartDbaasRedisMaintenance request - StartDbaasRedisMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasRedisMaintenanceResponse, error) - - // StopDbaasRedisMigration request - StopDbaasRedisMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasRedisMigrationResponse, error) - - // ListDbaasServices request - ListDbaasServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasServicesResponse, error) - - // GetDbaasServiceLogs request with any body - GetDbaasServiceLogsWithBodyWithResponse(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetDbaasServiceLogsResponse, error) - - GetDbaasServiceLogsWithResponse(ctx context.Context, serviceName string, body GetDbaasServiceLogsJSONRequestBody, reqEditors ...RequestEditorFn) (*GetDbaasServiceLogsResponse, error) - - // GetDbaasServiceMetrics request with any body - GetDbaasServiceMetricsWithBodyWithResponse(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetDbaasServiceMetricsResponse, error) - - GetDbaasServiceMetricsWithResponse(ctx context.Context, serviceName string, body GetDbaasServiceMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*GetDbaasServiceMetricsResponse, error) - - // ListDbaasServiceTypes request - ListDbaasServiceTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasServiceTypesResponse, error) - - // GetDbaasServiceType request - GetDbaasServiceTypeWithResponse(ctx context.Context, serviceTypeName string, reqEditors ...RequestEditorFn) (*GetDbaasServiceTypeResponse, error) - - // DeleteDbaasService request - DeleteDbaasServiceWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceResponse, error) - - // GetDbaasSettingsGrafana request - GetDbaasSettingsGrafanaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsGrafanaResponse, error) - - // GetDbaasSettingsKafka request - GetDbaasSettingsKafkaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsKafkaResponse, error) - - // GetDbaasSettingsMysql request - GetDbaasSettingsMysqlWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsMysqlResponse, error) - - // GetDbaasSettingsOpensearch request - GetDbaasSettingsOpensearchWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsOpensearchResponse, error) - - // GetDbaasSettingsPg request - GetDbaasSettingsPgWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsPgResponse, error) - - // GetDbaasSettingsRedis request - GetDbaasSettingsRedisWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsRedisResponse, error) - - // CreateDbaasTaskMigrationCheck request with any body - CreateDbaasTaskMigrationCheckWithBodyWithResponse(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasTaskMigrationCheckResponse, error) - - CreateDbaasTaskMigrationCheckWithResponse(ctx context.Context, service DbaasServiceName, body CreateDbaasTaskMigrationCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasTaskMigrationCheckResponse, error) - - // GetDbaasTask request - GetDbaasTaskWithResponse(ctx context.Context, service DbaasServiceName, id string, reqEditors ...RequestEditorFn) (*GetDbaasTaskResponse, error) - - // ListDeployTargets request - ListDeployTargetsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDeployTargetsResponse, error) - - // GetDeployTarget request - GetDeployTargetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDeployTargetResponse, error) - - // ListDnsDomains request - ListDnsDomainsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDnsDomainsResponse, error) - - // CreateDnsDomain request with any body - CreateDnsDomainWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDnsDomainResponse, error) - - CreateDnsDomainWithResponse(ctx context.Context, body CreateDnsDomainJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDnsDomainResponse, error) - - // ListDnsDomainRecords request - ListDnsDomainRecordsWithResponse(ctx context.Context, domainId string, reqEditors ...RequestEditorFn) (*ListDnsDomainRecordsResponse, error) - - // CreateDnsDomainRecord request with any body - CreateDnsDomainRecordWithBodyWithResponse(ctx context.Context, domainId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDnsDomainRecordResponse, error) - - CreateDnsDomainRecordWithResponse(ctx context.Context, domainId string, body CreateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDnsDomainRecordResponse, error) - - // DeleteDnsDomainRecord request - DeleteDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*DeleteDnsDomainRecordResponse, error) - - // GetDnsDomainRecord request - GetDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*GetDnsDomainRecordResponse, error) - - // UpdateDnsDomainRecord request with any body - UpdateDnsDomainRecordWithBodyWithResponse(ctx context.Context, domainId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDnsDomainRecordResponse, error) - - UpdateDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, body UpdateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDnsDomainRecordResponse, error) - - // DeleteDnsDomain request - DeleteDnsDomainWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteDnsDomainResponse, error) - - // GetDnsDomain request - GetDnsDomainWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDnsDomainResponse, error) - - // GetDnsDomainZoneFile request - GetDnsDomainZoneFileWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDnsDomainZoneFileResponse, error) - - // ListElasticIps request - ListElasticIpsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListElasticIpsResponse, error) - - // CreateElasticIp request with any body - CreateElasticIpWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateElasticIpResponse, error) - - CreateElasticIpWithResponse(ctx context.Context, body CreateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateElasticIpResponse, error) - - // DeleteElasticIp request - DeleteElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteElasticIpResponse, error) - - // GetElasticIp request - GetElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetElasticIpResponse, error) - - // UpdateElasticIp request with any body - UpdateElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateElasticIpResponse, error) - - UpdateElasticIpWithResponse(ctx context.Context, id string, body UpdateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateElasticIpResponse, error) - - // ResetElasticIpField request - ResetElasticIpFieldWithResponse(ctx context.Context, id string, field ResetElasticIpFieldParamsField, reqEditors ...RequestEditorFn) (*ResetElasticIpFieldResponse, error) - - // AttachInstanceToElasticIp request with any body - AttachInstanceToElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToElasticIpResponse, error) - - AttachInstanceToElasticIpWithResponse(ctx context.Context, id string, body AttachInstanceToElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToElasticIpResponse, error) - - // DetachInstanceFromElasticIp request with any body - DetachInstanceFromElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromElasticIpResponse, error) - - DetachInstanceFromElasticIpWithResponse(ctx context.Context, id string, body DetachInstanceFromElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromElasticIpResponse, error) - - // ListEvents request - ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error) - - // GetIamOrganizationPolicy request - GetIamOrganizationPolicyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIamOrganizationPolicyResponse, error) - - // UpdateIamOrganizationPolicy request with any body - UpdateIamOrganizationPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamOrganizationPolicyResponse, error) - - UpdateIamOrganizationPolicyWithResponse(ctx context.Context, body UpdateIamOrganizationPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamOrganizationPolicyResponse, error) - - // ListIamRoles request - ListIamRolesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListIamRolesResponse, error) - - // CreateIamRole request with any body - CreateIamRoleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateIamRoleResponse, error) - - CreateIamRoleWithResponse(ctx context.Context, body CreateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateIamRoleResponse, error) - - // DeleteIamRole request - DeleteIamRoleWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteIamRoleResponse, error) - - // GetIamRole request - GetIamRoleWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetIamRoleResponse, error) - - // UpdateIamRole request with any body - UpdateIamRoleWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamRoleResponse, error) - - UpdateIamRoleWithResponse(ctx context.Context, id string, body UpdateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamRoleResponse, error) - - // UpdateIamRolePolicy request with any body - UpdateIamRolePolicyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamRolePolicyResponse, error) - - UpdateIamRolePolicyWithResponse(ctx context.Context, id string, body UpdateIamRolePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamRolePolicyResponse, error) - - // ListInstances request - ListInstancesWithResponse(ctx context.Context, params *ListInstancesParams, reqEditors ...RequestEditorFn) (*ListInstancesResponse, error) - - // CreateInstance request with any body - CreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateInstanceResponse, error) - - CreateInstanceWithResponse(ctx context.Context, body CreateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateInstanceResponse, error) - - // ListInstancePools request - ListInstancePoolsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListInstancePoolsResponse, error) - - // CreateInstancePool request with any body - CreateInstancePoolWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateInstancePoolResponse, error) - - CreateInstancePoolWithResponse(ctx context.Context, body CreateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateInstancePoolResponse, error) - - // DeleteInstancePool request - DeleteInstancePoolWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteInstancePoolResponse, error) - - // GetInstancePool request - GetInstancePoolWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstancePoolResponse, error) - - // UpdateInstancePool request with any body - UpdateInstancePoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateInstancePoolResponse, error) - - UpdateInstancePoolWithResponse(ctx context.Context, id string, body UpdateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateInstancePoolResponse, error) - - // ResetInstancePoolField request - ResetInstancePoolFieldWithResponse(ctx context.Context, id string, field ResetInstancePoolFieldParamsField, reqEditors ...RequestEditorFn) (*ResetInstancePoolFieldResponse, error) - - // EvictInstancePoolMembers request with any body - EvictInstancePoolMembersWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EvictInstancePoolMembersResponse, error) - - EvictInstancePoolMembersWithResponse(ctx context.Context, id string, body EvictInstancePoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*EvictInstancePoolMembersResponse, error) - - // ScaleInstancePool request with any body - ScaleInstancePoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleInstancePoolResponse, error) - - ScaleInstancePoolWithResponse(ctx context.Context, id string, body ScaleInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleInstancePoolResponse, error) - - // ListInstanceTypes request - ListInstanceTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListInstanceTypesResponse, error) - - // GetInstanceType request - GetInstanceTypeWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstanceTypeResponse, error) - - // DeleteInstance request - DeleteInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteInstanceResponse, error) - - // GetInstance request - GetInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstanceResponse, error) - - // UpdateInstance request with any body - UpdateInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateInstanceResponse, error) - - UpdateInstanceWithResponse(ctx context.Context, id string, body UpdateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateInstanceResponse, error) - - // ResetInstanceField request - ResetInstanceFieldWithResponse(ctx context.Context, id string, field ResetInstanceFieldParamsField, reqEditors ...RequestEditorFn) (*ResetInstanceFieldResponse, error) - - // AddInstanceProtection request - AddInstanceProtectionWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*AddInstanceProtectionResponse, error) - - // CreateSnapshot request - CreateSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*CreateSnapshotResponse, error) - - // RevealInstancePassword request - RevealInstancePasswordWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RevealInstancePasswordResponse, error) - - // RebootInstance request - RebootInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RebootInstanceResponse, error) - - // RemoveInstanceProtection request - RemoveInstanceProtectionWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RemoveInstanceProtectionResponse, error) - - // ResetInstance request with any body - ResetInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetInstanceResponse, error) - - ResetInstanceWithResponse(ctx context.Context, id string, body ResetInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetInstanceResponse, error) - - // ResetInstancePassword request - ResetInstancePasswordWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ResetInstancePasswordResponse, error) - - // ResizeInstanceDisk request with any body - ResizeInstanceDiskWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResizeInstanceDiskResponse, error) - - ResizeInstanceDiskWithResponse(ctx context.Context, id string, body ResizeInstanceDiskJSONRequestBody, reqEditors ...RequestEditorFn) (*ResizeInstanceDiskResponse, error) - - // ScaleInstance request with any body - ScaleInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleInstanceResponse, error) - - ScaleInstanceWithResponse(ctx context.Context, id string, body ScaleInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleInstanceResponse, error) - - // StartInstance request with any body - StartInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartInstanceResponse, error) - - StartInstanceWithResponse(ctx context.Context, id string, body StartInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*StartInstanceResponse, error) - - // StopInstance request - StopInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*StopInstanceResponse, error) - - // RevertInstanceToSnapshot request with any body - RevertInstanceToSnapshotWithBodyWithResponse(ctx context.Context, instanceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RevertInstanceToSnapshotResponse, error) - - RevertInstanceToSnapshotWithResponse(ctx context.Context, instanceId string, body RevertInstanceToSnapshotJSONRequestBody, reqEditors ...RequestEditorFn) (*RevertInstanceToSnapshotResponse, error) - - // ListLoadBalancers request - ListLoadBalancersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListLoadBalancersResponse, error) - - // CreateLoadBalancer request with any body - CreateLoadBalancerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateLoadBalancerResponse, error) - - CreateLoadBalancerWithResponse(ctx context.Context, body CreateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateLoadBalancerResponse, error) - - // DeleteLoadBalancer request - DeleteLoadBalancerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteLoadBalancerResponse, error) - - // GetLoadBalancer request - GetLoadBalancerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetLoadBalancerResponse, error) - - // UpdateLoadBalancer request with any body - UpdateLoadBalancerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerResponse, error) - - UpdateLoadBalancerWithResponse(ctx context.Context, id string, body UpdateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerResponse, error) - - // AddServiceToLoadBalancer request with any body - AddServiceToLoadBalancerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddServiceToLoadBalancerResponse, error) - - AddServiceToLoadBalancerWithResponse(ctx context.Context, id string, body AddServiceToLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*AddServiceToLoadBalancerResponse, error) - - // DeleteLoadBalancerService request - DeleteLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteLoadBalancerServiceResponse, error) - - // GetLoadBalancerService request - GetLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*GetLoadBalancerServiceResponse, error) - - // UpdateLoadBalancerService request with any body - UpdateLoadBalancerServiceWithBodyWithResponse(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerServiceResponse, error) - - UpdateLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, body UpdateLoadBalancerServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerServiceResponse, error) - - // ResetLoadBalancerServiceField request - ResetLoadBalancerServiceFieldWithResponse(ctx context.Context, id string, serviceId string, field ResetLoadBalancerServiceFieldParamsField, reqEditors ...RequestEditorFn) (*ResetLoadBalancerServiceFieldResponse, error) - - // ResetLoadBalancerField request - ResetLoadBalancerFieldWithResponse(ctx context.Context, id string, field ResetLoadBalancerFieldParamsField, reqEditors ...RequestEditorFn) (*ResetLoadBalancerFieldResponse, error) - - // GetOperation request - GetOperationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetOperationResponse, error) - - // ListPrivateNetworks request - ListPrivateNetworksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListPrivateNetworksResponse, error) - - // CreatePrivateNetwork request with any body - CreatePrivateNetworkWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePrivateNetworkResponse, error) - - CreatePrivateNetworkWithResponse(ctx context.Context, body CreatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePrivateNetworkResponse, error) - - // DeletePrivateNetwork request - DeletePrivateNetworkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeletePrivateNetworkResponse, error) - - // GetPrivateNetwork request - GetPrivateNetworkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetPrivateNetworkResponse, error) - - // UpdatePrivateNetwork request with any body - UpdatePrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkResponse, error) - - UpdatePrivateNetworkWithResponse(ctx context.Context, id string, body UpdatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkResponse, error) - - // ResetPrivateNetworkField request - ResetPrivateNetworkFieldWithResponse(ctx context.Context, id string, field ResetPrivateNetworkFieldParamsField, reqEditors ...RequestEditorFn) (*ResetPrivateNetworkFieldResponse, error) - - // AttachInstanceToPrivateNetwork request with any body - AttachInstanceToPrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToPrivateNetworkResponse, error) - - AttachInstanceToPrivateNetworkWithResponse(ctx context.Context, id string, body AttachInstanceToPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToPrivateNetworkResponse, error) - - // DetachInstanceFromPrivateNetwork request with any body - DetachInstanceFromPrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromPrivateNetworkResponse, error) - - DetachInstanceFromPrivateNetworkWithResponse(ctx context.Context, id string, body DetachInstanceFromPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromPrivateNetworkResponse, error) - - // UpdatePrivateNetworkInstanceIp request with any body - UpdatePrivateNetworkInstanceIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkInstanceIpResponse, error) - - UpdatePrivateNetworkInstanceIpWithResponse(ctx context.Context, id string, body UpdatePrivateNetworkInstanceIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkInstanceIpResponse, error) - - // ListQuotas request - ListQuotasWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQuotasResponse, error) - - // GetQuota request - GetQuotaWithResponse(ctx context.Context, entity string, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error) - - // DeleteReverseDnsElasticIp request - DeleteReverseDnsElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteReverseDnsElasticIpResponse, error) - - // GetReverseDnsElasticIp request - GetReverseDnsElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetReverseDnsElasticIpResponse, error) - - // UpdateReverseDnsElasticIp request with any body - UpdateReverseDnsElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateReverseDnsElasticIpResponse, error) - - UpdateReverseDnsElasticIpWithResponse(ctx context.Context, id string, body UpdateReverseDnsElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateReverseDnsElasticIpResponse, error) - - // DeleteReverseDnsInstance request - DeleteReverseDnsInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteReverseDnsInstanceResponse, error) - - // GetReverseDnsInstance request - GetReverseDnsInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetReverseDnsInstanceResponse, error) - - // UpdateReverseDnsInstance request with any body - UpdateReverseDnsInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateReverseDnsInstanceResponse, error) - - UpdateReverseDnsInstanceWithResponse(ctx context.Context, id string, body UpdateReverseDnsInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateReverseDnsInstanceResponse, error) - - // ListSecurityGroups request - ListSecurityGroupsWithResponse(ctx context.Context, params *ListSecurityGroupsParams, reqEditors ...RequestEditorFn) (*ListSecurityGroupsResponse, error) - - // CreateSecurityGroup request with any body - CreateSecurityGroupWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSecurityGroupResponse, error) - - CreateSecurityGroupWithResponse(ctx context.Context, body CreateSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSecurityGroupResponse, error) - - // DeleteSecurityGroup request - DeleteSecurityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSecurityGroupResponse, error) - - // GetSecurityGroup request - GetSecurityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSecurityGroupResponse, error) - - // AddRuleToSecurityGroup request with any body - AddRuleToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddRuleToSecurityGroupResponse, error) - - AddRuleToSecurityGroupWithResponse(ctx context.Context, id string, body AddRuleToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AddRuleToSecurityGroupResponse, error) - - // DeleteRuleFromSecurityGroup request - DeleteRuleFromSecurityGroupWithResponse(ctx context.Context, id string, ruleId string, reqEditors ...RequestEditorFn) (*DeleteRuleFromSecurityGroupResponse, error) - - // AddExternalSourceToSecurityGroup request with any body - AddExternalSourceToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddExternalSourceToSecurityGroupResponse, error) - - AddExternalSourceToSecurityGroupWithResponse(ctx context.Context, id string, body AddExternalSourceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AddExternalSourceToSecurityGroupResponse, error) - - // AttachInstanceToSecurityGroup request with any body - AttachInstanceToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToSecurityGroupResponse, error) - - AttachInstanceToSecurityGroupWithResponse(ctx context.Context, id string, body AttachInstanceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToSecurityGroupResponse, error) - - // DetachInstanceFromSecurityGroup request with any body - DetachInstanceFromSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromSecurityGroupResponse, error) - - DetachInstanceFromSecurityGroupWithResponse(ctx context.Context, id string, body DetachInstanceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromSecurityGroupResponse, error) - - // RemoveExternalSourceFromSecurityGroup request with any body - RemoveExternalSourceFromSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RemoveExternalSourceFromSecurityGroupResponse, error) - - RemoveExternalSourceFromSecurityGroupWithResponse(ctx context.Context, id string, body RemoveExternalSourceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*RemoveExternalSourceFromSecurityGroupResponse, error) - - // ListSksClusters request - ListSksClustersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSksClustersResponse, error) - - // CreateSksCluster request with any body - CreateSksClusterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSksClusterResponse, error) - - CreateSksClusterWithResponse(ctx context.Context, body CreateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSksClusterResponse, error) - - // ListSksClusterDeprecatedResources request - ListSksClusterDeprecatedResourcesWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ListSksClusterDeprecatedResourcesResponse, error) - - // GenerateSksClusterKubeconfig request with any body - GenerateSksClusterKubeconfigWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GenerateSksClusterKubeconfigResponse, error) - - GenerateSksClusterKubeconfigWithResponse(ctx context.Context, id string, body GenerateSksClusterKubeconfigJSONRequestBody, reqEditors ...RequestEditorFn) (*GenerateSksClusterKubeconfigResponse, error) - - // ListSksClusterVersions request - ListSksClusterVersionsWithResponse(ctx context.Context, params *ListSksClusterVersionsParams, reqEditors ...RequestEditorFn) (*ListSksClusterVersionsResponse, error) - - // DeleteSksCluster request - DeleteSksClusterWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSksClusterResponse, error) - - // GetSksCluster request - GetSksClusterWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSksClusterResponse, error) - - // UpdateSksCluster request with any body - UpdateSksClusterWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSksClusterResponse, error) - - UpdateSksClusterWithResponse(ctx context.Context, id string, body UpdateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSksClusterResponse, error) - - // GetSksClusterAuthorityCert request - GetSksClusterAuthorityCertWithResponse(ctx context.Context, id string, authority GetSksClusterAuthorityCertParamsAuthority, reqEditors ...RequestEditorFn) (*GetSksClusterAuthorityCertResponse, error) - - // CreateSksNodepool request with any body - CreateSksNodepoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSksNodepoolResponse, error) - - CreateSksNodepoolWithResponse(ctx context.Context, id string, body CreateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSksNodepoolResponse, error) - - // DeleteSksNodepool request - DeleteSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*DeleteSksNodepoolResponse, error) - - // GetSksNodepool request - GetSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*GetSksNodepoolResponse, error) - - // UpdateSksNodepool request with any body - UpdateSksNodepoolWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSksNodepoolResponse, error) - - UpdateSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, body UpdateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSksNodepoolResponse, error) - - // ResetSksNodepoolField request - ResetSksNodepoolFieldWithResponse(ctx context.Context, id string, sksNodepoolId string, field ResetSksNodepoolFieldParamsField, reqEditors ...RequestEditorFn) (*ResetSksNodepoolFieldResponse, error) - - // EvictSksNodepoolMembers request with any body - EvictSksNodepoolMembersWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EvictSksNodepoolMembersResponse, error) - - EvictSksNodepoolMembersWithResponse(ctx context.Context, id string, sksNodepoolId string, body EvictSksNodepoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*EvictSksNodepoolMembersResponse, error) - - // ScaleSksNodepool request with any body - ScaleSksNodepoolWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleSksNodepoolResponse, error) - - ScaleSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, body ScaleSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleSksNodepoolResponse, error) - - // RotateSksCcmCredentials request - RotateSksCcmCredentialsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RotateSksCcmCredentialsResponse, error) - - // RotateSksOperatorsCa request - RotateSksOperatorsCaWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RotateSksOperatorsCaResponse, error) - - // UpgradeSksCluster request with any body - UpgradeSksClusterWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpgradeSksClusterResponse, error) - - UpgradeSksClusterWithResponse(ctx context.Context, id string, body UpgradeSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*UpgradeSksClusterResponse, error) - - // UpgradeSksClusterServiceLevel request - UpgradeSksClusterServiceLevelWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*UpgradeSksClusterServiceLevelResponse, error) - - // ResetSksClusterField request - ResetSksClusterFieldWithResponse(ctx context.Context, id string, field ResetSksClusterFieldParamsField, reqEditors ...RequestEditorFn) (*ResetSksClusterFieldResponse, error) - - // ListSnapshots request - ListSnapshotsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSnapshotsResponse, error) - - // DeleteSnapshot request - DeleteSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSnapshotResponse, error) - - // GetSnapshot request - GetSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSnapshotResponse, error) - - // ExportSnapshot request - ExportSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ExportSnapshotResponse, error) - - // PromoteSnapshotToTemplate request with any body - PromoteSnapshotToTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PromoteSnapshotToTemplateResponse, error) - - PromoteSnapshotToTemplateWithResponse(ctx context.Context, id string, body PromoteSnapshotToTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*PromoteSnapshotToTemplateResponse, error) - - // ListSosBucketsUsage request - ListSosBucketsUsageWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSosBucketsUsageResponse, error) - - // GetSosPresignedUrl request - GetSosPresignedUrlWithResponse(ctx context.Context, bucket string, params *GetSosPresignedUrlParams, reqEditors ...RequestEditorFn) (*GetSosPresignedUrlResponse, error) - - // ListSshKeys request - ListSshKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSshKeysResponse, error) - - // RegisterSshKey request with any body - RegisterSshKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterSshKeyResponse, error) - - RegisterSshKeyWithResponse(ctx context.Context, body RegisterSshKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterSshKeyResponse, error) - - // DeleteSshKey request - DeleteSshKeyWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteSshKeyResponse, error) - - // GetSshKey request - GetSshKeyWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetSshKeyResponse, error) - - // ListTemplates request - ListTemplatesWithResponse(ctx context.Context, params *ListTemplatesParams, reqEditors ...RequestEditorFn) (*ListTemplatesResponse, error) - - // RegisterTemplate request with any body - RegisterTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterTemplateResponse, error) - - RegisterTemplateWithResponse(ctx context.Context, body RegisterTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterTemplateResponse, error) - - // DeleteTemplate request - DeleteTemplateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteTemplateResponse, error) - - // GetTemplate request - GetTemplateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetTemplateResponse, error) - - // CopyTemplate request with any body - CopyTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CopyTemplateResponse, error) - - CopyTemplateWithResponse(ctx context.Context, id string, body CopyTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*CopyTemplateResponse, error) - - // UpdateTemplate request with any body - UpdateTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateTemplateResponse, error) - - UpdateTemplateWithResponse(ctx context.Context, id string, body UpdateTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateTemplateResponse, error) - - // ListZones request - ListZonesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListZonesResponse, error) -} - -type ListAccessKeysResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - AccessKeys *[]AccessKey `json:"access-keys,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListAccessKeysResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListAccessKeysResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateAccessKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AccessKey -} - -// Status returns HTTPResponse.Status -func (r CreateAccessKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateAccessKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListAccessKeyKnownOperationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - AccessKeyOperations *[]AccessKeyOperation `json:"access-key-operations,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListAccessKeyKnownOperationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListAccessKeyKnownOperationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListAccessKeyOperationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - AccessKeyOperations *[]AccessKeyOperation `json:"access-key-operations,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListAccessKeyOperationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListAccessKeyOperationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RevokeAccessKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RevokeAccessKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RevokeAccessKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetAccessKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AccessKey -} - -// Status returns HTTPResponse.Status -func (r GetAccessKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetAccessKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListAntiAffinityGroupsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListAntiAffinityGroupsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListAntiAffinityGroupsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateAntiAffinityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateAntiAffinityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateAntiAffinityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteAntiAffinityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteAntiAffinityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteAntiAffinityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetAntiAffinityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AntiAffinityGroup -} - -// Status returns HTTPResponse.Status -func (r GetAntiAffinityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetAntiAffinityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListApiKeysResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - ApiKeys *[]IamApiKey `json:"api-keys,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListApiKeysResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListApiKeysResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateApiKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IamApiKeyCreated -} - -// Status returns HTTPResponse.Status -func (r CreateApiKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateApiKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteApiKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteApiKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteApiKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetApiKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IamApiKey -} - -// Status returns HTTPResponse.Status -func (r GetApiKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetApiKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasCaCertificateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Certificate *string `json:"certificate,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasCaCertificateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasCaCertificateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceGrafanaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceGrafanaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceGrafanaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceGrafanaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceGrafana -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceGrafanaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceGrafanaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServiceGrafanaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServiceGrafanaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServiceGrafanaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServiceGrafanaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServiceGrafanaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServiceGrafanaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasGrafanaMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasGrafanaMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasGrafanaMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasIntegrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasIntegrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasIntegrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDbaasIntegrationSettingsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - // The JSON schema representing the settings for the given integration type, source, and destination service types. - Settings *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDbaasIntegrationSettingsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDbaasIntegrationSettingsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDbaasIntegrationTypesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DbaasIntegrationTypes *[]DbaasIntegrationType `json:"dbaas-integration-types,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDbaasIntegrationTypesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDbaasIntegrationTypesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasIntegrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasIntegrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasIntegrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasIntegrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasIntegration -} - -// Status returns HTTPResponse.Status -func (r GetDbaasIntegrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasIntegrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasIntegrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasIntegrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasIntegrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceKafkaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceKafkaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceKafkaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceKafkaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceKafka -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceKafkaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceKafkaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServiceKafkaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServiceKafkaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServiceKafkaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServiceKafkaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServiceKafkaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServiceKafkaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasKafkaAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasKafkaAcls -} - -// Status returns HTTPResponse.Status -func (r GetDbaasKafkaAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasKafkaAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasKafkaMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasKafkaMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasKafkaMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasKafkaSchemaRegistryAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasKafkaSchemaRegistryAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasKafkaSchemaRegistryAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasKafkaSchemaRegistryAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasKafkaSchemaRegistryAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasKafkaSchemaRegistryAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasKafkaTopicAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasKafkaTopicAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasKafkaTopicAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasKafkaTopicAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasKafkaTopicAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasKafkaTopicAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasKafkaUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasKafkaUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasKafkaUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasKafkaUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasKafkaUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasKafkaUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetDbaasKafkaUserPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetDbaasKafkaUserPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetDbaasKafkaUserPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasMigrationStatusResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasMigrationStatus -} - -// Status returns HTTPResponse.Status -func (r GetDbaasMigrationStatusResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasMigrationStatusResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceMysqlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceMysqlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceMysqlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceMysqlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceMysql -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceMysqlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceMysqlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServiceMysqlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServiceMysqlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServiceMysqlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServiceMysqlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServiceMysqlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServiceMysqlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasMysqlMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasMysqlMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasMysqlMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StopDbaasMysqlMigrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StopDbaasMysqlMigrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StopDbaasMysqlMigrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasMysqlDatabaseResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasMysqlDatabaseResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasMysqlDatabaseResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasMysqlDatabaseResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasMysqlDatabaseResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasMysqlDatabaseResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasMysqlUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasMysqlUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasMysqlUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasMysqlUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasMysqlUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasMysqlUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetDbaasMysqlUserPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetDbaasMysqlUserPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetDbaasMysqlUserPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceOpensearchResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceOpensearchResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceOpensearchResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceOpensearchResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceOpensearch -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceOpensearchResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceOpensearchResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServiceOpensearchResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServiceOpensearchResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServiceOpensearchResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServiceOpensearchResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServiceOpensearchResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServiceOpensearchResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasOpensearchAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasOpensearchAclConfig -} - -// Status returns HTTPResponse.Status -func (r GetDbaasOpensearchAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasOpensearchAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasOpensearchAclConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasOpensearchAclConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasOpensearchAclConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasOpensearchMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasOpensearchMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasOpensearchMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasOpensearchUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasOpensearchUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasOpensearchUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasOpensearchUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasOpensearchUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasOpensearchUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetDbaasOpensearchUserPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetDbaasOpensearchUserPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetDbaasOpensearchUserPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServicePgResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServicePgResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServicePgResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServicePgResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServicePg -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServicePgResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServicePgResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServicePgResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServicePgResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServicePgResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServicePgResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServicePgResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServicePgResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasPgMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasPgMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasPgMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StopDbaasPgMigrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StopDbaasPgMigrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StopDbaasPgMigrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasPgConnectionPoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasPgConnectionPoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasPgConnectionPoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasPgConnectionPoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasPgConnectionPoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasPgConnectionPoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasPgConnectionPoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasPgConnectionPoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasPgConnectionPoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasPgDatabaseResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasPgDatabaseResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasPgDatabaseResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasPgDatabaseResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasPgDatabaseResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasPgDatabaseResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasPostgresUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasPostgresUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasPostgresUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasPostgresUserResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasPostgresUserResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasPostgresUserResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasPostgresAllowReplicationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasPostgresUsers -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasPostgresAllowReplicationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasPostgresAllowReplicationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetDbaasPostgresUserPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetDbaasPostgresUserPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetDbaasPostgresUserPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasPgUpgradeCheckResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasTask -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasPgUpgradeCheckResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasPgUpgradeCheckResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceRedisResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceRedisResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceRedisResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceRedisResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceRedis -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceRedisResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceRedisResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasServiceRedisResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasServiceRedisResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasServiceRedisResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDbaasServiceRedisResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDbaasServiceRedisResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDbaasServiceRedisResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartDbaasRedisMaintenanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartDbaasRedisMaintenanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartDbaasRedisMaintenanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StopDbaasRedisMigrationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StopDbaasRedisMigrationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StopDbaasRedisMigrationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDbaasServicesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DbaasServices *[]DbaasServiceCommon `json:"dbaas-services,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDbaasServicesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDbaasServicesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceLogsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceLogs -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceLogsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceLogsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceMetricsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Metrics *map[string]interface{} `json:"metrics,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceMetricsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceMetricsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDbaasServiceTypesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DbaasServiceTypes *[]DbaasServiceType `json:"dbaas-service-types,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDbaasServiceTypesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDbaasServiceTypesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasServiceTypeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasServiceType -} - -// Status returns HTTPResponse.Status -func (r GetDbaasServiceTypeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasServiceTypeResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDbaasServiceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDbaasServiceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDbaasServiceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsGrafanaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // Grafana configuration values - Grafana *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"grafana,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsGrafanaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsGrafanaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsKafkaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // Kafka broker configuration values - Kafka *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka,omitempty"` - - // Kafka Connect configuration values - KafkaConnect *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka-connect,omitempty"` - - // Kafka REST configuration - KafkaRest *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka-rest,omitempty"` - - // Schema Registry configuration - SchemaRegistry *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"schema-registry,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsKafkaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsKafkaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsMysqlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // mysql.conf configuration values - Mysql *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"mysql,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsMysqlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsMysqlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsOpensearchResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // OpenSearch configuration values - Opensearch *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"opensearch,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsOpensearchResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsOpensearchResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsPgResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // postgresql.conf configuration values - Pg *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pg,omitempty"` - - // PGBouncer connection pooling settings - Pgbouncer *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pgbouncer,omitempty"` - - // PGLookout settings - Pglookout *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pglookout,omitempty"` - - // TimescaleDB extension configuration values - Timescaledb *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"timescaledb,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsPgResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsPgResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasSettingsRedisResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Settings *struct { - // Redis configuration values - Redis *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"redis,omitempty"` - } `json:"settings,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDbaasSettingsRedisResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasSettingsRedisResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDbaasTaskMigrationCheckResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDbaasTaskMigrationCheckResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDbaasTaskMigrationCheckResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDbaasTaskResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DbaasTask -} - -// Status returns HTTPResponse.Status -func (r GetDbaasTaskResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDbaasTaskResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDeployTargetsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DeployTargets *[]DeployTarget `json:"deploy-targets,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDeployTargetsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDeployTargetsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDeployTargetResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DeployTarget -} - -// Status returns HTTPResponse.Status -func (r GetDeployTargetResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDeployTargetResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDnsDomainsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DnsDomains *[]DnsDomain `json:"dns-domains,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDnsDomainsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDnsDomainsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDnsDomainResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DnsDomain -} - -// Status returns HTTPResponse.Status -func (r CreateDnsDomainResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDnsDomainResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListDnsDomainRecordsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - DnsDomainRecords *[]DnsDomainRecord `json:"dns-domain-records,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListDnsDomainRecordsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListDnsDomainRecordsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateDnsDomainRecordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateDnsDomainRecordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateDnsDomainRecordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDnsDomainRecordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDnsDomainRecordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDnsDomainRecordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDnsDomainRecordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DnsDomainRecord -} - -// Status returns HTTPResponse.Status -func (r GetDnsDomainRecordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDnsDomainRecordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateDnsDomainRecordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateDnsDomainRecordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateDnsDomainRecordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteDnsDomainResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteDnsDomainResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDnsDomainResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDnsDomainResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DnsDomain -} - -// Status returns HTTPResponse.Status -func (r GetDnsDomainResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDnsDomainResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetDnsDomainZoneFileResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - ZoneFile *string `json:"zone-file,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetDnsDomainZoneFileResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetDnsDomainZoneFileResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListElasticIpsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - ElasticIps *[]ElasticIp `json:"elastic-ips,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListElasticIpsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListElasticIpsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ElasticIp -} - -// Status returns HTTPResponse.Status -func (r GetElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetElasticIpFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetElasticIpFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetElasticIpFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AttachInstanceToElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AttachInstanceToElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AttachInstanceToElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DetachInstanceFromElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DetachInstanceFromElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DetachInstanceFromElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListEventsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *[]Event -} - -// Status returns HTTPResponse.Status -func (r ListEventsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListEventsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetIamOrganizationPolicyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IamPolicy -} - -// Status returns HTTPResponse.Status -func (r GetIamOrganizationPolicyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetIamOrganizationPolicyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateIamOrganizationPolicyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateIamOrganizationPolicyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateIamOrganizationPolicyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListIamRolesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - IamRoles *[]IamRole `json:"iam-roles,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListIamRolesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListIamRolesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateIamRoleResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateIamRoleResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateIamRoleResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteIamRoleResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteIamRoleResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteIamRoleResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetIamRoleResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IamRole -} - -// Status returns HTTPResponse.Status -func (r GetIamRoleResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetIamRoleResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateIamRoleResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateIamRoleResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateIamRoleResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateIamRolePolicyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateIamRolePolicyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateIamRolePolicyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListInstancesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Instances *[]Instance `json:"instances,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListInstancesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListInstancesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListInstancePoolsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - InstancePools *[]InstancePool `json:"instance-pools,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListInstancePoolsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListInstancePoolsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateInstancePoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateInstancePoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateInstancePoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteInstancePoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteInstancePoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteInstancePoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetInstancePoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *InstancePool -} - -// Status returns HTTPResponse.Status -func (r GetInstancePoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetInstancePoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateInstancePoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateInstancePoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateInstancePoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetInstancePoolFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetInstancePoolFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetInstancePoolFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type EvictInstancePoolMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r EvictInstancePoolMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r EvictInstancePoolMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ScaleInstancePoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ScaleInstancePoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ScaleInstancePoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListInstanceTypesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - InstanceTypes *[]InstanceType `json:"instance-types,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListInstanceTypesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListInstanceTypesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetInstanceTypeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *InstanceType -} - -// Status returns HTTPResponse.Status -func (r GetInstanceTypeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetInstanceTypeResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Instance -} - -// Status returns HTTPResponse.Status -func (r GetInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetInstanceFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetInstanceFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetInstanceFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AddInstanceProtectionResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *map[string]interface{} -} - -// Status returns HTTPResponse.Status -func (r AddInstanceProtectionResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddInstanceProtectionResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateSnapshotResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateSnapshotResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateSnapshotResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RevealInstancePasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *InstancePassword -} - -// Status returns HTTPResponse.Status -func (r RevealInstancePasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RevealInstancePasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RebootInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RebootInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RebootInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RemoveInstanceProtectionResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *map[string]interface{} -} - -// Status returns HTTPResponse.Status -func (r RemoveInstanceProtectionResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RemoveInstanceProtectionResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetInstancePasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetInstancePasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetInstancePasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResizeInstanceDiskResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResizeInstanceDiskResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResizeInstanceDiskResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ScaleInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ScaleInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ScaleInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StartInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StartInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StartInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type StopInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r StopInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r StopInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RevertInstanceToSnapshotResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RevertInstanceToSnapshotResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RevertInstanceToSnapshotResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListLoadBalancersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - LoadBalancers *[]LoadBalancer `json:"load-balancers,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListLoadBalancersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListLoadBalancersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateLoadBalancerResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateLoadBalancerResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateLoadBalancerResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteLoadBalancerResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteLoadBalancerResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteLoadBalancerResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetLoadBalancerResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LoadBalancer -} - -// Status returns HTTPResponse.Status -func (r GetLoadBalancerResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLoadBalancerResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateLoadBalancerResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateLoadBalancerResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateLoadBalancerResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AddServiceToLoadBalancerResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AddServiceToLoadBalancerResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddServiceToLoadBalancerResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteLoadBalancerServiceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteLoadBalancerServiceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteLoadBalancerServiceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetLoadBalancerServiceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LoadBalancerService -} - -// Status returns HTTPResponse.Status -func (r GetLoadBalancerServiceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetLoadBalancerServiceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateLoadBalancerServiceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateLoadBalancerServiceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateLoadBalancerServiceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetLoadBalancerServiceFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetLoadBalancerServiceFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetLoadBalancerServiceFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetLoadBalancerFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetLoadBalancerFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetLoadBalancerFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetOperationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r GetOperationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetOperationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListPrivateNetworksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListPrivateNetworksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListPrivateNetworksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreatePrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreatePrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreatePrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeletePrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeletePrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeletePrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetPrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *PrivateNetwork -} - -// Status returns HTTPResponse.Status -func (r GetPrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetPrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdatePrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdatePrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdatePrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetPrivateNetworkFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetPrivateNetworkFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetPrivateNetworkFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AttachInstanceToPrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AttachInstanceToPrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AttachInstanceToPrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DetachInstanceFromPrivateNetworkResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DetachInstanceFromPrivateNetworkResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DetachInstanceFromPrivateNetworkResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdatePrivateNetworkInstanceIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdatePrivateNetworkInstanceIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdatePrivateNetworkInstanceIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListQuotasResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Quotas *[]Quota `json:"quotas,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListQuotasResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListQuotasResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetQuotaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Quota -} - -// Status returns HTTPResponse.Status -func (r GetQuotaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetQuotaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteReverseDnsElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteReverseDnsElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteReverseDnsElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetReverseDnsElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ReverseDnsRecord -} - -// Status returns HTTPResponse.Status -func (r GetReverseDnsElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetReverseDnsElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateReverseDnsElasticIpResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateReverseDnsElasticIpResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateReverseDnsElasticIpResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteReverseDnsInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteReverseDnsInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteReverseDnsInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetReverseDnsInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ReverseDnsRecord -} - -// Status returns HTTPResponse.Status -func (r GetReverseDnsInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetReverseDnsInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateReverseDnsInstanceResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateReverseDnsInstanceResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateReverseDnsInstanceResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSecurityGroupsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSecurityGroupsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSecurityGroupsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SecurityGroup -} - -// Status returns HTTPResponse.Status -func (r GetSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AddRuleToSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AddRuleToSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddRuleToSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteRuleFromSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteRuleFromSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteRuleFromSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AddExternalSourceToSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AddExternalSourceToSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AddExternalSourceToSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type AttachInstanceToSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r AttachInstanceToSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r AttachInstanceToSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DetachInstanceFromSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DetachInstanceFromSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DetachInstanceFromSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RemoveExternalSourceFromSecurityGroupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RemoveExternalSourceFromSecurityGroupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RemoveExternalSourceFromSecurityGroupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSksClustersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - SksClusters *[]SksCluster `json:"sks-clusters,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSksClustersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSksClustersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateSksClusterResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateSksClusterResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateSksClusterResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSksClusterDeprecatedResourcesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *[]SksClusterDeprecatedResource -} - -// Status returns HTTPResponse.Status -func (r ListSksClusterDeprecatedResourcesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSksClusterDeprecatedResourcesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GenerateSksClusterKubeconfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Kubeconfig *string `json:"kubeconfig,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GenerateSksClusterKubeconfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GenerateSksClusterKubeconfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSksClusterVersionsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - SksClusterVersions *[]string `json:"sks-cluster-versions,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSksClusterVersionsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSksClusterVersionsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteSksClusterResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteSksClusterResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSksClusterResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSksClusterResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SksCluster -} - -// Status returns HTTPResponse.Status -func (r GetSksClusterResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSksClusterResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateSksClusterResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateSksClusterResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateSksClusterResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSksClusterAuthorityCertResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Cacert *string `json:"cacert,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetSksClusterAuthorityCertResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSksClusterAuthorityCertResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CreateSksNodepoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CreateSksNodepoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CreateSksNodepoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteSksNodepoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteSksNodepoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSksNodepoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSksNodepoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SksNodepool -} - -// Status returns HTTPResponse.Status -func (r GetSksNodepoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSksNodepoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateSksNodepoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateSksNodepoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateSksNodepoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetSksNodepoolFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetSksNodepoolFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetSksNodepoolFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type EvictSksNodepoolMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r EvictSksNodepoolMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r EvictSksNodepoolMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ScaleSksNodepoolResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ScaleSksNodepoolResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ScaleSksNodepoolResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RotateSksCcmCredentialsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RotateSksCcmCredentialsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RotateSksCcmCredentialsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RotateSksOperatorsCaResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RotateSksOperatorsCaResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RotateSksOperatorsCaResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpgradeSksClusterResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpgradeSksClusterResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpgradeSksClusterResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpgradeSksClusterServiceLevelResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpgradeSksClusterServiceLevelResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpgradeSksClusterServiceLevelResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ResetSksClusterFieldResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ResetSksClusterFieldResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ResetSksClusterFieldResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSnapshotsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Snapshots *[]Snapshot `json:"snapshots,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSnapshotsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSnapshotsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteSnapshotResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteSnapshotResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSnapshotResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSnapshotResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Snapshot -} - -// Status returns HTTPResponse.Status -func (r GetSnapshotResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSnapshotResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ExportSnapshotResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r ExportSnapshotResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ExportSnapshotResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type PromoteSnapshotToTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r PromoteSnapshotToTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r PromoteSnapshotToTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSosBucketsUsageResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - SosBucketsUsage *[]SosBucketUsage `json:"sos-buckets-usage,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSosBucketsUsageResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSosBucketsUsageResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSosPresignedUrlResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Url *string `json:"url,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r GetSosPresignedUrlResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSosPresignedUrlResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListSshKeysResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListSshKeysResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListSshKeysResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RegisterSshKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RegisterSshKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RegisterSshKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteSshKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteSshKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSshKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetSshKeyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SshKey -} - -// Status returns HTTPResponse.Status -func (r GetSshKeyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetSshKeyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListTemplatesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Templates *[]Template `json:"templates,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListTemplatesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListTemplatesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type RegisterTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r RegisterTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r RegisterTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type DeleteTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r DeleteTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type GetTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Template -} - -// Status returns HTTPResponse.Status -func (r GetTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r GetTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type CopyTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r CopyTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r CopyTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type UpdateTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Operation -} - -// Status returns HTTPResponse.Status -func (r UpdateTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -type ListZonesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Zones *[]Zone `json:"zones,omitempty"` - } -} - -// Status returns HTTPResponse.Status -func (r ListZonesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r ListZonesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} - -// ListAccessKeysWithResponse request returning *ListAccessKeysResponse -func (c *ClientWithResponses) ListAccessKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeysResponse, error) { - rsp, err := c.ListAccessKeys(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAccessKeysResponse(rsp) -} - -// CreateAccessKeyWithBodyWithResponse request with arbitrary body returning *CreateAccessKeyResponse -func (c *ClientWithResponses) CreateAccessKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAccessKeyResponse, error) { - rsp, err := c.CreateAccessKeyWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateAccessKeyResponse(rsp) -} - -func (c *ClientWithResponses) CreateAccessKeyWithResponse(ctx context.Context, body CreateAccessKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAccessKeyResponse, error) { - rsp, err := c.CreateAccessKey(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateAccessKeyResponse(rsp) -} - -// ListAccessKeyKnownOperationsWithResponse request returning *ListAccessKeyKnownOperationsResponse -func (c *ClientWithResponses) ListAccessKeyKnownOperationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeyKnownOperationsResponse, error) { - rsp, err := c.ListAccessKeyKnownOperations(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAccessKeyKnownOperationsResponse(rsp) -} - -// ListAccessKeyOperationsWithResponse request returning *ListAccessKeyOperationsResponse -func (c *ClientWithResponses) ListAccessKeyOperationsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAccessKeyOperationsResponse, error) { - rsp, err := c.ListAccessKeyOperations(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAccessKeyOperationsResponse(rsp) -} - -// RevokeAccessKeyWithResponse request returning *RevokeAccessKeyResponse -func (c *ClientWithResponses) RevokeAccessKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*RevokeAccessKeyResponse, error) { - rsp, err := c.RevokeAccessKey(ctx, key, reqEditors...) - if err != nil { - return nil, err - } - return ParseRevokeAccessKeyResponse(rsp) -} - -// GetAccessKeyWithResponse request returning *GetAccessKeyResponse -func (c *ClientWithResponses) GetAccessKeyWithResponse(ctx context.Context, key string, reqEditors ...RequestEditorFn) (*GetAccessKeyResponse, error) { - rsp, err := c.GetAccessKey(ctx, key, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetAccessKeyResponse(rsp) -} - -// ListAntiAffinityGroupsWithResponse request returning *ListAntiAffinityGroupsResponse -func (c *ClientWithResponses) ListAntiAffinityGroupsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListAntiAffinityGroupsResponse, error) { - rsp, err := c.ListAntiAffinityGroups(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListAntiAffinityGroupsResponse(rsp) -} - -// CreateAntiAffinityGroupWithBodyWithResponse request with arbitrary body returning *CreateAntiAffinityGroupResponse -func (c *ClientWithResponses) CreateAntiAffinityGroupWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateAntiAffinityGroupResponse, error) { - rsp, err := c.CreateAntiAffinityGroupWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateAntiAffinityGroupResponse(rsp) -} - -func (c *ClientWithResponses) CreateAntiAffinityGroupWithResponse(ctx context.Context, body CreateAntiAffinityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateAntiAffinityGroupResponse, error) { - rsp, err := c.CreateAntiAffinityGroup(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateAntiAffinityGroupResponse(rsp) -} - -// DeleteAntiAffinityGroupWithResponse request returning *DeleteAntiAffinityGroupResponse -func (c *ClientWithResponses) DeleteAntiAffinityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteAntiAffinityGroupResponse, error) { - rsp, err := c.DeleteAntiAffinityGroup(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteAntiAffinityGroupResponse(rsp) -} - -// GetAntiAffinityGroupWithResponse request returning *GetAntiAffinityGroupResponse -func (c *ClientWithResponses) GetAntiAffinityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetAntiAffinityGroupResponse, error) { - rsp, err := c.GetAntiAffinityGroup(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetAntiAffinityGroupResponse(rsp) -} - -// ListApiKeysWithResponse request returning *ListApiKeysResponse -func (c *ClientWithResponses) ListApiKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListApiKeysResponse, error) { - rsp, err := c.ListApiKeys(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListApiKeysResponse(rsp) -} - -// CreateApiKeyWithBodyWithResponse request with arbitrary body returning *CreateApiKeyResponse -func (c *ClientWithResponses) CreateApiKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) { - rsp, err := c.CreateApiKeyWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateApiKeyResponse(rsp) -} - -func (c *ClientWithResponses) CreateApiKeyWithResponse(ctx context.Context, body CreateApiKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateApiKeyResponse, error) { - rsp, err := c.CreateApiKey(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateApiKeyResponse(rsp) -} - -// DeleteApiKeyWithResponse request returning *DeleteApiKeyResponse -func (c *ClientWithResponses) DeleteApiKeyWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteApiKeyResponse, error) { - rsp, err := c.DeleteApiKey(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteApiKeyResponse(rsp) -} - -// GetApiKeyWithResponse request returning *GetApiKeyResponse -func (c *ClientWithResponses) GetApiKeyWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetApiKeyResponse, error) { - rsp, err := c.GetApiKey(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetApiKeyResponse(rsp) -} - -// GetDbaasCaCertificateWithResponse request returning *GetDbaasCaCertificateResponse -func (c *ClientWithResponses) GetDbaasCaCertificateWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasCaCertificateResponse, error) { - rsp, err := c.GetDbaasCaCertificate(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasCaCertificateResponse(rsp) -} - -// DeleteDbaasServiceGrafanaWithResponse request returning *DeleteDbaasServiceGrafanaResponse -func (c *ClientWithResponses) DeleteDbaasServiceGrafanaWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceGrafanaResponse, error) { - rsp, err := c.DeleteDbaasServiceGrafana(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceGrafanaResponse(rsp) -} - -// GetDbaasServiceGrafanaWithResponse request returning *GetDbaasServiceGrafanaResponse -func (c *ClientWithResponses) GetDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceGrafanaResponse, error) { - rsp, err := c.GetDbaasServiceGrafana(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceGrafanaResponse(rsp) -} - -// CreateDbaasServiceGrafanaWithBodyWithResponse request with arbitrary body returning *CreateDbaasServiceGrafanaResponse -func (c *ClientWithResponses) CreateDbaasServiceGrafanaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceGrafanaResponse, error) { - rsp, err := c.CreateDbaasServiceGrafanaWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceGrafanaResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceGrafanaResponse, error) { - rsp, err := c.CreateDbaasServiceGrafana(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceGrafanaResponse(rsp) -} - -// UpdateDbaasServiceGrafanaWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServiceGrafanaResponse -func (c *ClientWithResponses) UpdateDbaasServiceGrafanaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceGrafanaResponse, error) { - rsp, err := c.UpdateDbaasServiceGrafanaWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceGrafanaResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServiceGrafanaWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceGrafanaJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceGrafanaResponse, error) { - rsp, err := c.UpdateDbaasServiceGrafana(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceGrafanaResponse(rsp) -} - -// StartDbaasGrafanaMaintenanceWithResponse request returning *StartDbaasGrafanaMaintenanceResponse -func (c *ClientWithResponses) StartDbaasGrafanaMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasGrafanaMaintenanceResponse, error) { - rsp, err := c.StartDbaasGrafanaMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasGrafanaMaintenanceResponse(rsp) -} - -// CreateDbaasIntegrationWithBodyWithResponse request with arbitrary body returning *CreateDbaasIntegrationResponse -func (c *ClientWithResponses) CreateDbaasIntegrationWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasIntegrationResponse, error) { - rsp, err := c.CreateDbaasIntegrationWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasIntegrationResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasIntegrationWithResponse(ctx context.Context, body CreateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasIntegrationResponse, error) { - rsp, err := c.CreateDbaasIntegration(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasIntegrationResponse(rsp) -} - -// ListDbaasIntegrationSettingsWithResponse request returning *ListDbaasIntegrationSettingsResponse -func (c *ClientWithResponses) ListDbaasIntegrationSettingsWithResponse(ctx context.Context, integrationType string, sourceType string, destType string, reqEditors ...RequestEditorFn) (*ListDbaasIntegrationSettingsResponse, error) { - rsp, err := c.ListDbaasIntegrationSettings(ctx, integrationType, sourceType, destType, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDbaasIntegrationSettingsResponse(rsp) -} - -// ListDbaasIntegrationTypesWithResponse request returning *ListDbaasIntegrationTypesResponse -func (c *ClientWithResponses) ListDbaasIntegrationTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasIntegrationTypesResponse, error) { - rsp, err := c.ListDbaasIntegrationTypes(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDbaasIntegrationTypesResponse(rsp) -} - -// DeleteDbaasIntegrationWithResponse request returning *DeleteDbaasIntegrationResponse -func (c *ClientWithResponses) DeleteDbaasIntegrationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteDbaasIntegrationResponse, error) { - rsp, err := c.DeleteDbaasIntegration(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasIntegrationResponse(rsp) -} - -// GetDbaasIntegrationWithResponse request returning *GetDbaasIntegrationResponse -func (c *ClientWithResponses) GetDbaasIntegrationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDbaasIntegrationResponse, error) { - rsp, err := c.GetDbaasIntegration(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasIntegrationResponse(rsp) -} - -// UpdateDbaasIntegrationWithBodyWithResponse request with arbitrary body returning *UpdateDbaasIntegrationResponse -func (c *ClientWithResponses) UpdateDbaasIntegrationWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasIntegrationResponse, error) { - rsp, err := c.UpdateDbaasIntegrationWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasIntegrationResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasIntegrationWithResponse(ctx context.Context, id string, body UpdateDbaasIntegrationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasIntegrationResponse, error) { - rsp, err := c.UpdateDbaasIntegration(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasIntegrationResponse(rsp) -} - -// DeleteDbaasServiceKafkaWithResponse request returning *DeleteDbaasServiceKafkaResponse -func (c *ClientWithResponses) DeleteDbaasServiceKafkaWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceKafkaResponse, error) { - rsp, err := c.DeleteDbaasServiceKafka(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceKafkaResponse(rsp) -} - -// GetDbaasServiceKafkaWithResponse request returning *GetDbaasServiceKafkaResponse -func (c *ClientWithResponses) GetDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceKafkaResponse, error) { - rsp, err := c.GetDbaasServiceKafka(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceKafkaResponse(rsp) -} - -// CreateDbaasServiceKafkaWithBodyWithResponse request with arbitrary body returning *CreateDbaasServiceKafkaResponse -func (c *ClientWithResponses) CreateDbaasServiceKafkaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceKafkaResponse, error) { - rsp, err := c.CreateDbaasServiceKafkaWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceKafkaResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceKafkaResponse, error) { - rsp, err := c.CreateDbaasServiceKafka(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceKafkaResponse(rsp) -} - -// UpdateDbaasServiceKafkaWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServiceKafkaResponse -func (c *ClientWithResponses) UpdateDbaasServiceKafkaWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceKafkaResponse, error) { - rsp, err := c.UpdateDbaasServiceKafkaWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceKafkaResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServiceKafkaWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceKafkaJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceKafkaResponse, error) { - rsp, err := c.UpdateDbaasServiceKafka(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceKafkaResponse(rsp) -} - -// GetDbaasKafkaAclConfigWithResponse request returning *GetDbaasKafkaAclConfigResponse -func (c *ClientWithResponses) GetDbaasKafkaAclConfigWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasKafkaAclConfigResponse, error) { - rsp, err := c.GetDbaasKafkaAclConfig(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasKafkaAclConfigResponse(rsp) -} - -// StartDbaasKafkaMaintenanceWithResponse request returning *StartDbaasKafkaMaintenanceResponse -func (c *ClientWithResponses) StartDbaasKafkaMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasKafkaMaintenanceResponse, error) { - rsp, err := c.StartDbaasKafkaMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasKafkaMaintenanceResponse(rsp) -} - -// CreateDbaasKafkaSchemaRegistryAclConfigWithBodyWithResponse request with arbitrary body returning *CreateDbaasKafkaSchemaRegistryAclConfigResponse -func (c *ClientWithResponses) CreateDbaasKafkaSchemaRegistryAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaSchemaRegistryAclConfigResponse, error) { - rsp, err := c.CreateDbaasKafkaSchemaRegistryAclConfigWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaSchemaRegistryAclConfigResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasKafkaSchemaRegistryAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaSchemaRegistryAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaSchemaRegistryAclConfigResponse, error) { - rsp, err := c.CreateDbaasKafkaSchemaRegistryAclConfig(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaSchemaRegistryAclConfigResponse(rsp) -} - -// DeleteDbaasKafkaSchemaRegistryAclConfigWithResponse request returning *DeleteDbaasKafkaSchemaRegistryAclConfigResponse -func (c *ClientWithResponses) DeleteDbaasKafkaSchemaRegistryAclConfigWithResponse(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaSchemaRegistryAclConfigResponse, error) { - rsp, err := c.DeleteDbaasKafkaSchemaRegistryAclConfig(ctx, name, aclId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasKafkaSchemaRegistryAclConfigResponse(rsp) -} - -// CreateDbaasKafkaTopicAclConfigWithBodyWithResponse request with arbitrary body returning *CreateDbaasKafkaTopicAclConfigResponse -func (c *ClientWithResponses) CreateDbaasKafkaTopicAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaTopicAclConfigResponse, error) { - rsp, err := c.CreateDbaasKafkaTopicAclConfigWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaTopicAclConfigResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasKafkaTopicAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasKafkaTopicAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaTopicAclConfigResponse, error) { - rsp, err := c.CreateDbaasKafkaTopicAclConfig(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaTopicAclConfigResponse(rsp) -} - -// DeleteDbaasKafkaTopicAclConfigWithResponse request returning *DeleteDbaasKafkaTopicAclConfigResponse -func (c *ClientWithResponses) DeleteDbaasKafkaTopicAclConfigWithResponse(ctx context.Context, name DbaasServiceName, aclId DbaasKafkaAclId, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaTopicAclConfigResponse, error) { - rsp, err := c.DeleteDbaasKafkaTopicAclConfig(ctx, name, aclId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasKafkaTopicAclConfigResponse(rsp) -} - -// CreateDbaasKafkaUserWithBodyWithResponse request with arbitrary body returning *CreateDbaasKafkaUserResponse -func (c *ClientWithResponses) CreateDbaasKafkaUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaUserResponse, error) { - rsp, err := c.CreateDbaasKafkaUserWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaUserResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasKafkaUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasKafkaUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasKafkaUserResponse, error) { - rsp, err := c.CreateDbaasKafkaUser(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasKafkaUserResponse(rsp) -} - -// DeleteDbaasKafkaUserWithResponse request returning *DeleteDbaasKafkaUserResponse -func (c *ClientWithResponses) DeleteDbaasKafkaUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasKafkaUserResponse, error) { - rsp, err := c.DeleteDbaasKafkaUser(ctx, serviceName, username, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasKafkaUserResponse(rsp) -} - -// ResetDbaasKafkaUserPasswordWithBodyWithResponse request with arbitrary body returning *ResetDbaasKafkaUserPasswordResponse -func (c *ClientWithResponses) ResetDbaasKafkaUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasKafkaUserPasswordResponse, error) { - rsp, err := c.ResetDbaasKafkaUserPasswordWithBody(ctx, serviceName, username, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasKafkaUserPasswordResponse(rsp) -} - -func (c *ClientWithResponses) ResetDbaasKafkaUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasKafkaUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasKafkaUserPasswordResponse, error) { - rsp, err := c.ResetDbaasKafkaUserPassword(ctx, serviceName, username, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasKafkaUserPasswordResponse(rsp) -} - -// GetDbaasMigrationStatusWithResponse request returning *GetDbaasMigrationStatusResponse -func (c *ClientWithResponses) GetDbaasMigrationStatusWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasMigrationStatusResponse, error) { - rsp, err := c.GetDbaasMigrationStatus(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasMigrationStatusResponse(rsp) -} - -// DeleteDbaasServiceMysqlWithResponse request returning *DeleteDbaasServiceMysqlResponse -func (c *ClientWithResponses) DeleteDbaasServiceMysqlWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceMysqlResponse, error) { - rsp, err := c.DeleteDbaasServiceMysql(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceMysqlResponse(rsp) -} - -// GetDbaasServiceMysqlWithResponse request returning *GetDbaasServiceMysqlResponse -func (c *ClientWithResponses) GetDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceMysqlResponse, error) { - rsp, err := c.GetDbaasServiceMysql(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceMysqlResponse(rsp) -} - -// CreateDbaasServiceMysqlWithBodyWithResponse request with arbitrary body returning *CreateDbaasServiceMysqlResponse -func (c *ClientWithResponses) CreateDbaasServiceMysqlWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceMysqlResponse, error) { - rsp, err := c.CreateDbaasServiceMysqlWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceMysqlResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceMysqlResponse, error) { - rsp, err := c.CreateDbaasServiceMysql(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceMysqlResponse(rsp) -} - -// UpdateDbaasServiceMysqlWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServiceMysqlResponse -func (c *ClientWithResponses) UpdateDbaasServiceMysqlWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceMysqlResponse, error) { - rsp, err := c.UpdateDbaasServiceMysqlWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceMysqlResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServiceMysqlWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceMysqlJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceMysqlResponse, error) { - rsp, err := c.UpdateDbaasServiceMysql(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceMysqlResponse(rsp) -} - -// StartDbaasMysqlMaintenanceWithResponse request returning *StartDbaasMysqlMaintenanceResponse -func (c *ClientWithResponses) StartDbaasMysqlMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasMysqlMaintenanceResponse, error) { - rsp, err := c.StartDbaasMysqlMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasMysqlMaintenanceResponse(rsp) -} - -// StopDbaasMysqlMigrationWithResponse request returning *StopDbaasMysqlMigrationResponse -func (c *ClientWithResponses) StopDbaasMysqlMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasMysqlMigrationResponse, error) { - rsp, err := c.StopDbaasMysqlMigration(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStopDbaasMysqlMigrationResponse(rsp) -} - -// CreateDbaasMysqlDatabaseWithBodyWithResponse request with arbitrary body returning *CreateDbaasMysqlDatabaseResponse -func (c *ClientWithResponses) CreateDbaasMysqlDatabaseWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlDatabaseResponse, error) { - rsp, err := c.CreateDbaasMysqlDatabaseWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasMysqlDatabaseResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasMysqlDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlDatabaseResponse, error) { - rsp, err := c.CreateDbaasMysqlDatabase(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasMysqlDatabaseResponse(rsp) -} - -// DeleteDbaasMysqlDatabaseWithResponse request returning *DeleteDbaasMysqlDatabaseResponse -func (c *ClientWithResponses) DeleteDbaasMysqlDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasMysqlDatabaseName, reqEditors ...RequestEditorFn) (*DeleteDbaasMysqlDatabaseResponse, error) { - rsp, err := c.DeleteDbaasMysqlDatabase(ctx, serviceName, databaseName, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasMysqlDatabaseResponse(rsp) -} - -// CreateDbaasMysqlUserWithBodyWithResponse request with arbitrary body returning *CreateDbaasMysqlUserResponse -func (c *ClientWithResponses) CreateDbaasMysqlUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlUserResponse, error) { - rsp, err := c.CreateDbaasMysqlUserWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasMysqlUserResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasMysqlUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasMysqlUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasMysqlUserResponse, error) { - rsp, err := c.CreateDbaasMysqlUser(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasMysqlUserResponse(rsp) -} - -// DeleteDbaasMysqlUserWithResponse request returning *DeleteDbaasMysqlUserResponse -func (c *ClientWithResponses) DeleteDbaasMysqlUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasMysqlUserResponse, error) { - rsp, err := c.DeleteDbaasMysqlUser(ctx, serviceName, username, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasMysqlUserResponse(rsp) -} - -// ResetDbaasMysqlUserPasswordWithBodyWithResponse request with arbitrary body returning *ResetDbaasMysqlUserPasswordResponse -func (c *ClientWithResponses) ResetDbaasMysqlUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasMysqlUserPasswordResponse, error) { - rsp, err := c.ResetDbaasMysqlUserPasswordWithBody(ctx, serviceName, username, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasMysqlUserPasswordResponse(rsp) -} - -func (c *ClientWithResponses) ResetDbaasMysqlUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasMysqlUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasMysqlUserPasswordResponse, error) { - rsp, err := c.ResetDbaasMysqlUserPassword(ctx, serviceName, username, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasMysqlUserPasswordResponse(rsp) -} - -// DeleteDbaasServiceOpensearchWithResponse request returning *DeleteDbaasServiceOpensearchResponse -func (c *ClientWithResponses) DeleteDbaasServiceOpensearchWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceOpensearchResponse, error) { - rsp, err := c.DeleteDbaasServiceOpensearch(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceOpensearchResponse(rsp) -} - -// GetDbaasServiceOpensearchWithResponse request returning *GetDbaasServiceOpensearchResponse -func (c *ClientWithResponses) GetDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceOpensearchResponse, error) { - rsp, err := c.GetDbaasServiceOpensearch(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceOpensearchResponse(rsp) -} - -// CreateDbaasServiceOpensearchWithBodyWithResponse request with arbitrary body returning *CreateDbaasServiceOpensearchResponse -func (c *ClientWithResponses) CreateDbaasServiceOpensearchWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceOpensearchResponse, error) { - rsp, err := c.CreateDbaasServiceOpensearchWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceOpensearchResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceOpensearchResponse, error) { - rsp, err := c.CreateDbaasServiceOpensearch(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceOpensearchResponse(rsp) -} - -// UpdateDbaasServiceOpensearchWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServiceOpensearchResponse -func (c *ClientWithResponses) UpdateDbaasServiceOpensearchWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceOpensearchResponse, error) { - rsp, err := c.UpdateDbaasServiceOpensearchWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceOpensearchResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServiceOpensearchWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceOpensearchJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceOpensearchResponse, error) { - rsp, err := c.UpdateDbaasServiceOpensearch(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceOpensearchResponse(rsp) -} - -// GetDbaasOpensearchAclConfigWithResponse request returning *GetDbaasOpensearchAclConfigResponse -func (c *ClientWithResponses) GetDbaasOpensearchAclConfigWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasOpensearchAclConfigResponse, error) { - rsp, err := c.GetDbaasOpensearchAclConfig(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasOpensearchAclConfigResponse(rsp) -} - -// UpdateDbaasOpensearchAclConfigWithBodyWithResponse request with arbitrary body returning *UpdateDbaasOpensearchAclConfigResponse -func (c *ClientWithResponses) UpdateDbaasOpensearchAclConfigWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasOpensearchAclConfigResponse, error) { - rsp, err := c.UpdateDbaasOpensearchAclConfigWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasOpensearchAclConfigResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasOpensearchAclConfigWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasOpensearchAclConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasOpensearchAclConfigResponse, error) { - rsp, err := c.UpdateDbaasOpensearchAclConfig(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasOpensearchAclConfigResponse(rsp) -} - -// StartDbaasOpensearchMaintenanceWithResponse request returning *StartDbaasOpensearchMaintenanceResponse -func (c *ClientWithResponses) StartDbaasOpensearchMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasOpensearchMaintenanceResponse, error) { - rsp, err := c.StartDbaasOpensearchMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasOpensearchMaintenanceResponse(rsp) -} - -// CreateDbaasOpensearchUserWithBodyWithResponse request with arbitrary body returning *CreateDbaasOpensearchUserResponse -func (c *ClientWithResponses) CreateDbaasOpensearchUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasOpensearchUserResponse, error) { - rsp, err := c.CreateDbaasOpensearchUserWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasOpensearchUserResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasOpensearchUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasOpensearchUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasOpensearchUserResponse, error) { - rsp, err := c.CreateDbaasOpensearchUser(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasOpensearchUserResponse(rsp) -} - -// DeleteDbaasOpensearchUserWithResponse request returning *DeleteDbaasOpensearchUserResponse -func (c *ClientWithResponses) DeleteDbaasOpensearchUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasOpensearchUserResponse, error) { - rsp, err := c.DeleteDbaasOpensearchUser(ctx, serviceName, username, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasOpensearchUserResponse(rsp) -} - -// ResetDbaasOpensearchUserPasswordWithBodyWithResponse request with arbitrary body returning *ResetDbaasOpensearchUserPasswordResponse -func (c *ClientWithResponses) ResetDbaasOpensearchUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasOpensearchUserPasswordResponse, error) { - rsp, err := c.ResetDbaasOpensearchUserPasswordWithBody(ctx, serviceName, username, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasOpensearchUserPasswordResponse(rsp) -} - -func (c *ClientWithResponses) ResetDbaasOpensearchUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasOpensearchUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasOpensearchUserPasswordResponse, error) { - rsp, err := c.ResetDbaasOpensearchUserPassword(ctx, serviceName, username, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasOpensearchUserPasswordResponse(rsp) -} - -// DeleteDbaasServicePgWithResponse request returning *DeleteDbaasServicePgResponse -func (c *ClientWithResponses) DeleteDbaasServicePgWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServicePgResponse, error) { - rsp, err := c.DeleteDbaasServicePg(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServicePgResponse(rsp) -} - -// GetDbaasServicePgWithResponse request returning *GetDbaasServicePgResponse -func (c *ClientWithResponses) GetDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServicePgResponse, error) { - rsp, err := c.GetDbaasServicePg(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServicePgResponse(rsp) -} - -// CreateDbaasServicePgWithBodyWithResponse request with arbitrary body returning *CreateDbaasServicePgResponse -func (c *ClientWithResponses) CreateDbaasServicePgWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServicePgResponse, error) { - rsp, err := c.CreateDbaasServicePgWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServicePgResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServicePgResponse, error) { - rsp, err := c.CreateDbaasServicePg(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServicePgResponse(rsp) -} - -// UpdateDbaasServicePgWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServicePgResponse -func (c *ClientWithResponses) UpdateDbaasServicePgWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServicePgResponse, error) { - rsp, err := c.UpdateDbaasServicePgWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServicePgResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServicePgWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServicePgJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServicePgResponse, error) { - rsp, err := c.UpdateDbaasServicePg(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServicePgResponse(rsp) -} - -// StartDbaasPgMaintenanceWithResponse request returning *StartDbaasPgMaintenanceResponse -func (c *ClientWithResponses) StartDbaasPgMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasPgMaintenanceResponse, error) { - rsp, err := c.StartDbaasPgMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasPgMaintenanceResponse(rsp) -} - -// StopDbaasPgMigrationWithResponse request returning *StopDbaasPgMigrationResponse -func (c *ClientWithResponses) StopDbaasPgMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasPgMigrationResponse, error) { - rsp, err := c.StopDbaasPgMigration(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStopDbaasPgMigrationResponse(rsp) -} - -// CreateDbaasPgConnectionPoolWithBodyWithResponse request with arbitrary body returning *CreateDbaasPgConnectionPoolResponse -func (c *ClientWithResponses) CreateDbaasPgConnectionPoolWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgConnectionPoolResponse, error) { - rsp, err := c.CreateDbaasPgConnectionPoolWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgConnectionPoolResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgConnectionPoolResponse, error) { - rsp, err := c.CreateDbaasPgConnectionPool(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgConnectionPoolResponse(rsp) -} - -// DeleteDbaasPgConnectionPoolWithResponse request returning *DeleteDbaasPgConnectionPoolResponse -func (c *ClientWithResponses) DeleteDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, reqEditors ...RequestEditorFn) (*DeleteDbaasPgConnectionPoolResponse, error) { - rsp, err := c.DeleteDbaasPgConnectionPool(ctx, serviceName, connectionPoolName, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasPgConnectionPoolResponse(rsp) -} - -// UpdateDbaasPgConnectionPoolWithBodyWithResponse request with arbitrary body returning *UpdateDbaasPgConnectionPoolResponse -func (c *ClientWithResponses) UpdateDbaasPgConnectionPoolWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasPgConnectionPoolResponse, error) { - rsp, err := c.UpdateDbaasPgConnectionPoolWithBody(ctx, serviceName, connectionPoolName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasPgConnectionPoolResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasPgConnectionPoolWithResponse(ctx context.Context, serviceName DbaasServiceName, connectionPoolName DbaasPgPoolName, body UpdateDbaasPgConnectionPoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasPgConnectionPoolResponse, error) { - rsp, err := c.UpdateDbaasPgConnectionPool(ctx, serviceName, connectionPoolName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasPgConnectionPoolResponse(rsp) -} - -// CreateDbaasPgDatabaseWithBodyWithResponse request with arbitrary body returning *CreateDbaasPgDatabaseResponse -func (c *ClientWithResponses) CreateDbaasPgDatabaseWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgDatabaseResponse, error) { - rsp, err := c.CreateDbaasPgDatabaseWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgDatabaseResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasPgDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPgDatabaseJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgDatabaseResponse, error) { - rsp, err := c.CreateDbaasPgDatabase(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgDatabaseResponse(rsp) -} - -// DeleteDbaasPgDatabaseWithResponse request returning *DeleteDbaasPgDatabaseResponse -func (c *ClientWithResponses) DeleteDbaasPgDatabaseWithResponse(ctx context.Context, serviceName DbaasServiceName, databaseName DbaasPgDatabaseName, reqEditors ...RequestEditorFn) (*DeleteDbaasPgDatabaseResponse, error) { - rsp, err := c.DeleteDbaasPgDatabase(ctx, serviceName, databaseName, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasPgDatabaseResponse(rsp) -} - -// CreateDbaasPostgresUserWithBodyWithResponse request with arbitrary body returning *CreateDbaasPostgresUserResponse -func (c *ClientWithResponses) CreateDbaasPostgresUserWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPostgresUserResponse, error) { - rsp, err := c.CreateDbaasPostgresUserWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPostgresUserResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasPostgresUserWithResponse(ctx context.Context, serviceName DbaasServiceName, body CreateDbaasPostgresUserJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPostgresUserResponse, error) { - rsp, err := c.CreateDbaasPostgresUser(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPostgresUserResponse(rsp) -} - -// DeleteDbaasPostgresUserWithResponse request returning *DeleteDbaasPostgresUserResponse -func (c *ClientWithResponses) DeleteDbaasPostgresUserWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, reqEditors ...RequestEditorFn) (*DeleteDbaasPostgresUserResponse, error) { - rsp, err := c.DeleteDbaasPostgresUser(ctx, serviceName, username, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasPostgresUserResponse(rsp) -} - -// UpdateDbaasPostgresAllowReplicationWithBodyWithResponse request with arbitrary body returning *UpdateDbaasPostgresAllowReplicationResponse -func (c *ClientWithResponses) UpdateDbaasPostgresAllowReplicationWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasPostgresAllowReplicationResponse, error) { - rsp, err := c.UpdateDbaasPostgresAllowReplicationWithBody(ctx, serviceName, username, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasPostgresAllowReplicationResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasPostgresAllowReplicationWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body UpdateDbaasPostgresAllowReplicationJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasPostgresAllowReplicationResponse, error) { - rsp, err := c.UpdateDbaasPostgresAllowReplication(ctx, serviceName, username, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasPostgresAllowReplicationResponse(rsp) -} - -// ResetDbaasPostgresUserPasswordWithBodyWithResponse request with arbitrary body returning *ResetDbaasPostgresUserPasswordResponse -func (c *ClientWithResponses) ResetDbaasPostgresUserPasswordWithBodyWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetDbaasPostgresUserPasswordResponse, error) { - rsp, err := c.ResetDbaasPostgresUserPasswordWithBody(ctx, serviceName, username, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasPostgresUserPasswordResponse(rsp) -} - -func (c *ClientWithResponses) ResetDbaasPostgresUserPasswordWithResponse(ctx context.Context, serviceName DbaasServiceName, username DbaasUserUsername, body ResetDbaasPostgresUserPasswordJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetDbaasPostgresUserPasswordResponse, error) { - rsp, err := c.ResetDbaasPostgresUserPassword(ctx, serviceName, username, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetDbaasPostgresUserPasswordResponse(rsp) -} - -// CreateDbaasPgUpgradeCheckWithBodyWithResponse request with arbitrary body returning *CreateDbaasPgUpgradeCheckResponse -func (c *ClientWithResponses) CreateDbaasPgUpgradeCheckWithBodyWithResponse(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasPgUpgradeCheckResponse, error) { - rsp, err := c.CreateDbaasPgUpgradeCheckWithBody(ctx, service, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgUpgradeCheckResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasPgUpgradeCheckWithResponse(ctx context.Context, service DbaasServiceName, body CreateDbaasPgUpgradeCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasPgUpgradeCheckResponse, error) { - rsp, err := c.CreateDbaasPgUpgradeCheck(ctx, service, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasPgUpgradeCheckResponse(rsp) -} - -// DeleteDbaasServiceRedisWithResponse request returning *DeleteDbaasServiceRedisResponse -func (c *ClientWithResponses) DeleteDbaasServiceRedisWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceRedisResponse, error) { - rsp, err := c.DeleteDbaasServiceRedis(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceRedisResponse(rsp) -} - -// GetDbaasServiceRedisWithResponse request returning *GetDbaasServiceRedisResponse -func (c *ClientWithResponses) GetDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*GetDbaasServiceRedisResponse, error) { - rsp, err := c.GetDbaasServiceRedis(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceRedisResponse(rsp) -} - -// CreateDbaasServiceRedisWithBodyWithResponse request with arbitrary body returning *CreateDbaasServiceRedisResponse -func (c *ClientWithResponses) CreateDbaasServiceRedisWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasServiceRedisResponse, error) { - rsp, err := c.CreateDbaasServiceRedisWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceRedisResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, body CreateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasServiceRedisResponse, error) { - rsp, err := c.CreateDbaasServiceRedis(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasServiceRedisResponse(rsp) -} - -// UpdateDbaasServiceRedisWithBodyWithResponse request with arbitrary body returning *UpdateDbaasServiceRedisResponse -func (c *ClientWithResponses) UpdateDbaasServiceRedisWithBodyWithResponse(ctx context.Context, name DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceRedisResponse, error) { - rsp, err := c.UpdateDbaasServiceRedisWithBody(ctx, name, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceRedisResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDbaasServiceRedisWithResponse(ctx context.Context, name DbaasServiceName, body UpdateDbaasServiceRedisJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDbaasServiceRedisResponse, error) { - rsp, err := c.UpdateDbaasServiceRedis(ctx, name, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDbaasServiceRedisResponse(rsp) -} - -// StartDbaasRedisMaintenanceWithResponse request returning *StartDbaasRedisMaintenanceResponse -func (c *ClientWithResponses) StartDbaasRedisMaintenanceWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StartDbaasRedisMaintenanceResponse, error) { - rsp, err := c.StartDbaasRedisMaintenance(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartDbaasRedisMaintenanceResponse(rsp) -} - -// StopDbaasRedisMigrationWithResponse request returning *StopDbaasRedisMigrationResponse -func (c *ClientWithResponses) StopDbaasRedisMigrationWithResponse(ctx context.Context, name DbaasServiceName, reqEditors ...RequestEditorFn) (*StopDbaasRedisMigrationResponse, error) { - rsp, err := c.StopDbaasRedisMigration(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseStopDbaasRedisMigrationResponse(rsp) -} - -// ListDbaasServicesWithResponse request returning *ListDbaasServicesResponse -func (c *ClientWithResponses) ListDbaasServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasServicesResponse, error) { - rsp, err := c.ListDbaasServices(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDbaasServicesResponse(rsp) -} - -// GetDbaasServiceLogsWithBodyWithResponse request with arbitrary body returning *GetDbaasServiceLogsResponse -func (c *ClientWithResponses) GetDbaasServiceLogsWithBodyWithResponse(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetDbaasServiceLogsResponse, error) { - rsp, err := c.GetDbaasServiceLogsWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceLogsResponse(rsp) -} - -func (c *ClientWithResponses) GetDbaasServiceLogsWithResponse(ctx context.Context, serviceName string, body GetDbaasServiceLogsJSONRequestBody, reqEditors ...RequestEditorFn) (*GetDbaasServiceLogsResponse, error) { - rsp, err := c.GetDbaasServiceLogs(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceLogsResponse(rsp) -} - -// GetDbaasServiceMetricsWithBodyWithResponse request with arbitrary body returning *GetDbaasServiceMetricsResponse -func (c *ClientWithResponses) GetDbaasServiceMetricsWithBodyWithResponse(ctx context.Context, serviceName string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GetDbaasServiceMetricsResponse, error) { - rsp, err := c.GetDbaasServiceMetricsWithBody(ctx, serviceName, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceMetricsResponse(rsp) -} - -func (c *ClientWithResponses) GetDbaasServiceMetricsWithResponse(ctx context.Context, serviceName string, body GetDbaasServiceMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*GetDbaasServiceMetricsResponse, error) { - rsp, err := c.GetDbaasServiceMetrics(ctx, serviceName, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceMetricsResponse(rsp) -} - -// ListDbaasServiceTypesWithResponse request returning *ListDbaasServiceTypesResponse -func (c *ClientWithResponses) ListDbaasServiceTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDbaasServiceTypesResponse, error) { - rsp, err := c.ListDbaasServiceTypes(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDbaasServiceTypesResponse(rsp) -} - -// GetDbaasServiceTypeWithResponse request returning *GetDbaasServiceTypeResponse -func (c *ClientWithResponses) GetDbaasServiceTypeWithResponse(ctx context.Context, serviceTypeName string, reqEditors ...RequestEditorFn) (*GetDbaasServiceTypeResponse, error) { - rsp, err := c.GetDbaasServiceType(ctx, serviceTypeName, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasServiceTypeResponse(rsp) -} - -// DeleteDbaasServiceWithResponse request returning *DeleteDbaasServiceResponse -func (c *ClientWithResponses) DeleteDbaasServiceWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteDbaasServiceResponse, error) { - rsp, err := c.DeleteDbaasService(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDbaasServiceResponse(rsp) -} - -// GetDbaasSettingsGrafanaWithResponse request returning *GetDbaasSettingsGrafanaResponse -func (c *ClientWithResponses) GetDbaasSettingsGrafanaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsGrafanaResponse, error) { - rsp, err := c.GetDbaasSettingsGrafana(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsGrafanaResponse(rsp) -} - -// GetDbaasSettingsKafkaWithResponse request returning *GetDbaasSettingsKafkaResponse -func (c *ClientWithResponses) GetDbaasSettingsKafkaWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsKafkaResponse, error) { - rsp, err := c.GetDbaasSettingsKafka(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsKafkaResponse(rsp) -} - -// GetDbaasSettingsMysqlWithResponse request returning *GetDbaasSettingsMysqlResponse -func (c *ClientWithResponses) GetDbaasSettingsMysqlWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsMysqlResponse, error) { - rsp, err := c.GetDbaasSettingsMysql(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsMysqlResponse(rsp) -} - -// GetDbaasSettingsOpensearchWithResponse request returning *GetDbaasSettingsOpensearchResponse -func (c *ClientWithResponses) GetDbaasSettingsOpensearchWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsOpensearchResponse, error) { - rsp, err := c.GetDbaasSettingsOpensearch(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsOpensearchResponse(rsp) -} - -// GetDbaasSettingsPgWithResponse request returning *GetDbaasSettingsPgResponse -func (c *ClientWithResponses) GetDbaasSettingsPgWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsPgResponse, error) { - rsp, err := c.GetDbaasSettingsPg(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsPgResponse(rsp) -} - -// GetDbaasSettingsRedisWithResponse request returning *GetDbaasSettingsRedisResponse -func (c *ClientWithResponses) GetDbaasSettingsRedisWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetDbaasSettingsRedisResponse, error) { - rsp, err := c.GetDbaasSettingsRedis(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasSettingsRedisResponse(rsp) -} - -// CreateDbaasTaskMigrationCheckWithBodyWithResponse request with arbitrary body returning *CreateDbaasTaskMigrationCheckResponse -func (c *ClientWithResponses) CreateDbaasTaskMigrationCheckWithBodyWithResponse(ctx context.Context, service DbaasServiceName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDbaasTaskMigrationCheckResponse, error) { - rsp, err := c.CreateDbaasTaskMigrationCheckWithBody(ctx, service, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasTaskMigrationCheckResponse(rsp) -} - -func (c *ClientWithResponses) CreateDbaasTaskMigrationCheckWithResponse(ctx context.Context, service DbaasServiceName, body CreateDbaasTaskMigrationCheckJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDbaasTaskMigrationCheckResponse, error) { - rsp, err := c.CreateDbaasTaskMigrationCheck(ctx, service, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDbaasTaskMigrationCheckResponse(rsp) -} - -// GetDbaasTaskWithResponse request returning *GetDbaasTaskResponse -func (c *ClientWithResponses) GetDbaasTaskWithResponse(ctx context.Context, service DbaasServiceName, id string, reqEditors ...RequestEditorFn) (*GetDbaasTaskResponse, error) { - rsp, err := c.GetDbaasTask(ctx, service, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDbaasTaskResponse(rsp) -} - -// ListDeployTargetsWithResponse request returning *ListDeployTargetsResponse -func (c *ClientWithResponses) ListDeployTargetsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDeployTargetsResponse, error) { - rsp, err := c.ListDeployTargets(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDeployTargetsResponse(rsp) -} - -// GetDeployTargetWithResponse request returning *GetDeployTargetResponse -func (c *ClientWithResponses) GetDeployTargetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDeployTargetResponse, error) { - rsp, err := c.GetDeployTarget(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDeployTargetResponse(rsp) -} - -// ListDnsDomainsWithResponse request returning *ListDnsDomainsResponse -func (c *ClientWithResponses) ListDnsDomainsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListDnsDomainsResponse, error) { - rsp, err := c.ListDnsDomains(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDnsDomainsResponse(rsp) -} - -// CreateDnsDomainWithBodyWithResponse request with arbitrary body returning *CreateDnsDomainResponse -func (c *ClientWithResponses) CreateDnsDomainWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDnsDomainResponse, error) { - rsp, err := c.CreateDnsDomainWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDnsDomainResponse(rsp) -} - -func (c *ClientWithResponses) CreateDnsDomainWithResponse(ctx context.Context, body CreateDnsDomainJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDnsDomainResponse, error) { - rsp, err := c.CreateDnsDomain(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDnsDomainResponse(rsp) -} - -// ListDnsDomainRecordsWithResponse request returning *ListDnsDomainRecordsResponse -func (c *ClientWithResponses) ListDnsDomainRecordsWithResponse(ctx context.Context, domainId string, reqEditors ...RequestEditorFn) (*ListDnsDomainRecordsResponse, error) { - rsp, err := c.ListDnsDomainRecords(ctx, domainId, reqEditors...) - if err != nil { - return nil, err - } - return ParseListDnsDomainRecordsResponse(rsp) -} - -// CreateDnsDomainRecordWithBodyWithResponse request with arbitrary body returning *CreateDnsDomainRecordResponse -func (c *ClientWithResponses) CreateDnsDomainRecordWithBodyWithResponse(ctx context.Context, domainId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateDnsDomainRecordResponse, error) { - rsp, err := c.CreateDnsDomainRecordWithBody(ctx, domainId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDnsDomainRecordResponse(rsp) -} - -func (c *ClientWithResponses) CreateDnsDomainRecordWithResponse(ctx context.Context, domainId string, body CreateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateDnsDomainRecordResponse, error) { - rsp, err := c.CreateDnsDomainRecord(ctx, domainId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateDnsDomainRecordResponse(rsp) -} - -// DeleteDnsDomainRecordWithResponse request returning *DeleteDnsDomainRecordResponse -func (c *ClientWithResponses) DeleteDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*DeleteDnsDomainRecordResponse, error) { - rsp, err := c.DeleteDnsDomainRecord(ctx, domainId, recordId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDnsDomainRecordResponse(rsp) -} - -// GetDnsDomainRecordWithResponse request returning *GetDnsDomainRecordResponse -func (c *ClientWithResponses) GetDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, reqEditors ...RequestEditorFn) (*GetDnsDomainRecordResponse, error) { - rsp, err := c.GetDnsDomainRecord(ctx, domainId, recordId, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDnsDomainRecordResponse(rsp) -} - -// UpdateDnsDomainRecordWithBodyWithResponse request with arbitrary body returning *UpdateDnsDomainRecordResponse -func (c *ClientWithResponses) UpdateDnsDomainRecordWithBodyWithResponse(ctx context.Context, domainId string, recordId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateDnsDomainRecordResponse, error) { - rsp, err := c.UpdateDnsDomainRecordWithBody(ctx, domainId, recordId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDnsDomainRecordResponse(rsp) -} - -func (c *ClientWithResponses) UpdateDnsDomainRecordWithResponse(ctx context.Context, domainId string, recordId string, body UpdateDnsDomainRecordJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateDnsDomainRecordResponse, error) { - rsp, err := c.UpdateDnsDomainRecord(ctx, domainId, recordId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateDnsDomainRecordResponse(rsp) -} - -// DeleteDnsDomainWithResponse request returning *DeleteDnsDomainResponse -func (c *ClientWithResponses) DeleteDnsDomainWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteDnsDomainResponse, error) { - rsp, err := c.DeleteDnsDomain(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteDnsDomainResponse(rsp) -} - -// GetDnsDomainWithResponse request returning *GetDnsDomainResponse -func (c *ClientWithResponses) GetDnsDomainWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDnsDomainResponse, error) { - rsp, err := c.GetDnsDomain(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDnsDomainResponse(rsp) -} - -// GetDnsDomainZoneFileWithResponse request returning *GetDnsDomainZoneFileResponse -func (c *ClientWithResponses) GetDnsDomainZoneFileWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetDnsDomainZoneFileResponse, error) { - rsp, err := c.GetDnsDomainZoneFile(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetDnsDomainZoneFileResponse(rsp) -} - -// ListElasticIpsWithResponse request returning *ListElasticIpsResponse -func (c *ClientWithResponses) ListElasticIpsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListElasticIpsResponse, error) { - rsp, err := c.ListElasticIps(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListElasticIpsResponse(rsp) -} - -// CreateElasticIpWithBodyWithResponse request with arbitrary body returning *CreateElasticIpResponse -func (c *ClientWithResponses) CreateElasticIpWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateElasticIpResponse, error) { - rsp, err := c.CreateElasticIpWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateElasticIpResponse(rsp) -} - -func (c *ClientWithResponses) CreateElasticIpWithResponse(ctx context.Context, body CreateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateElasticIpResponse, error) { - rsp, err := c.CreateElasticIp(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateElasticIpResponse(rsp) -} - -// DeleteElasticIpWithResponse request returning *DeleteElasticIpResponse -func (c *ClientWithResponses) DeleteElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteElasticIpResponse, error) { - rsp, err := c.DeleteElasticIp(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteElasticIpResponse(rsp) -} - -// GetElasticIpWithResponse request returning *GetElasticIpResponse -func (c *ClientWithResponses) GetElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetElasticIpResponse, error) { - rsp, err := c.GetElasticIp(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetElasticIpResponse(rsp) -} - -// UpdateElasticIpWithBodyWithResponse request with arbitrary body returning *UpdateElasticIpResponse -func (c *ClientWithResponses) UpdateElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateElasticIpResponse, error) { - rsp, err := c.UpdateElasticIpWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateElasticIpResponse(rsp) -} - -func (c *ClientWithResponses) UpdateElasticIpWithResponse(ctx context.Context, id string, body UpdateElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateElasticIpResponse, error) { - rsp, err := c.UpdateElasticIp(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateElasticIpResponse(rsp) -} - -// ResetElasticIpFieldWithResponse request returning *ResetElasticIpFieldResponse -func (c *ClientWithResponses) ResetElasticIpFieldWithResponse(ctx context.Context, id string, field ResetElasticIpFieldParamsField, reqEditors ...RequestEditorFn) (*ResetElasticIpFieldResponse, error) { - rsp, err := c.ResetElasticIpField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetElasticIpFieldResponse(rsp) -} - -// AttachInstanceToElasticIpWithBodyWithResponse request with arbitrary body returning *AttachInstanceToElasticIpResponse -func (c *ClientWithResponses) AttachInstanceToElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToElasticIpResponse, error) { - rsp, err := c.AttachInstanceToElasticIpWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToElasticIpResponse(rsp) -} - -func (c *ClientWithResponses) AttachInstanceToElasticIpWithResponse(ctx context.Context, id string, body AttachInstanceToElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToElasticIpResponse, error) { - rsp, err := c.AttachInstanceToElasticIp(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToElasticIpResponse(rsp) -} - -// DetachInstanceFromElasticIpWithBodyWithResponse request with arbitrary body returning *DetachInstanceFromElasticIpResponse -func (c *ClientWithResponses) DetachInstanceFromElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromElasticIpResponse, error) { - rsp, err := c.DetachInstanceFromElasticIpWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromElasticIpResponse(rsp) -} - -func (c *ClientWithResponses) DetachInstanceFromElasticIpWithResponse(ctx context.Context, id string, body DetachInstanceFromElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromElasticIpResponse, error) { - rsp, err := c.DetachInstanceFromElasticIp(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromElasticIpResponse(rsp) -} - -// ListEventsWithResponse request returning *ListEventsResponse -func (c *ClientWithResponses) ListEventsWithResponse(ctx context.Context, params *ListEventsParams, reqEditors ...RequestEditorFn) (*ListEventsResponse, error) { - rsp, err := c.ListEvents(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListEventsResponse(rsp) -} - -// GetIamOrganizationPolicyWithResponse request returning *GetIamOrganizationPolicyResponse -func (c *ClientWithResponses) GetIamOrganizationPolicyWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*GetIamOrganizationPolicyResponse, error) { - rsp, err := c.GetIamOrganizationPolicy(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetIamOrganizationPolicyResponse(rsp) -} - -// UpdateIamOrganizationPolicyWithBodyWithResponse request with arbitrary body returning *UpdateIamOrganizationPolicyResponse -func (c *ClientWithResponses) UpdateIamOrganizationPolicyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamOrganizationPolicyResponse, error) { - rsp, err := c.UpdateIamOrganizationPolicyWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamOrganizationPolicyResponse(rsp) -} - -func (c *ClientWithResponses) UpdateIamOrganizationPolicyWithResponse(ctx context.Context, body UpdateIamOrganizationPolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamOrganizationPolicyResponse, error) { - rsp, err := c.UpdateIamOrganizationPolicy(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamOrganizationPolicyResponse(rsp) -} - -// ListIamRolesWithResponse request returning *ListIamRolesResponse -func (c *ClientWithResponses) ListIamRolesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListIamRolesResponse, error) { - rsp, err := c.ListIamRoles(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListIamRolesResponse(rsp) -} - -// CreateIamRoleWithBodyWithResponse request with arbitrary body returning *CreateIamRoleResponse -func (c *ClientWithResponses) CreateIamRoleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateIamRoleResponse, error) { - rsp, err := c.CreateIamRoleWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateIamRoleResponse(rsp) -} - -func (c *ClientWithResponses) CreateIamRoleWithResponse(ctx context.Context, body CreateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateIamRoleResponse, error) { - rsp, err := c.CreateIamRole(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateIamRoleResponse(rsp) -} - -// DeleteIamRoleWithResponse request returning *DeleteIamRoleResponse -func (c *ClientWithResponses) DeleteIamRoleWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteIamRoleResponse, error) { - rsp, err := c.DeleteIamRole(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteIamRoleResponse(rsp) -} - -// GetIamRoleWithResponse request returning *GetIamRoleResponse -func (c *ClientWithResponses) GetIamRoleWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetIamRoleResponse, error) { - rsp, err := c.GetIamRole(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetIamRoleResponse(rsp) -} - -// UpdateIamRoleWithBodyWithResponse request with arbitrary body returning *UpdateIamRoleResponse -func (c *ClientWithResponses) UpdateIamRoleWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamRoleResponse, error) { - rsp, err := c.UpdateIamRoleWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamRoleResponse(rsp) -} - -func (c *ClientWithResponses) UpdateIamRoleWithResponse(ctx context.Context, id string, body UpdateIamRoleJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamRoleResponse, error) { - rsp, err := c.UpdateIamRole(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamRoleResponse(rsp) -} - -// UpdateIamRolePolicyWithBodyWithResponse request with arbitrary body returning *UpdateIamRolePolicyResponse -func (c *ClientWithResponses) UpdateIamRolePolicyWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateIamRolePolicyResponse, error) { - rsp, err := c.UpdateIamRolePolicyWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamRolePolicyResponse(rsp) -} - -func (c *ClientWithResponses) UpdateIamRolePolicyWithResponse(ctx context.Context, id string, body UpdateIamRolePolicyJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateIamRolePolicyResponse, error) { - rsp, err := c.UpdateIamRolePolicy(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateIamRolePolicyResponse(rsp) -} - -// ListInstancesWithResponse request returning *ListInstancesResponse -func (c *ClientWithResponses) ListInstancesWithResponse(ctx context.Context, params *ListInstancesParams, reqEditors ...RequestEditorFn) (*ListInstancesResponse, error) { - rsp, err := c.ListInstances(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListInstancesResponse(rsp) -} - -// CreateInstanceWithBodyWithResponse request with arbitrary body returning *CreateInstanceResponse -func (c *ClientWithResponses) CreateInstanceWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateInstanceResponse, error) { - rsp, err := c.CreateInstanceWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateInstanceResponse(rsp) -} - -func (c *ClientWithResponses) CreateInstanceWithResponse(ctx context.Context, body CreateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateInstanceResponse, error) { - rsp, err := c.CreateInstance(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateInstanceResponse(rsp) -} - -// ListInstancePoolsWithResponse request returning *ListInstancePoolsResponse -func (c *ClientWithResponses) ListInstancePoolsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListInstancePoolsResponse, error) { - rsp, err := c.ListInstancePools(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListInstancePoolsResponse(rsp) -} - -// CreateInstancePoolWithBodyWithResponse request with arbitrary body returning *CreateInstancePoolResponse -func (c *ClientWithResponses) CreateInstancePoolWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateInstancePoolResponse, error) { - rsp, err := c.CreateInstancePoolWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateInstancePoolResponse(rsp) -} - -func (c *ClientWithResponses) CreateInstancePoolWithResponse(ctx context.Context, body CreateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateInstancePoolResponse, error) { - rsp, err := c.CreateInstancePool(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateInstancePoolResponse(rsp) -} - -// DeleteInstancePoolWithResponse request returning *DeleteInstancePoolResponse -func (c *ClientWithResponses) DeleteInstancePoolWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteInstancePoolResponse, error) { - rsp, err := c.DeleteInstancePool(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteInstancePoolResponse(rsp) -} - -// GetInstancePoolWithResponse request returning *GetInstancePoolResponse -func (c *ClientWithResponses) GetInstancePoolWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstancePoolResponse, error) { - rsp, err := c.GetInstancePool(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetInstancePoolResponse(rsp) -} - -// UpdateInstancePoolWithBodyWithResponse request with arbitrary body returning *UpdateInstancePoolResponse -func (c *ClientWithResponses) UpdateInstancePoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateInstancePoolResponse, error) { - rsp, err := c.UpdateInstancePoolWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateInstancePoolResponse(rsp) -} - -func (c *ClientWithResponses) UpdateInstancePoolWithResponse(ctx context.Context, id string, body UpdateInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateInstancePoolResponse, error) { - rsp, err := c.UpdateInstancePool(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateInstancePoolResponse(rsp) -} - -// ResetInstancePoolFieldWithResponse request returning *ResetInstancePoolFieldResponse -func (c *ClientWithResponses) ResetInstancePoolFieldWithResponse(ctx context.Context, id string, field ResetInstancePoolFieldParamsField, reqEditors ...RequestEditorFn) (*ResetInstancePoolFieldResponse, error) { - rsp, err := c.ResetInstancePoolField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetInstancePoolFieldResponse(rsp) -} - -// EvictInstancePoolMembersWithBodyWithResponse request with arbitrary body returning *EvictInstancePoolMembersResponse -func (c *ClientWithResponses) EvictInstancePoolMembersWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EvictInstancePoolMembersResponse, error) { - rsp, err := c.EvictInstancePoolMembersWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseEvictInstancePoolMembersResponse(rsp) -} - -func (c *ClientWithResponses) EvictInstancePoolMembersWithResponse(ctx context.Context, id string, body EvictInstancePoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*EvictInstancePoolMembersResponse, error) { - rsp, err := c.EvictInstancePoolMembers(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseEvictInstancePoolMembersResponse(rsp) -} - -// ScaleInstancePoolWithBodyWithResponse request with arbitrary body returning *ScaleInstancePoolResponse -func (c *ClientWithResponses) ScaleInstancePoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleInstancePoolResponse, error) { - rsp, err := c.ScaleInstancePoolWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleInstancePoolResponse(rsp) -} - -func (c *ClientWithResponses) ScaleInstancePoolWithResponse(ctx context.Context, id string, body ScaleInstancePoolJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleInstancePoolResponse, error) { - rsp, err := c.ScaleInstancePool(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleInstancePoolResponse(rsp) -} - -// ListInstanceTypesWithResponse request returning *ListInstanceTypesResponse -func (c *ClientWithResponses) ListInstanceTypesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListInstanceTypesResponse, error) { - rsp, err := c.ListInstanceTypes(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListInstanceTypesResponse(rsp) -} - -// GetInstanceTypeWithResponse request returning *GetInstanceTypeResponse -func (c *ClientWithResponses) GetInstanceTypeWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstanceTypeResponse, error) { - rsp, err := c.GetInstanceType(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetInstanceTypeResponse(rsp) -} - -// DeleteInstanceWithResponse request returning *DeleteInstanceResponse -func (c *ClientWithResponses) DeleteInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteInstanceResponse, error) { - rsp, err := c.DeleteInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteInstanceResponse(rsp) -} - -// GetInstanceWithResponse request returning *GetInstanceResponse -func (c *ClientWithResponses) GetInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetInstanceResponse, error) { - rsp, err := c.GetInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetInstanceResponse(rsp) -} - -// UpdateInstanceWithBodyWithResponse request with arbitrary body returning *UpdateInstanceResponse -func (c *ClientWithResponses) UpdateInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateInstanceResponse, error) { - rsp, err := c.UpdateInstanceWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateInstanceResponse(rsp) -} - -func (c *ClientWithResponses) UpdateInstanceWithResponse(ctx context.Context, id string, body UpdateInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateInstanceResponse, error) { - rsp, err := c.UpdateInstance(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateInstanceResponse(rsp) -} - -// ResetInstanceFieldWithResponse request returning *ResetInstanceFieldResponse -func (c *ClientWithResponses) ResetInstanceFieldWithResponse(ctx context.Context, id string, field ResetInstanceFieldParamsField, reqEditors ...RequestEditorFn) (*ResetInstanceFieldResponse, error) { - rsp, err := c.ResetInstanceField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetInstanceFieldResponse(rsp) -} - -// AddInstanceProtectionWithResponse request returning *AddInstanceProtectionResponse -func (c *ClientWithResponses) AddInstanceProtectionWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*AddInstanceProtectionResponse, error) { - rsp, err := c.AddInstanceProtection(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddInstanceProtectionResponse(rsp) -} - -// CreateSnapshotWithResponse request returning *CreateSnapshotResponse -func (c *ClientWithResponses) CreateSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*CreateSnapshotResponse, error) { - rsp, err := c.CreateSnapshot(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSnapshotResponse(rsp) -} - -// RevealInstancePasswordWithResponse request returning *RevealInstancePasswordResponse -func (c *ClientWithResponses) RevealInstancePasswordWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RevealInstancePasswordResponse, error) { - rsp, err := c.RevealInstancePassword(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseRevealInstancePasswordResponse(rsp) -} - -// RebootInstanceWithResponse request returning *RebootInstanceResponse -func (c *ClientWithResponses) RebootInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RebootInstanceResponse, error) { - rsp, err := c.RebootInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseRebootInstanceResponse(rsp) -} - -// RemoveInstanceProtectionWithResponse request returning *RemoveInstanceProtectionResponse -func (c *ClientWithResponses) RemoveInstanceProtectionWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RemoveInstanceProtectionResponse, error) { - rsp, err := c.RemoveInstanceProtection(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseRemoveInstanceProtectionResponse(rsp) -} - -// ResetInstanceWithBodyWithResponse request with arbitrary body returning *ResetInstanceResponse -func (c *ClientWithResponses) ResetInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResetInstanceResponse, error) { - rsp, err := c.ResetInstanceWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetInstanceResponse(rsp) -} - -func (c *ClientWithResponses) ResetInstanceWithResponse(ctx context.Context, id string, body ResetInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*ResetInstanceResponse, error) { - rsp, err := c.ResetInstance(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetInstanceResponse(rsp) -} - -// ResetInstancePasswordWithResponse request returning *ResetInstancePasswordResponse -func (c *ClientWithResponses) ResetInstancePasswordWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ResetInstancePasswordResponse, error) { - rsp, err := c.ResetInstancePassword(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetInstancePasswordResponse(rsp) -} - -// ResizeInstanceDiskWithBodyWithResponse request with arbitrary body returning *ResizeInstanceDiskResponse -func (c *ClientWithResponses) ResizeInstanceDiskWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ResizeInstanceDiskResponse, error) { - rsp, err := c.ResizeInstanceDiskWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResizeInstanceDiskResponse(rsp) -} - -func (c *ClientWithResponses) ResizeInstanceDiskWithResponse(ctx context.Context, id string, body ResizeInstanceDiskJSONRequestBody, reqEditors ...RequestEditorFn) (*ResizeInstanceDiskResponse, error) { - rsp, err := c.ResizeInstanceDisk(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseResizeInstanceDiskResponse(rsp) -} - -// ScaleInstanceWithBodyWithResponse request with arbitrary body returning *ScaleInstanceResponse -func (c *ClientWithResponses) ScaleInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleInstanceResponse, error) { - rsp, err := c.ScaleInstanceWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleInstanceResponse(rsp) -} - -func (c *ClientWithResponses) ScaleInstanceWithResponse(ctx context.Context, id string, body ScaleInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleInstanceResponse, error) { - rsp, err := c.ScaleInstance(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleInstanceResponse(rsp) -} - -// StartInstanceWithBodyWithResponse request with arbitrary body returning *StartInstanceResponse -func (c *ClientWithResponses) StartInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*StartInstanceResponse, error) { - rsp, err := c.StartInstanceWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartInstanceResponse(rsp) -} - -func (c *ClientWithResponses) StartInstanceWithResponse(ctx context.Context, id string, body StartInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*StartInstanceResponse, error) { - rsp, err := c.StartInstance(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseStartInstanceResponse(rsp) -} - -// StopInstanceWithResponse request returning *StopInstanceResponse -func (c *ClientWithResponses) StopInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*StopInstanceResponse, error) { - rsp, err := c.StopInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseStopInstanceResponse(rsp) -} - -// RevertInstanceToSnapshotWithBodyWithResponse request with arbitrary body returning *RevertInstanceToSnapshotResponse -func (c *ClientWithResponses) RevertInstanceToSnapshotWithBodyWithResponse(ctx context.Context, instanceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RevertInstanceToSnapshotResponse, error) { - rsp, err := c.RevertInstanceToSnapshotWithBody(ctx, instanceId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRevertInstanceToSnapshotResponse(rsp) -} - -func (c *ClientWithResponses) RevertInstanceToSnapshotWithResponse(ctx context.Context, instanceId string, body RevertInstanceToSnapshotJSONRequestBody, reqEditors ...RequestEditorFn) (*RevertInstanceToSnapshotResponse, error) { - rsp, err := c.RevertInstanceToSnapshot(ctx, instanceId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRevertInstanceToSnapshotResponse(rsp) -} - -// ListLoadBalancersWithResponse request returning *ListLoadBalancersResponse -func (c *ClientWithResponses) ListLoadBalancersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListLoadBalancersResponse, error) { - rsp, err := c.ListLoadBalancers(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListLoadBalancersResponse(rsp) -} - -// CreateLoadBalancerWithBodyWithResponse request with arbitrary body returning *CreateLoadBalancerResponse -func (c *ClientWithResponses) CreateLoadBalancerWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateLoadBalancerResponse, error) { - rsp, err := c.CreateLoadBalancerWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateLoadBalancerResponse(rsp) -} - -func (c *ClientWithResponses) CreateLoadBalancerWithResponse(ctx context.Context, body CreateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateLoadBalancerResponse, error) { - rsp, err := c.CreateLoadBalancer(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateLoadBalancerResponse(rsp) -} - -// DeleteLoadBalancerWithResponse request returning *DeleteLoadBalancerResponse -func (c *ClientWithResponses) DeleteLoadBalancerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteLoadBalancerResponse, error) { - rsp, err := c.DeleteLoadBalancer(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteLoadBalancerResponse(rsp) -} - -// GetLoadBalancerWithResponse request returning *GetLoadBalancerResponse -func (c *ClientWithResponses) GetLoadBalancerWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetLoadBalancerResponse, error) { - rsp, err := c.GetLoadBalancer(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLoadBalancerResponse(rsp) -} - -// UpdateLoadBalancerWithBodyWithResponse request with arbitrary body returning *UpdateLoadBalancerResponse -func (c *ClientWithResponses) UpdateLoadBalancerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerResponse, error) { - rsp, err := c.UpdateLoadBalancerWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateLoadBalancerResponse(rsp) -} - -func (c *ClientWithResponses) UpdateLoadBalancerWithResponse(ctx context.Context, id string, body UpdateLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerResponse, error) { - rsp, err := c.UpdateLoadBalancer(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateLoadBalancerResponse(rsp) -} - -// AddServiceToLoadBalancerWithBodyWithResponse request with arbitrary body returning *AddServiceToLoadBalancerResponse -func (c *ClientWithResponses) AddServiceToLoadBalancerWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddServiceToLoadBalancerResponse, error) { - rsp, err := c.AddServiceToLoadBalancerWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddServiceToLoadBalancerResponse(rsp) -} - -func (c *ClientWithResponses) AddServiceToLoadBalancerWithResponse(ctx context.Context, id string, body AddServiceToLoadBalancerJSONRequestBody, reqEditors ...RequestEditorFn) (*AddServiceToLoadBalancerResponse, error) { - rsp, err := c.AddServiceToLoadBalancer(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddServiceToLoadBalancerResponse(rsp) -} - -// DeleteLoadBalancerServiceWithResponse request returning *DeleteLoadBalancerServiceResponse -func (c *ClientWithResponses) DeleteLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*DeleteLoadBalancerServiceResponse, error) { - rsp, err := c.DeleteLoadBalancerService(ctx, id, serviceId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteLoadBalancerServiceResponse(rsp) -} - -// GetLoadBalancerServiceWithResponse request returning *GetLoadBalancerServiceResponse -func (c *ClientWithResponses) GetLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, reqEditors ...RequestEditorFn) (*GetLoadBalancerServiceResponse, error) { - rsp, err := c.GetLoadBalancerService(ctx, id, serviceId, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetLoadBalancerServiceResponse(rsp) -} - -// UpdateLoadBalancerServiceWithBodyWithResponse request with arbitrary body returning *UpdateLoadBalancerServiceResponse -func (c *ClientWithResponses) UpdateLoadBalancerServiceWithBodyWithResponse(ctx context.Context, id string, serviceId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerServiceResponse, error) { - rsp, err := c.UpdateLoadBalancerServiceWithBody(ctx, id, serviceId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateLoadBalancerServiceResponse(rsp) -} - -func (c *ClientWithResponses) UpdateLoadBalancerServiceWithResponse(ctx context.Context, id string, serviceId string, body UpdateLoadBalancerServiceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateLoadBalancerServiceResponse, error) { - rsp, err := c.UpdateLoadBalancerService(ctx, id, serviceId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateLoadBalancerServiceResponse(rsp) -} - -// ResetLoadBalancerServiceFieldWithResponse request returning *ResetLoadBalancerServiceFieldResponse -func (c *ClientWithResponses) ResetLoadBalancerServiceFieldWithResponse(ctx context.Context, id string, serviceId string, field ResetLoadBalancerServiceFieldParamsField, reqEditors ...RequestEditorFn) (*ResetLoadBalancerServiceFieldResponse, error) { - rsp, err := c.ResetLoadBalancerServiceField(ctx, id, serviceId, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetLoadBalancerServiceFieldResponse(rsp) -} - -// ResetLoadBalancerFieldWithResponse request returning *ResetLoadBalancerFieldResponse -func (c *ClientWithResponses) ResetLoadBalancerFieldWithResponse(ctx context.Context, id string, field ResetLoadBalancerFieldParamsField, reqEditors ...RequestEditorFn) (*ResetLoadBalancerFieldResponse, error) { - rsp, err := c.ResetLoadBalancerField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetLoadBalancerFieldResponse(rsp) -} - -// GetOperationWithResponse request returning *GetOperationResponse -func (c *ClientWithResponses) GetOperationWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetOperationResponse, error) { - rsp, err := c.GetOperation(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetOperationResponse(rsp) -} - -// ListPrivateNetworksWithResponse request returning *ListPrivateNetworksResponse -func (c *ClientWithResponses) ListPrivateNetworksWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListPrivateNetworksResponse, error) { - rsp, err := c.ListPrivateNetworks(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListPrivateNetworksResponse(rsp) -} - -// CreatePrivateNetworkWithBodyWithResponse request with arbitrary body returning *CreatePrivateNetworkResponse -func (c *ClientWithResponses) CreatePrivateNetworkWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreatePrivateNetworkResponse, error) { - rsp, err := c.CreatePrivateNetworkWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreatePrivateNetworkResponse(rsp) -} - -func (c *ClientWithResponses) CreatePrivateNetworkWithResponse(ctx context.Context, body CreatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*CreatePrivateNetworkResponse, error) { - rsp, err := c.CreatePrivateNetwork(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreatePrivateNetworkResponse(rsp) -} - -// DeletePrivateNetworkWithResponse request returning *DeletePrivateNetworkResponse -func (c *ClientWithResponses) DeletePrivateNetworkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeletePrivateNetworkResponse, error) { - rsp, err := c.DeletePrivateNetwork(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeletePrivateNetworkResponse(rsp) -} - -// GetPrivateNetworkWithResponse request returning *GetPrivateNetworkResponse -func (c *ClientWithResponses) GetPrivateNetworkWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetPrivateNetworkResponse, error) { - rsp, err := c.GetPrivateNetwork(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetPrivateNetworkResponse(rsp) -} - -// UpdatePrivateNetworkWithBodyWithResponse request with arbitrary body returning *UpdatePrivateNetworkResponse -func (c *ClientWithResponses) UpdatePrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkResponse, error) { - rsp, err := c.UpdatePrivateNetworkWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdatePrivateNetworkResponse(rsp) -} - -func (c *ClientWithResponses) UpdatePrivateNetworkWithResponse(ctx context.Context, id string, body UpdatePrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkResponse, error) { - rsp, err := c.UpdatePrivateNetwork(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdatePrivateNetworkResponse(rsp) -} - -// ResetPrivateNetworkFieldWithResponse request returning *ResetPrivateNetworkFieldResponse -func (c *ClientWithResponses) ResetPrivateNetworkFieldWithResponse(ctx context.Context, id string, field ResetPrivateNetworkFieldParamsField, reqEditors ...RequestEditorFn) (*ResetPrivateNetworkFieldResponse, error) { - rsp, err := c.ResetPrivateNetworkField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetPrivateNetworkFieldResponse(rsp) -} - -// AttachInstanceToPrivateNetworkWithBodyWithResponse request with arbitrary body returning *AttachInstanceToPrivateNetworkResponse -func (c *ClientWithResponses) AttachInstanceToPrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToPrivateNetworkResponse, error) { - rsp, err := c.AttachInstanceToPrivateNetworkWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToPrivateNetworkResponse(rsp) -} - -func (c *ClientWithResponses) AttachInstanceToPrivateNetworkWithResponse(ctx context.Context, id string, body AttachInstanceToPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToPrivateNetworkResponse, error) { - rsp, err := c.AttachInstanceToPrivateNetwork(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToPrivateNetworkResponse(rsp) -} - -// DetachInstanceFromPrivateNetworkWithBodyWithResponse request with arbitrary body returning *DetachInstanceFromPrivateNetworkResponse -func (c *ClientWithResponses) DetachInstanceFromPrivateNetworkWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromPrivateNetworkResponse, error) { - rsp, err := c.DetachInstanceFromPrivateNetworkWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromPrivateNetworkResponse(rsp) -} - -func (c *ClientWithResponses) DetachInstanceFromPrivateNetworkWithResponse(ctx context.Context, id string, body DetachInstanceFromPrivateNetworkJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromPrivateNetworkResponse, error) { - rsp, err := c.DetachInstanceFromPrivateNetwork(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromPrivateNetworkResponse(rsp) -} - -// UpdatePrivateNetworkInstanceIpWithBodyWithResponse request with arbitrary body returning *UpdatePrivateNetworkInstanceIpResponse -func (c *ClientWithResponses) UpdatePrivateNetworkInstanceIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkInstanceIpResponse, error) { - rsp, err := c.UpdatePrivateNetworkInstanceIpWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdatePrivateNetworkInstanceIpResponse(rsp) -} - -func (c *ClientWithResponses) UpdatePrivateNetworkInstanceIpWithResponse(ctx context.Context, id string, body UpdatePrivateNetworkInstanceIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdatePrivateNetworkInstanceIpResponse, error) { - rsp, err := c.UpdatePrivateNetworkInstanceIp(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdatePrivateNetworkInstanceIpResponse(rsp) -} - -// ListQuotasWithResponse request returning *ListQuotasResponse -func (c *ClientWithResponses) ListQuotasWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQuotasResponse, error) { - rsp, err := c.ListQuotas(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListQuotasResponse(rsp) -} - -// GetQuotaWithResponse request returning *GetQuotaResponse -func (c *ClientWithResponses) GetQuotaWithResponse(ctx context.Context, entity string, reqEditors ...RequestEditorFn) (*GetQuotaResponse, error) { - rsp, err := c.GetQuota(ctx, entity, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetQuotaResponse(rsp) -} - -// DeleteReverseDnsElasticIpWithResponse request returning *DeleteReverseDnsElasticIpResponse -func (c *ClientWithResponses) DeleteReverseDnsElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteReverseDnsElasticIpResponse, error) { - rsp, err := c.DeleteReverseDnsElasticIp(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteReverseDnsElasticIpResponse(rsp) -} - -// GetReverseDnsElasticIpWithResponse request returning *GetReverseDnsElasticIpResponse -func (c *ClientWithResponses) GetReverseDnsElasticIpWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetReverseDnsElasticIpResponse, error) { - rsp, err := c.GetReverseDnsElasticIp(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetReverseDnsElasticIpResponse(rsp) -} - -// UpdateReverseDnsElasticIpWithBodyWithResponse request with arbitrary body returning *UpdateReverseDnsElasticIpResponse -func (c *ClientWithResponses) UpdateReverseDnsElasticIpWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateReverseDnsElasticIpResponse, error) { - rsp, err := c.UpdateReverseDnsElasticIpWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateReverseDnsElasticIpResponse(rsp) -} - -func (c *ClientWithResponses) UpdateReverseDnsElasticIpWithResponse(ctx context.Context, id string, body UpdateReverseDnsElasticIpJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateReverseDnsElasticIpResponse, error) { - rsp, err := c.UpdateReverseDnsElasticIp(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateReverseDnsElasticIpResponse(rsp) -} - -// DeleteReverseDnsInstanceWithResponse request returning *DeleteReverseDnsInstanceResponse -func (c *ClientWithResponses) DeleteReverseDnsInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteReverseDnsInstanceResponse, error) { - rsp, err := c.DeleteReverseDnsInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteReverseDnsInstanceResponse(rsp) -} - -// GetReverseDnsInstanceWithResponse request returning *GetReverseDnsInstanceResponse -func (c *ClientWithResponses) GetReverseDnsInstanceWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetReverseDnsInstanceResponse, error) { - rsp, err := c.GetReverseDnsInstance(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetReverseDnsInstanceResponse(rsp) -} - -// UpdateReverseDnsInstanceWithBodyWithResponse request with arbitrary body returning *UpdateReverseDnsInstanceResponse -func (c *ClientWithResponses) UpdateReverseDnsInstanceWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateReverseDnsInstanceResponse, error) { - rsp, err := c.UpdateReverseDnsInstanceWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateReverseDnsInstanceResponse(rsp) -} - -func (c *ClientWithResponses) UpdateReverseDnsInstanceWithResponse(ctx context.Context, id string, body UpdateReverseDnsInstanceJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateReverseDnsInstanceResponse, error) { - rsp, err := c.UpdateReverseDnsInstance(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateReverseDnsInstanceResponse(rsp) -} - -// ListSecurityGroupsWithResponse request returning *ListSecurityGroupsResponse -func (c *ClientWithResponses) ListSecurityGroupsWithResponse(ctx context.Context, params *ListSecurityGroupsParams, reqEditors ...RequestEditorFn) (*ListSecurityGroupsResponse, error) { - rsp, err := c.ListSecurityGroups(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSecurityGroupsResponse(rsp) -} - -// CreateSecurityGroupWithBodyWithResponse request with arbitrary body returning *CreateSecurityGroupResponse -func (c *ClientWithResponses) CreateSecurityGroupWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSecurityGroupResponse, error) { - rsp, err := c.CreateSecurityGroupWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) CreateSecurityGroupWithResponse(ctx context.Context, body CreateSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSecurityGroupResponse, error) { - rsp, err := c.CreateSecurityGroup(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSecurityGroupResponse(rsp) -} - -// DeleteSecurityGroupWithResponse request returning *DeleteSecurityGroupResponse -func (c *ClientWithResponses) DeleteSecurityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSecurityGroupResponse, error) { - rsp, err := c.DeleteSecurityGroup(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSecurityGroupResponse(rsp) -} - -// GetSecurityGroupWithResponse request returning *GetSecurityGroupResponse -func (c *ClientWithResponses) GetSecurityGroupWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSecurityGroupResponse, error) { - rsp, err := c.GetSecurityGroup(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSecurityGroupResponse(rsp) -} - -// AddRuleToSecurityGroupWithBodyWithResponse request with arbitrary body returning *AddRuleToSecurityGroupResponse -func (c *ClientWithResponses) AddRuleToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddRuleToSecurityGroupResponse, error) { - rsp, err := c.AddRuleToSecurityGroupWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddRuleToSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) AddRuleToSecurityGroupWithResponse(ctx context.Context, id string, body AddRuleToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AddRuleToSecurityGroupResponse, error) { - rsp, err := c.AddRuleToSecurityGroup(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddRuleToSecurityGroupResponse(rsp) -} - -// DeleteRuleFromSecurityGroupWithResponse request returning *DeleteRuleFromSecurityGroupResponse -func (c *ClientWithResponses) DeleteRuleFromSecurityGroupWithResponse(ctx context.Context, id string, ruleId string, reqEditors ...RequestEditorFn) (*DeleteRuleFromSecurityGroupResponse, error) { - rsp, err := c.DeleteRuleFromSecurityGroup(ctx, id, ruleId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteRuleFromSecurityGroupResponse(rsp) -} - -// AddExternalSourceToSecurityGroupWithBodyWithResponse request with arbitrary body returning *AddExternalSourceToSecurityGroupResponse -func (c *ClientWithResponses) AddExternalSourceToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AddExternalSourceToSecurityGroupResponse, error) { - rsp, err := c.AddExternalSourceToSecurityGroupWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddExternalSourceToSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) AddExternalSourceToSecurityGroupWithResponse(ctx context.Context, id string, body AddExternalSourceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AddExternalSourceToSecurityGroupResponse, error) { - rsp, err := c.AddExternalSourceToSecurityGroup(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAddExternalSourceToSecurityGroupResponse(rsp) -} - -// AttachInstanceToSecurityGroupWithBodyWithResponse request with arbitrary body returning *AttachInstanceToSecurityGroupResponse -func (c *ClientWithResponses) AttachInstanceToSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AttachInstanceToSecurityGroupResponse, error) { - rsp, err := c.AttachInstanceToSecurityGroupWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) AttachInstanceToSecurityGroupWithResponse(ctx context.Context, id string, body AttachInstanceToSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*AttachInstanceToSecurityGroupResponse, error) { - rsp, err := c.AttachInstanceToSecurityGroup(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseAttachInstanceToSecurityGroupResponse(rsp) -} - -// DetachInstanceFromSecurityGroupWithBodyWithResponse request with arbitrary body returning *DetachInstanceFromSecurityGroupResponse -func (c *ClientWithResponses) DetachInstanceFromSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*DetachInstanceFromSecurityGroupResponse, error) { - rsp, err := c.DetachInstanceFromSecurityGroupWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) DetachInstanceFromSecurityGroupWithResponse(ctx context.Context, id string, body DetachInstanceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*DetachInstanceFromSecurityGroupResponse, error) { - rsp, err := c.DetachInstanceFromSecurityGroup(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseDetachInstanceFromSecurityGroupResponse(rsp) -} - -// RemoveExternalSourceFromSecurityGroupWithBodyWithResponse request with arbitrary body returning *RemoveExternalSourceFromSecurityGroupResponse -func (c *ClientWithResponses) RemoveExternalSourceFromSecurityGroupWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RemoveExternalSourceFromSecurityGroupResponse, error) { - rsp, err := c.RemoveExternalSourceFromSecurityGroupWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRemoveExternalSourceFromSecurityGroupResponse(rsp) -} - -func (c *ClientWithResponses) RemoveExternalSourceFromSecurityGroupWithResponse(ctx context.Context, id string, body RemoveExternalSourceFromSecurityGroupJSONRequestBody, reqEditors ...RequestEditorFn) (*RemoveExternalSourceFromSecurityGroupResponse, error) { - rsp, err := c.RemoveExternalSourceFromSecurityGroup(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRemoveExternalSourceFromSecurityGroupResponse(rsp) -} - -// ListSksClustersWithResponse request returning *ListSksClustersResponse -func (c *ClientWithResponses) ListSksClustersWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSksClustersResponse, error) { - rsp, err := c.ListSksClusters(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSksClustersResponse(rsp) -} - -// CreateSksClusterWithBodyWithResponse request with arbitrary body returning *CreateSksClusterResponse -func (c *ClientWithResponses) CreateSksClusterWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSksClusterResponse, error) { - rsp, err := c.CreateSksClusterWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSksClusterResponse(rsp) -} - -func (c *ClientWithResponses) CreateSksClusterWithResponse(ctx context.Context, body CreateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSksClusterResponse, error) { - rsp, err := c.CreateSksCluster(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSksClusterResponse(rsp) -} - -// ListSksClusterDeprecatedResourcesWithResponse request returning *ListSksClusterDeprecatedResourcesResponse -func (c *ClientWithResponses) ListSksClusterDeprecatedResourcesWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ListSksClusterDeprecatedResourcesResponse, error) { - rsp, err := c.ListSksClusterDeprecatedResources(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSksClusterDeprecatedResourcesResponse(rsp) -} - -// GenerateSksClusterKubeconfigWithBodyWithResponse request with arbitrary body returning *GenerateSksClusterKubeconfigResponse -func (c *ClientWithResponses) GenerateSksClusterKubeconfigWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*GenerateSksClusterKubeconfigResponse, error) { - rsp, err := c.GenerateSksClusterKubeconfigWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGenerateSksClusterKubeconfigResponse(rsp) -} - -func (c *ClientWithResponses) GenerateSksClusterKubeconfigWithResponse(ctx context.Context, id string, body GenerateSksClusterKubeconfigJSONRequestBody, reqEditors ...RequestEditorFn) (*GenerateSksClusterKubeconfigResponse, error) { - rsp, err := c.GenerateSksClusterKubeconfig(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseGenerateSksClusterKubeconfigResponse(rsp) -} - -// ListSksClusterVersionsWithResponse request returning *ListSksClusterVersionsResponse -func (c *ClientWithResponses) ListSksClusterVersionsWithResponse(ctx context.Context, params *ListSksClusterVersionsParams, reqEditors ...RequestEditorFn) (*ListSksClusterVersionsResponse, error) { - rsp, err := c.ListSksClusterVersions(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSksClusterVersionsResponse(rsp) -} - -// DeleteSksClusterWithResponse request returning *DeleteSksClusterResponse -func (c *ClientWithResponses) DeleteSksClusterWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSksClusterResponse, error) { - rsp, err := c.DeleteSksCluster(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSksClusterResponse(rsp) -} - -// GetSksClusterWithResponse request returning *GetSksClusterResponse -func (c *ClientWithResponses) GetSksClusterWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSksClusterResponse, error) { - rsp, err := c.GetSksCluster(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSksClusterResponse(rsp) -} - -// UpdateSksClusterWithBodyWithResponse request with arbitrary body returning *UpdateSksClusterResponse -func (c *ClientWithResponses) UpdateSksClusterWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSksClusterResponse, error) { - rsp, err := c.UpdateSksClusterWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateSksClusterResponse(rsp) -} - -func (c *ClientWithResponses) UpdateSksClusterWithResponse(ctx context.Context, id string, body UpdateSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSksClusterResponse, error) { - rsp, err := c.UpdateSksCluster(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateSksClusterResponse(rsp) -} - -// GetSksClusterAuthorityCertWithResponse request returning *GetSksClusterAuthorityCertResponse -func (c *ClientWithResponses) GetSksClusterAuthorityCertWithResponse(ctx context.Context, id string, authority GetSksClusterAuthorityCertParamsAuthority, reqEditors ...RequestEditorFn) (*GetSksClusterAuthorityCertResponse, error) { - rsp, err := c.GetSksClusterAuthorityCert(ctx, id, authority, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSksClusterAuthorityCertResponse(rsp) -} - -// CreateSksNodepoolWithBodyWithResponse request with arbitrary body returning *CreateSksNodepoolResponse -func (c *ClientWithResponses) CreateSksNodepoolWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSksNodepoolResponse, error) { - rsp, err := c.CreateSksNodepoolWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSksNodepoolResponse(rsp) -} - -func (c *ClientWithResponses) CreateSksNodepoolWithResponse(ctx context.Context, id string, body CreateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSksNodepoolResponse, error) { - rsp, err := c.CreateSksNodepool(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCreateSksNodepoolResponse(rsp) -} - -// DeleteSksNodepoolWithResponse request returning *DeleteSksNodepoolResponse -func (c *ClientWithResponses) DeleteSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*DeleteSksNodepoolResponse, error) { - rsp, err := c.DeleteSksNodepool(ctx, id, sksNodepoolId, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSksNodepoolResponse(rsp) -} - -// GetSksNodepoolWithResponse request returning *GetSksNodepoolResponse -func (c *ClientWithResponses) GetSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, reqEditors ...RequestEditorFn) (*GetSksNodepoolResponse, error) { - rsp, err := c.GetSksNodepool(ctx, id, sksNodepoolId, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSksNodepoolResponse(rsp) -} - -// UpdateSksNodepoolWithBodyWithResponse request with arbitrary body returning *UpdateSksNodepoolResponse -func (c *ClientWithResponses) UpdateSksNodepoolWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSksNodepoolResponse, error) { - rsp, err := c.UpdateSksNodepoolWithBody(ctx, id, sksNodepoolId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateSksNodepoolResponse(rsp) -} - -func (c *ClientWithResponses) UpdateSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, body UpdateSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSksNodepoolResponse, error) { - rsp, err := c.UpdateSksNodepool(ctx, id, sksNodepoolId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateSksNodepoolResponse(rsp) -} - -// ResetSksNodepoolFieldWithResponse request returning *ResetSksNodepoolFieldResponse -func (c *ClientWithResponses) ResetSksNodepoolFieldWithResponse(ctx context.Context, id string, sksNodepoolId string, field ResetSksNodepoolFieldParamsField, reqEditors ...RequestEditorFn) (*ResetSksNodepoolFieldResponse, error) { - rsp, err := c.ResetSksNodepoolField(ctx, id, sksNodepoolId, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetSksNodepoolFieldResponse(rsp) -} - -// EvictSksNodepoolMembersWithBodyWithResponse request with arbitrary body returning *EvictSksNodepoolMembersResponse -func (c *ClientWithResponses) EvictSksNodepoolMembersWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*EvictSksNodepoolMembersResponse, error) { - rsp, err := c.EvictSksNodepoolMembersWithBody(ctx, id, sksNodepoolId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseEvictSksNodepoolMembersResponse(rsp) -} - -func (c *ClientWithResponses) EvictSksNodepoolMembersWithResponse(ctx context.Context, id string, sksNodepoolId string, body EvictSksNodepoolMembersJSONRequestBody, reqEditors ...RequestEditorFn) (*EvictSksNodepoolMembersResponse, error) { - rsp, err := c.EvictSksNodepoolMembers(ctx, id, sksNodepoolId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseEvictSksNodepoolMembersResponse(rsp) -} - -// ScaleSksNodepoolWithBodyWithResponse request with arbitrary body returning *ScaleSksNodepoolResponse -func (c *ClientWithResponses) ScaleSksNodepoolWithBodyWithResponse(ctx context.Context, id string, sksNodepoolId string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*ScaleSksNodepoolResponse, error) { - rsp, err := c.ScaleSksNodepoolWithBody(ctx, id, sksNodepoolId, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleSksNodepoolResponse(rsp) -} - -func (c *ClientWithResponses) ScaleSksNodepoolWithResponse(ctx context.Context, id string, sksNodepoolId string, body ScaleSksNodepoolJSONRequestBody, reqEditors ...RequestEditorFn) (*ScaleSksNodepoolResponse, error) { - rsp, err := c.ScaleSksNodepool(ctx, id, sksNodepoolId, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseScaleSksNodepoolResponse(rsp) -} - -// RotateSksCcmCredentialsWithResponse request returning *RotateSksCcmCredentialsResponse -func (c *ClientWithResponses) RotateSksCcmCredentialsWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RotateSksCcmCredentialsResponse, error) { - rsp, err := c.RotateSksCcmCredentials(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseRotateSksCcmCredentialsResponse(rsp) -} - -// RotateSksOperatorsCaWithResponse request returning *RotateSksOperatorsCaResponse -func (c *ClientWithResponses) RotateSksOperatorsCaWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*RotateSksOperatorsCaResponse, error) { - rsp, err := c.RotateSksOperatorsCa(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseRotateSksOperatorsCaResponse(rsp) -} - -// UpgradeSksClusterWithBodyWithResponse request with arbitrary body returning *UpgradeSksClusterResponse -func (c *ClientWithResponses) UpgradeSksClusterWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpgradeSksClusterResponse, error) { - rsp, err := c.UpgradeSksClusterWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpgradeSksClusterResponse(rsp) -} - -func (c *ClientWithResponses) UpgradeSksClusterWithResponse(ctx context.Context, id string, body UpgradeSksClusterJSONRequestBody, reqEditors ...RequestEditorFn) (*UpgradeSksClusterResponse, error) { - rsp, err := c.UpgradeSksCluster(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpgradeSksClusterResponse(rsp) -} - -// UpgradeSksClusterServiceLevelWithResponse request returning *UpgradeSksClusterServiceLevelResponse -func (c *ClientWithResponses) UpgradeSksClusterServiceLevelWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*UpgradeSksClusterServiceLevelResponse, error) { - rsp, err := c.UpgradeSksClusterServiceLevel(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpgradeSksClusterServiceLevelResponse(rsp) -} - -// ResetSksClusterFieldWithResponse request returning *ResetSksClusterFieldResponse -func (c *ClientWithResponses) ResetSksClusterFieldWithResponse(ctx context.Context, id string, field ResetSksClusterFieldParamsField, reqEditors ...RequestEditorFn) (*ResetSksClusterFieldResponse, error) { - rsp, err := c.ResetSksClusterField(ctx, id, field, reqEditors...) - if err != nil { - return nil, err - } - return ParseResetSksClusterFieldResponse(rsp) -} - -// ListSnapshotsWithResponse request returning *ListSnapshotsResponse -func (c *ClientWithResponses) ListSnapshotsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSnapshotsResponse, error) { - rsp, err := c.ListSnapshots(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSnapshotsResponse(rsp) -} - -// DeleteSnapshotWithResponse request returning *DeleteSnapshotResponse -func (c *ClientWithResponses) DeleteSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteSnapshotResponse, error) { - rsp, err := c.DeleteSnapshot(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSnapshotResponse(rsp) -} - -// GetSnapshotWithResponse request returning *GetSnapshotResponse -func (c *ClientWithResponses) GetSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetSnapshotResponse, error) { - rsp, err := c.GetSnapshot(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSnapshotResponse(rsp) -} - -// ExportSnapshotWithResponse request returning *ExportSnapshotResponse -func (c *ClientWithResponses) ExportSnapshotWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*ExportSnapshotResponse, error) { - rsp, err := c.ExportSnapshot(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseExportSnapshotResponse(rsp) -} - -// PromoteSnapshotToTemplateWithBodyWithResponse request with arbitrary body returning *PromoteSnapshotToTemplateResponse -func (c *ClientWithResponses) PromoteSnapshotToTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PromoteSnapshotToTemplateResponse, error) { - rsp, err := c.PromoteSnapshotToTemplateWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePromoteSnapshotToTemplateResponse(rsp) -} - -func (c *ClientWithResponses) PromoteSnapshotToTemplateWithResponse(ctx context.Context, id string, body PromoteSnapshotToTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*PromoteSnapshotToTemplateResponse, error) { - rsp, err := c.PromoteSnapshotToTemplate(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParsePromoteSnapshotToTemplateResponse(rsp) -} - -// ListSosBucketsUsageWithResponse request returning *ListSosBucketsUsageResponse -func (c *ClientWithResponses) ListSosBucketsUsageWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSosBucketsUsageResponse, error) { - rsp, err := c.ListSosBucketsUsage(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSosBucketsUsageResponse(rsp) -} - -// GetSosPresignedUrlWithResponse request returning *GetSosPresignedUrlResponse -func (c *ClientWithResponses) GetSosPresignedUrlWithResponse(ctx context.Context, bucket string, params *GetSosPresignedUrlParams, reqEditors ...RequestEditorFn) (*GetSosPresignedUrlResponse, error) { - rsp, err := c.GetSosPresignedUrl(ctx, bucket, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSosPresignedUrlResponse(rsp) -} - -// ListSshKeysWithResponse request returning *ListSshKeysResponse -func (c *ClientWithResponses) ListSshKeysWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListSshKeysResponse, error) { - rsp, err := c.ListSshKeys(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListSshKeysResponse(rsp) -} - -// RegisterSshKeyWithBodyWithResponse request with arbitrary body returning *RegisterSshKeyResponse -func (c *ClientWithResponses) RegisterSshKeyWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterSshKeyResponse, error) { - rsp, err := c.RegisterSshKeyWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRegisterSshKeyResponse(rsp) -} - -func (c *ClientWithResponses) RegisterSshKeyWithResponse(ctx context.Context, body RegisterSshKeyJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterSshKeyResponse, error) { - rsp, err := c.RegisterSshKey(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRegisterSshKeyResponse(rsp) -} - -// DeleteSshKeyWithResponse request returning *DeleteSshKeyResponse -func (c *ClientWithResponses) DeleteSshKeyWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*DeleteSshKeyResponse, error) { - rsp, err := c.DeleteSshKey(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteSshKeyResponse(rsp) -} - -// GetSshKeyWithResponse request returning *GetSshKeyResponse -func (c *ClientWithResponses) GetSshKeyWithResponse(ctx context.Context, name string, reqEditors ...RequestEditorFn) (*GetSshKeyResponse, error) { - rsp, err := c.GetSshKey(ctx, name, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetSshKeyResponse(rsp) -} - -// ListTemplatesWithResponse request returning *ListTemplatesResponse -func (c *ClientWithResponses) ListTemplatesWithResponse(ctx context.Context, params *ListTemplatesParams, reqEditors ...RequestEditorFn) (*ListTemplatesResponse, error) { - rsp, err := c.ListTemplates(ctx, params, reqEditors...) - if err != nil { - return nil, err - } - return ParseListTemplatesResponse(rsp) -} - -// RegisterTemplateWithBodyWithResponse request with arbitrary body returning *RegisterTemplateResponse -func (c *ClientWithResponses) RegisterTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RegisterTemplateResponse, error) { - rsp, err := c.RegisterTemplateWithBody(ctx, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRegisterTemplateResponse(rsp) -} - -func (c *ClientWithResponses) RegisterTemplateWithResponse(ctx context.Context, body RegisterTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*RegisterTemplateResponse, error) { - rsp, err := c.RegisterTemplate(ctx, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseRegisterTemplateResponse(rsp) -} - -// DeleteTemplateWithResponse request returning *DeleteTemplateResponse -func (c *ClientWithResponses) DeleteTemplateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeleteTemplateResponse, error) { - rsp, err := c.DeleteTemplate(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseDeleteTemplateResponse(rsp) -} - -// GetTemplateWithResponse request returning *GetTemplateResponse -func (c *ClientWithResponses) GetTemplateWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetTemplateResponse, error) { - rsp, err := c.GetTemplate(ctx, id, reqEditors...) - if err != nil { - return nil, err - } - return ParseGetTemplateResponse(rsp) -} - -// CopyTemplateWithBodyWithResponse request with arbitrary body returning *CopyTemplateResponse -func (c *ClientWithResponses) CopyTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CopyTemplateResponse, error) { - rsp, err := c.CopyTemplateWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCopyTemplateResponse(rsp) -} - -func (c *ClientWithResponses) CopyTemplateWithResponse(ctx context.Context, id string, body CopyTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*CopyTemplateResponse, error) { - rsp, err := c.CopyTemplate(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseCopyTemplateResponse(rsp) -} - -// UpdateTemplateWithBodyWithResponse request with arbitrary body returning *UpdateTemplateResponse -func (c *ClientWithResponses) UpdateTemplateWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateTemplateResponse, error) { - rsp, err := c.UpdateTemplateWithBody(ctx, id, contentType, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateTemplateResponse(rsp) -} - -func (c *ClientWithResponses) UpdateTemplateWithResponse(ctx context.Context, id string, body UpdateTemplateJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateTemplateResponse, error) { - rsp, err := c.UpdateTemplate(ctx, id, body, reqEditors...) - if err != nil { - return nil, err - } - return ParseUpdateTemplateResponse(rsp) -} - -// ListZonesWithResponse request returning *ListZonesResponse -func (c *ClientWithResponses) ListZonesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListZonesResponse, error) { - rsp, err := c.ListZones(ctx, reqEditors...) - if err != nil { - return nil, err - } - return ParseListZonesResponse(rsp) -} - -// ParseListAccessKeysResponse parses an HTTP response from a ListAccessKeysWithResponse call -func ParseListAccessKeysResponse(rsp *http.Response) (*ListAccessKeysResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListAccessKeysResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - AccessKeys *[]AccessKey `json:"access-keys,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateAccessKeyResponse parses an HTTP response from a CreateAccessKeyWithResponse call -func ParseCreateAccessKeyResponse(rsp *http.Response) (*CreateAccessKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateAccessKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AccessKey - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListAccessKeyKnownOperationsResponse parses an HTTP response from a ListAccessKeyKnownOperationsWithResponse call -func ParseListAccessKeyKnownOperationsResponse(rsp *http.Response) (*ListAccessKeyKnownOperationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListAccessKeyKnownOperationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - AccessKeyOperations *[]AccessKeyOperation `json:"access-key-operations,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListAccessKeyOperationsResponse parses an HTTP response from a ListAccessKeyOperationsWithResponse call -func ParseListAccessKeyOperationsResponse(rsp *http.Response) (*ListAccessKeyOperationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListAccessKeyOperationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - AccessKeyOperations *[]AccessKeyOperation `json:"access-key-operations,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRevokeAccessKeyResponse parses an HTTP response from a RevokeAccessKeyWithResponse call -func ParseRevokeAccessKeyResponse(rsp *http.Response) (*RevokeAccessKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RevokeAccessKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetAccessKeyResponse parses an HTTP response from a GetAccessKeyWithResponse call -func ParseGetAccessKeyResponse(rsp *http.Response) (*GetAccessKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetAccessKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AccessKey - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListAntiAffinityGroupsResponse parses an HTTP response from a ListAntiAffinityGroupsWithResponse call -func ParseListAntiAffinityGroupsResponse(rsp *http.Response) (*ListAntiAffinityGroupsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListAntiAffinityGroupsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - AntiAffinityGroups *[]AntiAffinityGroup `json:"anti-affinity-groups,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateAntiAffinityGroupResponse parses an HTTP response from a CreateAntiAffinityGroupWithResponse call -func ParseCreateAntiAffinityGroupResponse(rsp *http.Response) (*CreateAntiAffinityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateAntiAffinityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteAntiAffinityGroupResponse parses an HTTP response from a DeleteAntiAffinityGroupWithResponse call -func ParseDeleteAntiAffinityGroupResponse(rsp *http.Response) (*DeleteAntiAffinityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteAntiAffinityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetAntiAffinityGroupResponse parses an HTTP response from a GetAntiAffinityGroupWithResponse call -func ParseGetAntiAffinityGroupResponse(rsp *http.Response) (*GetAntiAffinityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetAntiAffinityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AntiAffinityGroup - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListApiKeysResponse parses an HTTP response from a ListApiKeysWithResponse call -func ParseListApiKeysResponse(rsp *http.Response) (*ListApiKeysResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListApiKeysResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - ApiKeys *[]IamApiKey `json:"api-keys,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateApiKeyResponse parses an HTTP response from a CreateApiKeyWithResponse call -func ParseCreateApiKeyResponse(rsp *http.Response) (*CreateApiKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateApiKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IamApiKeyCreated - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteApiKeyResponse parses an HTTP response from a DeleteApiKeyWithResponse call -func ParseDeleteApiKeyResponse(rsp *http.Response) (*DeleteApiKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteApiKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetApiKeyResponse parses an HTTP response from a GetApiKeyWithResponse call -func ParseGetApiKeyResponse(rsp *http.Response) (*GetApiKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetApiKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IamApiKey - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasCaCertificateResponse parses an HTTP response from a GetDbaasCaCertificateWithResponse call -func ParseGetDbaasCaCertificateResponse(rsp *http.Response) (*GetDbaasCaCertificateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasCaCertificateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Certificate *string `json:"certificate,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceGrafanaResponse parses an HTTP response from a DeleteDbaasServiceGrafanaWithResponse call -func ParseDeleteDbaasServiceGrafanaResponse(rsp *http.Response) (*DeleteDbaasServiceGrafanaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceGrafanaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceGrafanaResponse parses an HTTP response from a GetDbaasServiceGrafanaWithResponse call -func ParseGetDbaasServiceGrafanaResponse(rsp *http.Response) (*GetDbaasServiceGrafanaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceGrafanaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceGrafana - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServiceGrafanaResponse parses an HTTP response from a CreateDbaasServiceGrafanaWithResponse call -func ParseCreateDbaasServiceGrafanaResponse(rsp *http.Response) (*CreateDbaasServiceGrafanaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServiceGrafanaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServiceGrafanaResponse parses an HTTP response from a UpdateDbaasServiceGrafanaWithResponse call -func ParseUpdateDbaasServiceGrafanaResponse(rsp *http.Response) (*UpdateDbaasServiceGrafanaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServiceGrafanaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasGrafanaMaintenanceResponse parses an HTTP response from a StartDbaasGrafanaMaintenanceWithResponse call -func ParseStartDbaasGrafanaMaintenanceResponse(rsp *http.Response) (*StartDbaasGrafanaMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasGrafanaMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasIntegrationResponse parses an HTTP response from a CreateDbaasIntegrationWithResponse call -func ParseCreateDbaasIntegrationResponse(rsp *http.Response) (*CreateDbaasIntegrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasIntegrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDbaasIntegrationSettingsResponse parses an HTTP response from a ListDbaasIntegrationSettingsWithResponse call -func ParseListDbaasIntegrationSettingsResponse(rsp *http.Response) (*ListDbaasIntegrationSettingsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDbaasIntegrationSettingsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - // The JSON schema representing the settings for the given integration type, source, and destination service types. - Settings *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDbaasIntegrationTypesResponse parses an HTTP response from a ListDbaasIntegrationTypesWithResponse call -func ParseListDbaasIntegrationTypesResponse(rsp *http.Response) (*ListDbaasIntegrationTypesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDbaasIntegrationTypesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DbaasIntegrationTypes *[]DbaasIntegrationType `json:"dbaas-integration-types,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasIntegrationResponse parses an HTTP response from a DeleteDbaasIntegrationWithResponse call -func ParseDeleteDbaasIntegrationResponse(rsp *http.Response) (*DeleteDbaasIntegrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasIntegrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasIntegrationResponse parses an HTTP response from a GetDbaasIntegrationWithResponse call -func ParseGetDbaasIntegrationResponse(rsp *http.Response) (*GetDbaasIntegrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasIntegrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasIntegration - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasIntegrationResponse parses an HTTP response from a UpdateDbaasIntegrationWithResponse call -func ParseUpdateDbaasIntegrationResponse(rsp *http.Response) (*UpdateDbaasIntegrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasIntegrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceKafkaResponse parses an HTTP response from a DeleteDbaasServiceKafkaWithResponse call -func ParseDeleteDbaasServiceKafkaResponse(rsp *http.Response) (*DeleteDbaasServiceKafkaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceKafkaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceKafkaResponse parses an HTTP response from a GetDbaasServiceKafkaWithResponse call -func ParseGetDbaasServiceKafkaResponse(rsp *http.Response) (*GetDbaasServiceKafkaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceKafkaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceKafka - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServiceKafkaResponse parses an HTTP response from a CreateDbaasServiceKafkaWithResponse call -func ParseCreateDbaasServiceKafkaResponse(rsp *http.Response) (*CreateDbaasServiceKafkaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServiceKafkaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServiceKafkaResponse parses an HTTP response from a UpdateDbaasServiceKafkaWithResponse call -func ParseUpdateDbaasServiceKafkaResponse(rsp *http.Response) (*UpdateDbaasServiceKafkaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServiceKafkaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasKafkaAclConfigResponse parses an HTTP response from a GetDbaasKafkaAclConfigWithResponse call -func ParseGetDbaasKafkaAclConfigResponse(rsp *http.Response) (*GetDbaasKafkaAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasKafkaAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasKafkaAcls - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasKafkaMaintenanceResponse parses an HTTP response from a StartDbaasKafkaMaintenanceWithResponse call -func ParseStartDbaasKafkaMaintenanceResponse(rsp *http.Response) (*StartDbaasKafkaMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasKafkaMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasKafkaSchemaRegistryAclConfigResponse parses an HTTP response from a CreateDbaasKafkaSchemaRegistryAclConfigWithResponse call -func ParseCreateDbaasKafkaSchemaRegistryAclConfigResponse(rsp *http.Response) (*CreateDbaasKafkaSchemaRegistryAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasKafkaSchemaRegistryAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasKafkaSchemaRegistryAclConfigResponse parses an HTTP response from a DeleteDbaasKafkaSchemaRegistryAclConfigWithResponse call -func ParseDeleteDbaasKafkaSchemaRegistryAclConfigResponse(rsp *http.Response) (*DeleteDbaasKafkaSchemaRegistryAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasKafkaSchemaRegistryAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasKafkaTopicAclConfigResponse parses an HTTP response from a CreateDbaasKafkaTopicAclConfigWithResponse call -func ParseCreateDbaasKafkaTopicAclConfigResponse(rsp *http.Response) (*CreateDbaasKafkaTopicAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasKafkaTopicAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasKafkaTopicAclConfigResponse parses an HTTP response from a DeleteDbaasKafkaTopicAclConfigWithResponse call -func ParseDeleteDbaasKafkaTopicAclConfigResponse(rsp *http.Response) (*DeleteDbaasKafkaTopicAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasKafkaTopicAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasKafkaUserResponse parses an HTTP response from a CreateDbaasKafkaUserWithResponse call -func ParseCreateDbaasKafkaUserResponse(rsp *http.Response) (*CreateDbaasKafkaUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasKafkaUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasKafkaUserResponse parses an HTTP response from a DeleteDbaasKafkaUserWithResponse call -func ParseDeleteDbaasKafkaUserResponse(rsp *http.Response) (*DeleteDbaasKafkaUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasKafkaUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetDbaasKafkaUserPasswordResponse parses an HTTP response from a ResetDbaasKafkaUserPasswordWithResponse call -func ParseResetDbaasKafkaUserPasswordResponse(rsp *http.Response) (*ResetDbaasKafkaUserPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetDbaasKafkaUserPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasMigrationStatusResponse parses an HTTP response from a GetDbaasMigrationStatusWithResponse call -func ParseGetDbaasMigrationStatusResponse(rsp *http.Response) (*GetDbaasMigrationStatusResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasMigrationStatusResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasMigrationStatus - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceMysqlResponse parses an HTTP response from a DeleteDbaasServiceMysqlWithResponse call -func ParseDeleteDbaasServiceMysqlResponse(rsp *http.Response) (*DeleteDbaasServiceMysqlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceMysqlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceMysqlResponse parses an HTTP response from a GetDbaasServiceMysqlWithResponse call -func ParseGetDbaasServiceMysqlResponse(rsp *http.Response) (*GetDbaasServiceMysqlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceMysqlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceMysql - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServiceMysqlResponse parses an HTTP response from a CreateDbaasServiceMysqlWithResponse call -func ParseCreateDbaasServiceMysqlResponse(rsp *http.Response) (*CreateDbaasServiceMysqlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServiceMysqlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServiceMysqlResponse parses an HTTP response from a UpdateDbaasServiceMysqlWithResponse call -func ParseUpdateDbaasServiceMysqlResponse(rsp *http.Response) (*UpdateDbaasServiceMysqlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServiceMysqlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasMysqlMaintenanceResponse parses an HTTP response from a StartDbaasMysqlMaintenanceWithResponse call -func ParseStartDbaasMysqlMaintenanceResponse(rsp *http.Response) (*StartDbaasMysqlMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasMysqlMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStopDbaasMysqlMigrationResponse parses an HTTP response from a StopDbaasMysqlMigrationWithResponse call -func ParseStopDbaasMysqlMigrationResponse(rsp *http.Response) (*StopDbaasMysqlMigrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StopDbaasMysqlMigrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasMysqlDatabaseResponse parses an HTTP response from a CreateDbaasMysqlDatabaseWithResponse call -func ParseCreateDbaasMysqlDatabaseResponse(rsp *http.Response) (*CreateDbaasMysqlDatabaseResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasMysqlDatabaseResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasMysqlDatabaseResponse parses an HTTP response from a DeleteDbaasMysqlDatabaseWithResponse call -func ParseDeleteDbaasMysqlDatabaseResponse(rsp *http.Response) (*DeleteDbaasMysqlDatabaseResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasMysqlDatabaseResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasMysqlUserResponse parses an HTTP response from a CreateDbaasMysqlUserWithResponse call -func ParseCreateDbaasMysqlUserResponse(rsp *http.Response) (*CreateDbaasMysqlUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasMysqlUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasMysqlUserResponse parses an HTTP response from a DeleteDbaasMysqlUserWithResponse call -func ParseDeleteDbaasMysqlUserResponse(rsp *http.Response) (*DeleteDbaasMysqlUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasMysqlUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetDbaasMysqlUserPasswordResponse parses an HTTP response from a ResetDbaasMysqlUserPasswordWithResponse call -func ParseResetDbaasMysqlUserPasswordResponse(rsp *http.Response) (*ResetDbaasMysqlUserPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetDbaasMysqlUserPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceOpensearchResponse parses an HTTP response from a DeleteDbaasServiceOpensearchWithResponse call -func ParseDeleteDbaasServiceOpensearchResponse(rsp *http.Response) (*DeleteDbaasServiceOpensearchResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceOpensearchResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceOpensearchResponse parses an HTTP response from a GetDbaasServiceOpensearchWithResponse call -func ParseGetDbaasServiceOpensearchResponse(rsp *http.Response) (*GetDbaasServiceOpensearchResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceOpensearchResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceOpensearch - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServiceOpensearchResponse parses an HTTP response from a CreateDbaasServiceOpensearchWithResponse call -func ParseCreateDbaasServiceOpensearchResponse(rsp *http.Response) (*CreateDbaasServiceOpensearchResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServiceOpensearchResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServiceOpensearchResponse parses an HTTP response from a UpdateDbaasServiceOpensearchWithResponse call -func ParseUpdateDbaasServiceOpensearchResponse(rsp *http.Response) (*UpdateDbaasServiceOpensearchResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServiceOpensearchResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasOpensearchAclConfigResponse parses an HTTP response from a GetDbaasOpensearchAclConfigWithResponse call -func ParseGetDbaasOpensearchAclConfigResponse(rsp *http.Response) (*GetDbaasOpensearchAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasOpensearchAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasOpensearchAclConfig - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasOpensearchAclConfigResponse parses an HTTP response from a UpdateDbaasOpensearchAclConfigWithResponse call -func ParseUpdateDbaasOpensearchAclConfigResponse(rsp *http.Response) (*UpdateDbaasOpensearchAclConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasOpensearchAclConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasOpensearchMaintenanceResponse parses an HTTP response from a StartDbaasOpensearchMaintenanceWithResponse call -func ParseStartDbaasOpensearchMaintenanceResponse(rsp *http.Response) (*StartDbaasOpensearchMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasOpensearchMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasOpensearchUserResponse parses an HTTP response from a CreateDbaasOpensearchUserWithResponse call -func ParseCreateDbaasOpensearchUserResponse(rsp *http.Response) (*CreateDbaasOpensearchUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasOpensearchUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasOpensearchUserResponse parses an HTTP response from a DeleteDbaasOpensearchUserWithResponse call -func ParseDeleteDbaasOpensearchUserResponse(rsp *http.Response) (*DeleteDbaasOpensearchUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasOpensearchUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetDbaasOpensearchUserPasswordResponse parses an HTTP response from a ResetDbaasOpensearchUserPasswordWithResponse call -func ParseResetDbaasOpensearchUserPasswordResponse(rsp *http.Response) (*ResetDbaasOpensearchUserPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetDbaasOpensearchUserPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServicePgResponse parses an HTTP response from a DeleteDbaasServicePgWithResponse call -func ParseDeleteDbaasServicePgResponse(rsp *http.Response) (*DeleteDbaasServicePgResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServicePgResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServicePgResponse parses an HTTP response from a GetDbaasServicePgWithResponse call -func ParseGetDbaasServicePgResponse(rsp *http.Response) (*GetDbaasServicePgResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServicePgResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServicePg - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServicePgResponse parses an HTTP response from a CreateDbaasServicePgWithResponse call -func ParseCreateDbaasServicePgResponse(rsp *http.Response) (*CreateDbaasServicePgResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServicePgResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServicePgResponse parses an HTTP response from a UpdateDbaasServicePgWithResponse call -func ParseUpdateDbaasServicePgResponse(rsp *http.Response) (*UpdateDbaasServicePgResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServicePgResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasPgMaintenanceResponse parses an HTTP response from a StartDbaasPgMaintenanceWithResponse call -func ParseStartDbaasPgMaintenanceResponse(rsp *http.Response) (*StartDbaasPgMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasPgMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStopDbaasPgMigrationResponse parses an HTTP response from a StopDbaasPgMigrationWithResponse call -func ParseStopDbaasPgMigrationResponse(rsp *http.Response) (*StopDbaasPgMigrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StopDbaasPgMigrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasPgConnectionPoolResponse parses an HTTP response from a CreateDbaasPgConnectionPoolWithResponse call -func ParseCreateDbaasPgConnectionPoolResponse(rsp *http.Response) (*CreateDbaasPgConnectionPoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasPgConnectionPoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasPgConnectionPoolResponse parses an HTTP response from a DeleteDbaasPgConnectionPoolWithResponse call -func ParseDeleteDbaasPgConnectionPoolResponse(rsp *http.Response) (*DeleteDbaasPgConnectionPoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasPgConnectionPoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasPgConnectionPoolResponse parses an HTTP response from a UpdateDbaasPgConnectionPoolWithResponse call -func ParseUpdateDbaasPgConnectionPoolResponse(rsp *http.Response) (*UpdateDbaasPgConnectionPoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasPgConnectionPoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasPgDatabaseResponse parses an HTTP response from a CreateDbaasPgDatabaseWithResponse call -func ParseCreateDbaasPgDatabaseResponse(rsp *http.Response) (*CreateDbaasPgDatabaseResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasPgDatabaseResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasPgDatabaseResponse parses an HTTP response from a DeleteDbaasPgDatabaseWithResponse call -func ParseDeleteDbaasPgDatabaseResponse(rsp *http.Response) (*DeleteDbaasPgDatabaseResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasPgDatabaseResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasPostgresUserResponse parses an HTTP response from a CreateDbaasPostgresUserWithResponse call -func ParseCreateDbaasPostgresUserResponse(rsp *http.Response) (*CreateDbaasPostgresUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasPostgresUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasPostgresUserResponse parses an HTTP response from a DeleteDbaasPostgresUserWithResponse call -func ParseDeleteDbaasPostgresUserResponse(rsp *http.Response) (*DeleteDbaasPostgresUserResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasPostgresUserResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasPostgresAllowReplicationResponse parses an HTTP response from a UpdateDbaasPostgresAllowReplicationWithResponse call -func ParseUpdateDbaasPostgresAllowReplicationResponse(rsp *http.Response) (*UpdateDbaasPostgresAllowReplicationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasPostgresAllowReplicationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasPostgresUsers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetDbaasPostgresUserPasswordResponse parses an HTTP response from a ResetDbaasPostgresUserPasswordWithResponse call -func ParseResetDbaasPostgresUserPasswordResponse(rsp *http.Response) (*ResetDbaasPostgresUserPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetDbaasPostgresUserPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasPgUpgradeCheckResponse parses an HTTP response from a CreateDbaasPgUpgradeCheckWithResponse call -func ParseCreateDbaasPgUpgradeCheckResponse(rsp *http.Response) (*CreateDbaasPgUpgradeCheckResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasPgUpgradeCheckResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasTask - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceRedisResponse parses an HTTP response from a DeleteDbaasServiceRedisWithResponse call -func ParseDeleteDbaasServiceRedisResponse(rsp *http.Response) (*DeleteDbaasServiceRedisResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceRedisResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceRedisResponse parses an HTTP response from a GetDbaasServiceRedisWithResponse call -func ParseGetDbaasServiceRedisResponse(rsp *http.Response) (*GetDbaasServiceRedisResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceRedisResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceRedis - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasServiceRedisResponse parses an HTTP response from a CreateDbaasServiceRedisWithResponse call -func ParseCreateDbaasServiceRedisResponse(rsp *http.Response) (*CreateDbaasServiceRedisResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasServiceRedisResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDbaasServiceRedisResponse parses an HTTP response from a UpdateDbaasServiceRedisWithResponse call -func ParseUpdateDbaasServiceRedisResponse(rsp *http.Response) (*UpdateDbaasServiceRedisResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDbaasServiceRedisResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartDbaasRedisMaintenanceResponse parses an HTTP response from a StartDbaasRedisMaintenanceWithResponse call -func ParseStartDbaasRedisMaintenanceResponse(rsp *http.Response) (*StartDbaasRedisMaintenanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartDbaasRedisMaintenanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStopDbaasRedisMigrationResponse parses an HTTP response from a StopDbaasRedisMigrationWithResponse call -func ParseStopDbaasRedisMigrationResponse(rsp *http.Response) (*StopDbaasRedisMigrationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StopDbaasRedisMigrationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDbaasServicesResponse parses an HTTP response from a ListDbaasServicesWithResponse call -func ParseListDbaasServicesResponse(rsp *http.Response) (*ListDbaasServicesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDbaasServicesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DbaasServices *[]DbaasServiceCommon `json:"dbaas-services,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceLogsResponse parses an HTTP response from a GetDbaasServiceLogsWithResponse call -func ParseGetDbaasServiceLogsResponse(rsp *http.Response) (*GetDbaasServiceLogsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceLogsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceLogs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceMetricsResponse parses an HTTP response from a GetDbaasServiceMetricsWithResponse call -func ParseGetDbaasServiceMetricsResponse(rsp *http.Response) (*GetDbaasServiceMetricsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceMetricsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Metrics *map[string]interface{} `json:"metrics,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDbaasServiceTypesResponse parses an HTTP response from a ListDbaasServiceTypesWithResponse call -func ParseListDbaasServiceTypesResponse(rsp *http.Response) (*ListDbaasServiceTypesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDbaasServiceTypesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DbaasServiceTypes *[]DbaasServiceType `json:"dbaas-service-types,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasServiceTypeResponse parses an HTTP response from a GetDbaasServiceTypeWithResponse call -func ParseGetDbaasServiceTypeResponse(rsp *http.Response) (*GetDbaasServiceTypeResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasServiceTypeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasServiceType - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDbaasServiceResponse parses an HTTP response from a DeleteDbaasServiceWithResponse call -func ParseDeleteDbaasServiceResponse(rsp *http.Response) (*DeleteDbaasServiceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDbaasServiceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsGrafanaResponse parses an HTTP response from a GetDbaasSettingsGrafanaWithResponse call -func ParseGetDbaasSettingsGrafanaResponse(rsp *http.Response) (*GetDbaasSettingsGrafanaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsGrafanaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // Grafana configuration values - Grafana *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"grafana,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsKafkaResponse parses an HTTP response from a GetDbaasSettingsKafkaWithResponse call -func ParseGetDbaasSettingsKafkaResponse(rsp *http.Response) (*GetDbaasSettingsKafkaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsKafkaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // Kafka broker configuration values - Kafka *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka,omitempty"` - - // Kafka Connect configuration values - KafkaConnect *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka-connect,omitempty"` - - // Kafka REST configuration - KafkaRest *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"kafka-rest,omitempty"` - - // Schema Registry configuration - SchemaRegistry *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"schema-registry,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsMysqlResponse parses an HTTP response from a GetDbaasSettingsMysqlWithResponse call -func ParseGetDbaasSettingsMysqlResponse(rsp *http.Response) (*GetDbaasSettingsMysqlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsMysqlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // mysql.conf configuration values - Mysql *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"mysql,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsOpensearchResponse parses an HTTP response from a GetDbaasSettingsOpensearchWithResponse call -func ParseGetDbaasSettingsOpensearchResponse(rsp *http.Response) (*GetDbaasSettingsOpensearchResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsOpensearchResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // OpenSearch configuration values - Opensearch *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"opensearch,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsPgResponse parses an HTTP response from a GetDbaasSettingsPgWithResponse call -func ParseGetDbaasSettingsPgResponse(rsp *http.Response) (*GetDbaasSettingsPgResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsPgResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // postgresql.conf configuration values - Pg *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pg,omitempty"` - - // PGBouncer connection pooling settings - Pgbouncer *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pgbouncer,omitempty"` - - // PGLookout settings - Pglookout *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"pglookout,omitempty"` - - // TimescaleDB extension configuration values - Timescaledb *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"timescaledb,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasSettingsRedisResponse parses an HTTP response from a GetDbaasSettingsRedisWithResponse call -func ParseGetDbaasSettingsRedisResponse(rsp *http.Response) (*GetDbaasSettingsRedisResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasSettingsRedisResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Settings *struct { - // Redis configuration values - Redis *struct { - AdditionalProperties *bool `json:"additionalProperties,omitempty"` - Properties *map[string]interface{} `json:"properties,omitempty"` - Title *string `json:"title,omitempty"` - Type *string `json:"type,omitempty"` - } `json:"redis,omitempty"` - } `json:"settings,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDbaasTaskMigrationCheckResponse parses an HTTP response from a CreateDbaasTaskMigrationCheckWithResponse call -func ParseCreateDbaasTaskMigrationCheckResponse(rsp *http.Response) (*CreateDbaasTaskMigrationCheckResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDbaasTaskMigrationCheckResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDbaasTaskResponse parses an HTTP response from a GetDbaasTaskWithResponse call -func ParseGetDbaasTaskResponse(rsp *http.Response) (*GetDbaasTaskResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDbaasTaskResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DbaasTask - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDeployTargetsResponse parses an HTTP response from a ListDeployTargetsWithResponse call -func ParseListDeployTargetsResponse(rsp *http.Response) (*ListDeployTargetsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDeployTargetsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DeployTargets *[]DeployTarget `json:"deploy-targets,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDeployTargetResponse parses an HTTP response from a GetDeployTargetWithResponse call -func ParseGetDeployTargetResponse(rsp *http.Response) (*GetDeployTargetResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDeployTargetResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DeployTarget - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDnsDomainsResponse parses an HTTP response from a ListDnsDomainsWithResponse call -func ParseListDnsDomainsResponse(rsp *http.Response) (*ListDnsDomainsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDnsDomainsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DnsDomains *[]DnsDomain `json:"dns-domains,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDnsDomainResponse parses an HTTP response from a CreateDnsDomainWithResponse call -func ParseCreateDnsDomainResponse(rsp *http.Response) (*CreateDnsDomainResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDnsDomainResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DnsDomain - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListDnsDomainRecordsResponse parses an HTTP response from a ListDnsDomainRecordsWithResponse call -func ParseListDnsDomainRecordsResponse(rsp *http.Response) (*ListDnsDomainRecordsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListDnsDomainRecordsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - DnsDomainRecords *[]DnsDomainRecord `json:"dns-domain-records,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateDnsDomainRecordResponse parses an HTTP response from a CreateDnsDomainRecordWithResponse call -func ParseCreateDnsDomainRecordResponse(rsp *http.Response) (*CreateDnsDomainRecordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateDnsDomainRecordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDnsDomainRecordResponse parses an HTTP response from a DeleteDnsDomainRecordWithResponse call -func ParseDeleteDnsDomainRecordResponse(rsp *http.Response) (*DeleteDnsDomainRecordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDnsDomainRecordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDnsDomainRecordResponse parses an HTTP response from a GetDnsDomainRecordWithResponse call -func ParseGetDnsDomainRecordResponse(rsp *http.Response) (*GetDnsDomainRecordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDnsDomainRecordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DnsDomainRecord - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateDnsDomainRecordResponse parses an HTTP response from a UpdateDnsDomainRecordWithResponse call -func ParseUpdateDnsDomainRecordResponse(rsp *http.Response) (*UpdateDnsDomainRecordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateDnsDomainRecordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteDnsDomainResponse parses an HTTP response from a DeleteDnsDomainWithResponse call -func ParseDeleteDnsDomainResponse(rsp *http.Response) (*DeleteDnsDomainResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteDnsDomainResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDnsDomainResponse parses an HTTP response from a GetDnsDomainWithResponse call -func ParseGetDnsDomainResponse(rsp *http.Response) (*GetDnsDomainResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDnsDomainResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DnsDomain - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetDnsDomainZoneFileResponse parses an HTTP response from a GetDnsDomainZoneFileWithResponse call -func ParseGetDnsDomainZoneFileResponse(rsp *http.Response) (*GetDnsDomainZoneFileResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetDnsDomainZoneFileResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - ZoneFile *string `json:"zone-file,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListElasticIpsResponse parses an HTTP response from a ListElasticIpsWithResponse call -func ParseListElasticIpsResponse(rsp *http.Response) (*ListElasticIpsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListElasticIpsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - ElasticIps *[]ElasticIp `json:"elastic-ips,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateElasticIpResponse parses an HTTP response from a CreateElasticIpWithResponse call -func ParseCreateElasticIpResponse(rsp *http.Response) (*CreateElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteElasticIpResponse parses an HTTP response from a DeleteElasticIpWithResponse call -func ParseDeleteElasticIpResponse(rsp *http.Response) (*DeleteElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetElasticIpResponse parses an HTTP response from a GetElasticIpWithResponse call -func ParseGetElasticIpResponse(rsp *http.Response) (*GetElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ElasticIp - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateElasticIpResponse parses an HTTP response from a UpdateElasticIpWithResponse call -func ParseUpdateElasticIpResponse(rsp *http.Response) (*UpdateElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetElasticIpFieldResponse parses an HTTP response from a ResetElasticIpFieldWithResponse call -func ParseResetElasticIpFieldResponse(rsp *http.Response) (*ResetElasticIpFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetElasticIpFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAttachInstanceToElasticIpResponse parses an HTTP response from a AttachInstanceToElasticIpWithResponse call -func ParseAttachInstanceToElasticIpResponse(rsp *http.Response) (*AttachInstanceToElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AttachInstanceToElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDetachInstanceFromElasticIpResponse parses an HTTP response from a DetachInstanceFromElasticIpWithResponse call -func ParseDetachInstanceFromElasticIpResponse(rsp *http.Response) (*DetachInstanceFromElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DetachInstanceFromElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListEventsResponse parses an HTTP response from a ListEventsWithResponse call -func ParseListEventsResponse(rsp *http.Response) (*ListEventsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListEventsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []Event - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetIamOrganizationPolicyResponse parses an HTTP response from a GetIamOrganizationPolicyWithResponse call -func ParseGetIamOrganizationPolicyResponse(rsp *http.Response) (*GetIamOrganizationPolicyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetIamOrganizationPolicyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IamPolicy - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateIamOrganizationPolicyResponse parses an HTTP response from a UpdateIamOrganizationPolicyWithResponse call -func ParseUpdateIamOrganizationPolicyResponse(rsp *http.Response) (*UpdateIamOrganizationPolicyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateIamOrganizationPolicyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListIamRolesResponse parses an HTTP response from a ListIamRolesWithResponse call -func ParseListIamRolesResponse(rsp *http.Response) (*ListIamRolesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListIamRolesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - IamRoles *[]IamRole `json:"iam-roles,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateIamRoleResponse parses an HTTP response from a CreateIamRoleWithResponse call -func ParseCreateIamRoleResponse(rsp *http.Response) (*CreateIamRoleResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateIamRoleResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteIamRoleResponse parses an HTTP response from a DeleteIamRoleWithResponse call -func ParseDeleteIamRoleResponse(rsp *http.Response) (*DeleteIamRoleResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteIamRoleResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetIamRoleResponse parses an HTTP response from a GetIamRoleWithResponse call -func ParseGetIamRoleResponse(rsp *http.Response) (*GetIamRoleResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetIamRoleResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IamRole - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateIamRoleResponse parses an HTTP response from a UpdateIamRoleWithResponse call -func ParseUpdateIamRoleResponse(rsp *http.Response) (*UpdateIamRoleResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateIamRoleResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateIamRolePolicyResponse parses an HTTP response from a UpdateIamRolePolicyWithResponse call -func ParseUpdateIamRolePolicyResponse(rsp *http.Response) (*UpdateIamRolePolicyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateIamRolePolicyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListInstancesResponse parses an HTTP response from a ListInstancesWithResponse call -func ParseListInstancesResponse(rsp *http.Response) (*ListInstancesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListInstancesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Instances *[]Instance `json:"instances,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateInstanceResponse parses an HTTP response from a CreateInstanceWithResponse call -func ParseCreateInstanceResponse(rsp *http.Response) (*CreateInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListInstancePoolsResponse parses an HTTP response from a ListInstancePoolsWithResponse call -func ParseListInstancePoolsResponse(rsp *http.Response) (*ListInstancePoolsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListInstancePoolsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - InstancePools *[]InstancePool `json:"instance-pools,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateInstancePoolResponse parses an HTTP response from a CreateInstancePoolWithResponse call -func ParseCreateInstancePoolResponse(rsp *http.Response) (*CreateInstancePoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateInstancePoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteInstancePoolResponse parses an HTTP response from a DeleteInstancePoolWithResponse call -func ParseDeleteInstancePoolResponse(rsp *http.Response) (*DeleteInstancePoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteInstancePoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetInstancePoolResponse parses an HTTP response from a GetInstancePoolWithResponse call -func ParseGetInstancePoolResponse(rsp *http.Response) (*GetInstancePoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetInstancePoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest InstancePool - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateInstancePoolResponse parses an HTTP response from a UpdateInstancePoolWithResponse call -func ParseUpdateInstancePoolResponse(rsp *http.Response) (*UpdateInstancePoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateInstancePoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetInstancePoolFieldResponse parses an HTTP response from a ResetInstancePoolFieldWithResponse call -func ParseResetInstancePoolFieldResponse(rsp *http.Response) (*ResetInstancePoolFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetInstancePoolFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseEvictInstancePoolMembersResponse parses an HTTP response from a EvictInstancePoolMembersWithResponse call -func ParseEvictInstancePoolMembersResponse(rsp *http.Response) (*EvictInstancePoolMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &EvictInstancePoolMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseScaleInstancePoolResponse parses an HTTP response from a ScaleInstancePoolWithResponse call -func ParseScaleInstancePoolResponse(rsp *http.Response) (*ScaleInstancePoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ScaleInstancePoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListInstanceTypesResponse parses an HTTP response from a ListInstanceTypesWithResponse call -func ParseListInstanceTypesResponse(rsp *http.Response) (*ListInstanceTypesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListInstanceTypesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - InstanceTypes *[]InstanceType `json:"instance-types,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetInstanceTypeResponse parses an HTTP response from a GetInstanceTypeWithResponse call -func ParseGetInstanceTypeResponse(rsp *http.Response) (*GetInstanceTypeResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetInstanceTypeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest InstanceType - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteInstanceResponse parses an HTTP response from a DeleteInstanceWithResponse call -func ParseDeleteInstanceResponse(rsp *http.Response) (*DeleteInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetInstanceResponse parses an HTTP response from a GetInstanceWithResponse call -func ParseGetInstanceResponse(rsp *http.Response) (*GetInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Instance - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateInstanceResponse parses an HTTP response from a UpdateInstanceWithResponse call -func ParseUpdateInstanceResponse(rsp *http.Response) (*UpdateInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetInstanceFieldResponse parses an HTTP response from a ResetInstanceFieldWithResponse call -func ParseResetInstanceFieldResponse(rsp *http.Response) (*ResetInstanceFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetInstanceFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAddInstanceProtectionResponse parses an HTTP response from a AddInstanceProtectionWithResponse call -func ParseAddInstanceProtectionResponse(rsp *http.Response) (*AddInstanceProtectionResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddInstanceProtectionResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest map[string]interface{} - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateSnapshotResponse parses an HTTP response from a CreateSnapshotWithResponse call -func ParseCreateSnapshotResponse(rsp *http.Response) (*CreateSnapshotResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateSnapshotResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRevealInstancePasswordResponse parses an HTTP response from a RevealInstancePasswordWithResponse call -func ParseRevealInstancePasswordResponse(rsp *http.Response) (*RevealInstancePasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RevealInstancePasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest InstancePassword - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRebootInstanceResponse parses an HTTP response from a RebootInstanceWithResponse call -func ParseRebootInstanceResponse(rsp *http.Response) (*RebootInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RebootInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRemoveInstanceProtectionResponse parses an HTTP response from a RemoveInstanceProtectionWithResponse call -func ParseRemoveInstanceProtectionResponse(rsp *http.Response) (*RemoveInstanceProtectionResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RemoveInstanceProtectionResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest map[string]interface{} - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetInstanceResponse parses an HTTP response from a ResetInstanceWithResponse call -func ParseResetInstanceResponse(rsp *http.Response) (*ResetInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetInstancePasswordResponse parses an HTTP response from a ResetInstancePasswordWithResponse call -func ParseResetInstancePasswordResponse(rsp *http.Response) (*ResetInstancePasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetInstancePasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResizeInstanceDiskResponse parses an HTTP response from a ResizeInstanceDiskWithResponse call -func ParseResizeInstanceDiskResponse(rsp *http.Response) (*ResizeInstanceDiskResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResizeInstanceDiskResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseScaleInstanceResponse parses an HTTP response from a ScaleInstanceWithResponse call -func ParseScaleInstanceResponse(rsp *http.Response) (*ScaleInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ScaleInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStartInstanceResponse parses an HTTP response from a StartInstanceWithResponse call -func ParseStartInstanceResponse(rsp *http.Response) (*StartInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StartInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseStopInstanceResponse parses an HTTP response from a StopInstanceWithResponse call -func ParseStopInstanceResponse(rsp *http.Response) (*StopInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &StopInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRevertInstanceToSnapshotResponse parses an HTTP response from a RevertInstanceToSnapshotWithResponse call -func ParseRevertInstanceToSnapshotResponse(rsp *http.Response) (*RevertInstanceToSnapshotResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RevertInstanceToSnapshotResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListLoadBalancersResponse parses an HTTP response from a ListLoadBalancersWithResponse call -func ParseListLoadBalancersResponse(rsp *http.Response) (*ListLoadBalancersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListLoadBalancersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - LoadBalancers *[]LoadBalancer `json:"load-balancers,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateLoadBalancerResponse parses an HTTP response from a CreateLoadBalancerWithResponse call -func ParseCreateLoadBalancerResponse(rsp *http.Response) (*CreateLoadBalancerResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateLoadBalancerResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteLoadBalancerResponse parses an HTTP response from a DeleteLoadBalancerWithResponse call -func ParseDeleteLoadBalancerResponse(rsp *http.Response) (*DeleteLoadBalancerResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteLoadBalancerResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetLoadBalancerResponse parses an HTTP response from a GetLoadBalancerWithResponse call -func ParseGetLoadBalancerResponse(rsp *http.Response) (*GetLoadBalancerResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLoadBalancerResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LoadBalancer - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateLoadBalancerResponse parses an HTTP response from a UpdateLoadBalancerWithResponse call -func ParseUpdateLoadBalancerResponse(rsp *http.Response) (*UpdateLoadBalancerResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateLoadBalancerResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAddServiceToLoadBalancerResponse parses an HTTP response from a AddServiceToLoadBalancerWithResponse call -func ParseAddServiceToLoadBalancerResponse(rsp *http.Response) (*AddServiceToLoadBalancerResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddServiceToLoadBalancerResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteLoadBalancerServiceResponse parses an HTTP response from a DeleteLoadBalancerServiceWithResponse call -func ParseDeleteLoadBalancerServiceResponse(rsp *http.Response) (*DeleteLoadBalancerServiceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteLoadBalancerServiceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetLoadBalancerServiceResponse parses an HTTP response from a GetLoadBalancerServiceWithResponse call -func ParseGetLoadBalancerServiceResponse(rsp *http.Response) (*GetLoadBalancerServiceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetLoadBalancerServiceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LoadBalancerService - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateLoadBalancerServiceResponse parses an HTTP response from a UpdateLoadBalancerServiceWithResponse call -func ParseUpdateLoadBalancerServiceResponse(rsp *http.Response) (*UpdateLoadBalancerServiceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateLoadBalancerServiceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetLoadBalancerServiceFieldResponse parses an HTTP response from a ResetLoadBalancerServiceFieldWithResponse call -func ParseResetLoadBalancerServiceFieldResponse(rsp *http.Response) (*ResetLoadBalancerServiceFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetLoadBalancerServiceFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetLoadBalancerFieldResponse parses an HTTP response from a ResetLoadBalancerFieldWithResponse call -func ParseResetLoadBalancerFieldResponse(rsp *http.Response) (*ResetLoadBalancerFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetLoadBalancerFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetOperationResponse parses an HTTP response from a GetOperationWithResponse call -func ParseGetOperationResponse(rsp *http.Response) (*GetOperationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetOperationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListPrivateNetworksResponse parses an HTTP response from a ListPrivateNetworksWithResponse call -func ParseListPrivateNetworksResponse(rsp *http.Response) (*ListPrivateNetworksResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListPrivateNetworksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - PrivateNetworks *[]PrivateNetwork `json:"private-networks,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreatePrivateNetworkResponse parses an HTTP response from a CreatePrivateNetworkWithResponse call -func ParseCreatePrivateNetworkResponse(rsp *http.Response) (*CreatePrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreatePrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeletePrivateNetworkResponse parses an HTTP response from a DeletePrivateNetworkWithResponse call -func ParseDeletePrivateNetworkResponse(rsp *http.Response) (*DeletePrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeletePrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetPrivateNetworkResponse parses an HTTP response from a GetPrivateNetworkWithResponse call -func ParseGetPrivateNetworkResponse(rsp *http.Response) (*GetPrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetPrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest PrivateNetwork - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdatePrivateNetworkResponse parses an HTTP response from a UpdatePrivateNetworkWithResponse call -func ParseUpdatePrivateNetworkResponse(rsp *http.Response) (*UpdatePrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdatePrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetPrivateNetworkFieldResponse parses an HTTP response from a ResetPrivateNetworkFieldWithResponse call -func ParseResetPrivateNetworkFieldResponse(rsp *http.Response) (*ResetPrivateNetworkFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetPrivateNetworkFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAttachInstanceToPrivateNetworkResponse parses an HTTP response from a AttachInstanceToPrivateNetworkWithResponse call -func ParseAttachInstanceToPrivateNetworkResponse(rsp *http.Response) (*AttachInstanceToPrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AttachInstanceToPrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDetachInstanceFromPrivateNetworkResponse parses an HTTP response from a DetachInstanceFromPrivateNetworkWithResponse call -func ParseDetachInstanceFromPrivateNetworkResponse(rsp *http.Response) (*DetachInstanceFromPrivateNetworkResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DetachInstanceFromPrivateNetworkResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdatePrivateNetworkInstanceIpResponse parses an HTTP response from a UpdatePrivateNetworkInstanceIpWithResponse call -func ParseUpdatePrivateNetworkInstanceIpResponse(rsp *http.Response) (*UpdatePrivateNetworkInstanceIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdatePrivateNetworkInstanceIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListQuotasResponse parses an HTTP response from a ListQuotasWithResponse call -func ParseListQuotasResponse(rsp *http.Response) (*ListQuotasResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListQuotasResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Quotas *[]Quota `json:"quotas,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetQuotaResponse parses an HTTP response from a GetQuotaWithResponse call -func ParseGetQuotaResponse(rsp *http.Response) (*GetQuotaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetQuotaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Quota - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteReverseDnsElasticIpResponse parses an HTTP response from a DeleteReverseDnsElasticIpWithResponse call -func ParseDeleteReverseDnsElasticIpResponse(rsp *http.Response) (*DeleteReverseDnsElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteReverseDnsElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetReverseDnsElasticIpResponse parses an HTTP response from a GetReverseDnsElasticIpWithResponse call -func ParseGetReverseDnsElasticIpResponse(rsp *http.Response) (*GetReverseDnsElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetReverseDnsElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ReverseDnsRecord - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateReverseDnsElasticIpResponse parses an HTTP response from a UpdateReverseDnsElasticIpWithResponse call -func ParseUpdateReverseDnsElasticIpResponse(rsp *http.Response) (*UpdateReverseDnsElasticIpResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateReverseDnsElasticIpResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteReverseDnsInstanceResponse parses an HTTP response from a DeleteReverseDnsInstanceWithResponse call -func ParseDeleteReverseDnsInstanceResponse(rsp *http.Response) (*DeleteReverseDnsInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteReverseDnsInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetReverseDnsInstanceResponse parses an HTTP response from a GetReverseDnsInstanceWithResponse call -func ParseGetReverseDnsInstanceResponse(rsp *http.Response) (*GetReverseDnsInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetReverseDnsInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ReverseDnsRecord - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateReverseDnsInstanceResponse parses an HTTP response from a UpdateReverseDnsInstanceWithResponse call -func ParseUpdateReverseDnsInstanceResponse(rsp *http.Response) (*UpdateReverseDnsInstanceResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateReverseDnsInstanceResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSecurityGroupsResponse parses an HTTP response from a ListSecurityGroupsWithResponse call -func ParseListSecurityGroupsResponse(rsp *http.Response) (*ListSecurityGroupsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSecurityGroupsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - SecurityGroups *[]SecurityGroup `json:"security-groups,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateSecurityGroupResponse parses an HTTP response from a CreateSecurityGroupWithResponse call -func ParseCreateSecurityGroupResponse(rsp *http.Response) (*CreateSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteSecurityGroupResponse parses an HTTP response from a DeleteSecurityGroupWithResponse call -func ParseDeleteSecurityGroupResponse(rsp *http.Response) (*DeleteSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSecurityGroupResponse parses an HTTP response from a GetSecurityGroupWithResponse call -func ParseGetSecurityGroupResponse(rsp *http.Response) (*GetSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SecurityGroup - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAddRuleToSecurityGroupResponse parses an HTTP response from a AddRuleToSecurityGroupWithResponse call -func ParseAddRuleToSecurityGroupResponse(rsp *http.Response) (*AddRuleToSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddRuleToSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteRuleFromSecurityGroupResponse parses an HTTP response from a DeleteRuleFromSecurityGroupWithResponse call -func ParseDeleteRuleFromSecurityGroupResponse(rsp *http.Response) (*DeleteRuleFromSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteRuleFromSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAddExternalSourceToSecurityGroupResponse parses an HTTP response from a AddExternalSourceToSecurityGroupWithResponse call -func ParseAddExternalSourceToSecurityGroupResponse(rsp *http.Response) (*AddExternalSourceToSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AddExternalSourceToSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseAttachInstanceToSecurityGroupResponse parses an HTTP response from a AttachInstanceToSecurityGroupWithResponse call -func ParseAttachInstanceToSecurityGroupResponse(rsp *http.Response) (*AttachInstanceToSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &AttachInstanceToSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDetachInstanceFromSecurityGroupResponse parses an HTTP response from a DetachInstanceFromSecurityGroupWithResponse call -func ParseDetachInstanceFromSecurityGroupResponse(rsp *http.Response) (*DetachInstanceFromSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DetachInstanceFromSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRemoveExternalSourceFromSecurityGroupResponse parses an HTTP response from a RemoveExternalSourceFromSecurityGroupWithResponse call -func ParseRemoveExternalSourceFromSecurityGroupResponse(rsp *http.Response) (*RemoveExternalSourceFromSecurityGroupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RemoveExternalSourceFromSecurityGroupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSksClustersResponse parses an HTTP response from a ListSksClustersWithResponse call -func ParseListSksClustersResponse(rsp *http.Response) (*ListSksClustersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSksClustersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - SksClusters *[]SksCluster `json:"sks-clusters,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateSksClusterResponse parses an HTTP response from a CreateSksClusterWithResponse call -func ParseCreateSksClusterResponse(rsp *http.Response) (*CreateSksClusterResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateSksClusterResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSksClusterDeprecatedResourcesResponse parses an HTTP response from a ListSksClusterDeprecatedResourcesWithResponse call -func ParseListSksClusterDeprecatedResourcesResponse(rsp *http.Response) (*ListSksClusterDeprecatedResourcesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSksClusterDeprecatedResourcesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []SksClusterDeprecatedResource - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGenerateSksClusterKubeconfigResponse parses an HTTP response from a GenerateSksClusterKubeconfigWithResponse call -func ParseGenerateSksClusterKubeconfigResponse(rsp *http.Response) (*GenerateSksClusterKubeconfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GenerateSksClusterKubeconfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Kubeconfig *string `json:"kubeconfig,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSksClusterVersionsResponse parses an HTTP response from a ListSksClusterVersionsWithResponse call -func ParseListSksClusterVersionsResponse(rsp *http.Response) (*ListSksClusterVersionsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSksClusterVersionsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - SksClusterVersions *[]string `json:"sks-cluster-versions,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteSksClusterResponse parses an HTTP response from a DeleteSksClusterWithResponse call -func ParseDeleteSksClusterResponse(rsp *http.Response) (*DeleteSksClusterResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSksClusterResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSksClusterResponse parses an HTTP response from a GetSksClusterWithResponse call -func ParseGetSksClusterResponse(rsp *http.Response) (*GetSksClusterResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSksClusterResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SksCluster - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateSksClusterResponse parses an HTTP response from a UpdateSksClusterWithResponse call -func ParseUpdateSksClusterResponse(rsp *http.Response) (*UpdateSksClusterResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateSksClusterResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSksClusterAuthorityCertResponse parses an HTTP response from a GetSksClusterAuthorityCertWithResponse call -func ParseGetSksClusterAuthorityCertResponse(rsp *http.Response) (*GetSksClusterAuthorityCertResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSksClusterAuthorityCertResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Cacert *string `json:"cacert,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCreateSksNodepoolResponse parses an HTTP response from a CreateSksNodepoolWithResponse call -func ParseCreateSksNodepoolResponse(rsp *http.Response) (*CreateSksNodepoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CreateSksNodepoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteSksNodepoolResponse parses an HTTP response from a DeleteSksNodepoolWithResponse call -func ParseDeleteSksNodepoolResponse(rsp *http.Response) (*DeleteSksNodepoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSksNodepoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSksNodepoolResponse parses an HTTP response from a GetSksNodepoolWithResponse call -func ParseGetSksNodepoolResponse(rsp *http.Response) (*GetSksNodepoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSksNodepoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SksNodepool - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateSksNodepoolResponse parses an HTTP response from a UpdateSksNodepoolWithResponse call -func ParseUpdateSksNodepoolResponse(rsp *http.Response) (*UpdateSksNodepoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateSksNodepoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetSksNodepoolFieldResponse parses an HTTP response from a ResetSksNodepoolFieldWithResponse call -func ParseResetSksNodepoolFieldResponse(rsp *http.Response) (*ResetSksNodepoolFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetSksNodepoolFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseEvictSksNodepoolMembersResponse parses an HTTP response from a EvictSksNodepoolMembersWithResponse call -func ParseEvictSksNodepoolMembersResponse(rsp *http.Response) (*EvictSksNodepoolMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &EvictSksNodepoolMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseScaleSksNodepoolResponse parses an HTTP response from a ScaleSksNodepoolWithResponse call -func ParseScaleSksNodepoolResponse(rsp *http.Response) (*ScaleSksNodepoolResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ScaleSksNodepoolResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRotateSksCcmCredentialsResponse parses an HTTP response from a RotateSksCcmCredentialsWithResponse call -func ParseRotateSksCcmCredentialsResponse(rsp *http.Response) (*RotateSksCcmCredentialsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RotateSksCcmCredentialsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRotateSksOperatorsCaResponse parses an HTTP response from a RotateSksOperatorsCaWithResponse call -func ParseRotateSksOperatorsCaResponse(rsp *http.Response) (*RotateSksOperatorsCaResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RotateSksOperatorsCaResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpgradeSksClusterResponse parses an HTTP response from a UpgradeSksClusterWithResponse call -func ParseUpgradeSksClusterResponse(rsp *http.Response) (*UpgradeSksClusterResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpgradeSksClusterResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpgradeSksClusterServiceLevelResponse parses an HTTP response from a UpgradeSksClusterServiceLevelWithResponse call -func ParseUpgradeSksClusterServiceLevelResponse(rsp *http.Response) (*UpgradeSksClusterServiceLevelResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpgradeSksClusterServiceLevelResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseResetSksClusterFieldResponse parses an HTTP response from a ResetSksClusterFieldWithResponse call -func ParseResetSksClusterFieldResponse(rsp *http.Response) (*ResetSksClusterFieldResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ResetSksClusterFieldResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSnapshotsResponse parses an HTTP response from a ListSnapshotsWithResponse call -func ParseListSnapshotsResponse(rsp *http.Response) (*ListSnapshotsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSnapshotsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Snapshots *[]Snapshot `json:"snapshots,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteSnapshotResponse parses an HTTP response from a DeleteSnapshotWithResponse call -func ParseDeleteSnapshotResponse(rsp *http.Response) (*DeleteSnapshotResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSnapshotResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSnapshotResponse parses an HTTP response from a GetSnapshotWithResponse call -func ParseGetSnapshotResponse(rsp *http.Response) (*GetSnapshotResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSnapshotResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Snapshot - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseExportSnapshotResponse parses an HTTP response from a ExportSnapshotWithResponse call -func ParseExportSnapshotResponse(rsp *http.Response) (*ExportSnapshotResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ExportSnapshotResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParsePromoteSnapshotToTemplateResponse parses an HTTP response from a PromoteSnapshotToTemplateWithResponse call -func ParsePromoteSnapshotToTemplateResponse(rsp *http.Response) (*PromoteSnapshotToTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &PromoteSnapshotToTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSosBucketsUsageResponse parses an HTTP response from a ListSosBucketsUsageWithResponse call -func ParseListSosBucketsUsageResponse(rsp *http.Response) (*ListSosBucketsUsageResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSosBucketsUsageResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - SosBucketsUsage *[]SosBucketUsage `json:"sos-buckets-usage,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSosPresignedUrlResponse parses an HTTP response from a GetSosPresignedUrlWithResponse call -func ParseGetSosPresignedUrlResponse(rsp *http.Response) (*GetSosPresignedUrlResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSosPresignedUrlResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Url *string `json:"url,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListSshKeysResponse parses an HTTP response from a ListSshKeysWithResponse call -func ParseListSshKeysResponse(rsp *http.Response) (*ListSshKeysResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListSshKeysResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - SshKeys *[]SshKey `json:"ssh-keys,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRegisterSshKeyResponse parses an HTTP response from a RegisterSshKeyWithResponse call -func ParseRegisterSshKeyResponse(rsp *http.Response) (*RegisterSshKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RegisterSshKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteSshKeyResponse parses an HTTP response from a DeleteSshKeyWithResponse call -func ParseDeleteSshKeyResponse(rsp *http.Response) (*DeleteSshKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteSshKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetSshKeyResponse parses an HTTP response from a GetSshKeyWithResponse call -func ParseGetSshKeyResponse(rsp *http.Response) (*GetSshKeyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetSshKeyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SshKey - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListTemplatesResponse parses an HTTP response from a ListTemplatesWithResponse call -func ParseListTemplatesResponse(rsp *http.Response) (*ListTemplatesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListTemplatesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Templates *[]Template `json:"templates,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseRegisterTemplateResponse parses an HTTP response from a RegisterTemplateWithResponse call -func ParseRegisterTemplateResponse(rsp *http.Response) (*RegisterTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &RegisterTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseDeleteTemplateResponse parses an HTTP response from a DeleteTemplateWithResponse call -func ParseDeleteTemplateResponse(rsp *http.Response) (*DeleteTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &DeleteTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseGetTemplateResponse parses an HTTP response from a GetTemplateWithResponse call -func ParseGetTemplateResponse(rsp *http.Response) (*GetTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &GetTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Template - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseCopyTemplateResponse parses an HTTP response from a CopyTemplateWithResponse call -func ParseCopyTemplateResponse(rsp *http.Response) (*CopyTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &CopyTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseUpdateTemplateResponse parses an HTTP response from a UpdateTemplateWithResponse call -func ParseUpdateTemplateResponse(rsp *http.Response) (*UpdateTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &UpdateTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Operation - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} - -// ParseListZonesResponse parses an HTTP response from a ListZonesWithResponse call -func ParseListZonesResponse(rsp *http.Response) (*ListZonesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer func() { _ = rsp.Body.Close() }() - if err != nil { - return nil, err - } - - response := &ListZonesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Zones *[]Zone `json:"zones,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - } - - return response, nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.go b/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.go deleted file mode 100644 index 535cb2c1..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi.go +++ /dev/null @@ -1,42 +0,0 @@ -// Package oapi is an internal package containing code generated from the -// Exoscale API OpenAPI specs, as well as helpers and transition types exposed -// in the public-facing package. -package oapi - -import "context" - -//go:generate oapi-codegen -generate types,client -package oapi -o oapi.gen.go source.json - -type oapiClient interface { - ClientWithResponsesInterface - - GetOperationWithResponse(context.Context, string, ...RequestEditorFn) (*GetOperationResponse, error) -} - -// OptionalString returns the dereferenced string value of v if not nil, otherwise an empty string. -func OptionalString(v *string) string { - if v != nil { - return *v - } - - return "" -} - -// OptionalInt64 returns the dereferenced int64 value of v if not nil, otherwise 0. -func OptionalInt64(v *int64) int64 { - if v != nil { - return *v - } - - return 0 -} - -// NilableString returns the input string pointer v if the dereferenced string is non-empty, otherwise nil. -// This helper is intended for use with OAPI types containing nilable string properties. -func NilableString(v *string) *string { - if v != nil && *v == "" { - return nil - } - - return v -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi_mock.go b/vendor/github.com/exoscale/egoscale/v2/oapi/oapi_mock.go deleted file mode 100644 index ffbb8ce8..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/oapi_mock.go +++ /dev/null @@ -1,21 +0,0 @@ -package oapi - -import ( - "context" - - "github.com/stretchr/testify/mock" -) - -type oapiClientMock struct { - ClientWithResponsesInterface - mock.Mock -} - -func (m *oapiClientMock) GetOperationWithResponse( - ctx context.Context, - id string, - reqEditors ...RequestEditorFn, -) (*GetOperationResponse, error) { - args := m.Called(ctx, id, reqEditors) - return args.Get(0).(*GetOperationResponse), args.Error(1) -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/reference.go b/vendor/github.com/exoscale/egoscale/v2/oapi/reference.go deleted file mode 100644 index aca6e5e9..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/reference.go +++ /dev/null @@ -1,18 +0,0 @@ -package oapi - -// NewReference creates an oapi reference (inlined type) -func NewReference(command, id, link *string) *struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` -} { - return &struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }{ - Id: id, - Command: command, - Link: link, - } -} diff --git a/vendor/github.com/exoscale/egoscale/v2/oapi/request.go b/vendor/github.com/exoscale/egoscale/v2/oapi/request.go deleted file mode 100644 index 79f89868..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/oapi/request.go +++ /dev/null @@ -1,20 +0,0 @@ -package oapi - -import ( - "context" - "net/http" -) - -// MultiRequestsEditor is an oapi-codegen compatible RequestEditorFn function that executes multiple -// RequestEditorFn functions sequentially. -func MultiRequestsEditor(fns ...RequestEditorFn) RequestEditorFn { - return func(ctx context.Context, req *http.Request) error { - for _, fn := range fns { - if err := fn(ctx, req); err != nil { - return err - } - } - - return nil - } -} diff --git a/vendor/github.com/exoscale/egoscale/v2/private_network.go b/vendor/github.com/exoscale/egoscale/v2/private_network.go deleted file mode 100644 index d14215cf..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/private_network.go +++ /dev/null @@ -1,313 +0,0 @@ -package v2 - -import ( - "context" - "net" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// PrivateNetworkLease represents a managed Private Network lease. -type PrivateNetworkLease struct { - InstanceID *string - IPAddress *net.IP -} - -// PrivateNetwork represents a Private Network. -type PrivateNetwork struct { - Description *string - EndIP *net.IP - ID *string `req-for:"update,delete"` - Labels *map[string]string - Name *string `req-for:"create"` - Netmask *net.IP - StartIP *net.IP - Leases []*PrivateNetworkLease - Zone *string -} - -func privateNetworkFromAPI(p *oapi.PrivateNetwork, zone string) *PrivateNetwork { - return &PrivateNetwork{ - Description: p.Description, - EndIP: func() (v *net.IP) { - if p.EndIp != nil { - ip := net.ParseIP(*p.EndIp) - v = &ip - } - return - }(), - ID: p.Id, - Labels: func() (v *map[string]string) { - if p.Labels != nil && len(p.Labels.AdditionalProperties) > 0 { - v = &p.Labels.AdditionalProperties - } - return - }(), - Name: p.Name, - Netmask: func() (v *net.IP) { - if p.Netmask != nil { - ip := net.ParseIP(*p.Netmask) - v = &ip - } - return - }(), - StartIP: func() (v *net.IP) { - if p.StartIp != nil { - ip := net.ParseIP(*p.StartIp) - v = &ip - } - return - }(), - Leases: func() (v []*PrivateNetworkLease) { - if p.Leases != nil { - v = make([]*PrivateNetworkLease, len(*p.Leases)) - for i, lease := range *p.Leases { - v[i] = &PrivateNetworkLease{ - InstanceID: lease.InstanceId, - IPAddress: func() *net.IP { ip := net.ParseIP(*lease.Ip); return &ip }(), - } - } - } - return - }(), - Zone: &zone, - } -} - -// CreatePrivateNetwork creates a Private Network. -func (c *Client) CreatePrivateNetwork( - ctx context.Context, - zone string, - privateNetwork *PrivateNetwork, -) (*PrivateNetwork, error) { - if err := validateOperationParams(privateNetwork, "create"); err != nil { - return nil, err - } - - resp, err := c.CreatePrivateNetworkWithResponse( - apiv2.WithZone(ctx, zone), - oapi.CreatePrivateNetworkJSONRequestBody{ - Description: privateNetwork.Description, - EndIp: func() (ip *string) { - if privateNetwork.EndIP != nil { - v := privateNetwork.EndIP.String() - return &v - } - return - }(), - Labels: func() (v *oapi.Labels) { - if privateNetwork.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *privateNetwork.Labels} - } - return - }(), - Name: *privateNetwork.Name, - Netmask: func() (ip *string) { - if privateNetwork.Netmask != nil { - v := privateNetwork.Netmask.String() - return &v - } - return - }(), - StartIp: func() (ip *string) { - if privateNetwork.StartIP != nil { - v := privateNetwork.StartIP.String() - return &v - } - return - }(), - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetPrivateNetwork(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeletePrivateNetwork deletes a Private Network. -func (c *Client) DeletePrivateNetwork(ctx context.Context, zone string, privateNetwork *PrivateNetwork) error { - if err := validateOperationParams(privateNetwork, "delete"); err != nil { - return err - } - - resp, err := c.DeletePrivateNetworkWithResponse(apiv2.WithZone(ctx, zone), *privateNetwork.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindPrivateNetwork attempts to find a Private Network by name or ID. -// In case the identifier is a name and multiple resources match, an ErrTooManyFound error is returned. -func (c *Client) FindPrivateNetwork(ctx context.Context, zone, x string) (*PrivateNetwork, error) { - res, err := c.ListPrivateNetworks(ctx, zone) - if err != nil { - return nil, err - } - - var found *PrivateNetwork - for _, r := range res { - if *r.ID == x { - return c.GetPrivateNetwork(ctx, zone, *r.ID) - } - - // Historically, the Exoscale API allowed users to create multiple Private Networks sharing a common name. - // This function being expected to return one resource at most, in case the specified identifier is a name - // we have to check that there aren't more that one matching result before returning it. - if *r.Name == x { - if found != nil { - return nil, apiv2.ErrTooManyFound - } - found = r - } - } - - if found != nil { - return c.GetPrivateNetwork(ctx, zone, *found.ID) - } - - return nil, apiv2.ErrNotFound -} - -// GetPrivateNetwork returns the Private Network corresponding to the specified ID. -func (c *Client) GetPrivateNetwork(ctx context.Context, zone, id string) (*PrivateNetwork, error) { - resp, err := c.GetPrivateNetworkWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return privateNetworkFromAPI(resp.JSON200, zone), nil -} - -// ListPrivateNetworks returns the list of existing Private Networks. -func (c *Client) ListPrivateNetworks(ctx context.Context, zone string) ([]*PrivateNetwork, error) { - list := make([]*PrivateNetwork, 0) - - resp, err := c.ListPrivateNetworksWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.PrivateNetworks != nil { - for i := range *resp.JSON200.PrivateNetworks { - list = append(list, privateNetworkFromAPI(&(*resp.JSON200.PrivateNetworks)[i], zone)) - } - } - - return list, nil -} - -// UpdatePrivateNetwork updates a Private Network. -func (c *Client) UpdatePrivateNetwork(ctx context.Context, zone string, privateNetwork *PrivateNetwork) error { - if err := validateOperationParams(privateNetwork, "update"); err != nil { - return err - } - - resp, err := c.UpdatePrivateNetworkWithResponse( - apiv2.WithZone(ctx, zone), - *privateNetwork.ID, - oapi.UpdatePrivateNetworkJSONRequestBody{ - Description: oapi.NilableString(privateNetwork.Description), - EndIp: func() (ip *string) { - if privateNetwork.EndIP != nil { - v := privateNetwork.EndIP.String() - return &v - } - return - }(), - Labels: func() (v *oapi.Labels) { - if privateNetwork.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *privateNetwork.Labels} - } - return - }(), - Name: privateNetwork.Name, - Netmask: func() (ip *string) { - if privateNetwork.Netmask != nil { - v := privateNetwork.Netmask.String() - return &v - } - return - }(), - StartIp: func() (ip *string) { - if privateNetwork.StartIP != nil { - v := privateNetwork.StartIP.String() - return &v - } - return - }(), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdatePrivateNetworkInstanceIPAddress updates the IP address of a Compute instance attached to a managed -// Private Network. -func (c *Client) UpdatePrivateNetworkInstanceIPAddress( - ctx context.Context, - zone string, - instance *Instance, - privateNetwork *PrivateNetwork, - ip net.IP, -) error { - if err := validateOperationParams(instance, "update"); err != nil { - return err - } - if err := validateOperationParams(privateNetwork, "update"); err != nil { - return err - } - - resp, err := c.UpdatePrivateNetworkInstanceIpWithResponse( - apiv2.WithZone(ctx, zone), - *privateNetwork.ID, - oapi.UpdatePrivateNetworkInstanceIpJSONRequestBody{ - Instance: oapi.Instance{Id: instance.ID}, - Ip: func() *string { - s := ip.String() - return &s - }(), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - - return err -} diff --git a/vendor/github.com/exoscale/egoscale/v2/quota.go b/vendor/github.com/exoscale/egoscale/v2/quota.go deleted file mode 100644 index 98497e2d..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/quota.go +++ /dev/null @@ -1,51 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// Quota represents an Exoscale organization quota. -type Quota struct { - Resource *string - Usage *int64 - Limit *int64 -} - -func quotaFromAPI(q *oapi.Quota) *Quota { - return &Quota{ - Resource: q.Resource, - Usage: q.Usage, - Limit: q.Limit, - } -} - -// ListQuotas returns the list of Exoscale organization quotas. -func (c *Client) ListQuotas(ctx context.Context, zone string) ([]*Quota, error) { - list := make([]*Quota, 0) - - resp, err := c.ListQuotasWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.Quotas != nil { - for i := range *resp.JSON200.Quotas { - list = append(list, quotaFromAPI(&(*resp.JSON200.Quotas)[i])) - } - } - - return list, nil -} - -// GetQuota returns the current Exoscale organization quota for the specified resource. -func (c *Client) GetQuota(ctx context.Context, zone, resource string) (*Quota, error) { - resp, err := c.GetQuotaWithResponse(apiv2.WithZone(ctx, zone), resource) - if err != nil { - return nil, err - } - - return quotaFromAPI(resp.JSON200), nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/security_group.go b/vendor/github.com/exoscale/egoscale/v2/security_group.go deleted file mode 100644 index 419980ce..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/security_group.go +++ /dev/null @@ -1,220 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SecurityGroup represents a Security Group. -type SecurityGroup struct { - Description *string - ID *string `req-for:"update,delete"` - Name *string `req-for:"create"` - ExternalSources *[]string - Rules []*SecurityGroupRule -} - -func securityGroupFromAPI(s *oapi.SecurityGroup) *SecurityGroup { - return &SecurityGroup{ - Description: s.Description, - ID: s.Id, - Name: s.Name, - ExternalSources: s.ExternalSources, - Rules: func() (rules []*SecurityGroupRule) { - if s.Rules != nil { - rules = make([]*SecurityGroupRule, 0) - for _, rule := range *s.Rules { - rule := rule - rules = append(rules, securityGroupRuleFromAPI(&rule)) - } - } - return rules - }(), - } -} - -// AddExternalSourceToSecurityGroup adds a new external source to a -// Security Group. This operation is idempotent. -func (c *Client) AddExternalSourceToSecurityGroup( - ctx context.Context, - zone string, - securityGroup *SecurityGroup, - cidr string, -) error { - if err := validateOperationParams(securityGroup, "update"); err != nil { - return err - } - - resp, err := c.AddExternalSourceToSecurityGroupWithResponse( - apiv2.WithZone(ctx, zone), - *securityGroup.ID, - oapi.AddExternalSourceToSecurityGroupJSONRequestBody{ - Cidr: cidr, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// CreateSecurityGroup creates a Security Group. -func (c *Client) CreateSecurityGroup( - ctx context.Context, - zone string, - securityGroup *SecurityGroup, -) (*SecurityGroup, error) { - if err := validateOperationParams(securityGroup, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateSecurityGroupWithResponse(ctx, oapi.CreateSecurityGroupJSONRequestBody{ - Description: securityGroup.Description, - Name: *securityGroup.Name, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetSecurityGroup(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteSecurityGroup deletes a Security Group. -func (c *Client) DeleteSecurityGroup(ctx context.Context, zone string, securityGroup *SecurityGroup) error { - if err := validateOperationParams(securityGroup, "delete"); err != nil { - return err - } - - resp, err := c.DeleteSecurityGroupWithResponse(apiv2.WithZone(ctx, zone), *securityGroup.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindSecurityGroup attempts to find a Security Group by name or ID. -func (c *Client) FindSecurityGroup(ctx context.Context, zone, x string) (*SecurityGroup, error) { - res, err := c.ListSecurityGroups(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetSecurityGroup(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetSecurityGroup returns the Security Group corresponding to the specified ID. -func (c *Client) GetSecurityGroup(ctx context.Context, zone, id string) (*SecurityGroup, error) { - resp, err := c.GetSecurityGroupWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return securityGroupFromAPI(resp.JSON200), nil -} - -// ListSecurityGroups returns the list of existing Security Groups. -func (c *Client) ListSecurityGroups(ctx context.Context, zone string) ([]*SecurityGroup, error) { - list := make([]*SecurityGroup, 0) - - resp, err := c.ListSecurityGroupsWithResponse(apiv2.WithZone(ctx, zone), &oapi.ListSecurityGroupsParams{}) - if err != nil { - return nil, err - } - - if resp.JSON200.SecurityGroups != nil { - for i := range *resp.JSON200.SecurityGroups { - list = append(list, securityGroupFromAPI(&(*resp.JSON200.SecurityGroups)[i])) - } - } - - return list, nil -} - -// FindSecurityGroups returns the list of existing Security Groups. -// The `params` allows specifying standard filters. -func (c *Client) FindSecurityGroups(ctx context.Context, zone string, params *oapi.ListSecurityGroupsParams) ([]*SecurityGroup, error) { - list := make([]*SecurityGroup, 0) - - resp, err := c.ListSecurityGroupsWithResponse(apiv2.WithZone(ctx, zone), params) - if err != nil { - return nil, err - } - - if resp.JSON200.SecurityGroups != nil { - for i := range *resp.JSON200.SecurityGroups { - list = append(list, securityGroupFromAPI(&(*resp.JSON200.SecurityGroups)[i])) - } - } - - return list, nil -} - -// RemoveExternalSourceFromSecurityGroup removes an external source from -// a Security Group. This operation is idempotent. -func (c *Client) RemoveExternalSourceFromSecurityGroup( - ctx context.Context, - zone string, - securityGroup *SecurityGroup, - cidr string, -) error { - if err := validateOperationParams(securityGroup, "update"); err != nil { - return err - } - - resp, err := c.RemoveExternalSourceFromSecurityGroupWithResponse( - apiv2.WithZone(ctx, zone), - *securityGroup.ID, - oapi.RemoveExternalSourceFromSecurityGroupJSONRequestBody{ - Cidr: cidr, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/security_group_rule.go b/vendor/github.com/exoscale/egoscale/v2/security_group_rule.go deleted file mode 100644 index 2c761379..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/security_group_rule.go +++ /dev/null @@ -1,268 +0,0 @@ -package v2 - -import ( - "context" - "errors" - "net" - "strings" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SecurityGroupRule represents a Security Group rule. -type SecurityGroupRule struct { - Description *string - EndPort *uint16 - FlowDirection *string `req-for:"create"` - ICMPCode *int64 - ICMPType *int64 - ID *string `req-for:"delete"` - Network *net.IPNet - Protocol *string `req-for:"create"` - SecurityGroupID *string - SecurityGroupName *string - Visibility *string - StartPort *uint16 -} - -func securityGroupRuleFromAPI(r *oapi.SecurityGroupRule) *SecurityGroupRule { - return &SecurityGroupRule{ - Description: r.Description, - EndPort: func() (v *uint16) { - if r.EndPort != nil { - port := uint16(*r.EndPort) - v = &port - } - return - }(), - FlowDirection: (*string)(r.FlowDirection), - ICMPCode: func() (v *int64) { - if r.Icmp != nil { - v = r.Icmp.Code - } - return - }(), - ICMPType: func() (v *int64) { - if r.Icmp != nil { - v = r.Icmp.Type - } - return - }(), - ID: r.Id, - Network: func() (v *net.IPNet) { - if r.Network != nil { - _, v, _ = net.ParseCIDR(*r.Network) - } - return - }(), - Protocol: (*string)(r.Protocol), - SecurityGroupID: func() (v *string) { - if r.SecurityGroup != nil && - (r.SecurityGroup.Visibility == nil || - *r.SecurityGroup.Visibility != "public") { - v = r.SecurityGroup.Id - } - return - }(), - SecurityGroupName: func() (v *string) { - if r.SecurityGroup != nil && r.SecurityGroup.Visibility != nil && - *r.SecurityGroup.Visibility == "public" && r.SecurityGroup.Name != nil { - v = r.SecurityGroup.Name - } - return - }(), - StartPort: func() (v *uint16) { - if r.StartPort != nil { - port := uint16(*r.StartPort) - v = &port - } - return - }(), - Visibility: func() (v *string) { - if r.SecurityGroup != nil && r.SecurityGroup.Visibility != nil { - v = (*string)(r.SecurityGroup.Visibility) - } - return - }(), - } -} - -// CreateSecurityGroupRule creates a Security Group rule. -func (c *Client) CreateSecurityGroupRule( - ctx context.Context, - zone string, - securityGroup *SecurityGroup, - rule *SecurityGroupRule, -) (*SecurityGroupRule, error) { - if err := validateOperationParams(securityGroup, "update"); err != nil { - return nil, err - } - if err := validateOperationParams(rule, "create"); err != nil { - return nil, err - } - - var icmp *struct { - Code *int64 `json:"code,omitempty"` - Type *int64 `json:"type,omitempty"` - } - - if strings.HasPrefix(*rule.Protocol, "icmp") { - icmp = &struct { - Code *int64 `json:"code,omitempty"` - Type *int64 `json:"type,omitempty"` - }{ - Code: rule.ICMPCode, - Type: rule.ICMPType, - } - } - - // The API doesn't return the Security Group rule created directly, so in order to - // return a *SecurityGroupRule corresponding to the new rule we have to manually - // compare the list of rules in the SG before and after the rule creation, and - // identify the rule that wasn't there before. - // Note: in case of multiple rules creation in parallel this technique is subject - // to race condition as we could return an unrelated rule. To prevent this, we - // also compare the properties of the new rule to the ones specified in the input - // rule parameter. - sgCurrent, err := c.GetSecurityGroup(ctx, zone, *securityGroup.ID) - if err != nil { - return nil, err - } - - currentRules := make(map[string]struct{}) - for _, r := range sgCurrent.Rules { - currentRules[*r.ID] = struct{}{} - } - - resp, err := c.AddRuleToSecurityGroupWithResponse( - apiv2.WithZone(ctx, zone), - *securityGroup.ID, - oapi.AddRuleToSecurityGroupJSONRequestBody{ - Description: rule.Description, - EndPort: func() (v *int64) { - if rule.EndPort != nil { - port := int64(*rule.EndPort) - v = &port - } - return - }(), - FlowDirection: oapi.AddRuleToSecurityGroupJSONBodyFlowDirection(*rule.FlowDirection), - Icmp: icmp, - Network: func() (v *string) { - if rule.Network != nil { - ip := rule.Network.String() - v = &ip - } - return - }(), - Protocol: oapi.AddRuleToSecurityGroupJSONBodyProtocol(*rule.Protocol), - SecurityGroup: func() (v *oapi.SecurityGroupResource) { - if rule.SecurityGroupID != nil { - v = &oapi.SecurityGroupResource{Id: rule.SecurityGroupID} - } - if rule.SecurityGroupName != nil { - visibility := oapi.SecurityGroupResourceVisibilityPublic - v = &oapi.SecurityGroupResource{Name: rule.SecurityGroupName, Visibility: &visibility} - } - return - }(), - StartPort: func() (v *int64) { - if rule.StartPort != nil { - port := int64(*rule.StartPort) - v = &port - } - return - }(), - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - sgUpdated, err := c.GetSecurityGroup(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) - if err != nil { - return nil, err - } - - // Look for an unknown rule which properties match the one we've just created. - for _, r := range sgUpdated.Rules { - if _, ok := currentRules[*r.ID]; !ok { - if *r.FlowDirection == *rule.FlowDirection && *r.Protocol == *rule.Protocol { - if rule.Description != nil && r.Description != nil && *r.Description != *rule.Description { - continue - } - - if rule.StartPort != nil && r.StartPort != nil && *r.StartPort != *rule.StartPort { - continue - } - - if rule.EndPort != nil && r.EndPort != nil && *r.EndPort != *rule.EndPort { - continue - } - - if rule.Network != nil && r.Network != nil && r.Network.String() != rule.Network.String() { - continue - } - - if rule.SecurityGroupID != nil && r.SecurityGroupID != nil && - *r.SecurityGroupID != *rule.SecurityGroupID { - continue - } - - if rule.ICMPType != nil && r.ICMPType != nil && *r.ICMPType != *rule.ICMPType { - continue - } - - if rule.ICMPCode != nil && r.ICMPCode != nil && *r.ICMPCode != *rule.ICMPCode { - continue - } - - return r, nil - } - } - } - - return nil, errors.New("unable to identify the rule created") -} - -// DeleteSecurityGroupRule deletes a Security Group rule. -func (c *Client) DeleteSecurityGroupRule( - ctx context.Context, - zone string, - securityGroup *SecurityGroup, - rule *SecurityGroupRule, -) error { - if err := validateOperationParams(securityGroup, "update"); err != nil { - return err - } - if err := validateOperationParams(rule, "delete"); err != nil { - return err - } - - resp, err := c.DeleteRuleFromSecurityGroupWithResponse(apiv2.WithZone(ctx, zone), *securityGroup.ID, *rule.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/sks_cluster.go b/vendor/github.com/exoscale/egoscale/v2/sks_cluster.go deleted file mode 100644 index 8f7253f4..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/sks_cluster.go +++ /dev/null @@ -1,500 +0,0 @@ -package v2 - -import ( - "context" - "errors" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SKSClusterOIDCConfig represents an SKS cluster OpenID Connect configuration. -type SKSClusterOIDCConfig struct { - ClientID *string `req-for:"create"` - GroupsClaim *string - GroupsPrefix *string - IssuerURL *string `req-for:"create"` - RequiredClaim *map[string]string - UsernameClaim *string - UsernamePrefix *string -} - -// CreateSKSClusterOpt represents a CreateSKSCluster operation option. -type CreateSKSClusterOpt func(body *oapi.CreateSksClusterJSONRequestBody) error - -// CreateSKSClusterWithOIDC sets the OpenID Connect configuration to provide to the Kubernetes API Server. -func CreateSKSClusterWithOIDC(v *SKSClusterOIDCConfig) CreateSKSClusterOpt { - return func(b *oapi.CreateSksClusterJSONRequestBody) error { - if err := validateOperationParams(v, "create"); err != nil { - return err - } - - if v != nil { - b.Oidc = &oapi.SksOidc{ - ClientId: *v.ClientID, - GroupsClaim: v.GroupsClaim, - GroupsPrefix: v.GroupsPrefix, - IssuerUrl: *v.IssuerURL, - RequiredClaim: func() *oapi.SksOidc_RequiredClaim { - if v.RequiredClaim != nil { - return &oapi.SksOidc_RequiredClaim{AdditionalProperties: *v.RequiredClaim} - } - return nil - }(), - UsernameClaim: v.UsernameClaim, - UsernamePrefix: v.UsernamePrefix, - } - } - - return nil - } -} - -// ListSKSClusterVersionsOpt represents a ListSKSClusterVersions operation option. -type ListSKSClusterVersionsOpt func(params *oapi.ListSksClusterVersionsParams) - -// ListSKSClusterVersionsWithDeprecated includes deprecated results when listing SKS Cluster versions -// nolint:gocritic -func ListSKSClusterVersionsWithDeprecated(v bool) ListSKSClusterVersionsOpt { - return func(p *oapi.ListSksClusterVersionsParams) { - if v { - vs := "true" - p.IncludeDeprecated = &vs - } - } -} - -// SKSCluster represents an SKS cluster. -type SKSCluster struct { - AddOns *[]string - AutoUpgrade *bool - CNI *string - CreatedAt *time.Time - Description *string - Endpoint *string - ID *string `req-for:"update,delete"` - Labels *map[string]string - Name *string `req-for:"create"` - Nodepools []*SKSNodepool - ServiceLevel *string `req-for:"create"` - State *string - Version *string `req-for:"create"` - Zone *string -} - -func sksClusterFromAPI(c *oapi.SksCluster, zone string) *SKSCluster { - return &SKSCluster{ - AddOns: func() (v *[]string) { - if c.Addons != nil { - addOns := make([]string, 0) - for _, a := range *c.Addons { - addOns = append(addOns, string(a)) - } - v = &addOns - } - return - }(), - AutoUpgrade: c.AutoUpgrade, - CNI: (*string)(c.Cni), - CreatedAt: c.CreatedAt, - Description: c.Description, - Endpoint: c.Endpoint, - ID: c.Id, - Labels: func() (v *map[string]string) { - if c.Labels != nil && len(c.Labels.AdditionalProperties) > 0 { - v = &c.Labels.AdditionalProperties - } - return - }(), - Name: c.Name, - Nodepools: func() []*SKSNodepool { - nodepools := make([]*SKSNodepool, 0) - if c.Nodepools != nil { - for _, n := range *c.Nodepools { - n := n - nodepools = append(nodepools, sksNodepoolFromAPI(&n)) - } - } - return nodepools - }(), - ServiceLevel: (*string)(c.Level), - State: (*string)(c.State), - Version: c.Version, - Zone: &zone, - } -} - -// CreateSKSCluster creates an SKS cluster. -func (c *Client) CreateSKSCluster( - ctx context.Context, - zone string, - cluster *SKSCluster, - opts ...CreateSKSClusterOpt, -) (*SKSCluster, error) { - if err := validateOperationParams(cluster, "create"); err != nil { - return nil, err - } - - body := oapi.CreateSksClusterJSONRequestBody{ - Addons: func() (v *[]oapi.CreateSksClusterJSONBodyAddons) { - if cluster.AddOns != nil { - addOns := make([]oapi.CreateSksClusterJSONBodyAddons, len(*cluster.AddOns)) - for i, a := range *cluster.AddOns { - addOns[i] = oapi.CreateSksClusterJSONBodyAddons(a) - } - v = &addOns - } - return - }(), - AutoUpgrade: cluster.AutoUpgrade, - Cni: (*oapi.CreateSksClusterJSONBodyCni)(cluster.CNI), - Description: cluster.Description, - Labels: func() (v *oapi.Labels) { - if cluster.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *cluster.Labels} - } - return - }(), - Level: oapi.CreateSksClusterJSONBodyLevel(*cluster.ServiceLevel), - Name: *cluster.Name, - Version: *cluster.Version, - } - - for _, opt := range opts { - if err := opt(&body); err != nil { - return nil, err - } - } - - resp, err := c.CreateSksClusterWithResponse(apiv2.WithZone(ctx, zone), body) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetSKSCluster(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteSKSCluster deletes an SKS cluster. -func (c *Client) DeleteSKSCluster(ctx context.Context, zone string, cluster *SKSCluster) error { - if err := validateOperationParams(cluster, "delete"); err != nil { - return err - } - - resp, err := c.DeleteSksClusterWithResponse(apiv2.WithZone(ctx, zone), *cluster.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// FindSKSCluster attempts to find an SKS cluster by name or ID. -func (c *Client) FindSKSCluster(ctx context.Context, zone, x string) (*SKSCluster, error) { - res, err := c.ListSKSClusters(ctx, zone) - if err != nil { - return nil, err - } - - for _, r := range res { - if *r.ID == x || *r.Name == x { - return c.GetSKSCluster(ctx, zone, *r.ID) - } - } - - return nil, apiv2.ErrNotFound -} - -// GetSKSCluster returns the SKS cluster corresponding to the specified ID. -func (c *Client) GetSKSCluster(ctx context.Context, zone, id string) (*SKSCluster, error) { - resp, err := c.GetSksClusterWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return sksClusterFromAPI(resp.JSON200, zone), nil -} - -// GetSKSClusterAuthorityCert returns the SKS cluster base64-encoded certificate content for the specified authority. -func (c *Client) GetSKSClusterAuthorityCert( - ctx context.Context, - zone string, - cluster *SKSCluster, - authority string, -) (string, error) { - if err := validateOperationParams(cluster, "update"); err != nil { - return "", err - } - - if authority == "" { - return "", errors.New("authority not specified") - } - - resp, err := c.GetSksClusterAuthorityCertWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - oapi.GetSksClusterAuthorityCertParamsAuthority(authority), - ) - if err != nil { - return "", err - } - - return oapi.OptionalString(resp.JSON200.Cacert), nil -} - -// SKSClusterDeprecatedResource represents an resources deployed in a cluster -// that will be removed in a future release of Kubernetes. -type SKSClusterDeprecatedResource struct { - Group *string - RemovedRelease *string - Resource *string - SubResource *string - Version *string - RawProperties map[string]string -} - -func sksClusterDeprecatedResourcesFromAPI(c *oapi.SksClusterDeprecatedResource, zone string) *SKSClusterDeprecatedResource { - return &SKSClusterDeprecatedResource{ - Group: (*string)(mapValueOrNil(c.AdditionalProperties, "group")), - RemovedRelease: (*string)(mapValueOrNil(c.AdditionalProperties, "removed_release")), - Resource: (*string)(mapValueOrNil(c.AdditionalProperties, "resource")), - SubResource: (*string)(mapValueOrNil(c.AdditionalProperties, "subresource")), - Version: (*string)(mapValueOrNil(c.AdditionalProperties, "version")), - RawProperties: c.AdditionalProperties, - } -} - -func (c *Client) ListSKSClusterDeprecatedResources( - ctx context.Context, - zone string, - cluster *SKSCluster, -) ([]*SKSClusterDeprecatedResource, error) { - if err := validateOperationParams(cluster, "update"); err != nil { - return nil, err - } - - resp, err := c.ListSksClusterDeprecatedResourcesWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - ) - if err != nil { - return nil, err - } - - var list []*SKSClusterDeprecatedResource - if resp.JSON200 != nil && len(*resp.JSON200) > 0 { - for i := range *resp.JSON200 { - list = append(list, sksClusterDeprecatedResourcesFromAPI(&(*resp.JSON200)[i], zone)) - } - } - - return list, nil -} - -// GetSKSClusterKubeconfig returns a base64-encoded kubeconfig content for the specified user name, optionally -// associated to specified groups for a duration d (default API-set TTL applies if not specified). -// Fore more information: https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/ -func (c *Client) GetSKSClusterKubeconfig( - ctx context.Context, - zone string, - cluster *SKSCluster, - user string, - groups []string, - d time.Duration, -) (string, error) { - if err := validateOperationParams(cluster, "update"); err != nil { - return "", err - } - - if user == "" { - return "", errors.New("user not specified") - } - - resp, err := c.GenerateSksClusterKubeconfigWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - oapi.GenerateSksClusterKubeconfigJSONRequestBody{ - User: &user, - Groups: &groups, - Ttl: func() *int64 { - ttl := int64(d.Seconds()) - if ttl > 0 { - return &ttl - } - return nil - }(), - }) - if err != nil { - return "", err - } - - return oapi.OptionalString(resp.JSON200.Kubeconfig), nil -} - -// ListSKSClusters returns the list of existing SKS clusters. -func (c *Client) ListSKSClusters(ctx context.Context, zone string) ([]*SKSCluster, error) { - list := make([]*SKSCluster, 0) - - resp, err := c.ListSksClustersWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.SksClusters != nil { - for i := range *resp.JSON200.SksClusters { - list = append(list, sksClusterFromAPI(&(*resp.JSON200.SksClusters)[i], zone)) - } - } - - return list, nil -} - -// ListSKSClusterVersions returns the list of Kubernetes versions supported during SKS cluster creation. -func (c *Client) ListSKSClusterVersions(ctx context.Context, opts ...ListSKSClusterVersionsOpt) ([]string, error) { - list := make([]string, 0) - - params := oapi.ListSksClusterVersionsParams{} - - for _, opt := range opts { - opt(¶ms) - } - - resp, err := c.ListSksClusterVersionsWithResponse(ctx, ¶ms) - if err != nil { - return nil, err - } - - if resp.JSON200.SksClusterVersions != nil { - for i := range *resp.JSON200.SksClusterVersions { - version := &(*resp.JSON200.SksClusterVersions)[i] - list = append(list, *version) - } - } - - return list, nil -} - -// RotateSKSClusterCCMCredentials rotates the Exoscale IAM credentials managed by the SKS control plane for the -// Kubernetes Exoscale Cloud Controller Manager. -func (c *Client) RotateSKSClusterCCMCredentials(ctx context.Context, zone string, cluster *SKSCluster) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - - resp, err := c.RotateSksCcmCredentialsWithResponse(apiv2.WithZone(ctx, zone), *cluster.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateSKSCluster updates an SKS cluster. -func (c *Client) UpdateSKSCluster(ctx context.Context, zone string, cluster *SKSCluster) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - - resp, err := c.UpdateSksClusterWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - oapi.UpdateSksClusterJSONRequestBody{ - AutoUpgrade: cluster.AutoUpgrade, - Description: oapi.NilableString(cluster.Description), - Labels: func() (v *oapi.Labels) { - if cluster.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *cluster.Labels} - } - return - }(), - Name: cluster.Name, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpgradeSKSCluster upgrades an SKS cluster to the requested Kubernetes version. -func (c *Client) UpgradeSKSCluster(ctx context.Context, zone string, cluster *SKSCluster, version string) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - - resp, err := c.UpgradeSksClusterWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - oapi.UpgradeSksClusterJSONRequestBody{Version: version}) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpgradeSKSClusterServiceLevel upgrades an SKS cluster to service level "pro". -func (c *Client) UpgradeSKSClusterServiceLevel(ctx context.Context, zone string, cluster *SKSCluster) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - - resp, err := c.UpgradeSksClusterServiceLevelWithResponse(apiv2.WithZone(ctx, zone), *cluster.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/sks_nodepool.go b/vendor/github.com/exoscale/egoscale/v2/sks_nodepool.go deleted file mode 100644 index fc5f8357..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/sks_nodepool.go +++ /dev/null @@ -1,446 +0,0 @@ -package v2 - -import ( - "context" - "fmt" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SKSNodepoolTaint represents an SKS Nodepool Kubernetes Node taint. -type SKSNodepoolTaint struct { - Effect string - Value string -} - -func sksNodepoolTaintFromAPI(t *oapi.SksNodepoolTaint) *SKSNodepoolTaint { - return &SKSNodepoolTaint{ - Effect: string(t.Effect), - Value: t.Value, - } -} - -// SKSNodepool represents an SKS Nodepool. -type SKSNodepool struct { - AddOns *[]string - AntiAffinityGroupIDs *[]string - CreatedAt *time.Time - DeployTargetID *string - Description *string - DiskSize *int64 `req-for:"create"` - ID *string `req-for:"update,delete"` - InstancePoolID *string - InstancePrefix *string - InstanceTypeID *string `req-for:"create"` - Labels *map[string]string - Name *string `req-for:"create"` - PrivateNetworkIDs *[]string - SecurityGroupIDs *[]string - Size *int64 `req-for:"create"` - State *string - Taints *map[string]*SKSNodepoolTaint - TemplateID *string - Version *string -} - -func sksNodepoolFromAPI(n *oapi.SksNodepool) *SKSNodepool { - return &SKSNodepool{ - AddOns: func() (v *[]string) { - if n.Addons != nil { - addOns := make([]string, 0) - for _, a := range *n.Addons { - addOns = append(addOns, string(a)) - } - v = &addOns - } - return - }(), - AntiAffinityGroupIDs: func() (v *[]string) { - if n.AntiAffinityGroups != nil && len(*n.AntiAffinityGroups) > 0 { - ids := make([]string, 0) - for _, item := range *n.AntiAffinityGroups { - item := item - ids = append(ids, *item.Id) - } - v = &ids - } - return - }(), - CreatedAt: n.CreatedAt, - DeployTargetID: func() (v *string) { - if n.DeployTarget != nil { - v = &n.DeployTarget.Id - } - return - }(), - Description: n.Description, - DiskSize: n.DiskSize, - ID: n.Id, - InstancePoolID: n.InstancePool.Id, - InstancePrefix: n.InstancePrefix, - InstanceTypeID: n.InstanceType.Id, - Labels: func() (v *map[string]string) { - if n.Labels != nil && len(n.Labels.AdditionalProperties) > 0 { - v = &n.Labels.AdditionalProperties - } - return - }(), - Name: n.Name, - PrivateNetworkIDs: func() (v *[]string) { - if n.PrivateNetworks != nil && len(*n.PrivateNetworks) > 0 { - ids := make([]string, 0) - for _, item := range *n.PrivateNetworks { - item := item - ids = append(ids, *item.Id) - } - v = &ids - } - return - }(), - SecurityGroupIDs: func() (v *[]string) { - if n.SecurityGroups != nil && len(*n.SecurityGroups) > 0 { - ids := make([]string, 0) - for _, item := range *n.SecurityGroups { - item := item - ids = append(ids, *item.Id) - } - v = &ids - } - return - }(), - Size: n.Size, - State: (*string)(n.State), - Taints: func() (v *map[string]*SKSNodepoolTaint) { - if n.Taints != nil && len(n.Taints.AdditionalProperties) > 0 { - taints := make(map[string]*SKSNodepoolTaint) - for k, t := range n.Taints.AdditionalProperties { - taints[k] = sksNodepoolTaintFromAPI(&t) - } - v = &taints - } - return - }(), - TemplateID: n.Template.Id, - Version: n.Version, - } -} - -// CreateSKSNodepool create an SKS Nodepool. -func (c *Client) CreateSKSNodepool( - ctx context.Context, - zone string, - cluster *SKSCluster, - nodepool *SKSNodepool, -) (*SKSNodepool, error) { - if err := validateOperationParams(cluster, "update"); err != nil { - return nil, err - } - if err := validateOperationParams(nodepool, "create"); err != nil { - return nil, err - } - - resp, err := c.CreateSksNodepoolWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - oapi.CreateSksNodepoolJSONRequestBody{ - Addons: func() (v *[]oapi.CreateSksNodepoolJSONBodyAddons) { - if nodepool.AddOns != nil { - addOns := make([]oapi.CreateSksNodepoolJSONBodyAddons, len(*nodepool.AddOns)) - for i, a := range *nodepool.AddOns { - addOns[i] = oapi.CreateSksNodepoolJSONBodyAddons(a) - } - v = &addOns - } - return - }(), - AntiAffinityGroups: func() (v *[]oapi.AntiAffinityGroup) { - if nodepool.AntiAffinityGroupIDs != nil { - ids := make([]oapi.AntiAffinityGroup, len(*nodepool.AntiAffinityGroupIDs)) - for i, item := range *nodepool.AntiAffinityGroupIDs { - item := item - ids[i] = oapi.AntiAffinityGroup{Id: &item} - } - v = &ids - } - return - }(), - DeployTarget: func() (v *oapi.DeployTarget) { - if nodepool.DeployTargetID != nil { - v = &oapi.DeployTarget{Id: *nodepool.DeployTargetID} - } - return - }(), - Description: nodepool.Description, - DiskSize: *nodepool.DiskSize, - InstancePrefix: nodepool.InstancePrefix, - InstanceType: oapi.InstanceType{Id: nodepool.InstanceTypeID}, - Labels: func() (v *oapi.Labels) { - if nodepool.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *nodepool.Labels} - } - return - }(), - Name: *nodepool.Name, - PrivateNetworks: func() (v *[]oapi.PrivateNetwork) { - if nodepool.PrivateNetworkIDs != nil { - ids := make([]oapi.PrivateNetwork, len(*nodepool.PrivateNetworkIDs)) - for i, item := range *nodepool.PrivateNetworkIDs { - item := item - ids[i] = oapi.PrivateNetwork{Id: &item} - } - v = &ids - } - return - }(), - SecurityGroups: func() (v *[]oapi.SecurityGroup) { - if nodepool.SecurityGroupIDs != nil { - ids := make([]oapi.SecurityGroup, len(*nodepool.SecurityGroupIDs)) - for i, item := range *nodepool.SecurityGroupIDs { - item := item - ids[i] = oapi.SecurityGroup{Id: &item} - } - v = &ids - } - return - }(), - Size: *nodepool.Size, - Taints: func() (v *oapi.SksNodepoolTaints) { - if nodepool.Taints != nil { - taints := oapi.SksNodepoolTaints{AdditionalProperties: map[string]oapi.SksNodepoolTaint{}} - for k, t := range *nodepool.Taints { - taints.AdditionalProperties[k] = oapi.SksNodepoolTaint{ - Effect: (oapi.SksNodepoolTaintEffect)(t.Effect), - Value: t.Value, - } - } - v = &taints - } - return - }(), - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - nodepoolRes, err := c.GetSksNodepoolWithResponse(ctx, *cluster.ID, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) - if err != nil { - return nil, fmt.Errorf("unable to retrieve Nodepool: %s", err) - } - - return sksNodepoolFromAPI(nodepoolRes.JSON200), nil -} - -// DeleteSKSNodepool deletes an SKS Nodepool. -func (c *Client) DeleteSKSNodepool(ctx context.Context, zone string, cluster *SKSCluster, nodepool *SKSNodepool) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - if err := validateOperationParams(nodepool, "delete"); err != nil { - return err - } - - resp, err := c.DeleteSksNodepoolWithResponse(apiv2.WithZone(ctx, zone), *cluster.ID, *nodepool.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// EvictSKSNodepoolMembers evicts the specified members (identified by their Compute instance ID) from the -// SKS cluster Nodepool. -func (c *Client) EvictSKSNodepoolMembers( - ctx context.Context, - zone string, - cluster *SKSCluster, - nodepool *SKSNodepool, - members []string, -) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - if err := validateOperationParams(nodepool, "update"); err != nil { - return err - } - - resp, err := c.EvictSksNodepoolMembersWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - *nodepool.ID, - oapi.EvictSksNodepoolMembersJSONRequestBody{Instances: &members}, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// ScaleSKSNodepool scales the SKS cluster Nodepool to the specified number of Kubernetes Nodes. -func (c *Client) ScaleSKSNodepool( - ctx context.Context, - zone string, - cluster *SKSCluster, - nodepool *SKSNodepool, - size int64, -) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - if err := validateOperationParams(nodepool, "update"); err != nil { - return err - } - - resp, err := c.ScaleSksNodepoolWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - *nodepool.ID, - oapi.ScaleSksNodepoolJSONRequestBody{Size: size}, - ) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// UpdateSKSNodepool updates an SKS Nodepool. -func (c *Client) UpdateSKSNodepool( - ctx context.Context, - zone string, - cluster *SKSCluster, - nodepool *SKSNodepool, -) error { - if err := validateOperationParams(cluster, "update"); err != nil { - return err - } - if err := validateOperationParams(nodepool, "update"); err != nil { - return err - } - - resp, err := c.UpdateSksNodepoolWithResponse( - apiv2.WithZone(ctx, zone), - *cluster.ID, - *nodepool.ID, - oapi.UpdateSksNodepoolJSONRequestBody{ - AntiAffinityGroups: func() (v *[]oapi.AntiAffinityGroup) { - if nodepool.AntiAffinityGroupIDs != nil { - ids := make([]oapi.AntiAffinityGroup, len(*nodepool.AntiAffinityGroupIDs)) - for i, item := range *nodepool.AntiAffinityGroupIDs { - item := item - ids[i] = oapi.AntiAffinityGroup{Id: &item} - } - v = &ids - } - return - }(), - DeployTarget: func() (v *oapi.DeployTarget) { - if nodepool.DeployTargetID != nil { - v = &oapi.DeployTarget{Id: *nodepool.DeployTargetID} - } - return - }(), - Description: oapi.NilableString(nodepool.Description), - DiskSize: nodepool.DiskSize, - InstancePrefix: nodepool.InstancePrefix, - InstanceType: func() (v *oapi.InstanceType) { - if nodepool.InstanceTypeID != nil { - v = &oapi.InstanceType{Id: nodepool.InstanceTypeID} - } - return - }(), - Labels: func() (v *oapi.Labels) { - if nodepool.Labels != nil { - v = &oapi.Labels{AdditionalProperties: *nodepool.Labels} - } - return - }(), - Name: nodepool.Name, - PrivateNetworks: func() (v *[]oapi.PrivateNetwork) { - if nodepool.PrivateNetworkIDs != nil { - ids := make([]oapi.PrivateNetwork, len(*nodepool.PrivateNetworkIDs)) - for i, item := range *nodepool.PrivateNetworkIDs { - item := item - ids[i] = oapi.PrivateNetwork{Id: &item} - } - v = &ids - } - return - }(), - SecurityGroups: func() (v *[]oapi.SecurityGroup) { - if nodepool.SecurityGroupIDs != nil { - ids := make([]oapi.SecurityGroup, len(*nodepool.SecurityGroupIDs)) - for i, item := range *nodepool.SecurityGroupIDs { - item := item - ids[i] = oapi.SecurityGroup{Id: &item} - } - v = &ids - } - return - }(), - Taints: func() (v *oapi.SksNodepoolTaints) { - if nodepool.Taints != nil { - taints := oapi.SksNodepoolTaints{AdditionalProperties: map[string]oapi.SksNodepoolTaint{}} - for k, t := range *nodepool.Taints { - taints.AdditionalProperties[k] = oapi.SksNodepoolTaint{ - Effect: (oapi.SksNodepoolTaintEffect)(t.Effect), - Value: t.Value, - } - } - v = &taints - } - return - }(), - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/snapshot.go b/vendor/github.com/exoscale/egoscale/v2/snapshot.go deleted file mode 100644 index 5a9de4ce..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/snapshot.go +++ /dev/null @@ -1,122 +0,0 @@ -package v2 - -import ( - "context" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SnapshotExport represents exported Snapshot information. -type SnapshotExport struct { - MD5sum *string - PresignedURL *string -} - -// Snapshot represents a Snapshot. -type Snapshot struct { - CreatedAt *time.Time - ID *string `req-for:"update,delete"` - InstanceID *string - Name *string - Size *int64 - State *string - Zone *string -} - -func snapshotFromAPI(s *oapi.Snapshot, zone string) *Snapshot { - return &Snapshot{ - CreatedAt: s.CreatedAt, - ID: s.Id, - InstanceID: s.Instance.Id, - Name: s.Name, - Size: s.Size, - State: (*string)(s.State), - Zone: &zone, - } -} - -// DeleteSnapshot deletes a Snapshot. -func (c *Client) DeleteSnapshot(ctx context.Context, zone string, snapshot *Snapshot) error { - if err := validateOperationParams(snapshot, "delete"); err != nil { - return err - } - - resp, err := c.DeleteSnapshotWithResponse(apiv2.WithZone(ctx, zone), *snapshot.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// ExportSnapshot exports a Snapshot and returns the exported Snapshot information. -func (c *Client) ExportSnapshot(ctx context.Context, zone string, snapshot *Snapshot) (*SnapshotExport, error) { - if err := validateOperationParams(snapshot, "update"); err != nil { - return nil, err - } - - resp, err := c.ExportSnapshotWithResponse(apiv2.WithZone(ctx, zone), *snapshot.ID) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - expSnapshot, err := c.GetSnapshotWithResponse(apiv2.WithZone(ctx, zone), *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) - if err != nil { - return nil, err - } - - return &SnapshotExport{ - MD5sum: expSnapshot.JSON200.Export.Md5sum, - PresignedURL: expSnapshot.JSON200.Export.PresignedUrl, - }, nil -} - -// GetSnapshot returns the Snapshot corresponding to the specified ID. -func (c *Client) GetSnapshot(ctx context.Context, zone, id string) (*Snapshot, error) { - resp, err := c.GetSnapshotWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return snapshotFromAPI(resp.JSON200, zone), nil -} - -// ListSnapshots returns the list of existing Snapshots. -func (c *Client) ListSnapshots(ctx context.Context, zone string) ([]*Snapshot, error) { - list := make([]*Snapshot, 0) - - resp, err := c.ListSnapshotsWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.Snapshots != nil { - for i := range *resp.JSON200.Snapshots { - list = append(list, snapshotFromAPI(&(*resp.JSON200.Snapshots)[i], zone)) - } - } - - return list, nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/ssh_key.go b/vendor/github.com/exoscale/egoscale/v2/ssh_key.go deleted file mode 100644 index fca7b3a9..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/ssh_key.go +++ /dev/null @@ -1,86 +0,0 @@ -package v2 - -import ( - "context" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// SSHKey represents an SSH key. -type SSHKey struct { - Fingerprint *string - Name *string `req-for:"delete"` -} - -func sshKeyFromAPI(k *oapi.SshKey) *SSHKey { - return &SSHKey{ - Fingerprint: k.Fingerprint, - Name: k.Name, - } -} - -// DeleteSSHKey deletes an SSH key. -func (c *Client) DeleteSSHKey(ctx context.Context, zone string, sshKey *SSHKey) error { - if err := validateOperationParams(sshKey, "delete"); err != nil { - return err - } - - resp, err := c.DeleteSshKeyWithResponse(apiv2.WithZone(ctx, zone), *sshKey.Name) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// GetSSHKey returns the SSH key corresponding to the specified name. -func (c *Client) GetSSHKey(ctx context.Context, zone, name string) (*SSHKey, error) { - resp, err := c.GetSshKeyWithResponse(apiv2.WithZone(ctx, zone), name) - if err != nil { - return nil, err - } - - return sshKeyFromAPI(resp.JSON200), nil -} - -// ListSSHKeys returns the list of existing SSH keys. -func (c *Client) ListSSHKeys(ctx context.Context, zone string) ([]*SSHKey, error) { - list := make([]*SSHKey, 0) - - resp, err := c.ListSshKeysWithResponse(apiv2.WithZone(ctx, zone)) - if err != nil { - return nil, err - } - - if resp.JSON200.SshKeys != nil { - for i := range *resp.JSON200.SshKeys { - list = append(list, sshKeyFromAPI(&(*resp.JSON200.SshKeys)[i])) - } - } - - return list, nil -} - -// RegisterSSHKey registers a new SSH key. -func (c *Client) RegisterSSHKey(ctx context.Context, zone, name, publicKey string) (*SSHKey, error) { - _, err := c.RegisterSshKeyWithResponse( - apiv2.WithZone(ctx, zone), - oapi.RegisterSshKeyJSONRequestBody{ - Name: name, - PublicKey: publicKey, - }) - if err != nil { - return nil, err - } - - return c.GetSSHKey(ctx, zone, name) -} diff --git a/vendor/github.com/exoscale/egoscale/v2/template.go b/vendor/github.com/exoscale/egoscale/v2/template.go deleted file mode 100644 index b17bec68..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/template.go +++ /dev/null @@ -1,284 +0,0 @@ -package v2 - -import ( - "context" - "errors" - "sort" - "time" - - apiv2 "github.com/exoscale/egoscale/v2/api" - "github.com/exoscale/egoscale/v2/oapi" -) - -// Template represents a Compute instance template. -type Template struct { - BootMode *string - Build *string - Checksum *string `req-for:"create"` - CreatedAt *time.Time - DefaultUser *string - Description *string - Family *string - ID *string `req-for:"update,delete"` - Maintainer *string - Name *string `req-for:"create"` - PasswordEnabled *bool `req-for:"create"` - SSHKeyEnabled *bool `req-for:"create"` - Size *int64 - URL *string `req-for:"create"` - Version *string - Visibility *string - Zone *string -} - -// Implement sort.Interface for []*Template by CreatedAt or by Nane -type Templates []*Template - -func (s Templates) Len() int { return len(s) } -func (s Templates) Swap(i, j int) { s[i], s[j] = s[j], s[i] } - -type ByName struct{ Templates } - -func (s ByName) Less(i, j int) bool { return *s.Templates[i].Name < *s.Templates[j].Name } - -type ByCreatedAt struct{ Templates } - -func (s ByCreatedAt) Less(i, j int) bool { - return s.Templates[i].CreatedAt.Before(*s.Templates[j].CreatedAt) -} - -// ListTemplatesOpt represents an ListTemplates operation option. -type ListTemplatesOpt func(params *oapi.ListTemplatesParams) - -// ListTemplatesWithFamily sets a family filter to list Templates with. -func ListTemplatesWithFamily(v string) ListTemplatesOpt { - return func(p *oapi.ListTemplatesParams) { - if v != "" { - p.Family = &v - } - } -} - -// ListTemplatesWithVisibility sets a visibility filter to list Templates with (default: "public"). -func ListTemplatesWithVisibility(v string) ListTemplatesOpt { - return func(p *oapi.ListTemplatesParams) { - if v != "" { - p.Visibility = (*oapi.ListTemplatesParamsVisibility)(&v) - } - } -} - -func templateFromAPI(t *oapi.Template, zone string) *Template { - return &Template{ - BootMode: (*string)(t.BootMode), - Build: t.Build, - Checksum: t.Checksum, - CreatedAt: t.CreatedAt, - DefaultUser: t.DefaultUser, - Description: t.Description, - Family: t.Family, - ID: t.Id, - Maintainer: t.Maintainer, - Name: t.Name, - PasswordEnabled: t.PasswordEnabled, - SSHKeyEnabled: t.SshKeyEnabled, - Size: t.Size, - URL: t.Url, - Version: t.Version, - Visibility: (*string)(t.Visibility), - Zone: &zone, - } -} - -// CopyTemplate copies a Template to a different Exoscale zone. -func (c *Client) CopyTemplate(ctx context.Context, zone string, template *Template, dstZone string) (*Template, error) { - if err := validateOperationParams(template, "update"); err != nil { - return nil, err - } - - resp, err := c.CopyTemplateWithResponse( - apiv2.WithZone(ctx, zone), - *template.ID, - oapi.CopyTemplateJSONRequestBody{TargetZone: oapi.Zone{Name: (*oapi.ZoneName)(&dstZone)}}, - ) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetTemplate(ctx, dstZone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// DeleteTemplate deletes a Template. -func (c *Client) DeleteTemplate(ctx context.Context, zone string, template *Template) error { - if err := validateOperationParams(template, "delete"); err != nil { - return err - } - - resp, err := c.DeleteTemplateWithResponse(apiv2.WithZone(ctx, zone), *template.ID) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} - -// GetTemplate returns the Template corresponding to the specified ID. -func (c *Client) GetTemplate(ctx context.Context, zone, id string) (*Template, error) { - resp, err := c.GetTemplateWithResponse(apiv2.WithZone(ctx, zone), id) - if err != nil { - return nil, err - } - - return templateFromAPI(resp.JSON200, zone), nil -} - -// GetTemplateByName returns the newest Template corresponding to the specified Name. -func (c *Client) GetTemplateByName(ctx context.Context, zone string, templateName string, visibility string) (*Template, error) { - templates, err := c.ListTemplates(ctx, zone, ListTemplatesWithVisibility(visibility)) - if err != nil { - return nil, err - } - // Newest first (multiple private templates can have the same name) - sort.Sort(sort.Reverse(ByCreatedAt{templates})) - for _, template := range templates { - if *template.Name == templateName { - return template, nil - } - } - - return nil, apiv2.ErrNotFound -} - -// FindTemplate attempts to find a template by name or ID. -// In case the identifier is a name and multiple resources match, the newest template is returned. -func (c *Client) FindTemplate(ctx context.Context, zone, x string, visibilty string) (*Template, error) { - // Check if template is referenced by ID. - template, err := c.GetTemplate(ctx, zone, x) - if err != nil { - // ErrInvalidRequest when we pass an invalid id (should be a UUID) - // We can check if template is referenced by Name. - if errors.Is(err, apiv2.ErrInvalidRequest) || errors.Is(err, apiv2.ErrNotFound) { - template, err = c.GetTemplateByName(ctx, zone, x, visibilty) - if err == nil { - return template, nil - } - } - return nil, err - } - return template, nil -} - -// ListTemplates returns the list of existing Templates. -func (c *Client) ListTemplates(ctx context.Context, zone string, opts ...ListTemplatesOpt) ([]*Template, error) { - list := make([]*Template, 0) - - defaultVisibility := oapi.TemplateVisibilityPublic - params := oapi.ListTemplatesParams{ - Visibility: (*oapi.ListTemplatesParamsVisibility)(&defaultVisibility), - } - - for _, opt := range opts { - opt(¶ms) - } - - resp, err := c.ListTemplatesWithResponse(apiv2.WithZone(ctx, zone), ¶ms) - if err != nil { - return nil, err - } - - if resp.JSON200.Templates != nil { - for i := range *resp.JSON200.Templates { - list = append(list, templateFromAPI(&(*resp.JSON200.Templates)[i], zone)) - } - } - - return list, nil -} - -// RegisterTemplate registers a new Template. -func (c *Client) RegisterTemplate(ctx context.Context, zone string, template *Template) (*Template, error) { - if err := validateOperationParams(template, "create"); err != nil { - return nil, err - } - - resp, err := c.RegisterTemplateWithResponse( - apiv2.WithZone(ctx, zone), - oapi.RegisterTemplateJSONRequestBody{ - BootMode: (*oapi.RegisterTemplateJSONBodyBootMode)(template.BootMode), - Build: template.Build, - Checksum: *template.Checksum, - DefaultUser: template.DefaultUser, - Description: template.Description, - Maintainer: template.Maintainer, - Name: *template.Name, - PasswordEnabled: *template.PasswordEnabled, - SshKeyEnabled: *template.SSHKeyEnabled, - Url: *template.URL, - Version: template.Version, - }) - if err != nil { - return nil, err - } - - res, err := oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return nil, err - } - - return c.GetTemplate(ctx, zone, *res.(*struct { - Command *string `json:"command,omitempty"` - Id *string `json:"id,omitempty"` // revive:disable-line - Link *string `json:"link,omitempty"` - }).Id) -} - -// UpdateTemplate updates a Template. -func (c *Client) UpdateTemplate(ctx context.Context, zone string, template *Template) error { - if err := validateOperationParams(template, "update"); err != nil { - return err - } - - resp, err := c.UpdateTemplateWithResponse( - apiv2.WithZone(ctx, zone), - *template.ID, - oapi.UpdateTemplateJSONRequestBody{ - Description: oapi.NilableString(template.Description), - Name: template.Name, - }) - if err != nil { - return err - } - - _, err = oapi.NewPoller(). - WithTimeout(c.timeout). - WithInterval(c.pollInterval). - Poll(ctx, oapi.OperationPoller(c, zone, *resp.JSON200.Id)) - if err != nil { - return err - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/test.go b/vendor/github.com/exoscale/egoscale/v2/test.go deleted file mode 100644 index 053791f6..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/test.go +++ /dev/null @@ -1,5 +0,0 @@ -package v2 - -const iso8601Format = "2006-01-02T15:04:05Z" - -var testZone = "ch-gva-2" diff --git a/vendor/github.com/exoscale/egoscale/v2/utils.go b/vendor/github.com/exoscale/egoscale/v2/utils.go deleted file mode 100644 index 5751491f..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/utils.go +++ /dev/null @@ -1,18 +0,0 @@ -package v2 - -import ( - "github.com/gofrs/uuid" -) - -func mapValueOrNil(src map[string]string, key string) *string { - if x, found := src[key]; found { - return &x - } - - return nil -} - -func IsValidUUID(s string) bool { - _, err := uuid.FromString(s) - return err == nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/v2.go b/vendor/github.com/exoscale/egoscale/v2/v2.go deleted file mode 100644 index 33ac888c..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/v2.go +++ /dev/null @@ -1,74 +0,0 @@ -// Package v2 is the new Exoscale client API binding. -// Reference: https://openapi-v2.exoscale.com/ -package v2 - -import ( - "context" - "errors" - "fmt" - "reflect" - "strings" -) - -type getter interface { - get(ctx context.Context, client *Client, zone, id string) (interface{}, error) -} - -// validateOperationParams is a helper function that returns an error if -// fields of the struct res tagged with `req-for:""` are set -// to a nil value. Fields tagged with "req-for" MUST be of type pointer. -// The expected format for the `req-for:` tag value is a comma-separated -// list of required operations, or "*" for any operation (i.e. the field -// is always required). -func validateOperationParams(res interface{}, op string) error { - rv := reflect.ValueOf(res) - if rv.Kind() != reflect.Ptr || rv.IsNil() { - return errors.New("field must be a non-nil pointer value") - } - - if op == "" { - return errors.New("no operation specified") - } - - structValue := reflect.ValueOf(res).Elem() - for i := 0; i < structValue.NumField(); i++ { - structField := structValue.Type().Field(i) - - reqOp, required := structField.Tag.Lookup("req-for") - if required { - if structField.Type.Kind() != reflect.Ptr { - return fmt.Errorf( - "%s.%s field is tagged with req-for but its type is not a pointer", - structValue.Type().String(), - structField.Name, - ) - } - - switch { - case - reqOp == op, - reqOp == "*": - if structValue.Field(i).IsNil() { - return fmt.Errorf( - "%s.%s field is required for this operation", - structValue.Type().String(), - structField.Name, - ) - } - - case strings.Contains(reqOp, ","): - for _, o := range strings.Split(reqOp, ",") { - if strings.TrimSpace(o) == op && structValue.Field(i).IsNil() { - return fmt.Errorf( - "%s.%s field is required for this operation", - structValue.Type().String(), - structField.Name, - ) - } - } - } - } - } - - return nil -} diff --git a/vendor/github.com/exoscale/egoscale/v2/zone.go b/vendor/github.com/exoscale/egoscale/v2/zone.go deleted file mode 100644 index f832c101..00000000 --- a/vendor/github.com/exoscale/egoscale/v2/zone.go +++ /dev/null @@ -1,24 +0,0 @@ -package v2 - -import ( - "context" -) - -// ListZones returns the list of Exoscale zones. -func (c *Client) ListZones(ctx context.Context) ([]string, error) { - list := make([]string, 0) - - resp, err := c.ListZonesWithResponse(ctx) - if err != nil { - return nil, err - } - - if resp.JSON200.Zones != nil { - for i := range *resp.JSON200.Zones { - zone := &(*resp.JSON200.Zones)[i] - list = append(list, string(*zone.Name)) - } - } - - return list, nil -} diff --git a/vendor/github.com/exoscale/egoscale/version/version.go b/vendor/github.com/exoscale/egoscale/version/version.go deleted file mode 100644 index b34cd4ab..00000000 --- a/vendor/github.com/exoscale/egoscale/version/version.go +++ /dev/null @@ -1,5 +0,0 @@ -// Package version stores the current version of the egoscale package. -package version - -// Version represents the current egoscale version. -const Version = "0.102.3" diff --git a/vendor/github.com/gofrs/uuid/.gitignore b/vendor/github.com/gofrs/uuid/.gitignore deleted file mode 100644 index 666dbbb5..00000000 --- a/vendor/github.com/gofrs/uuid/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# binary bundle generated by go-fuzz -uuid-fuzz.zip diff --git a/vendor/github.com/gofrs/uuid/LICENSE b/vendor/github.com/gofrs/uuid/LICENSE deleted file mode 100644 index 926d5498..00000000 --- a/vendor/github.com/gofrs/uuid/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013-2018 by Maxim Bublis - -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/gofrs/uuid/README.md b/vendor/github.com/gofrs/uuid/README.md deleted file mode 100644 index 4f73bec8..00000000 --- a/vendor/github.com/gofrs/uuid/README.md +++ /dev/null @@ -1,117 +0,0 @@ -# UUID - -[![License](https://img.shields.io/github/license/gofrs/uuid.svg)](https://github.com/gofrs/uuid/blob/master/LICENSE) -[![Build Status](https://travis-ci.org/gofrs/uuid.svg?branch=master)](https://travis-ci.org/gofrs/uuid) -[![GoDoc](http://godoc.org/github.com/gofrs/uuid?status.svg)](http://godoc.org/github.com/gofrs/uuid) -[![Coverage Status](https://codecov.io/gh/gofrs/uuid/branch/master/graphs/badge.svg?branch=master)](https://codecov.io/gh/gofrs/uuid/) -[![Go Report Card](https://goreportcard.com/badge/github.com/gofrs/uuid)](https://goreportcard.com/report/github.com/gofrs/uuid) - -Package uuid provides a pure Go implementation of Universally Unique Identifiers -(UUID) variant as defined in RFC-4122. This package supports both the creation -and parsing of UUIDs in different formats. - -This package supports the following UUID versions: -* Version 1, based on timestamp and MAC address (RFC-4122) -* Version 3, based on MD5 hashing of a named value (RFC-4122) -* Version 4, based on random numbers (RFC-4122) -* Version 5, based on SHA-1 hashing of a named value (RFC-4122) - -This package also supports experimental Universally Unique Identifier implementations based on a -[draft RFC](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html) that updates RFC-4122 -* Version 6, a k-sortable id based on timestamp, and field-compatible with v1 (draft-peabody-dispatch-new-uuid-format, RFC-4122) -* Version 7, a k-sortable id based on timestamp (draft-peabody-dispatch-new-uuid-format, RFC-4122) - -The v6 and v7 IDs are **not** considered a part of the stable API, and may be subject to behavior or API changes as part of minor releases -to this package. They will be updated as the draft RFC changes, and will become stable if and when the draft RFC is accepted. - -## Project History - -This project was originally forked from the -[github.com/satori/go.uuid](https://github.com/satori/go.uuid) repository after -it appeared to be no longer maintained, while exhibiting [critical -flaws](https://github.com/satori/go.uuid/issues/73). We have decided to take -over this project to ensure it receives regular maintenance for the benefit of -the larger Go community. - -We'd like to thank Maxim Bublis for his hard work on the original iteration of -the package. - -## License - -This source code of this package is released under the MIT License. Please see -the [LICENSE](https://github.com/gofrs/uuid/blob/master/LICENSE) for the full -content of the license. - -## Recommended Package Version - -We recommend using v2.0.0+ of this package, as versions prior to 2.0.0 were -created before our fork of the original package and have some known -deficiencies. - -## Installation - -It is recommended to use a package manager like `dep` that understands tagged -releases of a package, as well as semantic versioning. - -If you are unable to make use of a dependency manager with your project, you can -use the `go get` command to download it directly: - -```Shell -$ go get github.com/gofrs/uuid -``` - -## Requirements - -Due to subtests not being supported in older versions of Go, this package is -only regularly tested against Go 1.7+. This package may work perfectly fine with -Go 1.2+, but support for these older versions is not actively maintained. - -## Go 1.11 Modules - -As of v3.2.0, this repository no longer adopts Go modules, and v3.2.0 no longer has a `go.mod` file. As a result, v3.2.0 also drops support for the `github.com/gofrs/uuid/v3` import path. Only module-based consumers are impacted. With the v3.2.0 release, _all_ gofrs/uuid consumers should use the `github.com/gofrs/uuid` import path. - -An existing module-based consumer will continue to be able to build using the `github.com/gofrs/uuid/v3` import path using any valid consumer `go.mod` that worked prior to the publishing of v3.2.0, but any module-based consumer should start using the `github.com/gofrs/uuid` import path when possible and _must_ use the `github.com/gofrs/uuid` import path prior to upgrading to v3.2.0. - -Please refer to [Issue #61](https://github.com/gofrs/uuid/issues/61) and [Issue #66](https://github.com/gofrs/uuid/issues/66) for more details. - -## Usage - -Here is a quick overview of how to use this package. For more detailed -documentation, please see the [GoDoc Page](http://godoc.org/github.com/gofrs/uuid). - -```go -package main - -import ( - "log" - - "github.com/gofrs/uuid" -) - -// Create a Version 4 UUID, panicking on error. -// Use this form to initialize package-level variables. -var u1 = uuid.Must(uuid.NewV4()) - -func main() { - // Create a Version 4 UUID. - u2, err := uuid.NewV4() - if err != nil { - log.Fatalf("failed to generate UUID: %v", err) - } - log.Printf("generated Version 4 UUID %v", u2) - - // Parse a UUID from a string. - s := "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - u3, err := uuid.FromString(s) - if err != nil { - log.Fatalf("failed to parse UUID %q: %v", s, err) - } - log.Printf("successfully parsed UUID %v", u3) -} -``` - -## References - -* [RFC-4122](https://tools.ietf.org/html/rfc4122) -* [DCE 1.1: Authentication and Security Services](http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01) -* [New UUID Formats RFC Draft (Peabody) Rev 04](https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#) diff --git a/vendor/github.com/gofrs/uuid/codec.go b/vendor/github.com/gofrs/uuid/codec.go deleted file mode 100644 index 66502641..00000000 --- a/vendor/github.com/gofrs/uuid/codec.go +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "errors" - "fmt" -) - -// FromBytes returns a UUID generated from the raw byte slice input. -// It will return an error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (UUID, error) { - u := UUID{} - err := u.UnmarshalBinary(input) - return u, err -} - -// FromBytesOrNil returns a UUID generated from the raw byte slice input. -// Same behavior as FromBytes(), but returns uuid.Nil instead of an error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -var errInvalidFormat = errors.New("uuid: invalid UUID format") - -func fromHexChar(c byte) byte { - switch { - case '0' <= c && c <= '9': - return c - '0' - case 'a' <= c && c <= 'f': - return c - 'a' + 10 - case 'A' <= c && c <= 'F': - return c - 'A' + 10 - } - return 255 -} - -// Parse parses the UUID stored in the string text. Parsing and supported -// formats are the same as UnmarshalText. -func (u *UUID) Parse(s string) error { - switch len(s) { - case 32: // hash - case 36: // canonical - case 34, 38: - if s[0] != '{' || s[len(s)-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format in string %q", s) - } - s = s[1 : len(s)-1] - case 41, 45: - if s[:9] != "urn:uuid:" { - return fmt.Errorf("uuid: incorrect UUID format in string %q", s[:9]) - } - s = s[9:] - default: - return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(s), s) - } - // canonical - if len(s) == 36 { - if s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format in string %q", s) - } - for i, x := range [16]byte{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34, - } { - v1 := fromHexChar(s[x]) - v2 := fromHexChar(s[x+1]) - if v1|v2 == 255 { - return errInvalidFormat - } - u[i] = (v1 << 4) | v2 - } - return nil - } - // hash like - for i := 0; i < 32; i += 2 { - v1 := fromHexChar(s[i]) - v2 := fromHexChar(s[i+1]) - if v1|v2 == 255 { - return errInvalidFormat - } - u[i/2] = (v1 << 4) | v2 - } - return nil -} - -// FromString returns a UUID parsed from the input string. -// Input is expected in a form accepted by UnmarshalText. -func FromString(text string) (UUID, error) { - var u UUID - err := u.Parse(text) - return u, err -} - -// FromStringOrNil returns a UUID parsed from the input string. -// Same behavior as FromString(), but returns uuid.Nil instead of an error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by the String() method. -func (u UUID) MarshalText() ([]byte, error) { - var buf [36]byte - encodeCanonical(buf[:], u) - return buf[:], nil -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// "{6ba7b8109dad11d180b400c04fd430c8}", -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8" -// -// ABNF for supported UUID text representation follows: -// -// URN := 'urn' -// UUID-NID := 'uuid' -// -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -// -// hexoct := hexdig hexdig -// 2hexoct := hexoct hexoct -// 4hexoct := 2hexoct 2hexoct -// 6hexoct := 4hexoct 2hexoct -// 12hexoct := 6hexoct 6hexoct -// -// hashlike := 12hexoct -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// -// plain := canonical | hashlike -// uuid := canonical | hashlike | braced | urn -// -// braced := '{' plain '}' | '{' hashlike '}' -// urn := URN ':' UUID-NID ':' plain -func (u *UUID) UnmarshalText(b []byte) error { - switch len(b) { - case 32: // hash - case 36: // canonical - case 34, 38: - if b[0] != '{' || b[len(b)-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format in string %q", b) - } - b = b[1 : len(b)-1] - case 41, 45: - if string(b[:9]) != "urn:uuid:" { - return fmt.Errorf("uuid: incorrect UUID format in string %q", b[:9]) - } - b = b[9:] - default: - return fmt.Errorf("uuid: incorrect UUID length %d in string %q", len(b), b) - } - if len(b) == 36 { - if b[8] != '-' || b[13] != '-' || b[18] != '-' || b[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format in string %q", b) - } - for i, x := range [16]byte{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34, - } { - v1 := fromHexChar(b[x]) - v2 := fromHexChar(b[x+1]) - if v1|v2 == 255 { - return errInvalidFormat - } - u[i] = (v1 << 4) | v2 - } - return nil - } - for i := 0; i < 32; i += 2 { - v1 := fromHexChar(b[i]) - v2 := fromHexChar(b[i+1]) - if v1|v2 == 255 { - return errInvalidFormat - } - u[i/2] = (v1 << 4) | v2 - } - return nil -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() ([]byte, error) { - return u.Bytes(), nil -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return an error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) error { - if len(data) != Size { - return fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - } - copy(u[:], data) - - return nil -} diff --git a/vendor/github.com/gofrs/uuid/fuzz.go b/vendor/github.com/gofrs/uuid/fuzz.go deleted file mode 100644 index ccf8d4ca..00000000 --- a/vendor/github.com/gofrs/uuid/fuzz.go +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018 Andrei Tudor Călin -// -// 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. - -//go:build gofuzz -// +build gofuzz - -package uuid - -// Fuzz implements a simple fuzz test for FromString / UnmarshalText. -// -// To run: -// -// $ go get github.com/dvyukov/go-fuzz/... -// $ cd $GOPATH/src/github.com/gofrs/uuid -// $ go-fuzz-build github.com/gofrs/uuid -// $ go-fuzz -bin=uuid-fuzz.zip -workdir=./testdata -// -// If you make significant changes to FromString / UnmarshalText and add -// new cases to fromStringTests (in codec_test.go), please run -// -// $ go test -seed_fuzz_corpus -// -// to seed the corpus with the new interesting inputs, then run the fuzzer. -func Fuzz(data []byte) int { - _, err := FromString(string(data)) - if err != nil { - return 0 - } - return 1 -} diff --git a/vendor/github.com/gofrs/uuid/generator.go b/vendor/github.com/gofrs/uuid/generator.go deleted file mode 100644 index 44be9e15..00000000 --- a/vendor/github.com/gofrs/uuid/generator.go +++ /dev/null @@ -1,456 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "fmt" - "hash" - "io" - "net" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -// EpochFunc is the function type used to provide the current time. -type EpochFunc func() time.Time - -// HWAddrFunc is the function type used to provide hardware (MAC) addresses. -type HWAddrFunc func() (net.HardwareAddr, error) - -// DefaultGenerator is the default UUID Generator used by this package. -var DefaultGenerator Generator = NewGen() - -// NewV1 returns a UUID based on the current timestamp and MAC address. -func NewV1() (UUID, error) { - return DefaultGenerator.NewV1() -} - -// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return DefaultGenerator.NewV3(ns, name) -} - -// NewV4 returns a randomly generated UUID. -func NewV4() (UUID, error) { - return DefaultGenerator.NewV4() -} - -// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return DefaultGenerator.NewV5(ns, name) -} - -// NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of -// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit -// order being adjusted to allow the UUID to be k-sortable. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. -func NewV6() (UUID, error) { - return DefaultGenerator.NewV6() -} - -// NewV7 returns a k-sortable UUID based on the current millisecond precision -// UNIX epoch and 74 bits of pseudorandom data. It supports single-node batch generation (multiple UUIDs in the same timestamp) with a Monotonic Random counter. -// -// This is implemented based on revision 04 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. -func NewV7() (UUID, error) { - return DefaultGenerator.NewV7() -} - -// Generator provides an interface for generating UUIDs. -type Generator interface { - NewV1() (UUID, error) - NewV3(ns UUID, name string) UUID - NewV4() (UUID, error) - NewV5(ns UUID, name string) UUID - NewV6() (UUID, error) - NewV7() (UUID, error) -} - -// Gen is a reference UUID generator based on the specifications laid out in -// RFC-4122 and DCE 1.1: Authentication and Security Services. This type -// satisfies the Generator interface as defined in this package. -// -// For consumers who are generating V1 UUIDs, but don't want to expose the MAC -// address of the node generating the UUIDs, the NewGenWithHWAF() function has been -// provided as a convenience. See the function's documentation for more info. -// -// The authors of this package do not feel that the majority of users will need -// to obfuscate their MAC address, and so we recommend using NewGen() to create -// a new generator. -type Gen struct { - clockSequenceOnce sync.Once - hardwareAddrOnce sync.Once - storageMutex sync.Mutex - - rand io.Reader - - epochFunc EpochFunc - hwAddrFunc HWAddrFunc - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -// GenOption is a function type that can be used to configure a Gen generator. -type GenOption func(*Gen) - -// interface check -- build will fail if *Gen doesn't satisfy Generator -var _ Generator = (*Gen)(nil) - -// NewGen returns a new instance of Gen with some default values set. Most -// people should use this. -func NewGen() *Gen { - return NewGenWithHWAF(defaultHWAddrFunc) -} - -// NewGenWithHWAF builds a new UUID generator with the HWAddrFunc provided. Most -// consumers should use NewGen() instead. -// -// This is used so that consumers can generate their own MAC addresses, for use -// in the generated UUIDs, if there is some concern about exposing the physical -// address of the machine generating the UUID. -// -// The Gen generator will only invoke the HWAddrFunc once, and cache that MAC -// address for all the future UUIDs generated by it. If you'd like to switch the -// MAC address being used, you'll need to create a new generator using this -// function. -func NewGenWithHWAF(hwaf HWAddrFunc) *Gen { - return NewGenWithOptions(WithHWAddrFunc(hwaf)) -} - -// NewGenWithOptions returns a new instance of Gen with the options provided. -// Most people should use NewGen() or NewGenWithHWAF() instead. -// -// To customize the generator, you can pass in one or more GenOption functions. -// For example: -// -// gen := NewGenWithOptions( -// WithHWAddrFunc(myHWAddrFunc), -// WithEpochFunc(myEpochFunc), -// WithRandomReader(myRandomReader), -// ) -// -// NewGenWithOptions(WithHWAddrFunc(myHWAddrFunc)) is equivalent to calling -// NewGenWithHWAF(myHWAddrFunc) -// NewGenWithOptions() is equivalent to calling NewGen() -func NewGenWithOptions(opts ...GenOption) *Gen { - gen := &Gen{ - epochFunc: time.Now, - hwAddrFunc: defaultHWAddrFunc, - rand: rand.Reader, - } - - for _, opt := range opts { - opt(gen) - } - - return gen -} - -// WithHWAddrFunc is a GenOption that allows you to provide your own HWAddrFunc -// function. -// When this option is nil, the defaultHWAddrFunc is used. -func WithHWAddrFunc(hwaf HWAddrFunc) GenOption { - return func(gen *Gen) { - if hwaf == nil { - hwaf = defaultHWAddrFunc - } - - gen.hwAddrFunc = hwaf - } -} - -// WithEpochFunc is a GenOption that allows you to provide your own EpochFunc -// function. -// When this option is nil, time.Now is used. -func WithEpochFunc(epochf EpochFunc) GenOption { - return func(gen *Gen) { - if epochf == nil { - epochf = time.Now - } - - gen.epochFunc = epochf - } -} - -// WithRandomReader is a GenOption that allows you to provide your own random -// reader. -// When this option is nil, the default rand.Reader is used. -func WithRandomReader(reader io.Reader) GenOption { - return func(gen *Gen) { - if reader == nil { - reader = rand.Reader - } - - gen.rand = reader - } -} - -// NewV1 returns a UUID based on the current timestamp and MAC address. -func (g *Gen) NewV1() (UUID, error) { - u := UUID{} - - timeNow, clockSeq, err := g.getClockSequence(false) - if err != nil { - return Nil, err - } - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - hardwareAddr, err := g.getHardwareAddr() - if err != nil { - return Nil, err - } - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV3 returns a UUID based on the MD5 hash of the namespace UUID and name. -func (g *Gen) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns a randomly generated UUID. -func (g *Gen) NewV4() (UUID, error) { - u := UUID{} - if _, err := io.ReadFull(g.rand, u[:]); err != nil { - return Nil, err - } - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// NewV5 returns a UUID based on SHA-1 hash of the namespace UUID and name. -func (g *Gen) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV6 returns a k-sortable UUID based on a timestamp and 48 bits of -// pseudorandom data. The timestamp in a V6 UUID is the same as V1, with the bit -// order being adjusted to allow the UUID to be k-sortable. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. -func (g *Gen) NewV6() (UUID, error) { - var u UUID - - if _, err := io.ReadFull(g.rand, u[10:]); err != nil { - return Nil, err - } - - timeNow, clockSeq, err := g.getClockSequence(false) - if err != nil { - return Nil, err - } - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow>>28)) // set time_high - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>12)) // set time_mid - binary.BigEndian.PutUint16(u[6:], uint16(timeNow&0xfff)) // set time_low (minus four version bits) - binary.BigEndian.PutUint16(u[8:], clockSeq&0x3fff) // set clk_seq_hi_res (minus two variant bits) - - u.SetVersion(V6) - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// getClockSequence returns the epoch and clock sequence for V1,V6 and V7 UUIDs. -// -// When useUnixTSMs is false, it uses the Coordinated Universal Time (UTC) as a count of 100- -// -// nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of Gregorian reform to the Christian calendar). -func (g *Gen) getClockSequence(useUnixTSMs bool) (uint64, uint16, error) { - var err error - g.clockSequenceOnce.Do(func() { - buf := make([]byte, 2) - if _, err = io.ReadFull(g.rand, buf); err != nil { - return - } - g.clockSequence = binary.BigEndian.Uint16(buf) - }) - if err != nil { - return 0, 0, err - } - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - var timeNow uint64 - if useUnixTSMs { - timeNow = uint64(g.epochFunc().UnixMilli()) - } else { - timeNow = g.getEpoch() - } - // Clock didn't change since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, nil -} - -// NewV7 returns a k-sortable UUID based on the current millisecond precision -// UNIX epoch and 74 bits of pseudorandom data. -// -// This is implemented based on revision 04 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. -func (g *Gen) NewV7() (UUID, error) { - var u UUID - /* https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-04.html#name-uuid-version-7 - 0 1 2 3 - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | unix_ts_ms | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | unix_ts_ms | ver | rand_a | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - |var| rand_b | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - | rand_b | - +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ - - ms, clockSeq, err := g.getClockSequence(true) - if err != nil { - return Nil, err - } - //UUIDv7 features a 48 bit timestamp. First 32bit (4bytes) represents seconds since 1970, followed by 2 bytes for the ms granularity. - u[0] = byte(ms >> 40) //1-6 bytes: big-endian unsigned number of Unix epoch timestamp - u[1] = byte(ms >> 32) - u[2] = byte(ms >> 24) - u[3] = byte(ms >> 16) - u[4] = byte(ms >> 8) - u[5] = byte(ms) - - //support batching by using a monotonic pseudo-random sequence - //The 6th byte contains the version and partially rand_a data. - //We will lose the most significant bites from the clockSeq (with SetVersion), but it is ok, we need the least significant that contains the counter to ensure the monotonic property - binary.BigEndian.PutUint16(u[6:8], clockSeq) // set rand_a with clock seq which is random and monotonic - - //override first 4bits of u[6]. - u.SetVersion(V7) - - //set rand_b 64bits of pseudo-random bits (first 2 will be overridden) - if _, err = io.ReadFull(g.rand, u[8:16]); err != nil { - return Nil, err - } - //override first 2 bits of byte[8] for the variant - u.SetVariant(VariantRFC4122) - - return u, nil -} - -// Returns the hardware address. -func (g *Gen) getHardwareAddr() ([]byte, error) { - var err error - g.hardwareAddrOnce.Do(func() { - var hwAddr net.HardwareAddr - if hwAddr, err = g.hwAddrFunc(); err == nil { - copy(g.hardwareAddr[:], hwAddr) - return - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence. - if _, err = io.ReadFull(g.rand, g.hardwareAddr[:]); err != nil { - return - } - // Set multicast bit as recommended by RFC-4122 - g.hardwareAddr[0] |= 0x01 - }) - if err != nil { - return []byte{}, err - } - return g.hardwareAddr[:], nil -} - -// Returns the difference between UUID epoch (October 15, 1582) -// and current time in 100-nanosecond intervals. -func (g *Gen) getEpoch() uint64 { - return epochStart + uint64(g.epochFunc().UnixNano()/100) -} - -// Returns the UUID based on the hashing of the namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} - -var netInterfaces = net.Interfaces - -// Returns the hardware address. -func defaultHWAddrFunc() (net.HardwareAddr, error) { - ifaces, err := netInterfaces() - if err != nil { - return []byte{}, err - } - for _, iface := range ifaces { - if len(iface.HardwareAddr) >= 6 { - return iface.HardwareAddr, nil - } - } - return []byte{}, fmt.Errorf("uuid: no HW address found") -} diff --git a/vendor/github.com/gofrs/uuid/sql.go b/vendor/github.com/gofrs/uuid/sql.go deleted file mode 100644 index 01d5d884..00000000 --- a/vendor/github.com/gofrs/uuid/sql.go +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -package uuid - -import ( - "database/sql" - "database/sql/driver" - "fmt" -) - -var _ driver.Valuer = UUID{} -var _ sql.Scanner = (*UUID)(nil) - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice will be handled by UnmarshalBinary, while -// a longer byte slice or a string will be handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case UUID: // support gorm convert from UUID to NullUUID - *u = src - return nil - - case []byte: - if len(src) == Size { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - uu, err := FromString(src) - *u = uu - return err - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database. -type NullUUID struct { - UUID UUID - Valid bool -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} - -var nullJSON = []byte("null") - -// MarshalJSON marshals the NullUUID as null or the nested UUID -func (u NullUUID) MarshalJSON() ([]byte, error) { - if !u.Valid { - return nullJSON, nil - } - var buf [38]byte - buf[0] = '"' - encodeCanonical(buf[1:37], u.UUID) - buf[37] = '"' - return buf[:], nil -} - -// UnmarshalJSON unmarshals a NullUUID -func (u *NullUUID) UnmarshalJSON(b []byte) error { - if string(b) == "null" { - u.UUID, u.Valid = Nil, false - return nil - } - if n := len(b); n >= 2 && b[0] == '"' { - b = b[1 : n-1] - } - err := u.UUID.UnmarshalText(b) - u.Valid = (err == nil) - return err -} diff --git a/vendor/github.com/gofrs/uuid/uuid.go b/vendor/github.com/gofrs/uuid/uuid.go deleted file mode 100644 index 5320fb53..00000000 --- a/vendor/github.com/gofrs/uuid/uuid.go +++ /dev/null @@ -1,285 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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. - -// Package uuid provides implementations of the Universally Unique Identifier -// (UUID), as specified in RFC-4122 and the Peabody RFC Draft (revision 03). -// -// RFC-4122[1] provides the specification for versions 1, 3, 4, and 5. The -// Peabody UUID RFC Draft[2] provides the specification for the new k-sortable -// UUIDs, versions 6 and 7. -// -// DCE 1.1[3] provides the specification for version 2, but version 2 support -// was removed from this package in v4 due to some concerns with the -// specification itself. Reading the spec, it seems that it would result in -// generating UUIDs that aren't very unique. In having read the spec it seemed -// that our implementation did not meet the spec. It also seems to be at-odds -// with RFC 4122, meaning we would need quite a bit of special code to support -// it. Lastly, there were no Version 2 implementations that we could find to -// ensure we were understanding the specification correctly. -// -// [1] https://tools.ietf.org/html/rfc4122 -// [2] https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03 -// [3] http://pubs.opengroup.org/onlinepubs/9696989899/chap5.htm#tagcjh_08_02_01_01 -package uuid - -import ( - "encoding/binary" - "encoding/hex" - "fmt" - "time" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID is an array type to represent the value of a UUID, as defined in RFC-4122. -type UUID [Size]byte - -// UUID versions. -const ( - _ byte = iota - V1 // Version 1 (date-time and MAC address) - _ // Version 2 (date-time and MAC address, DCE security version) [removed] - V3 // Version 3 (namespace name-based) - V4 // Version 4 (random) - V5 // Version 5 (namespace name-based) - V6 // Version 6 (k-sortable timestamp and random data, field-compatible with v1) [peabody draft] - V7 // Version 7 (k-sortable timestamp and random data) [peabody draft] - _ // Version 8 (k-sortable timestamp, meant for custom implementations) [peabody draft] [not implemented] -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// Timestamp is the count of 100-nanosecond intervals since 00:00:00.00, -// 15 October 1582 within a V1 UUID. This type has no meaning for other -// UUID versions since they don't have an embedded timestamp. -type Timestamp uint64 - -const _100nsPerSecond = 10000000 - -// Time returns the UTC time.Time representation of a Timestamp -func (t Timestamp) Time() (time.Time, error) { - secs := uint64(t) / _100nsPerSecond - nsecs := 100 * (uint64(t) % _100nsPerSecond) - - return time.Unix(int64(secs)-(epochStart/_100nsPerSecond), int64(nsecs)), nil -} - -// TimestampFromV1 returns the Timestamp embedded within a V1 UUID. -// Returns an error if the UUID is any version other than 1. -func TimestampFromV1(u UUID) (Timestamp, error) { - if u.Version() != 1 { - err := fmt.Errorf("uuid: %s is version %d, not version 1", u, u.Version()) - return 0, err - } - - low := binary.BigEndian.Uint32(u[0:4]) - mid := binary.BigEndian.Uint16(u[4:6]) - hi := binary.BigEndian.Uint16(u[6:8]) & 0xfff - - return Timestamp(uint64(low) + (uint64(mid) << 32) + (uint64(hi) << 48)), nil -} - -// TimestampFromV6 returns the Timestamp embedded within a V6 UUID. This -// function returns an error if the UUID is any version other than 6. -// -// This is implemented based on revision 03 of the Peabody UUID draft, and may -// be subject to change pending further revisions. Until the final specification -// revision is finished, changes required to implement updates to the spec will -// not be considered a breaking change. They will happen as a minor version -// releases until the spec is final. -func TimestampFromV6(u UUID) (Timestamp, error) { - if u.Version() != 6 { - return 0, fmt.Errorf("uuid: %s is version %d, not version 6", u, u.Version()) - } - - hi := binary.BigEndian.Uint32(u[0:4]) - mid := binary.BigEndian.Uint16(u[4:6]) - low := binary.BigEndian.Uint16(u[6:8]) & 0xfff - - return Timestamp(uint64(low) + (uint64(mid) << 12) + (uint64(hi) << 28)), nil -} - -// Nil is the nil UUID, as specified in RFC-4122, that has all 128 bits set to -// zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// IsNil returns if the UUID is equal to the nil UUID -func (u UUID) IsNil() bool { - return u == Nil -} - -// Version returns the algorithm version used to generate the UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns the UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns a byte slice representation of the UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// encodeCanonical encodes the canonical RFC-4122 form of UUID u into the -// first 36 bytes dst. -func encodeCanonical(dst []byte, u UUID) { - const hextable = "0123456789abcdef" - dst[8] = '-' - dst[13] = '-' - dst[18] = '-' - dst[23] = '-' - for i, x := range [16]byte{ - 0, 2, 4, 6, - 9, 11, - 14, 16, - 19, 21, - 24, 26, 28, 30, 32, 34, - } { - c := u[i] - dst[x] = hextable[c>>4] - dst[x+1] = hextable[c&0x0f] - } -} - -// String returns a canonical RFC-4122 string representation of the UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - var buf [36]byte - encodeCanonical(buf[:], u) - return string(buf[:]) -} - -// Format implements fmt.Formatter for UUID values. -// -// The behavior is as follows: -// The 'x' and 'X' verbs output only the hex digits of the UUID, using a-f for 'x' and A-F for 'X'. -// The 'v', '+v', 's' and 'q' verbs return the canonical RFC-4122 string representation. -// The 'S' verb returns the RFC-4122 format, but with capital hex digits. -// The '#v' verb returns the "Go syntax" representation, which is a 16 byte array initializer. -// All other verbs not handled directly by the fmt package (like '%p') are unsupported and will return -// "%!verb(uuid.UUID=value)" as recommended by the fmt package. -func (u UUID) Format(f fmt.State, c rune) { - if c == 'v' && f.Flag('#') { - fmt.Fprintf(f, "%#v", [Size]byte(u)) - return - } - switch c { - case 'x', 'X': - b := make([]byte, 32) - hex.Encode(b, u[:]) - if c == 'X' { - toUpperHex(b) - } - _, _ = f.Write(b) - case 'v', 's', 'S': - b, _ := u.MarshalText() - if c == 'S' { - toUpperHex(b) - } - _, _ = f.Write(b) - case 'q': - b := make([]byte, 38) - b[0] = '"' - encodeCanonical(b[1:], u) - b[37] = '"' - _, _ = f.Write(b) - default: - // invalid/unsupported format verb - fmt.Fprintf(f, "%%!%c(uuid.UUID=%s)", c, u.String()) - } -} - -func toUpperHex(b []byte) { - for i, c := range b { - if 'a' <= c && c <= 'f' { - b[i] = c - ('a' - 'A') - } - } -} - -// SetVersion sets the version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets the variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) - case VariantRFC4122: - u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) - case VariantMicrosoft: - u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) - case VariantFuture: - fallthrough - default: - u[8] = (u[8]&(0xff>>3) | (0x07 << 5)) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")) -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE deleted file mode 100644 index c67dad61..00000000 --- a/vendor/github.com/pmezard/go-difflib/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2013, Patrick Mezard -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - The names of its contributors may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go deleted file mode 100644 index 003e99fa..00000000 --- a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go +++ /dev/null @@ -1,772 +0,0 @@ -// Package difflib is a partial port of Python difflib module. -// -// It provides tools to compare sequences of strings and generate textual diffs. -// -// The following class and functions have been ported: -// -// - SequenceMatcher -// -// - unified_diff -// -// - context_diff -// -// Getting unified diffs was the main goal of the port. Keep in mind this code -// is mostly suitable to output text differences in a human friendly way, there -// are no guarantees generated diffs are consumable by patch(1). -package difflib - -import ( - "bufio" - "bytes" - "fmt" - "io" - "strings" -) - -func min(a, b int) int { - if a < b { - return a - } - return b -} - -func max(a, b int) int { - if a > b { - return a - } - return b -} - -func calculateRatio(matches, length int) float64 { - if length > 0 { - return 2.0 * float64(matches) / float64(length) - } - return 1.0 -} - -type Match struct { - A int - B int - Size int -} - -type OpCode struct { - Tag byte - I1 int - I2 int - J1 int - J2 int -} - -// SequenceMatcher compares sequence of strings. The basic -// algorithm predates, and is a little fancier than, an algorithm -// published in the late 1980's by Ratcliff and Obershelp under the -// hyperbolic name "gestalt pattern matching". The basic idea is to find -// the longest contiguous matching subsequence that contains no "junk" -// elements (R-O doesn't address junk). The same idea is then applied -// recursively to the pieces of the sequences to the left and to the right -// of the matching subsequence. This does not yield minimal edit -// sequences, but does tend to yield matches that "look right" to people. -// -// SequenceMatcher tries to compute a "human-friendly diff" between two -// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the -// longest *contiguous* & junk-free matching subsequence. That's what -// catches peoples' eyes. The Windows(tm) windiff has another interesting -// notion, pairing up elements that appear uniquely in each sequence. -// That, and the method here, appear to yield more intuitive difference -// reports than does diff. This method appears to be the least vulnerable -// to synching up on blocks of "junk lines", though (like blank lines in -// ordinary text files, or maybe "

" lines in HTML files). That may be -// because this is the only method of the 3 that has a *concept* of -// "junk" . -// -// Timing: Basic R-O is cubic time worst case and quadratic time expected -// case. SequenceMatcher is quadratic time for the worst case and has -// expected-case behavior dependent in a complicated way on how many -// elements the sequences have in common; best case time is linear. -type SequenceMatcher struct { - a []string - b []string - b2j map[string][]int - IsJunk func(string) bool - autoJunk bool - bJunk map[string]struct{} - matchingBlocks []Match - fullBCount map[string]int - bPopular map[string]struct{} - opCodes []OpCode -} - -func NewMatcher(a, b []string) *SequenceMatcher { - m := SequenceMatcher{autoJunk: true} - m.SetSeqs(a, b) - return &m -} - -func NewMatcherWithJunk(a, b []string, autoJunk bool, - isJunk func(string) bool) *SequenceMatcher { - - m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} - m.SetSeqs(a, b) - return &m -} - -// Set two sequences to be compared. -func (m *SequenceMatcher) SetSeqs(a, b []string) { - m.SetSeq1(a) - m.SetSeq2(b) -} - -// Set the first sequence to be compared. The second sequence to be compared is -// not changed. -// -// SequenceMatcher computes and caches detailed information about the second -// sequence, so if you want to compare one sequence S against many sequences, -// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other -// sequences. -// -// See also SetSeqs() and SetSeq2(). -func (m *SequenceMatcher) SetSeq1(a []string) { - if &a == &m.a { - return - } - m.a = a - m.matchingBlocks = nil - m.opCodes = nil -} - -// Set the second sequence to be compared. The first sequence to be compared is -// not changed. -func (m *SequenceMatcher) SetSeq2(b []string) { - if &b == &m.b { - return - } - m.b = b - m.matchingBlocks = nil - m.opCodes = nil - m.fullBCount = nil - m.chainB() -} - -func (m *SequenceMatcher) chainB() { - // Populate line -> index mapping - b2j := map[string][]int{} - for i, s := range m.b { - indices := b2j[s] - indices = append(indices, i) - b2j[s] = indices - } - - // Purge junk elements - m.bJunk = map[string]struct{}{} - if m.IsJunk != nil { - junk := m.bJunk - for s, _ := range b2j { - if m.IsJunk(s) { - junk[s] = struct{}{} - } - } - for s, _ := range junk { - delete(b2j, s) - } - } - - // Purge remaining popular elements - popular := map[string]struct{}{} - n := len(m.b) - if m.autoJunk && n >= 200 { - ntest := n/100 + 1 - for s, indices := range b2j { - if len(indices) > ntest { - popular[s] = struct{}{} - } - } - for s, _ := range popular { - delete(b2j, s) - } - } - m.bPopular = popular - m.b2j = b2j -} - -func (m *SequenceMatcher) isBJunk(s string) bool { - _, ok := m.bJunk[s] - return ok -} - -// Find longest matching block in a[alo:ahi] and b[blo:bhi]. -// -// If IsJunk is not defined: -// -// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where -// alo <= i <= i+k <= ahi -// blo <= j <= j+k <= bhi -// and for all (i',j',k') meeting those conditions, -// k >= k' -// i <= i' -// and if i == i', j <= j' -// -// In other words, of all maximal matching blocks, return one that -// starts earliest in a, and of all those maximal matching blocks that -// start earliest in a, return the one that starts earliest in b. -// -// If IsJunk is defined, first the longest matching block is -// determined as above, but with the additional restriction that no -// junk element appears in the block. Then that block is extended as -// far as possible by matching (only) junk elements on both sides. So -// the resulting block never matches on junk except as identical junk -// happens to be adjacent to an "interesting" match. -// -// If no blocks match, return (alo, blo, 0). -func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { - // CAUTION: stripping common prefix or suffix would be incorrect. - // E.g., - // ab - // acab - // Longest matching block is "ab", but if common prefix is - // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so - // strip, so ends up claiming that ab is changed to acab by - // inserting "ca" in the middle. That's minimal but unintuitive: - // "it's obvious" that someone inserted "ac" at the front. - // Windiff ends up at the same place as diff, but by pairing up - // the unique 'b's and then matching the first two 'a's. - besti, bestj, bestsize := alo, blo, 0 - - // find longest junk-free match - // during an iteration of the loop, j2len[j] = length of longest - // junk-free match ending with a[i-1] and b[j] - j2len := map[int]int{} - for i := alo; i != ahi; i++ { - // look at all instances of a[i] in b; note that because - // b2j has no junk keys, the loop is skipped if a[i] is junk - newj2len := map[int]int{} - for _, j := range m.b2j[m.a[i]] { - // a[i] matches b[j] - if j < blo { - continue - } - if j >= bhi { - break - } - k := j2len[j-1] + 1 - newj2len[j] = k - if k > bestsize { - besti, bestj, bestsize = i-k+1, j-k+1, k - } - } - j2len = newj2len - } - - // Extend the best by non-junk elements on each end. In particular, - // "popular" non-junk elements aren't in b2j, which greatly speeds - // the inner loop above, but also means "the best" match so far - // doesn't contain any junk *or* popular non-junk elements. - for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - !m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - // Now that we have a wholly interesting match (albeit possibly - // empty!), we may as well suck up the matching junk on each - // side of it too. Can't think of a good reason not to, and it - // saves post-processing the (possibly considerable) expense of - // figuring out what to do with it. In the case of an empty - // interesting match, this is clearly the right thing to do, - // because no other kind of match is possible in the regions. - for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && - m.a[besti-1] == m.b[bestj-1] { - besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 - } - for besti+bestsize < ahi && bestj+bestsize < bhi && - m.isBJunk(m.b[bestj+bestsize]) && - m.a[besti+bestsize] == m.b[bestj+bestsize] { - bestsize += 1 - } - - return Match{A: besti, B: bestj, Size: bestsize} -} - -// Return list of triples describing matching subsequences. -// -// Each triple is of the form (i, j, n), and means that -// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in -// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are -// adjacent triples in the list, and the second is not the last triple in the -// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe -// adjacent equal blocks. -// -// The last triple is a dummy, (len(a), len(b), 0), and is the only -// triple with n==0. -func (m *SequenceMatcher) GetMatchingBlocks() []Match { - if m.matchingBlocks != nil { - return m.matchingBlocks - } - - var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match - matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { - match := m.findLongestMatch(alo, ahi, blo, bhi) - i, j, k := match.A, match.B, match.Size - if match.Size > 0 { - if alo < i && blo < j { - matched = matchBlocks(alo, i, blo, j, matched) - } - matched = append(matched, match) - if i+k < ahi && j+k < bhi { - matched = matchBlocks(i+k, ahi, j+k, bhi, matched) - } - } - return matched - } - matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) - - // It's possible that we have adjacent equal blocks in the - // matching_blocks list now. - nonAdjacent := []Match{} - i1, j1, k1 := 0, 0, 0 - for _, b := range matched { - // Is this block adjacent to i1, j1, k1? - i2, j2, k2 := b.A, b.B, b.Size - if i1+k1 == i2 && j1+k1 == j2 { - // Yes, so collapse them -- this just increases the length of - // the first block by the length of the second, and the first - // block so lengthened remains the block to compare against. - k1 += k2 - } else { - // Not adjacent. Remember the first block (k1==0 means it's - // the dummy we started with), and make the second block the - // new block to compare against. - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - i1, j1, k1 = i2, j2, k2 - } - } - if k1 > 0 { - nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) - } - - nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) - m.matchingBlocks = nonAdjacent - return m.matchingBlocks -} - -// Return list of 5-tuples describing how to turn a into b. -// -// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple -// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the -// tuple preceding it, and likewise for j1 == the previous j2. -// -// The tags are characters, with these meanings: -// -// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] -// -// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. -// -// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. -// -// 'e' (equal): a[i1:i2] == b[j1:j2] -func (m *SequenceMatcher) GetOpCodes() []OpCode { - if m.opCodes != nil { - return m.opCodes - } - i, j := 0, 0 - matching := m.GetMatchingBlocks() - opCodes := make([]OpCode, 0, len(matching)) - for _, m := range matching { - // invariant: we've pumped out correct diffs to change - // a[:i] into b[:j], and the next matching block is - // a[ai:ai+size] == b[bj:bj+size]. So we need to pump - // out a diff to change a[i:ai] into b[j:bj], pump out - // the matching block, and move (i,j) beyond the match - ai, bj, size := m.A, m.B, m.Size - tag := byte(0) - if i < ai && j < bj { - tag = 'r' - } else if i < ai { - tag = 'd' - } else if j < bj { - tag = 'i' - } - if tag > 0 { - opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) - } - i, j = ai+size, bj+size - // the list of matching blocks is terminated by a - // sentinel with size 0 - if size > 0 { - opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) - } - } - m.opCodes = opCodes - return m.opCodes -} - -// Isolate change clusters by eliminating ranges with no changes. -// -// Return a generator of groups with up to n lines of context. -// Each group is in the same format as returned by GetOpCodes(). -func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { - if n < 0 { - n = 3 - } - codes := m.GetOpCodes() - if len(codes) == 0 { - codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} - } - // Fixup leading and trailing groups if they show no changes. - if codes[0].Tag == 'e' { - c := codes[0] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} - } - if codes[len(codes)-1].Tag == 'e' { - c := codes[len(codes)-1] - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} - } - nn := n + n - groups := [][]OpCode{} - group := []OpCode{} - for _, c := range codes { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - // End the current group and start a new one whenever - // there is a large range with no changes. - if c.Tag == 'e' && i2-i1 > nn { - group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), - j1, min(j2, j1+n)}) - groups = append(groups, group) - group = []OpCode{} - i1, j1 = max(i1, i2-n), max(j1, j2-n) - } - group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) - } - if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { - groups = append(groups, group) - } - return groups -} - -// Return a measure of the sequences' similarity (float in [0,1]). -// -// Where T is the total number of elements in both sequences, and -// M is the number of matches, this is 2.0*M / T. -// Note that this is 1 if the sequences are identical, and 0 if -// they have nothing in common. -// -// .Ratio() is expensive to compute if you haven't already computed -// .GetMatchingBlocks() or .GetOpCodes(), in which case you may -// want to try .QuickRatio() or .RealQuickRation() first to get an -// upper bound. -func (m *SequenceMatcher) Ratio() float64 { - matches := 0 - for _, m := range m.GetMatchingBlocks() { - matches += m.Size - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() relatively quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute. -func (m *SequenceMatcher) QuickRatio() float64 { - // viewing a and b as multisets, set matches to the cardinality - // of their intersection; this counts the number of matches - // without regard to order, so is clearly an upper bound - if m.fullBCount == nil { - m.fullBCount = map[string]int{} - for _, s := range m.b { - m.fullBCount[s] = m.fullBCount[s] + 1 - } - } - - // avail[x] is the number of times x appears in 'b' less the - // number of times we've seen it in 'a' so far ... kinda - avail := map[string]int{} - matches := 0 - for _, s := range m.a { - n, ok := avail[s] - if !ok { - n = m.fullBCount[s] - } - avail[s] = n - 1 - if n > 0 { - matches += 1 - } - } - return calculateRatio(matches, len(m.a)+len(m.b)) -} - -// Return an upper bound on ratio() very quickly. -// -// This isn't defined beyond that it is an upper bound on .Ratio(), and -// is faster to compute than either .Ratio() or .QuickRatio(). -func (m *SequenceMatcher) RealQuickRatio() float64 { - la, lb := len(m.a), len(m.b) - return calculateRatio(min(la, lb), la+lb) -} - -// Convert range to the "ed" format -func formatRangeUnified(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 1 { - return fmt.Sprintf("%d", beginning) - } - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - return fmt.Sprintf("%d,%d", beginning, length) -} - -// Unified diff parameters -type UnifiedDiff struct { - A []string // First sequence lines - FromFile string // First file name - FromDate string // First file time - B []string // Second sequence lines - ToFile string // Second file name - ToDate string // Second file time - Eol string // Headers end of line, defaults to LF - Context int // Number of context lines -} - -// Compare two sequences of lines; generate the delta as a unified diff. -// -// Unified diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by 'n' which -// defaults to three. -// -// By default, the diff control lines (those with ---, +++, or @@) are -// created with a trailing newline. This is helpful so that inputs -// created from file.readlines() result in diffs that are suitable for -// file.writelines() since both the inputs and outputs have trailing -// newlines. -// -// For inputs that do not have trailing newlines, set the lineterm -// argument to "" so that the output will be uniformly newline free. -// -// The unidiff format normally has a header for filenames and modification -// times. Any or all of these may be specified using strings for -// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. -// The modification times are normally expressed in the ISO 8601 format. -func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - wf := func(format string, args ...interface{}) error { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - return err - } - ws := func(s string) error { - _, err := buf.WriteString(s) - return err - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - err := wf("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) - if err != nil { - return err - } - err = wf("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) - if err != nil { - return err - } - } - } - first, last := g[0], g[len(g)-1] - range1 := formatRangeUnified(first.I1, last.I2) - range2 := formatRangeUnified(first.J1, last.J2) - if err := wf("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { - return err - } - for _, c := range g { - i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 - if c.Tag == 'e' { - for _, line := range diff.A[i1:i2] { - if err := ws(" " + line); err != nil { - return err - } - } - continue - } - if c.Tag == 'r' || c.Tag == 'd' { - for _, line := range diff.A[i1:i2] { - if err := ws("-" + line); err != nil { - return err - } - } - } - if c.Tag == 'r' || c.Tag == 'i' { - for _, line := range diff.B[j1:j2] { - if err := ws("+" + line); err != nil { - return err - } - } - } - } - } - return nil -} - -// Like WriteUnifiedDiff but returns the diff a string. -func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteUnifiedDiff(w, diff) - return string(w.Bytes()), err -} - -// Convert range to the "ed" format. -func formatRangeContext(start, stop int) string { - // Per the diff spec at http://www.unix.org/single_unix_specification/ - beginning := start + 1 // lines start numbering with one - length := stop - start - if length == 0 { - beginning -= 1 // empty ranges begin at line just before the range - } - if length <= 1 { - return fmt.Sprintf("%d", beginning) - } - return fmt.Sprintf("%d,%d", beginning, beginning+length-1) -} - -type ContextDiff UnifiedDiff - -// Compare two sequences of lines; generate the delta as a context diff. -// -// Context diffs are a compact way of showing line changes and a few -// lines of context. The number of context lines is set by diff.Context -// which defaults to three. -// -// By default, the diff control lines (those with *** or ---) are -// created with a trailing newline. -// -// For inputs that do not have trailing newlines, set the diff.Eol -// argument to "" so that the output will be uniformly newline free. -// -// The context diff format normally has a header for filenames and -// modification times. Any or all of these may be specified using -// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. -// The modification times are normally expressed in the ISO 8601 format. -// If not specified, the strings default to blanks. -func WriteContextDiff(writer io.Writer, diff ContextDiff) error { - buf := bufio.NewWriter(writer) - defer buf.Flush() - var diffErr error - wf := func(format string, args ...interface{}) { - _, err := buf.WriteString(fmt.Sprintf(format, args...)) - if diffErr == nil && err != nil { - diffErr = err - } - } - ws := func(s string) { - _, err := buf.WriteString(s) - if diffErr == nil && err != nil { - diffErr = err - } - } - - if len(diff.Eol) == 0 { - diff.Eol = "\n" - } - - prefix := map[byte]string{ - 'i': "+ ", - 'd': "- ", - 'r': "! ", - 'e': " ", - } - - started := false - m := NewMatcher(diff.A, diff.B) - for _, g := range m.GetGroupedOpCodes(diff.Context) { - if !started { - started = true - fromDate := "" - if len(diff.FromDate) > 0 { - fromDate = "\t" + diff.FromDate - } - toDate := "" - if len(diff.ToDate) > 0 { - toDate = "\t" + diff.ToDate - } - if diff.FromFile != "" || diff.ToFile != "" { - wf("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) - wf("--- %s%s%s", diff.ToFile, toDate, diff.Eol) - } - } - - first, last := g[0], g[len(g)-1] - ws("***************" + diff.Eol) - - range1 := formatRangeContext(first.I1, last.I2) - wf("*** %s ****%s", range1, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'd' { - for _, cc := range g { - if cc.Tag == 'i' { - continue - } - for _, line := range diff.A[cc.I1:cc.I2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - - range2 := formatRangeContext(first.J1, last.J2) - wf("--- %s ----%s", range2, diff.Eol) - for _, c := range g { - if c.Tag == 'r' || c.Tag == 'i' { - for _, cc := range g { - if cc.Tag == 'd' { - continue - } - for _, line := range diff.B[cc.J1:cc.J2] { - ws(prefix[cc.Tag] + line) - } - } - break - } - } - } - return diffErr -} - -// Like WriteContextDiff but returns the diff a string. -func GetContextDiffString(diff ContextDiff) (string, error) { - w := &bytes.Buffer{} - err := WriteContextDiff(w, diff) - return string(w.Bytes()), err -} - -// Split a string on "\n" while preserving them. The output can be used -// as input for UnifiedDiff and ContextDiff structures. -func SplitLines(s string) []string { - lines := strings.SplitAfter(s, "\n") - lines[len(lines)-1] += "\n" - return lines -} diff --git a/vendor/github.com/stretchr/objx/.codeclimate.yml b/vendor/github.com/stretchr/objx/.codeclimate.yml deleted file mode 100644 index 559fa399..00000000 --- a/vendor/github.com/stretchr/objx/.codeclimate.yml +++ /dev/null @@ -1,21 +0,0 @@ -engines: - gofmt: - enabled: true - golint: - enabled: true - govet: - enabled: true - -exclude_patterns: -- ".github/" -- "vendor/" -- "codegen/" -- "*.yml" -- ".*.yml" -- "*.md" -- "Gopkg.*" -- "doc.go" -- "type_specific_codegen_test.go" -- "type_specific_codegen.go" -- ".gitignore" -- "LICENSE" diff --git a/vendor/github.com/stretchr/objx/.gitignore b/vendor/github.com/stretchr/objx/.gitignore deleted file mode 100644 index ea58090b..00000000 --- a/vendor/github.com/stretchr/objx/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/stretchr/objx/LICENSE b/vendor/github.com/stretchr/objx/LICENSE deleted file mode 100644 index 44d4d9d5..00000000 --- a/vendor/github.com/stretchr/objx/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors - -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/stretchr/objx/README.md b/vendor/github.com/stretchr/objx/README.md deleted file mode 100644 index 78dc1f8b..00000000 --- a/vendor/github.com/stretchr/objx/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# Objx -[![Build Status](https://travis-ci.org/stretchr/objx.svg?branch=master)](https://travis-ci.org/stretchr/objx) -[![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/objx)](https://goreportcard.com/report/github.com/stretchr/objx) -[![Maintainability](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/maintainability)](https://codeclimate.com/github/stretchr/objx/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/test_coverage)](https://codeclimate.com/github/stretchr/objx/test_coverage) -[![Sourcegraph](https://sourcegraph.com/github.com/stretchr/objx/-/badge.svg)](https://sourcegraph.com/github.com/stretchr/objx) -[![GoDoc](https://pkg.go.dev/badge/github.com/stretchr/objx?utm_source=godoc)](https://pkg.go.dev/github.com/stretchr/objx) - -Objx - Go package for dealing with maps, slices, JSON and other data. - -Get started: - -- Install Objx with [one line of code](#installation), or [update it with another](#staying-up-to-date) -- Check out the API Documentation http://pkg.go.dev/github.com/stretchr/objx - -## Overview -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc. - -### Pattern -Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below. - -### Reading data -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -### Ranging -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } - -## Installation -To install Objx, use go get: - - go get github.com/stretchr/objx - -### Staying up to date -To update Objx to the latest version, run: - - go get -u github.com/stretchr/objx - -### Supported go versions -We currently support the three recent major Go versions. - -## Contributing -Please feel free to submit issues, fork the repository and send pull requests! diff --git a/vendor/github.com/stretchr/objx/Taskfile.yml b/vendor/github.com/stretchr/objx/Taskfile.yml deleted file mode 100644 index 8a79e8d6..00000000 --- a/vendor/github.com/stretchr/objx/Taskfile.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3' - -tasks: - default: - deps: [test] - - lint: - desc: Checks code style - cmds: - - gofmt -d -s *.go - - go vet ./... - silent: true - - lint-fix: - desc: Fixes code style - cmds: - - gofmt -w -s *.go - - test: - desc: Runs go tests - cmds: - - go test -race ./... - - test-coverage: - desc: Runs go tests and calculates test coverage - cmds: - - go test -race -coverprofile=c.out ./... diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go deleted file mode 100644 index 72f1d1c1..00000000 --- a/vendor/github.com/stretchr/objx/accessors.go +++ /dev/null @@ -1,197 +0,0 @@ -package objx - -import ( - "reflect" - "regexp" - "strconv" - "strings" -) - -const ( - // PathSeparator is the character used to separate the elements - // of the keypath. - // - // For example, `location.address.city` - PathSeparator string = "." - - // arrayAccessRegexString is the regex used to extract the array number - // from the access path - arrayAccessRegexString = `^(.+)\[([0-9]+)\]$` - - // mapAccessRegexString is the regex used to extract the map key - // from the access path - mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$` -) - -// arrayAccessRegex is the compiled arrayAccessRegexString -var arrayAccessRegex = regexp.MustCompile(arrayAccessRegexString) - -// mapAccessRegex is the compiled mapAccessRegexString -var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) - -// Get gets the value using the specified selector and -// returns it inside a new Obj object. -// -// If it cannot find the value, Get will return a nil -// value inside an instance of Obj. -// -// Get can only operate directly on map[string]interface{} and []interface. -// -// # Example -// -// To access the title of the third chapter of the second book, do: -// -// o.Get("books[1].chapters[2].title") -func (m Map) Get(selector string) *Value { - rawObj := access(m, selector, nil, false) - return &Value{data: rawObj} -} - -// Set sets the value using the specified selector and -// returns the object on which Set was called. -// -// Set can only operate directly on map[string]interface{} and []interface -// -// # Example -// -// To set the title of the third chapter of the second book, do: -// -// o.Set("books[1].chapters[2].title","Time to Go") -func (m Map) Set(selector string, value interface{}) Map { - access(m, selector, value, true) - return m -} - -// getIndex returns the index, which is hold in s by two branches. -// It also returns s without the index part, e.g. name[1] will return (1, name). -// If no index is found, -1 is returned -func getIndex(s string) (int, string) { - arrayMatches := arrayAccessRegex.FindStringSubmatch(s) - if len(arrayMatches) > 0 { - // Get the key into the map - selector := arrayMatches[1] - // Get the index into the array at the key - // We know this can't fail because arrayMatches[2] is an int for sure - index, _ := strconv.Atoi(arrayMatches[2]) - return index, selector - } - return -1, s -} - -// getKey returns the key which is held in s by two brackets. -// It also returns the next selector. -func getKey(s string) (string, string) { - selSegs := strings.SplitN(s, PathSeparator, 2) - thisSel := selSegs[0] - nextSel := "" - - if len(selSegs) > 1 { - nextSel = selSegs[1] - } - - mapMatches := mapAccessRegex.FindStringSubmatch(s) - if len(mapMatches) > 0 { - if _, err := strconv.Atoi(mapMatches[2]); err != nil { - thisSel = mapMatches[1] - nextSel = "[" + mapMatches[2] + "]" + mapMatches[3] - - if thisSel == "" { - thisSel = mapMatches[2] - nextSel = mapMatches[3] - } - - if nextSel == "" { - selSegs = []string{"", ""} - } else if nextSel[0] == '.' { - nextSel = nextSel[1:] - } - } - } - - return thisSel, nextSel -} - -// access accesses the object using the selector and performs the -// appropriate action. -func access(current interface{}, selector string, value interface{}, isSet bool) interface{} { - thisSel, nextSel := getKey(selector) - - indexes := []int{} - for strings.Contains(thisSel, "[") { - prevSel := thisSel - index := -1 - index, thisSel = getIndex(thisSel) - indexes = append(indexes, index) - if prevSel == thisSel { - break - } - } - - if curMap, ok := current.(Map); ok { - current = map[string]interface{}(curMap) - } - // get the object in question - switch current.(type) { - case map[string]interface{}: - curMSI := current.(map[string]interface{}) - if nextSel == "" && isSet { - curMSI[thisSel] = value - return nil - } - - _, ok := curMSI[thisSel].(map[string]interface{}) - if !ok { - _, ok = curMSI[thisSel].(Map) - } - - if (curMSI[thisSel] == nil || !ok) && len(indexes) == 0 && isSet { - curMSI[thisSel] = map[string]interface{}{} - } - - current = curMSI[thisSel] - default: - current = nil - } - - // do we need to access the item of an array? - if len(indexes) > 0 { - num := len(indexes) - for num > 0 { - num-- - index := indexes[num] - indexes = indexes[:num] - if array, ok := interSlice(current); ok { - if index < len(array) { - current = array[index] - } else { - current = nil - break - } - } - } - } - - if nextSel != "" { - current = access(current, nextSel, value, isSet) - } - return current -} - -func interSlice(slice interface{}) ([]interface{}, bool) { - if array, ok := slice.([]interface{}); ok { - return array, ok - } - - s := reflect.ValueOf(slice) - if s.Kind() != reflect.Slice { - return nil, false - } - - ret := make([]interface{}, s.Len()) - - for i := 0; i < s.Len(); i++ { - ret[i] = s.Index(i).Interface() - } - - return ret, true -} diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go deleted file mode 100644 index 01c63d7d..00000000 --- a/vendor/github.com/stretchr/objx/conversions.go +++ /dev/null @@ -1,280 +0,0 @@ -package objx - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "net/url" - "strconv" -) - -// SignatureSeparator is the character that is used to -// separate the Base64 string from the security signature. -const SignatureSeparator = "_" - -// URLValuesSliceKeySuffix is the character that is used to -// specify a suffix for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -var urlValuesSliceKeySuffix = "[]" - -const ( - URLValuesSliceKeySuffixEmpty = "" - URLValuesSliceKeySuffixArray = "[]" - URLValuesSliceKeySuffixIndex = "[i]" -) - -// SetURLValuesSliceKeySuffix sets the character that is used to -// specify a suffix for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -func SetURLValuesSliceKeySuffix(s string) error { - if s == URLValuesSliceKeySuffixEmpty || s == URLValuesSliceKeySuffixArray || s == URLValuesSliceKeySuffixIndex { - urlValuesSliceKeySuffix = s - return nil - } - - return errors.New("objx: Invalid URLValuesSliceKeySuffix provided.") -} - -// JSON converts the contained object to a JSON string -// representation -func (m Map) JSON() (string, error) { - for k, v := range m { - m[k] = cleanUp(v) - } - - result, err := json.Marshal(m) - if err != nil { - err = errors.New("objx: JSON encode failed with: " + err.Error()) - } - return string(result), err -} - -func cleanUpInterfaceArray(in []interface{}) []interface{} { - result := make([]interface{}, len(in)) - for i, v := range in { - result[i] = cleanUp(v) - } - return result -} - -func cleanUpInterfaceMap(in map[interface{}]interface{}) Map { - result := Map{} - for k, v := range in { - result[fmt.Sprintf("%v", k)] = cleanUp(v) - } - return result -} - -func cleanUpStringMap(in map[string]interface{}) Map { - result := Map{} - for k, v := range in { - result[k] = cleanUp(v) - } - return result -} - -func cleanUpMSIArray(in []map[string]interface{}) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUpMapArray(in []Map) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUp(v interface{}) interface{} { - switch v := v.(type) { - case []interface{}: - return cleanUpInterfaceArray(v) - case []map[string]interface{}: - return cleanUpMSIArray(v) - case map[interface{}]interface{}: - return cleanUpInterfaceMap(v) - case Map: - return cleanUpStringMap(v) - case []Map: - return cleanUpMapArray(v) - default: - return v - } -} - -// MustJSON converts the contained object to a JSON string -// representation and panics if there is an error -func (m Map) MustJSON() string { - result, err := m.JSON() - if err != nil { - panic(err.Error()) - } - return result -} - -// Base64 converts the contained object to a Base64 string -// representation of the JSON string representation -func (m Map) Base64() (string, error) { - var buf bytes.Buffer - - jsonData, err := m.JSON() - if err != nil { - return "", err - } - - encoder := base64.NewEncoder(base64.StdEncoding, &buf) - _, _ = encoder.Write([]byte(jsonData)) - _ = encoder.Close() - - return buf.String(), nil -} - -// MustBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and panics -// if there is an error -func (m Map) MustBase64() string { - result, err := m.Base64() - if err != nil { - panic(err.Error()) - } - return result -} - -// SignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key. -func (m Map) SignedBase64(key string) (string, error) { - base64, err := m.Base64() - if err != nil { - return "", err - } - - sig := HashWithKey(base64, key) - return base64 + SignatureSeparator + sig, nil -} - -// MustSignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key and panics if there is an error -func (m Map) MustSignedBase64(key string) string { - result, err := m.SignedBase64(key) - if err != nil { - panic(err.Error()) - } - return result -} - -/* - URL Query - ------------------------------------------------ -*/ - -// URLValues creates a url.Values object from an Obj. This -// function requires that the wrapped object be a map[string]interface{} -func (m Map) URLValues() url.Values { - vals := make(url.Values) - - m.parseURLValues(m, vals, "") - - return vals -} - -func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) { - useSliceIndex := false - if urlValuesSliceKeySuffix == "[i]" { - useSliceIndex = true - } - - for k, v := range queryMap { - val := &Value{data: v} - switch { - case val.IsObjxMap(): - if key == "" { - m.parseURLValues(val.ObjxMap(), vals, k) - } else { - m.parseURLValues(val.ObjxMap(), vals, key+"["+k+"]") - } - case val.IsObjxMapSlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustObjxMapSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(sv, vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustObjxMapSlice() { - m.parseURLValues(sv, vals, sliceKey) - } - } - case val.IsMSISlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustMSISlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(New(sv), vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustMSISlice() { - m.parseURLValues(New(sv), vals, sliceKey) - } - } - case val.IsStrSlice(), val.IsBoolSlice(), - val.IsFloat32Slice(), val.IsFloat64Slice(), - val.IsIntSlice(), val.IsInt8Slice(), val.IsInt16Slice(), val.IsInt32Slice(), val.IsInt64Slice(), - val.IsUintSlice(), val.IsUint8Slice(), val.IsUint16Slice(), val.IsUint32Slice(), val.IsUint64Slice(): - - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.StringSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - vals.Set(sk, sv) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - vals[sliceKey] = val.StringSlice() - } - - default: - if key == "" { - vals.Set(k, val.String()) - } else { - vals.Set(key+"["+k+"]", val.String()) - } - } - } -} - -// URLQuery gets an encoded URL query representing the given -// Obj. This function requires that the wrapped object be a -// map[string]interface{} -func (m Map) URLQuery() (string, error) { - return m.URLValues().Encode(), nil -} diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go deleted file mode 100644 index b170af74..00000000 --- a/vendor/github.com/stretchr/objx/doc.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Package objx provides utilities for dealing with maps, slices, JSON and other data. - -# Overview - -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes -a powerful `Get` method (among others) that allows you to easily and quickly get -access to data within the map, without having to worry too much about type assertions, -missing data, default values etc. - -# Pattern - -Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. -Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, -the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, -or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, -manipulating and selecting that data. You can find out more by exploring the index below. - -# Reading data - -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -# Ranging - -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. -For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } -*/ -package objx diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go deleted file mode 100644 index ab9f9ae6..00000000 --- a/vendor/github.com/stretchr/objx/map.go +++ /dev/null @@ -1,214 +0,0 @@ -package objx - -import ( - "encoding/base64" - "encoding/json" - "errors" - "io/ioutil" - "net/url" - "strings" -) - -// MSIConvertable is an interface that defines methods for converting your -// custom types to a map[string]interface{} representation. -type MSIConvertable interface { - // MSI gets a map[string]interface{} (msi) representing the - // object. - MSI() map[string]interface{} -} - -// Map provides extended functionality for working with -// untyped data, in particular map[string]interface (msi). -type Map map[string]interface{} - -// Value returns the internal value instance -func (m Map) Value() *Value { - return &Value{data: m} -} - -// Nil represents a nil Map. -var Nil = New(nil) - -// New creates a new Map containing the map[string]interface{} in the data argument. -// If the data argument is not a map[string]interface, New attempts to call the -// MSI() method on the MSIConvertable interface to create one. -func New(data interface{}) Map { - if _, ok := data.(map[string]interface{}); !ok { - if converter, ok := data.(MSIConvertable); ok { - data = converter.MSI() - } else { - return nil - } - } - return Map(data.(map[string]interface{})) -} - -// MSI creates a map[string]interface{} and puts it inside a new Map. -// -// The arguments follow a key, value pattern. -// -// Returns nil if any key argument is non-string or if there are an odd number of arguments. -// -// # Example -// -// To easily create Maps: -// -// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) -// -// // creates an Map equivalent to -// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}} -func MSI(keyAndValuePairs ...interface{}) Map { - newMap := Map{} - keyAndValuePairsLen := len(keyAndValuePairs) - if keyAndValuePairsLen%2 != 0 { - return nil - } - for i := 0; i < keyAndValuePairsLen; i = i + 2 { - key := keyAndValuePairs[i] - value := keyAndValuePairs[i+1] - - // make sure the key is a string - keyString, keyStringOK := key.(string) - if !keyStringOK { - return nil - } - newMap[keyString] = value - } - return newMap -} - -// ****** Conversion Constructors - -// MustFromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Panics if the JSON is invalid. -func MustFromJSON(jsonString string) Map { - o, err := FromJSON(jsonString) - if err != nil { - panic("objx: MustFromJSON failed with error: " + err.Error()) - } - return o -} - -// MustFromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Panics if the JSON is invalid. -func MustFromJSONSlice(jsonString string) []Map { - slice, err := FromJSONSlice(jsonString) - if err != nil { - panic("objx: MustFromJSONSlice failed with error: " + err.Error()) - } - return slice -} - -// FromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Returns an error if the JSON is invalid. -func FromJSON(jsonString string) (Map, error) { - var m Map - err := json.Unmarshal([]byte(jsonString), &m) - if err != nil { - return Nil, err - } - return m, nil -} - -// FromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Returns an error if the JSON is invalid. -func FromJSONSlice(jsonString string) ([]Map, error) { - var slice []Map - err := json.Unmarshal([]byte(jsonString), &slice) - if err != nil { - return nil, err - } - return slice, nil -} - -// FromBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by Base64 -func FromBase64(base64String string) (Map, error) { - decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String)) - decoded, err := ioutil.ReadAll(decoder) - if err != nil { - return nil, err - } - return FromJSON(string(decoded)) -} - -// MustFromBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromBase64(base64String string) Map { - result, err := FromBase64(base64String) - if err != nil { - panic("objx: MustFromBase64 failed with error: " + err.Error()) - } - return result -} - -// FromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by SignedBase64 -func FromSignedBase64(base64String, key string) (Map, error) { - parts := strings.Split(base64String, SignatureSeparator) - if len(parts) != 2 { - return nil, errors.New("objx: Signed base64 string is malformed") - } - - sig := HashWithKey(parts[0], key) - if parts[1] != sig { - return nil, errors.New("objx: Signature for base64 data does not match") - } - return FromBase64(parts[0]) -} - -// MustFromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromSignedBase64(base64String, key string) Map { - result, err := FromSignedBase64(base64String, key) - if err != nil { - panic("objx: MustFromSignedBase64 failed with error: " + err.Error()) - } - return result -} - -// FromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -func FromURLQuery(query string) (Map, error) { - vals, err := url.ParseQuery(query) - if err != nil { - return nil, err - } - m := Map{} - for k, vals := range vals { - m[k] = vals[0] - } - return m, nil -} - -// MustFromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -// -// Panics if it encounters an error -func MustFromURLQuery(query string) Map { - o, err := FromURLQuery(query) - if err != nil { - panic("objx: MustFromURLQuery failed with error: " + err.Error()) - } - return o -} diff --git a/vendor/github.com/stretchr/objx/mutations.go b/vendor/github.com/stretchr/objx/mutations.go deleted file mode 100644 index c3400a3f..00000000 --- a/vendor/github.com/stretchr/objx/mutations.go +++ /dev/null @@ -1,77 +0,0 @@ -package objx - -// Exclude returns a new Map with the keys in the specified []string -// excluded. -func (m Map) Exclude(exclude []string) Map { - excluded := make(Map) - for k, v := range m { - if !contains(exclude, k) { - excluded[k] = v - } - } - return excluded -} - -// Copy creates a shallow copy of the Obj. -func (m Map) Copy() Map { - copied := Map{} - for k, v := range m { - copied[k] = v - } - return copied -} - -// Merge blends the specified map with a copy of this map and returns the result. -// -// Keys that appear in both will be selected from the specified map. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) Merge(merge Map) Map { - return m.Copy().MergeHere(merge) -} - -// MergeHere blends the specified map with this map and returns the current map. -// -// Keys that appear in both will be selected from the specified map. The original map -// will be modified. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) MergeHere(merge Map) Map { - for k, v := range merge { - m[k] = v - } - return m -} - -// Transform builds a new Obj giving the transformer a chance -// to change the keys and values as it goes. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map { - newMap := Map{} - for k, v := range m { - modifiedKey, modifiedVal := transformer(k, v) - newMap[modifiedKey] = modifiedVal - } - return newMap -} - -// TransformKeys builds a new map using the specified key mapping. -// -// Unspecified keys will be unaltered. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) TransformKeys(mapping map[string]string) Map { - return m.Transform(func(key string, value interface{}) (string, interface{}) { - if newKey, ok := mapping[key]; ok { - return newKey, value - } - return key, value - }) -} - -// Checks if a string slice contains a string -func contains(s []string, e string) bool { - for _, a := range s { - if a == e { - return true - } - } - return false -} diff --git a/vendor/github.com/stretchr/objx/security.go b/vendor/github.com/stretchr/objx/security.go deleted file mode 100644 index 692be8e2..00000000 --- a/vendor/github.com/stretchr/objx/security.go +++ /dev/null @@ -1,12 +0,0 @@ -package objx - -import ( - "crypto/sha1" - "encoding/hex" -) - -// HashWithKey hashes the specified string using the security key -func HashWithKey(data, key string) string { - d := sha1.Sum([]byte(data + ":" + key)) - return hex.EncodeToString(d[:]) -} diff --git a/vendor/github.com/stretchr/objx/tests.go b/vendor/github.com/stretchr/objx/tests.go deleted file mode 100644 index d9e0b479..00000000 --- a/vendor/github.com/stretchr/objx/tests.go +++ /dev/null @@ -1,17 +0,0 @@ -package objx - -// Has gets whether there is something at the specified selector -// or not. -// -// If m is nil, Has will always return false. -func (m Map) Has(selector string) bool { - if m == nil { - return false - } - return !m.Get(selector).IsNil() -} - -// IsNil gets whether the data is nil or not. -func (v *Value) IsNil() bool { - return v == nil || v.data == nil -} diff --git a/vendor/github.com/stretchr/objx/type_specific.go b/vendor/github.com/stretchr/objx/type_specific.go deleted file mode 100644 index 80f88d9f..00000000 --- a/vendor/github.com/stretchr/objx/type_specific.go +++ /dev/null @@ -1,346 +0,0 @@ -package objx - -/* - MSI (map[string]interface{} and []map[string]interface{}) -*/ - -// MSI gets the value as a map[string]interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustMSI gets the value as a map[string]interface{}. -// -// Panics if the object is not a map[string]interface{}. -func (v *Value) MustMSI() map[string]interface{} { - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - return v.data.(map[string]interface{}) -} - -// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault -// value or nil if the value is not a []map[string]interface{}. -func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { - if s, ok := v.data.([]map[string]interface{}); ok { - return s - } - - s := v.ObjxMapSlice() - if s == nil { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]map[string]interface{}, len(s)) - for i := range s { - result[i] = s[i].Value().MSI() - } - return result -} - -// MustMSISlice gets the value as a []map[string]interface{}. -// -// Panics if the object is not a []map[string]interface{}. -func (v *Value) MustMSISlice() []map[string]interface{} { - if s := v.MSISlice(); s != nil { - return s - } - - return v.data.([]map[string]interface{}) -} - -// IsMSI gets whether the object contained is a map[string]interface{} or not. -func (v *Value) IsMSI() bool { - _, ok := v.data.(map[string]interface{}) - if !ok { - _, ok = v.data.(Map) - } - return ok -} - -// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. -func (v *Value) IsMSISlice() bool { - _, ok := v.data.([]map[string]interface{}) - if !ok { - _, ok = v.data.([]Map) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - return ok -} - -// EachMSI calls the specified callback for each object -// in the []map[string]interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { - for index, val := range v.MustMSISlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereMSI uses the specified decider function to select items -// from the []map[string]interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { - var selected []map[string]interface{} - v.EachMSI(func(index int, val map[string]interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupMSI uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]map[string]interface{}. -func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { - groups := make(map[string][]map[string]interface{}) - v.EachMSI(func(index int, val map[string]interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]map[string]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceMSI uses the specified function to replace each map[string]interface{}s -// by iterating each item. The data in the returned result will be a -// []map[string]interface{} containing the replaced items. -func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { - arr := v.MustMSISlice() - replaced := make([]map[string]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectMSI uses the specified collector function to collect a value -// for each of the map[string]interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { - arr := v.MustMSISlice() - collected := make([]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - ObjxMap ((Map) and [](Map)) -*/ - -// ObjxMap gets the value as a (Map), returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { - if s, ok := v.data.((Map)); ok { - return s - } - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return New(nil) -} - -// MustObjxMap gets the value as a (Map). -// -// Panics if the object is not a (Map). -func (v *Value) MustObjxMap() Map { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - return v.data.((Map)) -} - -// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault -// value or nil if the value is not a [](Map). -func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { - if s, ok := v.data.([]Map); ok { - return s - } - - if s, ok := v.data.([]map[string]interface{}); ok { - result := make([]Map, len(s)) - for i := range s { - result[i] = s[i] - } - return result - } - - s, ok := v.data.([]interface{}) - if !ok { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]Map, len(s)) - for i := range s { - switch s[i].(type) { - case Map: - result[i] = s[i].(Map) - case map[string]interface{}: - result[i] = New(s[i]) - default: - return nil - } - } - return result -} - -// MustObjxMapSlice gets the value as a [](Map). -// -// Panics if the object is not a [](Map). -func (v *Value) MustObjxMapSlice() [](Map) { - if s := v.ObjxMapSlice(); s != nil { - return s - } - return v.data.([](Map)) -} - -// IsObjxMap gets whether the object contained is a (Map) or not. -func (v *Value) IsObjxMap() bool { - _, ok := v.data.((Map)) - if !ok { - _, ok = v.data.(map[string]interface{}) - } - return ok -} - -// IsObjxMapSlice gets whether the object contained is a [](Map) or not. -func (v *Value) IsObjxMapSlice() bool { - _, ok := v.data.([](Map)) - if !ok { - _, ok = v.data.([]map[string]interface{}) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - - return ok -} - -// EachObjxMap calls the specified callback for each object -// in the [](Map). -// -// Panics if the object is the wrong type. -func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { - for index, val := range v.MustObjxMapSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereObjxMap uses the specified decider function to select items -// from the [](Map). The object contained in the result will contain -// only the selected items. -func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { - var selected [](Map) - v.EachObjxMap(func(index int, val Map) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupObjxMap uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][](Map). -func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { - groups := make(map[string][](Map)) - v.EachObjxMap(func(index int, val Map) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([](Map), 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceObjxMap uses the specified function to replace each (Map)s -// by iterating each item. The data in the returned result will be a -// [](Map) containing the replaced items. -func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { - arr := v.MustObjxMapSlice() - replaced := make([](Map), len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectObjxMap uses the specified collector function to collect a value -// for each of the (Map)s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { - arr := v.MustObjxMapSlice() - collected := make([]interface{}, len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen.go b/vendor/github.com/stretchr/objx/type_specific_codegen.go deleted file mode 100644 index 45850456..00000000 --- a/vendor/github.com/stretchr/objx/type_specific_codegen.go +++ /dev/null @@ -1,2261 +0,0 @@ -package objx - -/* - Inter (interface{} and []interface{}) -*/ - -// Inter gets the value as a interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Inter(optionalDefault ...interface{}) interface{} { - if s, ok := v.data.(interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInter gets the value as a interface{}. -// -// Panics if the object is not a interface{}. -func (v *Value) MustInter() interface{} { - return v.data.(interface{}) -} - -// InterSlice gets the value as a []interface{}, returns the optionalDefault -// value or nil if the value is not a []interface{}. -func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} { - if s, ok := v.data.([]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInterSlice gets the value as a []interface{}. -// -// Panics if the object is not a []interface{}. -func (v *Value) MustInterSlice() []interface{} { - return v.data.([]interface{}) -} - -// IsInter gets whether the object contained is a interface{} or not. -func (v *Value) IsInter() bool { - _, ok := v.data.(interface{}) - return ok -} - -// IsInterSlice gets whether the object contained is a []interface{} or not. -func (v *Value) IsInterSlice() bool { - _, ok := v.data.([]interface{}) - return ok -} - -// EachInter calls the specified callback for each object -// in the []interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachInter(callback func(int, interface{}) bool) *Value { - for index, val := range v.MustInterSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInter uses the specified decider function to select items -// from the []interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value { - var selected []interface{} - v.EachInter(func(index int, val interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInter uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]interface{}. -func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value { - groups := make(map[string][]interface{}) - v.EachInter(func(index int, val interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInter uses the specified function to replace each interface{}s -// by iterating each item. The data in the returned result will be a -// []interface{} containing the replaced items. -func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - replaced := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInter uses the specified collector function to collect a value -// for each of the interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - collected := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Bool (bool and []bool) -*/ - -// Bool gets the value as a bool, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Bool(optionalDefault ...bool) bool { - if s, ok := v.data.(bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return false -} - -// MustBool gets the value as a bool. -// -// Panics if the object is not a bool. -func (v *Value) MustBool() bool { - return v.data.(bool) -} - -// BoolSlice gets the value as a []bool, returns the optionalDefault -// value or nil if the value is not a []bool. -func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool { - if s, ok := v.data.([]bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustBoolSlice gets the value as a []bool. -// -// Panics if the object is not a []bool. -func (v *Value) MustBoolSlice() []bool { - return v.data.([]bool) -} - -// IsBool gets whether the object contained is a bool or not. -func (v *Value) IsBool() bool { - _, ok := v.data.(bool) - return ok -} - -// IsBoolSlice gets whether the object contained is a []bool or not. -func (v *Value) IsBoolSlice() bool { - _, ok := v.data.([]bool) - return ok -} - -// EachBool calls the specified callback for each object -// in the []bool. -// -// Panics if the object is the wrong type. -func (v *Value) EachBool(callback func(int, bool) bool) *Value { - for index, val := range v.MustBoolSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereBool uses the specified decider function to select items -// from the []bool. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereBool(decider func(int, bool) bool) *Value { - var selected []bool - v.EachBool(func(index int, val bool) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupBool uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]bool. -func (v *Value) GroupBool(grouper func(int, bool) string) *Value { - groups := make(map[string][]bool) - v.EachBool(func(index int, val bool) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]bool, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceBool uses the specified function to replace each bools -// by iterating each item. The data in the returned result will be a -// []bool containing the replaced items. -func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value { - arr := v.MustBoolSlice() - replaced := make([]bool, len(arr)) - v.EachBool(func(index int, val bool) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectBool uses the specified collector function to collect a value -// for each of the bools in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value { - arr := v.MustBoolSlice() - collected := make([]interface{}, len(arr)) - v.EachBool(func(index int, val bool) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Str (string and []string) -*/ - -// Str gets the value as a string, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Str(optionalDefault ...string) string { - if s, ok := v.data.(string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return "" -} - -// MustStr gets the value as a string. -// -// Panics if the object is not a string. -func (v *Value) MustStr() string { - return v.data.(string) -} - -// StrSlice gets the value as a []string, returns the optionalDefault -// value or nil if the value is not a []string. -func (v *Value) StrSlice(optionalDefault ...[]string) []string { - if s, ok := v.data.([]string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustStrSlice gets the value as a []string. -// -// Panics if the object is not a []string. -func (v *Value) MustStrSlice() []string { - return v.data.([]string) -} - -// IsStr gets whether the object contained is a string or not. -func (v *Value) IsStr() bool { - _, ok := v.data.(string) - return ok -} - -// IsStrSlice gets whether the object contained is a []string or not. -func (v *Value) IsStrSlice() bool { - _, ok := v.data.([]string) - return ok -} - -// EachStr calls the specified callback for each object -// in the []string. -// -// Panics if the object is the wrong type. -func (v *Value) EachStr(callback func(int, string) bool) *Value { - for index, val := range v.MustStrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereStr uses the specified decider function to select items -// from the []string. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereStr(decider func(int, string) bool) *Value { - var selected []string - v.EachStr(func(index int, val string) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupStr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]string. -func (v *Value) GroupStr(grouper func(int, string) string) *Value { - groups := make(map[string][]string) - v.EachStr(func(index int, val string) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]string, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceStr uses the specified function to replace each strings -// by iterating each item. The data in the returned result will be a -// []string containing the replaced items. -func (v *Value) ReplaceStr(replacer func(int, string) string) *Value { - arr := v.MustStrSlice() - replaced := make([]string, len(arr)) - v.EachStr(func(index int, val string) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectStr uses the specified collector function to collect a value -// for each of the strings in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectStr(collector func(int, string) interface{}) *Value { - arr := v.MustStrSlice() - collected := make([]interface{}, len(arr)) - v.EachStr(func(index int, val string) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int (int and []int) -*/ - -// Int gets the value as a int, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int(optionalDefault ...int) int { - if s, ok := v.data.(int); ok { - return s - } - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt gets the value as a int. -// -// Panics if the object is not a int. -func (v *Value) MustInt() int { - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - return v.data.(int) -} - -// IntSlice gets the value as a []int, returns the optionalDefault -// value or nil if the value is not a []int. -func (v *Value) IntSlice(optionalDefault ...[]int) []int { - if s, ok := v.data.([]int); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustIntSlice gets the value as a []int. -// -// Panics if the object is not a []int. -func (v *Value) MustIntSlice() []int { - return v.data.([]int) -} - -// IsInt gets whether the object contained is a int or not. -func (v *Value) IsInt() bool { - _, ok := v.data.(int) - return ok -} - -// IsIntSlice gets whether the object contained is a []int or not. -func (v *Value) IsIntSlice() bool { - _, ok := v.data.([]int) - return ok -} - -// EachInt calls the specified callback for each object -// in the []int. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt(callback func(int, int) bool) *Value { - for index, val := range v.MustIntSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt uses the specified decider function to select items -// from the []int. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt(decider func(int, int) bool) *Value { - var selected []int - v.EachInt(func(index int, val int) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int. -func (v *Value) GroupInt(grouper func(int, int) string) *Value { - groups := make(map[string][]int) - v.EachInt(func(index int, val int) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt uses the specified function to replace each ints -// by iterating each item. The data in the returned result will be a -// []int containing the replaced items. -func (v *Value) ReplaceInt(replacer func(int, int) int) *Value { - arr := v.MustIntSlice() - replaced := make([]int, len(arr)) - v.EachInt(func(index int, val int) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt uses the specified collector function to collect a value -// for each of the ints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt(collector func(int, int) interface{}) *Value { - arr := v.MustIntSlice() - collected := make([]interface{}, len(arr)) - v.EachInt(func(index int, val int) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int8 (int8 and []int8) -*/ - -// Int8 gets the value as a int8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int8(optionalDefault ...int8) int8 { - if s, ok := v.data.(int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt8 gets the value as a int8. -// -// Panics if the object is not a int8. -func (v *Value) MustInt8() int8 { - return v.data.(int8) -} - -// Int8Slice gets the value as a []int8, returns the optionalDefault -// value or nil if the value is not a []int8. -func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 { - if s, ok := v.data.([]int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt8Slice gets the value as a []int8. -// -// Panics if the object is not a []int8. -func (v *Value) MustInt8Slice() []int8 { - return v.data.([]int8) -} - -// IsInt8 gets whether the object contained is a int8 or not. -func (v *Value) IsInt8() bool { - _, ok := v.data.(int8) - return ok -} - -// IsInt8Slice gets whether the object contained is a []int8 or not. -func (v *Value) IsInt8Slice() bool { - _, ok := v.data.([]int8) - return ok -} - -// EachInt8 calls the specified callback for each object -// in the []int8. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt8(callback func(int, int8) bool) *Value { - for index, val := range v.MustInt8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt8 uses the specified decider function to select items -// from the []int8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt8(decider func(int, int8) bool) *Value { - var selected []int8 - v.EachInt8(func(index int, val int8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int8. -func (v *Value) GroupInt8(grouper func(int, int8) string) *Value { - groups := make(map[string][]int8) - v.EachInt8(func(index int, val int8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt8 uses the specified function to replace each int8s -// by iterating each item. The data in the returned result will be a -// []int8 containing the replaced items. -func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value { - arr := v.MustInt8Slice() - replaced := make([]int8, len(arr)) - v.EachInt8(func(index int, val int8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt8 uses the specified collector function to collect a value -// for each of the int8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value { - arr := v.MustInt8Slice() - collected := make([]interface{}, len(arr)) - v.EachInt8(func(index int, val int8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int16 (int16 and []int16) -*/ - -// Int16 gets the value as a int16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int16(optionalDefault ...int16) int16 { - if s, ok := v.data.(int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt16 gets the value as a int16. -// -// Panics if the object is not a int16. -func (v *Value) MustInt16() int16 { - return v.data.(int16) -} - -// Int16Slice gets the value as a []int16, returns the optionalDefault -// value or nil if the value is not a []int16. -func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 { - if s, ok := v.data.([]int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt16Slice gets the value as a []int16. -// -// Panics if the object is not a []int16. -func (v *Value) MustInt16Slice() []int16 { - return v.data.([]int16) -} - -// IsInt16 gets whether the object contained is a int16 or not. -func (v *Value) IsInt16() bool { - _, ok := v.data.(int16) - return ok -} - -// IsInt16Slice gets whether the object contained is a []int16 or not. -func (v *Value) IsInt16Slice() bool { - _, ok := v.data.([]int16) - return ok -} - -// EachInt16 calls the specified callback for each object -// in the []int16. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt16(callback func(int, int16) bool) *Value { - for index, val := range v.MustInt16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt16 uses the specified decider function to select items -// from the []int16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt16(decider func(int, int16) bool) *Value { - var selected []int16 - v.EachInt16(func(index int, val int16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int16. -func (v *Value) GroupInt16(grouper func(int, int16) string) *Value { - groups := make(map[string][]int16) - v.EachInt16(func(index int, val int16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt16 uses the specified function to replace each int16s -// by iterating each item. The data in the returned result will be a -// []int16 containing the replaced items. -func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value { - arr := v.MustInt16Slice() - replaced := make([]int16, len(arr)) - v.EachInt16(func(index int, val int16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt16 uses the specified collector function to collect a value -// for each of the int16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value { - arr := v.MustInt16Slice() - collected := make([]interface{}, len(arr)) - v.EachInt16(func(index int, val int16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int32 (int32 and []int32) -*/ - -// Int32 gets the value as a int32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int32(optionalDefault ...int32) int32 { - if s, ok := v.data.(int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt32 gets the value as a int32. -// -// Panics if the object is not a int32. -func (v *Value) MustInt32() int32 { - return v.data.(int32) -} - -// Int32Slice gets the value as a []int32, returns the optionalDefault -// value or nil if the value is not a []int32. -func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 { - if s, ok := v.data.([]int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt32Slice gets the value as a []int32. -// -// Panics if the object is not a []int32. -func (v *Value) MustInt32Slice() []int32 { - return v.data.([]int32) -} - -// IsInt32 gets whether the object contained is a int32 or not. -func (v *Value) IsInt32() bool { - _, ok := v.data.(int32) - return ok -} - -// IsInt32Slice gets whether the object contained is a []int32 or not. -func (v *Value) IsInt32Slice() bool { - _, ok := v.data.([]int32) - return ok -} - -// EachInt32 calls the specified callback for each object -// in the []int32. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt32(callback func(int, int32) bool) *Value { - for index, val := range v.MustInt32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt32 uses the specified decider function to select items -// from the []int32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt32(decider func(int, int32) bool) *Value { - var selected []int32 - v.EachInt32(func(index int, val int32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int32. -func (v *Value) GroupInt32(grouper func(int, int32) string) *Value { - groups := make(map[string][]int32) - v.EachInt32(func(index int, val int32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt32 uses the specified function to replace each int32s -// by iterating each item. The data in the returned result will be a -// []int32 containing the replaced items. -func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value { - arr := v.MustInt32Slice() - replaced := make([]int32, len(arr)) - v.EachInt32(func(index int, val int32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt32 uses the specified collector function to collect a value -// for each of the int32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value { - arr := v.MustInt32Slice() - collected := make([]interface{}, len(arr)) - v.EachInt32(func(index int, val int32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int64 (int64 and []int64) -*/ - -// Int64 gets the value as a int64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int64(optionalDefault ...int64) int64 { - if s, ok := v.data.(int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt64 gets the value as a int64. -// -// Panics if the object is not a int64. -func (v *Value) MustInt64() int64 { - return v.data.(int64) -} - -// Int64Slice gets the value as a []int64, returns the optionalDefault -// value or nil if the value is not a []int64. -func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 { - if s, ok := v.data.([]int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt64Slice gets the value as a []int64. -// -// Panics if the object is not a []int64. -func (v *Value) MustInt64Slice() []int64 { - return v.data.([]int64) -} - -// IsInt64 gets whether the object contained is a int64 or not. -func (v *Value) IsInt64() bool { - _, ok := v.data.(int64) - return ok -} - -// IsInt64Slice gets whether the object contained is a []int64 or not. -func (v *Value) IsInt64Slice() bool { - _, ok := v.data.([]int64) - return ok -} - -// EachInt64 calls the specified callback for each object -// in the []int64. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt64(callback func(int, int64) bool) *Value { - for index, val := range v.MustInt64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt64 uses the specified decider function to select items -// from the []int64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt64(decider func(int, int64) bool) *Value { - var selected []int64 - v.EachInt64(func(index int, val int64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int64. -func (v *Value) GroupInt64(grouper func(int, int64) string) *Value { - groups := make(map[string][]int64) - v.EachInt64(func(index int, val int64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt64 uses the specified function to replace each int64s -// by iterating each item. The data in the returned result will be a -// []int64 containing the replaced items. -func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value { - arr := v.MustInt64Slice() - replaced := make([]int64, len(arr)) - v.EachInt64(func(index int, val int64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt64 uses the specified collector function to collect a value -// for each of the int64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value { - arr := v.MustInt64Slice() - collected := make([]interface{}, len(arr)) - v.EachInt64(func(index int, val int64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint (uint and []uint) -*/ - -// Uint gets the value as a uint, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint(optionalDefault ...uint) uint { - if s, ok := v.data.(uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint gets the value as a uint. -// -// Panics if the object is not a uint. -func (v *Value) MustUint() uint { - return v.data.(uint) -} - -// UintSlice gets the value as a []uint, returns the optionalDefault -// value or nil if the value is not a []uint. -func (v *Value) UintSlice(optionalDefault ...[]uint) []uint { - if s, ok := v.data.([]uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintSlice gets the value as a []uint. -// -// Panics if the object is not a []uint. -func (v *Value) MustUintSlice() []uint { - return v.data.([]uint) -} - -// IsUint gets whether the object contained is a uint or not. -func (v *Value) IsUint() bool { - _, ok := v.data.(uint) - return ok -} - -// IsUintSlice gets whether the object contained is a []uint or not. -func (v *Value) IsUintSlice() bool { - _, ok := v.data.([]uint) - return ok -} - -// EachUint calls the specified callback for each object -// in the []uint. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint(callback func(int, uint) bool) *Value { - for index, val := range v.MustUintSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint uses the specified decider function to select items -// from the []uint. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint(decider func(int, uint) bool) *Value { - var selected []uint - v.EachUint(func(index int, val uint) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint. -func (v *Value) GroupUint(grouper func(int, uint) string) *Value { - groups := make(map[string][]uint) - v.EachUint(func(index int, val uint) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint uses the specified function to replace each uints -// by iterating each item. The data in the returned result will be a -// []uint containing the replaced items. -func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value { - arr := v.MustUintSlice() - replaced := make([]uint, len(arr)) - v.EachUint(func(index int, val uint) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint uses the specified collector function to collect a value -// for each of the uints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value { - arr := v.MustUintSlice() - collected := make([]interface{}, len(arr)) - v.EachUint(func(index int, val uint) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint8 (uint8 and []uint8) -*/ - -// Uint8 gets the value as a uint8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint8(optionalDefault ...uint8) uint8 { - if s, ok := v.data.(uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint8 gets the value as a uint8. -// -// Panics if the object is not a uint8. -func (v *Value) MustUint8() uint8 { - return v.data.(uint8) -} - -// Uint8Slice gets the value as a []uint8, returns the optionalDefault -// value or nil if the value is not a []uint8. -func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 { - if s, ok := v.data.([]uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint8Slice gets the value as a []uint8. -// -// Panics if the object is not a []uint8. -func (v *Value) MustUint8Slice() []uint8 { - return v.data.([]uint8) -} - -// IsUint8 gets whether the object contained is a uint8 or not. -func (v *Value) IsUint8() bool { - _, ok := v.data.(uint8) - return ok -} - -// IsUint8Slice gets whether the object contained is a []uint8 or not. -func (v *Value) IsUint8Slice() bool { - _, ok := v.data.([]uint8) - return ok -} - -// EachUint8 calls the specified callback for each object -// in the []uint8. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint8(callback func(int, uint8) bool) *Value { - for index, val := range v.MustUint8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint8 uses the specified decider function to select items -// from the []uint8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value { - var selected []uint8 - v.EachUint8(func(index int, val uint8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint8. -func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value { - groups := make(map[string][]uint8) - v.EachUint8(func(index int, val uint8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint8 uses the specified function to replace each uint8s -// by iterating each item. The data in the returned result will be a -// []uint8 containing the replaced items. -func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value { - arr := v.MustUint8Slice() - replaced := make([]uint8, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint8 uses the specified collector function to collect a value -// for each of the uint8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value { - arr := v.MustUint8Slice() - collected := make([]interface{}, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint16 (uint16 and []uint16) -*/ - -// Uint16 gets the value as a uint16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint16(optionalDefault ...uint16) uint16 { - if s, ok := v.data.(uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint16 gets the value as a uint16. -// -// Panics if the object is not a uint16. -func (v *Value) MustUint16() uint16 { - return v.data.(uint16) -} - -// Uint16Slice gets the value as a []uint16, returns the optionalDefault -// value or nil if the value is not a []uint16. -func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 { - if s, ok := v.data.([]uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint16Slice gets the value as a []uint16. -// -// Panics if the object is not a []uint16. -func (v *Value) MustUint16Slice() []uint16 { - return v.data.([]uint16) -} - -// IsUint16 gets whether the object contained is a uint16 or not. -func (v *Value) IsUint16() bool { - _, ok := v.data.(uint16) - return ok -} - -// IsUint16Slice gets whether the object contained is a []uint16 or not. -func (v *Value) IsUint16Slice() bool { - _, ok := v.data.([]uint16) - return ok -} - -// EachUint16 calls the specified callback for each object -// in the []uint16. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint16(callback func(int, uint16) bool) *Value { - for index, val := range v.MustUint16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint16 uses the specified decider function to select items -// from the []uint16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value { - var selected []uint16 - v.EachUint16(func(index int, val uint16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint16. -func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value { - groups := make(map[string][]uint16) - v.EachUint16(func(index int, val uint16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint16 uses the specified function to replace each uint16s -// by iterating each item. The data in the returned result will be a -// []uint16 containing the replaced items. -func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value { - arr := v.MustUint16Slice() - replaced := make([]uint16, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint16 uses the specified collector function to collect a value -// for each of the uint16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value { - arr := v.MustUint16Slice() - collected := make([]interface{}, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint32 (uint32 and []uint32) -*/ - -// Uint32 gets the value as a uint32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint32(optionalDefault ...uint32) uint32 { - if s, ok := v.data.(uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint32 gets the value as a uint32. -// -// Panics if the object is not a uint32. -func (v *Value) MustUint32() uint32 { - return v.data.(uint32) -} - -// Uint32Slice gets the value as a []uint32, returns the optionalDefault -// value or nil if the value is not a []uint32. -func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 { - if s, ok := v.data.([]uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint32Slice gets the value as a []uint32. -// -// Panics if the object is not a []uint32. -func (v *Value) MustUint32Slice() []uint32 { - return v.data.([]uint32) -} - -// IsUint32 gets whether the object contained is a uint32 or not. -func (v *Value) IsUint32() bool { - _, ok := v.data.(uint32) - return ok -} - -// IsUint32Slice gets whether the object contained is a []uint32 or not. -func (v *Value) IsUint32Slice() bool { - _, ok := v.data.([]uint32) - return ok -} - -// EachUint32 calls the specified callback for each object -// in the []uint32. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint32(callback func(int, uint32) bool) *Value { - for index, val := range v.MustUint32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint32 uses the specified decider function to select items -// from the []uint32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value { - var selected []uint32 - v.EachUint32(func(index int, val uint32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint32. -func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value { - groups := make(map[string][]uint32) - v.EachUint32(func(index int, val uint32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint32 uses the specified function to replace each uint32s -// by iterating each item. The data in the returned result will be a -// []uint32 containing the replaced items. -func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value { - arr := v.MustUint32Slice() - replaced := make([]uint32, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint32 uses the specified collector function to collect a value -// for each of the uint32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value { - arr := v.MustUint32Slice() - collected := make([]interface{}, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint64 (uint64 and []uint64) -*/ - -// Uint64 gets the value as a uint64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint64(optionalDefault ...uint64) uint64 { - if s, ok := v.data.(uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint64 gets the value as a uint64. -// -// Panics if the object is not a uint64. -func (v *Value) MustUint64() uint64 { - return v.data.(uint64) -} - -// Uint64Slice gets the value as a []uint64, returns the optionalDefault -// value or nil if the value is not a []uint64. -func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 { - if s, ok := v.data.([]uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint64Slice gets the value as a []uint64. -// -// Panics if the object is not a []uint64. -func (v *Value) MustUint64Slice() []uint64 { - return v.data.([]uint64) -} - -// IsUint64 gets whether the object contained is a uint64 or not. -func (v *Value) IsUint64() bool { - _, ok := v.data.(uint64) - return ok -} - -// IsUint64Slice gets whether the object contained is a []uint64 or not. -func (v *Value) IsUint64Slice() bool { - _, ok := v.data.([]uint64) - return ok -} - -// EachUint64 calls the specified callback for each object -// in the []uint64. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint64(callback func(int, uint64) bool) *Value { - for index, val := range v.MustUint64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint64 uses the specified decider function to select items -// from the []uint64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value { - var selected []uint64 - v.EachUint64(func(index int, val uint64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint64. -func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value { - groups := make(map[string][]uint64) - v.EachUint64(func(index int, val uint64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint64 uses the specified function to replace each uint64s -// by iterating each item. The data in the returned result will be a -// []uint64 containing the replaced items. -func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value { - arr := v.MustUint64Slice() - replaced := make([]uint64, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint64 uses the specified collector function to collect a value -// for each of the uint64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value { - arr := v.MustUint64Slice() - collected := make([]interface{}, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uintptr (uintptr and []uintptr) -*/ - -// Uintptr gets the value as a uintptr, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr { - if s, ok := v.data.(uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUintptr gets the value as a uintptr. -// -// Panics if the object is not a uintptr. -func (v *Value) MustUintptr() uintptr { - return v.data.(uintptr) -} - -// UintptrSlice gets the value as a []uintptr, returns the optionalDefault -// value or nil if the value is not a []uintptr. -func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr { - if s, ok := v.data.([]uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintptrSlice gets the value as a []uintptr. -// -// Panics if the object is not a []uintptr. -func (v *Value) MustUintptrSlice() []uintptr { - return v.data.([]uintptr) -} - -// IsUintptr gets whether the object contained is a uintptr or not. -func (v *Value) IsUintptr() bool { - _, ok := v.data.(uintptr) - return ok -} - -// IsUintptrSlice gets whether the object contained is a []uintptr or not. -func (v *Value) IsUintptrSlice() bool { - _, ok := v.data.([]uintptr) - return ok -} - -// EachUintptr calls the specified callback for each object -// in the []uintptr. -// -// Panics if the object is the wrong type. -func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value { - for index, val := range v.MustUintptrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUintptr uses the specified decider function to select items -// from the []uintptr. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value { - var selected []uintptr - v.EachUintptr(func(index int, val uintptr) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUintptr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uintptr. -func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value { - groups := make(map[string][]uintptr) - v.EachUintptr(func(index int, val uintptr) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uintptr, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUintptr uses the specified function to replace each uintptrs -// by iterating each item. The data in the returned result will be a -// []uintptr containing the replaced items. -func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value { - arr := v.MustUintptrSlice() - replaced := make([]uintptr, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUintptr uses the specified collector function to collect a value -// for each of the uintptrs in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value { - arr := v.MustUintptrSlice() - collected := make([]interface{}, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float32 (float32 and []float32) -*/ - -// Float32 gets the value as a float32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float32(optionalDefault ...float32) float32 { - if s, ok := v.data.(float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat32 gets the value as a float32. -// -// Panics if the object is not a float32. -func (v *Value) MustFloat32() float32 { - return v.data.(float32) -} - -// Float32Slice gets the value as a []float32, returns the optionalDefault -// value or nil if the value is not a []float32. -func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 { - if s, ok := v.data.([]float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat32Slice gets the value as a []float32. -// -// Panics if the object is not a []float32. -func (v *Value) MustFloat32Slice() []float32 { - return v.data.([]float32) -} - -// IsFloat32 gets whether the object contained is a float32 or not. -func (v *Value) IsFloat32() bool { - _, ok := v.data.(float32) - return ok -} - -// IsFloat32Slice gets whether the object contained is a []float32 or not. -func (v *Value) IsFloat32Slice() bool { - _, ok := v.data.([]float32) - return ok -} - -// EachFloat32 calls the specified callback for each object -// in the []float32. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat32(callback func(int, float32) bool) *Value { - for index, val := range v.MustFloat32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat32 uses the specified decider function to select items -// from the []float32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value { - var selected []float32 - v.EachFloat32(func(index int, val float32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float32. -func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value { - groups := make(map[string][]float32) - v.EachFloat32(func(index int, val float32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat32 uses the specified function to replace each float32s -// by iterating each item. The data in the returned result will be a -// []float32 containing the replaced items. -func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value { - arr := v.MustFloat32Slice() - replaced := make([]float32, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat32 uses the specified collector function to collect a value -// for each of the float32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value { - arr := v.MustFloat32Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float64 (float64 and []float64) -*/ - -// Float64 gets the value as a float64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float64(optionalDefault ...float64) float64 { - if s, ok := v.data.(float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat64 gets the value as a float64. -// -// Panics if the object is not a float64. -func (v *Value) MustFloat64() float64 { - return v.data.(float64) -} - -// Float64Slice gets the value as a []float64, returns the optionalDefault -// value or nil if the value is not a []float64. -func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 { - if s, ok := v.data.([]float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat64Slice gets the value as a []float64. -// -// Panics if the object is not a []float64. -func (v *Value) MustFloat64Slice() []float64 { - return v.data.([]float64) -} - -// IsFloat64 gets whether the object contained is a float64 or not. -func (v *Value) IsFloat64() bool { - _, ok := v.data.(float64) - return ok -} - -// IsFloat64Slice gets whether the object contained is a []float64 or not. -func (v *Value) IsFloat64Slice() bool { - _, ok := v.data.([]float64) - return ok -} - -// EachFloat64 calls the specified callback for each object -// in the []float64. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat64(callback func(int, float64) bool) *Value { - for index, val := range v.MustFloat64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat64 uses the specified decider function to select items -// from the []float64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value { - var selected []float64 - v.EachFloat64(func(index int, val float64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float64. -func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value { - groups := make(map[string][]float64) - v.EachFloat64(func(index int, val float64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat64 uses the specified function to replace each float64s -// by iterating each item. The data in the returned result will be a -// []float64 containing the replaced items. -func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value { - arr := v.MustFloat64Slice() - replaced := make([]float64, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat64 uses the specified collector function to collect a value -// for each of the float64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value { - arr := v.MustFloat64Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex64 (complex64 and []complex64) -*/ - -// Complex64 gets the value as a complex64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex64(optionalDefault ...complex64) complex64 { - if s, ok := v.data.(complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex64 gets the value as a complex64. -// -// Panics if the object is not a complex64. -func (v *Value) MustComplex64() complex64 { - return v.data.(complex64) -} - -// Complex64Slice gets the value as a []complex64, returns the optionalDefault -// value or nil if the value is not a []complex64. -func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 { - if s, ok := v.data.([]complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex64Slice gets the value as a []complex64. -// -// Panics if the object is not a []complex64. -func (v *Value) MustComplex64Slice() []complex64 { - return v.data.([]complex64) -} - -// IsComplex64 gets whether the object contained is a complex64 or not. -func (v *Value) IsComplex64() bool { - _, ok := v.data.(complex64) - return ok -} - -// IsComplex64Slice gets whether the object contained is a []complex64 or not. -func (v *Value) IsComplex64Slice() bool { - _, ok := v.data.([]complex64) - return ok -} - -// EachComplex64 calls the specified callback for each object -// in the []complex64. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value { - for index, val := range v.MustComplex64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex64 uses the specified decider function to select items -// from the []complex64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value { - var selected []complex64 - v.EachComplex64(func(index int, val complex64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex64. -func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value { - groups := make(map[string][]complex64) - v.EachComplex64(func(index int, val complex64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex64 uses the specified function to replace each complex64s -// by iterating each item. The data in the returned result will be a -// []complex64 containing the replaced items. -func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value { - arr := v.MustComplex64Slice() - replaced := make([]complex64, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex64 uses the specified collector function to collect a value -// for each of the complex64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value { - arr := v.MustComplex64Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex128 (complex128 and []complex128) -*/ - -// Complex128 gets the value as a complex128, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex128(optionalDefault ...complex128) complex128 { - if s, ok := v.data.(complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex128 gets the value as a complex128. -// -// Panics if the object is not a complex128. -func (v *Value) MustComplex128() complex128 { - return v.data.(complex128) -} - -// Complex128Slice gets the value as a []complex128, returns the optionalDefault -// value or nil if the value is not a []complex128. -func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 { - if s, ok := v.data.([]complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex128Slice gets the value as a []complex128. -// -// Panics if the object is not a []complex128. -func (v *Value) MustComplex128Slice() []complex128 { - return v.data.([]complex128) -} - -// IsComplex128 gets whether the object contained is a complex128 or not. -func (v *Value) IsComplex128() bool { - _, ok := v.data.(complex128) - return ok -} - -// IsComplex128Slice gets whether the object contained is a []complex128 or not. -func (v *Value) IsComplex128Slice() bool { - _, ok := v.data.([]complex128) - return ok -} - -// EachComplex128 calls the specified callback for each object -// in the []complex128. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value { - for index, val := range v.MustComplex128Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex128 uses the specified decider function to select items -// from the []complex128. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value { - var selected []complex128 - v.EachComplex128(func(index int, val complex128) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex128 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex128. -func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value { - groups := make(map[string][]complex128) - v.EachComplex128(func(index int, val complex128) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex128, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex128 uses the specified function to replace each complex128s -// by iterating each item. The data in the returned result will be a -// []complex128 containing the replaced items. -func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value { - arr := v.MustComplex128Slice() - replaced := make([]complex128, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex128 uses the specified collector function to collect a value -// for each of the complex128s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value { - arr := v.MustComplex128Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/value.go b/vendor/github.com/stretchr/objx/value.go deleted file mode 100644 index 4e5f9b77..00000000 --- a/vendor/github.com/stretchr/objx/value.go +++ /dev/null @@ -1,159 +0,0 @@ -package objx - -import ( - "fmt" - "strconv" -) - -// Value provides methods for extracting interface{} data in various -// types. -type Value struct { - // data contains the raw data being managed by this Value - data interface{} -} - -// Data returns the raw data contained by this Value -func (v *Value) Data() interface{} { - return v.data -} - -// String returns the value always as a string -func (v *Value) String() string { - switch { - case v.IsNil(): - return "" - case v.IsStr(): - return v.Str() - case v.IsBool(): - return strconv.FormatBool(v.Bool()) - case v.IsFloat32(): - return strconv.FormatFloat(float64(v.Float32()), 'f', -1, 32) - case v.IsFloat64(): - return strconv.FormatFloat(v.Float64(), 'f', -1, 64) - case v.IsInt(): - return strconv.FormatInt(int64(v.Int()), 10) - case v.IsInt8(): - return strconv.FormatInt(int64(v.Int8()), 10) - case v.IsInt16(): - return strconv.FormatInt(int64(v.Int16()), 10) - case v.IsInt32(): - return strconv.FormatInt(int64(v.Int32()), 10) - case v.IsInt64(): - return strconv.FormatInt(v.Int64(), 10) - case v.IsUint(): - return strconv.FormatUint(uint64(v.Uint()), 10) - case v.IsUint8(): - return strconv.FormatUint(uint64(v.Uint8()), 10) - case v.IsUint16(): - return strconv.FormatUint(uint64(v.Uint16()), 10) - case v.IsUint32(): - return strconv.FormatUint(uint64(v.Uint32()), 10) - case v.IsUint64(): - return strconv.FormatUint(v.Uint64(), 10) - } - return fmt.Sprintf("%#v", v.Data()) -} - -// StringSlice returns the value always as a []string -func (v *Value) StringSlice(optionalDefault ...[]string) []string { - switch { - case v.IsStrSlice(): - return v.MustStrSlice() - case v.IsBoolSlice(): - slice := v.MustBoolSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatBool(iv) - } - return vals - case v.IsFloat32Slice(): - slice := v.MustFloat32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(float64(iv), 'f', -1, 32) - } - return vals - case v.IsFloat64Slice(): - slice := v.MustFloat64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(iv, 'f', -1, 64) - } - return vals - case v.IsIntSlice(): - slice := v.MustIntSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt8Slice(): - slice := v.MustInt8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt16Slice(): - slice := v.MustInt16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt32Slice(): - slice := v.MustInt32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt64Slice(): - slice := v.MustInt64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(iv, 10) - } - return vals - case v.IsUintSlice(): - slice := v.MustUintSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint8Slice(): - slice := v.MustUint8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint16Slice(): - slice := v.MustUint16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint32Slice(): - slice := v.MustUint32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint64Slice(): - slice := v.MustUint64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(iv, 10) - } - return vals - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - - return []string{} -} diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE deleted file mode 100644 index 4b0421cf..00000000 --- a/vendor/github.com/stretchr/testify/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2012-2020 Mat Ryer, Tyler Bunnell and contributors. - -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/stretchr/testify/assert/assertion_compare.go b/vendor/github.com/stretchr/testify/assert/assertion_compare.go deleted file mode 100644 index 4d4b4aad..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_compare.go +++ /dev/null @@ -1,480 +0,0 @@ -package assert - -import ( - "bytes" - "fmt" - "reflect" - "time" -) - -type CompareType int - -const ( - compareLess CompareType = iota - 1 - compareEqual - compareGreater -) - -var ( - intType = reflect.TypeOf(int(1)) - int8Type = reflect.TypeOf(int8(1)) - int16Type = reflect.TypeOf(int16(1)) - int32Type = reflect.TypeOf(int32(1)) - int64Type = reflect.TypeOf(int64(1)) - - uintType = reflect.TypeOf(uint(1)) - uint8Type = reflect.TypeOf(uint8(1)) - uint16Type = reflect.TypeOf(uint16(1)) - uint32Type = reflect.TypeOf(uint32(1)) - uint64Type = reflect.TypeOf(uint64(1)) - - uintptrType = reflect.TypeOf(uintptr(1)) - - float32Type = reflect.TypeOf(float32(1)) - float64Type = reflect.TypeOf(float64(1)) - - stringType = reflect.TypeOf("") - - timeType = reflect.TypeOf(time.Time{}) - bytesType = reflect.TypeOf([]byte{}) -) - -func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) { - obj1Value := reflect.ValueOf(obj1) - obj2Value := reflect.ValueOf(obj2) - - // throughout this switch we try and avoid calling .Convert() if possible, - // as this has a pretty big performance impact - switch kind { - case reflect.Int: - { - intobj1, ok := obj1.(int) - if !ok { - intobj1 = obj1Value.Convert(intType).Interface().(int) - } - intobj2, ok := obj2.(int) - if !ok { - intobj2 = obj2Value.Convert(intType).Interface().(int) - } - if intobj1 > intobj2 { - return compareGreater, true - } - if intobj1 == intobj2 { - return compareEqual, true - } - if intobj1 < intobj2 { - return compareLess, true - } - } - case reflect.Int8: - { - int8obj1, ok := obj1.(int8) - if !ok { - int8obj1 = obj1Value.Convert(int8Type).Interface().(int8) - } - int8obj2, ok := obj2.(int8) - if !ok { - int8obj2 = obj2Value.Convert(int8Type).Interface().(int8) - } - if int8obj1 > int8obj2 { - return compareGreater, true - } - if int8obj1 == int8obj2 { - return compareEqual, true - } - if int8obj1 < int8obj2 { - return compareLess, true - } - } - case reflect.Int16: - { - int16obj1, ok := obj1.(int16) - if !ok { - int16obj1 = obj1Value.Convert(int16Type).Interface().(int16) - } - int16obj2, ok := obj2.(int16) - if !ok { - int16obj2 = obj2Value.Convert(int16Type).Interface().(int16) - } - if int16obj1 > int16obj2 { - return compareGreater, true - } - if int16obj1 == int16obj2 { - return compareEqual, true - } - if int16obj1 < int16obj2 { - return compareLess, true - } - } - case reflect.Int32: - { - int32obj1, ok := obj1.(int32) - if !ok { - int32obj1 = obj1Value.Convert(int32Type).Interface().(int32) - } - int32obj2, ok := obj2.(int32) - if !ok { - int32obj2 = obj2Value.Convert(int32Type).Interface().(int32) - } - if int32obj1 > int32obj2 { - return compareGreater, true - } - if int32obj1 == int32obj2 { - return compareEqual, true - } - if int32obj1 < int32obj2 { - return compareLess, true - } - } - case reflect.Int64: - { - int64obj1, ok := obj1.(int64) - if !ok { - int64obj1 = obj1Value.Convert(int64Type).Interface().(int64) - } - int64obj2, ok := obj2.(int64) - if !ok { - int64obj2 = obj2Value.Convert(int64Type).Interface().(int64) - } - if int64obj1 > int64obj2 { - return compareGreater, true - } - if int64obj1 == int64obj2 { - return compareEqual, true - } - if int64obj1 < int64obj2 { - return compareLess, true - } - } - case reflect.Uint: - { - uintobj1, ok := obj1.(uint) - if !ok { - uintobj1 = obj1Value.Convert(uintType).Interface().(uint) - } - uintobj2, ok := obj2.(uint) - if !ok { - uintobj2 = obj2Value.Convert(uintType).Interface().(uint) - } - if uintobj1 > uintobj2 { - return compareGreater, true - } - if uintobj1 == uintobj2 { - return compareEqual, true - } - if uintobj1 < uintobj2 { - return compareLess, true - } - } - case reflect.Uint8: - { - uint8obj1, ok := obj1.(uint8) - if !ok { - uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8) - } - uint8obj2, ok := obj2.(uint8) - if !ok { - uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8) - } - if uint8obj1 > uint8obj2 { - return compareGreater, true - } - if uint8obj1 == uint8obj2 { - return compareEqual, true - } - if uint8obj1 < uint8obj2 { - return compareLess, true - } - } - case reflect.Uint16: - { - uint16obj1, ok := obj1.(uint16) - if !ok { - uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16) - } - uint16obj2, ok := obj2.(uint16) - if !ok { - uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16) - } - if uint16obj1 > uint16obj2 { - return compareGreater, true - } - if uint16obj1 == uint16obj2 { - return compareEqual, true - } - if uint16obj1 < uint16obj2 { - return compareLess, true - } - } - case reflect.Uint32: - { - uint32obj1, ok := obj1.(uint32) - if !ok { - uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32) - } - uint32obj2, ok := obj2.(uint32) - if !ok { - uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32) - } - if uint32obj1 > uint32obj2 { - return compareGreater, true - } - if uint32obj1 == uint32obj2 { - return compareEqual, true - } - if uint32obj1 < uint32obj2 { - return compareLess, true - } - } - case reflect.Uint64: - { - uint64obj1, ok := obj1.(uint64) - if !ok { - uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64) - } - uint64obj2, ok := obj2.(uint64) - if !ok { - uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64) - } - if uint64obj1 > uint64obj2 { - return compareGreater, true - } - if uint64obj1 == uint64obj2 { - return compareEqual, true - } - if uint64obj1 < uint64obj2 { - return compareLess, true - } - } - case reflect.Float32: - { - float32obj1, ok := obj1.(float32) - if !ok { - float32obj1 = obj1Value.Convert(float32Type).Interface().(float32) - } - float32obj2, ok := obj2.(float32) - if !ok { - float32obj2 = obj2Value.Convert(float32Type).Interface().(float32) - } - if float32obj1 > float32obj2 { - return compareGreater, true - } - if float32obj1 == float32obj2 { - return compareEqual, true - } - if float32obj1 < float32obj2 { - return compareLess, true - } - } - case reflect.Float64: - { - float64obj1, ok := obj1.(float64) - if !ok { - float64obj1 = obj1Value.Convert(float64Type).Interface().(float64) - } - float64obj2, ok := obj2.(float64) - if !ok { - float64obj2 = obj2Value.Convert(float64Type).Interface().(float64) - } - if float64obj1 > float64obj2 { - return compareGreater, true - } - if float64obj1 == float64obj2 { - return compareEqual, true - } - if float64obj1 < float64obj2 { - return compareLess, true - } - } - case reflect.String: - { - stringobj1, ok := obj1.(string) - if !ok { - stringobj1 = obj1Value.Convert(stringType).Interface().(string) - } - stringobj2, ok := obj2.(string) - if !ok { - stringobj2 = obj2Value.Convert(stringType).Interface().(string) - } - if stringobj1 > stringobj2 { - return compareGreater, true - } - if stringobj1 == stringobj2 { - return compareEqual, true - } - if stringobj1 < stringobj2 { - return compareLess, true - } - } - // Check for known struct types we can check for compare results. - case reflect.Struct: - { - // All structs enter here. We're not interested in most types. - if !obj1Value.CanConvert(timeType) { - break - } - - // time.Time can be compared! - timeObj1, ok := obj1.(time.Time) - if !ok { - timeObj1 = obj1Value.Convert(timeType).Interface().(time.Time) - } - - timeObj2, ok := obj2.(time.Time) - if !ok { - timeObj2 = obj2Value.Convert(timeType).Interface().(time.Time) - } - - return compare(timeObj1.UnixNano(), timeObj2.UnixNano(), reflect.Int64) - } - case reflect.Slice: - { - // We only care about the []byte type. - if !obj1Value.CanConvert(bytesType) { - break - } - - // []byte can be compared! - bytesObj1, ok := obj1.([]byte) - if !ok { - bytesObj1 = obj1Value.Convert(bytesType).Interface().([]byte) - - } - bytesObj2, ok := obj2.([]byte) - if !ok { - bytesObj2 = obj2Value.Convert(bytesType).Interface().([]byte) - } - - return CompareType(bytes.Compare(bytesObj1, bytesObj2)), true - } - case reflect.Uintptr: - { - uintptrObj1, ok := obj1.(uintptr) - if !ok { - uintptrObj1 = obj1Value.Convert(uintptrType).Interface().(uintptr) - } - uintptrObj2, ok := obj2.(uintptr) - if !ok { - uintptrObj2 = obj2Value.Convert(uintptrType).Interface().(uintptr) - } - if uintptrObj1 > uintptrObj2 { - return compareGreater, true - } - if uintptrObj1 == uintptrObj2 { - return compareEqual, true - } - if uintptrObj1 < uintptrObj2 { - return compareLess, true - } - } - } - - return compareEqual, false -} - -// Greater asserts that the first element is greater than the second -// -// assert.Greater(t, 2, 1) -// assert.Greater(t, float64(2), float64(1)) -// assert.Greater(t, "b", "a") -func Greater(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// assert.GreaterOrEqual(t, 2, 1) -// assert.GreaterOrEqual(t, 2, 2) -// assert.GreaterOrEqual(t, "b", "a") -// assert.GreaterOrEqual(t, "b", "b") -func GreaterOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return compareTwoValues(t, e1, e2, []CompareType{compareGreater, compareEqual}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) -} - -// Less asserts that the first element is less than the second -// -// assert.Less(t, 1, 2) -// assert.Less(t, float64(1), float64(2)) -// assert.Less(t, "a", "b") -func Less(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return compareTwoValues(t, e1, e2, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// assert.LessOrEqual(t, 1, 2) -// assert.LessOrEqual(t, 2, 2) -// assert.LessOrEqual(t, "a", "b") -// assert.LessOrEqual(t, "b", "b") -func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) -} - -// Positive asserts that the specified element is positive -// -// assert.Positive(t, 1) -// assert.Positive(t, 1.23) -func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs...) -} - -// Negative asserts that the specified element is negative -// -// assert.Negative(t, -1) -// assert.Negative(t, -1.23) -func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - zero := reflect.Zero(reflect.TypeOf(e)) - return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs...) -} - -func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - e1Kind := reflect.ValueOf(e1).Kind() - e2Kind := reflect.ValueOf(e2).Kind() - if e1Kind != e2Kind { - return Fail(t, "Elements should be the same type", msgAndArgs...) - } - - compareResult, isComparable := compare(e1, e2, e1Kind) - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\"", reflect.TypeOf(e1)), msgAndArgs...) - } - - if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, e1, e2), msgAndArgs...) - } - - return true -} - -func containsValue(values []CompareType, value CompareType) bool { - for _, v := range values { - if v == value { - return true - } - } - - return false -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go deleted file mode 100644 index 3ddab109..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go +++ /dev/null @@ -1,815 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package assert - -import ( - http "net/http" - url "net/url" - time "time" -) - -// Conditionf uses a Comparison to assert a complex condition. -func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Condition(t, comp, append([]interface{}{msg}, args...)...) -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted") -// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted") -// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted") -func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Contains(t, s, contains, append([]interface{}{msg}, args...)...) -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return DirExists(t, path, append([]interface{}{msg}, args...)...) -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...) -} - -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// assert.Emptyf(t, obj, "error message %s", "formatted") -func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Empty(t, object, append([]interface{}{msg}, args...)...) -} - -// Equalf asserts that two objects are equal. -// -// assert.Equalf(t, 123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Equal(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted") -func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...) -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// assert.EqualExportedValuesf(t, S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// assert.EqualExportedValuesf(t, S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func EqualExportedValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualExportedValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. -// -// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted") -func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if assert.Errorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } -func Errorf(t TestingT, err error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Error(t, err, append([]interface{}{msg}, args...)...) -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// assert.ErrorContainsf(t, err, expectedErrorSubString, "error message %s", "formatted") -func ErrorContainsf(t TestingT, theError error, contains string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorContains(t, theError, contains, append([]interface{}{msg}, args...)...) -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// assert.Eventuallyf(t, func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Eventually(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// assert.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithTf(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return EventuallyWithT(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted") -func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Failf reports a failure through -func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, failureMessage, append([]interface{}{msg}, args...)...) -} - -// FailNowf fails test -func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...) -} - -// Falsef asserts that the specified value is false. -// -// assert.Falsef(t, myBool, "error message %s", "formatted") -func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return False(t, value, append([]interface{}{msg}, args...)...) -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return FileExists(t, path, append([]interface{}{msg}, args...)...) -} - -// Greaterf asserts that the first element is greater than the second -// -// assert.Greaterf(t, 2, 1, "error message %s", "formatted") -// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted") -// assert.Greaterf(t, "b", "a", "error message %s", "formatted") -func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Greater(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// assert.GreaterOrEqualf(t, 2, 1, "error message %s", "formatted") -// assert.GreaterOrEqualf(t, 2, 2, "error message %s", "formatted") -// assert.GreaterOrEqualf(t, "b", "a", "error message %s", "formatted") -// assert.GreaterOrEqualf(t, "b", "b", "error message %s", "formatted") -func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...) -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// assert.HTTPStatusCodef(t, myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCodef(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCode(t, handler, method, url, values, statuscode, append([]interface{}{msg}, args...)...) -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...) -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// assert.InDeltaf(t, math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...) -} - -// IsDecreasingf asserts that the collection is decreasing -// -// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted") -// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted") -// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsDecreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsIncreasingf asserts that the collection is increasing -// -// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted") -// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted") -// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsIncreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted") -// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted") -// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted") -func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted") -// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted") -// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted") -func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...) -} - -// IsTypef asserts that the specified objects are of the same type. -func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...) -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// assert.Lenf(t, mySlice, 3, "error message %s", "formatted") -func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Len(t, object, length, append([]interface{}{msg}, args...)...) -} - -// Lessf asserts that the first element is less than the second -// -// assert.Lessf(t, 1, 2, "error message %s", "formatted") -// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted") -// assert.Lessf(t, "a", "b", "error message %s", "formatted") -func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Less(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// assert.LessOrEqualf(t, 1, 2, "error message %s", "formatted") -// assert.LessOrEqualf(t, 2, 2, "error message %s", "formatted") -// assert.LessOrEqualf(t, "a", "b", "error message %s", "formatted") -// assert.LessOrEqualf(t, "b", "b", "error message %s", "formatted") -func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...) -} - -// Negativef asserts that the specified element is negative -// -// assert.Negativef(t, -1, "error message %s", "formatted") -// assert.Negativef(t, -1.23, "error message %s", "formatted") -func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Negative(t, e, append([]interface{}{msg}, args...)...) -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// assert.Neverf(t, func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func Neverf(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Never(t, condition, waitFor, tick, append([]interface{}{msg}, args...)...) -} - -// Nilf asserts that the specified object is nil. -// -// assert.Nilf(t, err, "error message %s", "formatted") -func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Nil(t, object, append([]interface{}{msg}, args...)...) -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoDirExists(t, path, append([]interface{}{msg}, args...)...) -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if assert.NoErrorf(t, err, "error message %s", "formatted") { -// assert.Equal(t, expectedObj, actualObj) -// } -func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoError(t, err, append([]interface{}{msg}, args...)...) -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExistsf(t TestingT, path string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NoFileExists(t, path, append([]interface{}{msg}, args...)...) -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted") -// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted") -// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted") -func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotContains(t, s, contains, append([]interface{}{msg}, args...)...) -} - -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if assert.NotEmptyf(t, obj, "error message %s", "formatted") { -// assert.Equal(t, "two", obj[1]) -// } -func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEmpty(t, object, append([]interface{}{msg}, args...)...) -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// assert.NotEqualValuesf(t, obj1, obj2, "error message %s", "formatted") -func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotErrorIsf asserts that at none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...) -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// assert.NotImplementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func NotImplementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotImplements(t, interfaceObject, object, append([]interface{}{msg}, args...)...) -} - -// NotNilf asserts that the specified object is not nil. -// -// assert.NotNilf(t, err, "error message %s", "formatted") -func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotNil(t, object, append([]interface{}{msg}, args...)...) -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted") -func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotPanics(t, f, append([]interface{}{msg}, args...)...) -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted") -func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...) -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// assert.NotSamef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSamef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotSame(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. -// -// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "error message %s", "formatted") -// assert.NotSubsetf(t, {"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...) -} - -// NotZerof asserts that i is not the zero value for its type. -func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return NotZero(t, i, append([]interface{}{msg}, args...)...) -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted") -func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Panics(t, f, append([]interface{}{msg}, args...)...) -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// assert.PanicsWithErrorf(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithErrorf(t TestingT, errString string, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return PanicsWithError(t, errString, f, append([]interface{}{msg}, args...)...) -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...) -} - -// Positivef asserts that the specified element is positive -// -// assert.Positivef(t, 1, "error message %s", "formatted") -// assert.Positivef(t, 1.23, "error message %s", "formatted") -func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Positive(t, e, append([]interface{}{msg}, args...)...) -} - -// Regexpf asserts that a specified regexp matches a string. -// -// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted") -func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Regexp(t, rx, str, append([]interface{}{msg}, args...)...) -} - -// Samef asserts that two pointers reference the same object. -// -// assert.Samef(t, ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Samef(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Same(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. -// -// assert.Subsetf(t, [1, 2, 3], [1, 2], "error message %s", "formatted") -// assert.Subsetf(t, {"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Subset(t, list, subset, append([]interface{}{msg}, args...)...) -} - -// Truef asserts that the specified value is true. -// -// assert.Truef(t, myBool, "error message %s", "formatted") -func Truef(t TestingT, value bool, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return True(t, value, append([]interface{}{msg}, args...)...) -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...) -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// assert.WithinRangef(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func WithinRangef(t TestingT, actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return WithinRange(t, actual, start, end, append([]interface{}{msg}, args...)...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func YAMLEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return YAMLEq(t, expected, actual, append([]interface{}{msg}, args...)...) -} - -// Zerof asserts that i is the zero value for its type. -func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Zero(t, i, append([]interface{}{msg}, args...)...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl deleted file mode 100644 index d2bb0b81..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{.CommentFormat}} -func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool { - if h, ok := t.(tHelper); ok { h.Helper() } - return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}}) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go deleted file mode 100644 index a84e09bd..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go +++ /dev/null @@ -1,1621 +0,0 @@ -// Code generated with github.com/stretchr/testify/_codegen; DO NOT EDIT. - -package assert - -import ( - http "net/http" - url "net/url" - time "time" -) - -// Condition uses a Comparison to assert a complex condition. -func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Condition(a.t, comp, msgAndArgs...) -} - -// Conditionf uses a Comparison to assert a complex condition. -func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Conditionf(a.t, comp, msg, args...) -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Contains("Hello World", "World") -// a.Contains(["Hello", "World"], "World") -// a.Contains({"Hello": "World"}, "Hello") -func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Contains(a.t, s, contains, msgAndArgs...) -} - -// Containsf asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// a.Containsf("Hello World", "World", "error message %s", "formatted") -// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted") -// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted") -func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Containsf(a.t, s, contains, msg, args...) -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return DirExists(a.t, path, msgAndArgs...) -} - -// DirExistsf checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return DirExistsf(a.t, path, msg, args...) -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2]) -func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ElementsMatch(a.t, listA, listB, msgAndArgs...) -} - -// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted") -func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ElementsMatchf(a.t, listA, listB, msg, args...) -} - -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// a.Empty(obj) -func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Empty(a.t, object, msgAndArgs...) -} - -// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// a.Emptyf(obj, "error message %s", "formatted") -func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Emptyf(a.t, object, msg, args...) -} - -// Equal asserts that two objects are equal. -// -// a.Equal(123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Equal(a.t, expected, actual, msgAndArgs...) -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualError(err, expectedErrorString) -func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualError(a.t, theError, errString, msgAndArgs...) -} - -// EqualErrorf asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted") -func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualErrorf(a.t, theError, errString, msg, args...) -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValues(S{1, 2}, S{1, 3}) => true -// a.EqualExportedValues(S{1, 2}, S{2, 3}) => false -func (a *Assertions) EqualExportedValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualExportedValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualExportedValuesf asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// a.EqualExportedValuesf(S{1, 2}, S{1, 3}, "error message %s", "formatted") => true -// a.EqualExportedValuesf(S{1, 2}, S{2, 3}, "error message %s", "formatted") => false -func (a *Assertions) EqualExportedValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualExportedValuesf(a.t, expected, actual, msg, args...) -} - -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. -// -// a.EqualValues(uint32(123), int32(123)) -func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualValues(a.t, expected, actual, msgAndArgs...) -} - -// EqualValuesf asserts that two objects are equal or convertible to the same types -// and equal. -// -// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted") -func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EqualValuesf(a.t, expected, actual, msg, args...) -} - -// Equalf asserts that two objects are equal. -// -// a.Equalf(123, 123, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Equalf(a.t, expected, actual, msg, args...) -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if a.Error(err) { -// assert.Equal(t, expectedError, err) -// } -func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Error(a.t, err, msgAndArgs...) -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorAs(a.t, err, target, msgAndArgs...) -} - -// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorAsf(a.t, err, target, msg, args...) -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContains(err, expectedErrorSubString) -func (a *Assertions) ErrorContains(theError error, contains string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorContains(a.t, theError, contains, msgAndArgs...) -} - -// ErrorContainsf asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// a.ErrorContainsf(err, expectedErrorSubString, "error message %s", "formatted") -func (a *Assertions) ErrorContainsf(theError error, contains string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorContainsf(a.t, theError, contains, msg, args...) -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorIs(a.t, err, target, msgAndArgs...) -} - -// ErrorIsf asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return ErrorIsf(a.t, err, target, msg, args...) -} - -// Errorf asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if a.Errorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedErrorf, err) -// } -func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Errorf(a.t, err, msg, args...) -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventually(func() bool { return true; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Eventually(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Eventually(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithT(func(c *assert.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithT(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EventuallyWithT(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// EventuallyWithTf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// a.EventuallyWithTf(func(c *assert.CollectT, "error message %s", "formatted") { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") -func (a *Assertions) EventuallyWithTf(condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return EventuallyWithTf(a.t, condition, waitFor, tick, msg, args...) -} - -// Eventuallyf asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// a.Eventuallyf(func() bool { return true; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Eventuallyf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Eventuallyf(a.t, condition, waitFor, tick, msg, args...) -} - -// Exactly asserts that two objects are equal in value and type. -// -// a.Exactly(int32(123), int64(123)) -func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Exactly(a.t, expected, actual, msgAndArgs...) -} - -// Exactlyf asserts that two objects are equal in value and type. -// -// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted") -func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Exactlyf(a.t, expected, actual, msg, args...) -} - -// Fail reports a failure through -func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Fail(a.t, failureMessage, msgAndArgs...) -} - -// FailNow fails test -func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FailNow(a.t, failureMessage, msgAndArgs...) -} - -// FailNowf fails test -func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FailNowf(a.t, failureMessage, msg, args...) -} - -// Failf reports a failure through -func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Failf(a.t, failureMessage, msg, args...) -} - -// False asserts that the specified value is false. -// -// a.False(myBool) -func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return False(a.t, value, msgAndArgs...) -} - -// Falsef asserts that the specified value is false. -// -// a.Falsef(myBool, "error message %s", "formatted") -func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Falsef(a.t, value, msg, args...) -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FileExists(a.t, path, msgAndArgs...) -} - -// FileExistsf checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return FileExistsf(a.t, path, msg, args...) -} - -// Greater asserts that the first element is greater than the second -// -// a.Greater(2, 1) -// a.Greater(float64(2), float64(1)) -// a.Greater("b", "a") -func (a *Assertions) Greater(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Greater(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqual asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqual(2, 1) -// a.GreaterOrEqual(2, 2) -// a.GreaterOrEqual("b", "a") -// a.GreaterOrEqual("b", "b") -func (a *Assertions) GreaterOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// GreaterOrEqualf asserts that the first element is greater than or equal to the second -// -// a.GreaterOrEqualf(2, 1, "error message %s", "formatted") -// a.GreaterOrEqualf(2, 2, "error message %s", "formatted") -// a.GreaterOrEqualf("b", "a", "error message %s", "formatted") -// a.GreaterOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return GreaterOrEqualf(a.t, e1, e2, msg, args...) -} - -// Greaterf asserts that the first element is greater than the second -// -// a.Greaterf(2, 1, "error message %s", "formatted") -// a.Greaterf(float64(2), float64(1), "error message %s", "formatted") -// a.Greaterf("b", "a", "error message %s", "formatted") -func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Greaterf(a.t, e1, e2, msg, args...) -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyContainsf asserts that a specified handler returns a -// body that contains a string. -// -// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...) -} - -// HTTPBodyNotContainsf asserts that a specified handler returns a -// body that does not contain a string. -// -// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...) -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPError(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPErrorf asserts that a specified handler returns an error status code. -// -// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPErrorf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPRedirectf asserts that a specified handler returns a redirect status code. -// -// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPRedirectf(a.t, handler, method, url, values, msg, args...) -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCode(myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCode(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCode(a.t, handler, method, url, values, statuscode, msgAndArgs...) -} - -// HTTPStatusCodef asserts that a specified handler returns a specified status code. -// -// a.HTTPStatusCodef(myHandler, "GET", "/notImplemented", nil, 501, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPStatusCodef(handler http.HandlerFunc, method string, url string, values url.Values, statuscode int, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPStatusCodef(a.t, handler, method, url, values, statuscode, msg, args...) -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...) -} - -// HTTPSuccessf asserts that a specified handler returns a success status code. -// -// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted") -// -// Returns whether the assertion was successful (true) or not (false). -func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return HTTPSuccessf(a.t, handler, method, url, values, msg, args...) -} - -// Implements asserts that an object is implemented by the specified interface. -// -// a.Implements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Implements(a.t, interfaceObject, object, msgAndArgs...) -} - -// Implementsf asserts that an object is implemented by the specified interface. -// -// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Implementsf(a.t, interfaceObject, object, msg, args...) -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// a.InDelta(math.Pi, 22/7.0, 0.01) -func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDelta(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) -} - -// InDeltaSlicef is the same as InDelta, except it compares two slices. -func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaSlicef(a.t, expected, actual, delta, msg, args...) -} - -// InDeltaf asserts that the two numerals are within delta of each other. -// -// a.InDeltaf(math.Pi, 22/7.0, 0.01, "error message %s", "formatted") -func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InDeltaf(a.t, expected, actual, delta, msg, args...) -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...) -} - -// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices. -func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...) -} - -// InEpsilonf asserts that expected and actual have a relative error less than epsilon -func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return InEpsilonf(a.t, expected, actual, epsilon, msg, args...) -} - -// IsDecreasing asserts that the collection is decreasing -// -// a.IsDecreasing([]int{2, 1, 0}) -// a.IsDecreasing([]float{2, 1}) -// a.IsDecreasing([]string{"b", "a"}) -func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsDecreasing(a.t, object, msgAndArgs...) -} - -// IsDecreasingf asserts that the collection is decreasing -// -// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted") -// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsDecreasingf(a.t, object, msg, args...) -} - -// IsIncreasing asserts that the collection is increasing -// -// a.IsIncreasing([]int{1, 2, 3}) -// a.IsIncreasing([]float{1, 2}) -// a.IsIncreasing([]string{"a", "b"}) -func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsIncreasing(a.t, object, msgAndArgs...) -} - -// IsIncreasingf asserts that the collection is increasing -// -// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted") -// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsIncreasingf(a.t, object, msg, args...) -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// a.IsNonDecreasing([]int{1, 1, 2}) -// a.IsNonDecreasing([]float{1, 2}) -// a.IsNonDecreasing([]string{"a", "b"}) -func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasing(a.t, object, msgAndArgs...) -} - -// IsNonDecreasingf asserts that the collection is not decreasing -// -// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted") -// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted") -func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonDecreasingf(a.t, object, msg, args...) -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// a.IsNonIncreasing([]int{2, 1, 1}) -// a.IsNonIncreasing([]float{2, 1}) -// a.IsNonIncreasing([]string{"b", "a"}) -func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasing(a.t, object, msgAndArgs...) -} - -// IsNonIncreasingf asserts that the collection is not increasing -// -// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted") -// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted") -func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsNonIncreasingf(a.t, object, msg, args...) -} - -// IsType asserts that the specified objects are of the same type. -func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsType(a.t, expectedType, object, msgAndArgs...) -} - -// IsTypef asserts that the specified objects are of the same type. -func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return IsTypef(a.t, expectedType, object, msg, args...) -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return JSONEq(a.t, expected, actual, msgAndArgs...) -} - -// JSONEqf asserts that two JSON strings are equivalent. -// -// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted") -func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return JSONEqf(a.t, expected, actual, msg, args...) -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// a.Len(mySlice, 3) -func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Len(a.t, object, length, msgAndArgs...) -} - -// Lenf asserts that the specified object has specific length. -// Lenf also fails if the object has a type that len() not accept. -// -// a.Lenf(mySlice, 3, "error message %s", "formatted") -func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Lenf(a.t, object, length, msg, args...) -} - -// Less asserts that the first element is less than the second -// -// a.Less(1, 2) -// a.Less(float64(1), float64(2)) -// a.Less("a", "b") -func (a *Assertions) Less(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Less(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqual asserts that the first element is less than or equal to the second -// -// a.LessOrEqual(1, 2) -// a.LessOrEqual(2, 2) -// a.LessOrEqual("a", "b") -// a.LessOrEqual("b", "b") -func (a *Assertions) LessOrEqual(e1 interface{}, e2 interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return LessOrEqual(a.t, e1, e2, msgAndArgs...) -} - -// LessOrEqualf asserts that the first element is less than or equal to the second -// -// a.LessOrEqualf(1, 2, "error message %s", "formatted") -// a.LessOrEqualf(2, 2, "error message %s", "formatted") -// a.LessOrEqualf("a", "b", "error message %s", "formatted") -// a.LessOrEqualf("b", "b", "error message %s", "formatted") -func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return LessOrEqualf(a.t, e1, e2, msg, args...) -} - -// Lessf asserts that the first element is less than the second -// -// a.Lessf(1, 2, "error message %s", "formatted") -// a.Lessf(float64(1), float64(2), "error message %s", "formatted") -// a.Lessf("a", "b", "error message %s", "formatted") -func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Lessf(a.t, e1, e2, msg, args...) -} - -// Negative asserts that the specified element is negative -// -// a.Negative(-1) -// a.Negative(-1.23) -func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Negative(a.t, e, msgAndArgs...) -} - -// Negativef asserts that the specified element is negative -// -// a.Negativef(-1, "error message %s", "formatted") -// a.Negativef(-1.23, "error message %s", "formatted") -func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Negativef(a.t, e, msg, args...) -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Never(func() bool { return false; }, time.Second, 10*time.Millisecond) -func (a *Assertions) Never(condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Never(a.t, condition, waitFor, tick, msgAndArgs...) -} - -// Neverf asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// a.Neverf(func() bool { return false; }, time.Second, 10*time.Millisecond, "error message %s", "formatted") -func (a *Assertions) Neverf(condition func() bool, waitFor time.Duration, tick time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Neverf(a.t, condition, waitFor, tick, msg, args...) -} - -// Nil asserts that the specified object is nil. -// -// a.Nil(err) -func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Nil(a.t, object, msgAndArgs...) -} - -// Nilf asserts that the specified object is nil. -// -// a.Nilf(err, "error message %s", "formatted") -func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Nilf(a.t, object, msg, args...) -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoDirExists(a.t, path, msgAndArgs...) -} - -// NoDirExistsf checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func (a *Assertions) NoDirExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoDirExistsf(a.t, path, msg, args...) -} - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoError(err) { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoError(a.t, err, msgAndArgs...) -} - -// NoErrorf asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if a.NoErrorf(err, "error message %s", "formatted") { -// assert.Equal(t, expectedObj, actualObj) -// } -func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoErrorf(a.t, err, msg, args...) -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExists(path string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoFileExists(a.t, path, msgAndArgs...) -} - -// NoFileExistsf checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func (a *Assertions) NoFileExistsf(path string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NoFileExistsf(a.t, path, msg, args...) -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContains("Hello World", "Earth") -// a.NotContains(["Hello", "World"], "Earth") -// a.NotContains({"Hello": "World"}, "Earth") -func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotContains(a.t, s, contains, msgAndArgs...) -} - -// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted") -// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted") -// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted") -func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotContainsf(a.t, s, contains, msg, args...) -} - -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if a.NotEmpty(obj) { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEmpty(a.t, object, msgAndArgs...) -} - -// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if a.NotEmptyf(obj, "error message %s", "formatted") { -// assert.Equal(t, "two", obj[1]) -// } -func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEmptyf(a.t, object, msg, args...) -} - -// NotEqual asserts that the specified values are NOT equal. -// -// a.NotEqual(obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqual(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValues(obj1, obj2) -func (a *Assertions) NotEqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualValues(a.t, expected, actual, msgAndArgs...) -} - -// NotEqualValuesf asserts that two objects are not equal even when converted to the same type -// -// a.NotEqualValuesf(obj1, obj2, "error message %s", "formatted") -func (a *Assertions) NotEqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualValuesf(a.t, expected, actual, msg, args...) -} - -// NotEqualf asserts that the specified values are NOT equal. -// -// a.NotEqualf(obj1, obj2, "error message %s", "formatted") -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotEqualf(a.t, expected, actual, msg, args...) -} - -// NotErrorIs asserts that at none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorIs(a.t, err, target, msgAndArgs...) -} - -// NotErrorIsf asserts that at none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotErrorIsf(a.t, err, target, msg, args...) -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// a.NotImplements((*MyInterface)(nil), new(MyObject)) -func (a *Assertions) NotImplements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotImplements(a.t, interfaceObject, object, msgAndArgs...) -} - -// NotImplementsf asserts that an object does not implement the specified interface. -// -// a.NotImplementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted") -func (a *Assertions) NotImplementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotImplementsf(a.t, interfaceObject, object, msg, args...) -} - -// NotNil asserts that the specified object is not nil. -// -// a.NotNil(err) -func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotNil(a.t, object, msgAndArgs...) -} - -// NotNilf asserts that the specified object is not nil. -// -// a.NotNilf(err, "error message %s", "formatted") -func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotNilf(a.t, object, msg, args...) -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanics(func(){ RemainCalm() }) -func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotPanics(a.t, f, msgAndArgs...) -} - -// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted") -func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotPanicsf(a.t, f, msg, args...) -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") -// a.NotRegexp("^start", "it's not starting") -func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotRegexp(a.t, rx, str, msgAndArgs...) -} - -// NotRegexpf asserts that a specified regexp does not match a string. -// -// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted") -// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted") -func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotRegexpf(a.t, rx, str, msg, args...) -} - -// NotSame asserts that two pointers do not reference the same object. -// -// a.NotSame(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSame(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSame(a.t, expected, actual, msgAndArgs...) -} - -// NotSamef asserts that two pointers do not reference the same object. -// -// a.NotSamef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) NotSamef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSamef(a.t, expected, actual, msg, args...) -} - -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. -// -// a.NotSubset([1, 3, 4], [1, 2]) -// a.NotSubset({"x": 1, "y": 2}, {"z": 3}) -func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSubset(a.t, list, subset, msgAndArgs...) -} - -// NotSubsetf asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. -// -// a.NotSubsetf([1, 3, 4], [1, 2], "error message %s", "formatted") -// a.NotSubsetf({"x": 1, "y": 2}, {"z": 3}, "error message %s", "formatted") -func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotSubsetf(a.t, list, subset, msg, args...) -} - -// NotZero asserts that i is not the zero value for its type. -func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotZero(a.t, i, msgAndArgs...) -} - -// NotZerof asserts that i is not the zero value for its type. -func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return NotZerof(a.t, i, msg, args...) -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panics(func(){ GoCrazy() }) -func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Panics(a.t, f, msgAndArgs...) -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithError("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithError(errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithError(a.t, errString, f, msgAndArgs...) -} - -// PanicsWithErrorf asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// a.PanicsWithErrorf("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithErrorf(errString string, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithErrorf(a.t, errString, f, msg, args...) -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValue("crazy error", func(){ GoCrazy() }) -func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithValue(a.t, expected, f, msgAndArgs...) -} - -// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return PanicsWithValuef(a.t, expected, f, msg, args...) -} - -// Panicsf asserts that the code inside the specified PanicTestFunc panics. -// -// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted") -func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Panicsf(a.t, f, msg, args...) -} - -// Positive asserts that the specified element is positive -// -// a.Positive(1) -// a.Positive(1.23) -func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Positive(a.t, e, msgAndArgs...) -} - -// Positivef asserts that the specified element is positive -// -// a.Positivef(1, "error message %s", "formatted") -// a.Positivef(1.23, "error message %s", "formatted") -func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Positivef(a.t, e, msg, args...) -} - -// Regexp asserts that a specified regexp matches a string. -// -// a.Regexp(regexp.MustCompile("start"), "it's starting") -// a.Regexp("start...$", "it's not starting") -func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Regexp(a.t, rx, str, msgAndArgs...) -} - -// Regexpf asserts that a specified regexp matches a string. -// -// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted") -// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted") -func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Regexpf(a.t, rx, str, msg, args...) -} - -// Same asserts that two pointers reference the same object. -// -// a.Same(ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Same(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Same(a.t, expected, actual, msgAndArgs...) -} - -// Samef asserts that two pointers reference the same object. -// -// a.Samef(ptr1, ptr2, "error message %s", "formatted") -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func (a *Assertions) Samef(expected interface{}, actual interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Samef(a.t, expected, actual, msg, args...) -} - -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. -// -// a.Subset([1, 2, 3], [1, 2]) -// a.Subset({"x": 1, "y": 2}, {"x": 1}) -func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Subset(a.t, list, subset, msgAndArgs...) -} - -// Subsetf asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. -// -// a.Subsetf([1, 2, 3], [1, 2], "error message %s", "formatted") -// a.Subsetf({"x": 1, "y": 2}, {"x": 1}, "error message %s", "formatted") -func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Subsetf(a.t, list, subset, msg, args...) -} - -// True asserts that the specified value is true. -// -// a.True(myBool) -func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return True(a.t, value, msgAndArgs...) -} - -// Truef asserts that the specified value is true. -// -// a.Truef(myBool, "error message %s", "formatted") -func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Truef(a.t, value, msg, args...) -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// a.WithinDuration(time.Now(), time.Now(), 10*time.Second) -func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) -} - -// WithinDurationf asserts that the two times are within duration delta of each other. -// -// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted") -func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinDurationf(a.t, expected, actual, delta, msg, args...) -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// a.WithinRange(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func (a *Assertions) WithinRange(actual time.Time, start time.Time, end time.Time, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinRange(a.t, actual, start, end, msgAndArgs...) -} - -// WithinRangef asserts that a time is within a time range (inclusive). -// -// a.WithinRangef(time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second), "error message %s", "formatted") -func (a *Assertions) WithinRangef(actual time.Time, start time.Time, end time.Time, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return WithinRangef(a.t, actual, start, end, msg, args...) -} - -// YAMLEq asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEq(expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEq(a.t, expected, actual, msgAndArgs...) -} - -// YAMLEqf asserts that two YAML strings are equivalent. -func (a *Assertions) YAMLEqf(expected string, actual string, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return YAMLEqf(a.t, expected, actual, msg, args...) -} - -// Zero asserts that i is the zero value for its type. -func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Zero(a.t, i, msgAndArgs...) -} - -// Zerof asserts that i is the zero value for its type. -func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool { - if h, ok := a.t.(tHelper); ok { - h.Helper() - } - return Zerof(a.t, i, msg, args...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl deleted file mode 100644 index 188bb9e1..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl +++ /dev/null @@ -1,5 +0,0 @@ -{{.CommentWithoutT "a"}} -func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { - if h, ok := a.t.(tHelper); ok { h.Helper() } - return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_order.go b/vendor/github.com/stretchr/testify/assert/assertion_order.go deleted file mode 100644 index 00df62a0..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertion_order.go +++ /dev/null @@ -1,81 +0,0 @@ -package assert - -import ( - "fmt" - "reflect" -) - -// isOrdered checks that collection contains orderable elements. -func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool { - objKind := reflect.TypeOf(object).Kind() - if objKind != reflect.Slice && objKind != reflect.Array { - return false - } - - objValue := reflect.ValueOf(object) - objLen := objValue.Len() - - if objLen <= 1 { - return true - } - - value := objValue.Index(0) - valueInterface := value.Interface() - firstValueKind := value.Kind() - - for i := 1; i < objLen; i++ { - prevValue := value - prevValueInterface := valueInterface - - value = objValue.Index(i) - valueInterface = value.Interface() - - compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind) - - if !isComparable { - return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...) - } - - if !containsValue(allowedComparesResults, compareResult) { - return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...) - } - } - - return true -} - -// IsIncreasing asserts that the collection is increasing -// -// assert.IsIncreasing(t, []int{1, 2, 3}) -// assert.IsIncreasing(t, []float{1, 2}) -// assert.IsIncreasing(t, []string{"a", "b"}) -func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs...) -} - -// IsNonIncreasing asserts that the collection is not increasing -// -// assert.IsNonIncreasing(t, []int{2, 1, 1}) -// assert.IsNonIncreasing(t, []float{2, 1}) -// assert.IsNonIncreasing(t, []string{"b", "a"}) -func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs...) -} - -// IsDecreasing asserts that the collection is decreasing -// -// assert.IsDecreasing(t, []int{2, 1, 0}) -// assert.IsDecreasing(t, []float{2, 1}) -// assert.IsDecreasing(t, []string{"b", "a"}) -func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs...) -} - -// IsNonDecreasing asserts that the collection is not decreasing -// -// assert.IsNonDecreasing(t, []int{1, 1, 2}) -// assert.IsNonDecreasing(t, []float{1, 2}) -// assert.IsNonDecreasing(t, []string{"a", "b"}) -func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs...) -} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go deleted file mode 100644 index 0b7570f2..00000000 --- a/vendor/github.com/stretchr/testify/assert/assertions.go +++ /dev/null @@ -1,2105 +0,0 @@ -package assert - -import ( - "bufio" - "bytes" - "encoding/json" - "errors" - "fmt" - "math" - "os" - "reflect" - "regexp" - "runtime" - "runtime/debug" - "strings" - "time" - "unicode" - "unicode/utf8" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" - "gopkg.in/yaml.v3" -) - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_format.go.tmpl" - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Errorf(format string, args ...interface{}) -} - -// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful -// for table driven tests. -type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool - -// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful -// for table driven tests. -type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool - -// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful -// for table driven tests. -type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool - -// ErrorAssertionFunc is a common function prototype when validating an error value. Can be useful -// for table driven tests. -type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool - -// Comparison is a custom function that returns true on success and false on failure -type Comparison func() (success bool) - -/* - Helper functions -*/ - -// ObjectsAreEqual determines if two objects are considered equal. -// -// This function does no assertion of any kind. -func ObjectsAreEqual(expected, actual interface{}) bool { - if expected == nil || actual == nil { - return expected == actual - } - - exp, ok := expected.([]byte) - if !ok { - return reflect.DeepEqual(expected, actual) - } - - act, ok := actual.([]byte) - if !ok { - return false - } - if exp == nil || act == nil { - return exp == nil && act == nil - } - return bytes.Equal(exp, act) -} - -// copyExportedFields iterates downward through nested data structures and creates a copy -// that only contains the exported struct fields. -func copyExportedFields(expected interface{}) interface{} { - if isNil(expected) { - return expected - } - - expectedType := reflect.TypeOf(expected) - expectedKind := expectedType.Kind() - expectedValue := reflect.ValueOf(expected) - - switch expectedKind { - case reflect.Struct: - result := reflect.New(expectedType).Elem() - for i := 0; i < expectedType.NumField(); i++ { - field := expectedType.Field(i) - isExported := field.IsExported() - if isExported { - fieldValue := expectedValue.Field(i) - if isNil(fieldValue) || isNil(fieldValue.Interface()) { - continue - } - newValue := copyExportedFields(fieldValue.Interface()) - result.Field(i).Set(reflect.ValueOf(newValue)) - } - } - return result.Interface() - - case reflect.Ptr: - result := reflect.New(expectedType.Elem()) - unexportedRemoved := copyExportedFields(expectedValue.Elem().Interface()) - result.Elem().Set(reflect.ValueOf(unexportedRemoved)) - return result.Interface() - - case reflect.Array, reflect.Slice: - var result reflect.Value - if expectedKind == reflect.Array { - result = reflect.New(reflect.ArrayOf(expectedValue.Len(), expectedType.Elem())).Elem() - } else { - result = reflect.MakeSlice(expectedType, expectedValue.Len(), expectedValue.Len()) - } - for i := 0; i < expectedValue.Len(); i++ { - index := expectedValue.Index(i) - if isNil(index) { - continue - } - unexportedRemoved := copyExportedFields(index.Interface()) - result.Index(i).Set(reflect.ValueOf(unexportedRemoved)) - } - return result.Interface() - - case reflect.Map: - result := reflect.MakeMap(expectedType) - for _, k := range expectedValue.MapKeys() { - index := expectedValue.MapIndex(k) - unexportedRemoved := copyExportedFields(index.Interface()) - result.SetMapIndex(k, reflect.ValueOf(unexportedRemoved)) - } - return result.Interface() - - default: - return expected - } -} - -// ObjectsExportedFieldsAreEqual determines if the exported (public) fields of two objects are -// considered equal. This comparison of only exported fields is applied recursively to nested data -// structures. -// -// This function does no assertion of any kind. -// -// Deprecated: Use [EqualExportedValues] instead. -func ObjectsExportedFieldsAreEqual(expected, actual interface{}) bool { - expectedCleaned := copyExportedFields(expected) - actualCleaned := copyExportedFields(actual) - return ObjectsAreEqualValues(expectedCleaned, actualCleaned) -} - -// ObjectsAreEqualValues gets whether two objects are equal, or if their -// values are equal. -func ObjectsAreEqualValues(expected, actual interface{}) bool { - if ObjectsAreEqual(expected, actual) { - return true - } - - expectedValue := reflect.ValueOf(expected) - actualValue := reflect.ValueOf(actual) - if !expectedValue.IsValid() || !actualValue.IsValid() { - return false - } - - expectedType := expectedValue.Type() - actualType := actualValue.Type() - if !expectedType.ConvertibleTo(actualType) { - return false - } - - if !isNumericType(expectedType) || !isNumericType(actualType) { - // Attempt comparison after type conversion - return reflect.DeepEqual( - expectedValue.Convert(actualType).Interface(), actual, - ) - } - - // If BOTH values are numeric, there are chances of false positives due - // to overflow or underflow. So, we need to make sure to always convert - // the smaller type to a larger type before comparing. - if expectedType.Size() >= actualType.Size() { - return actualValue.Convert(expectedType).Interface() == expected - } - - return expectedValue.Convert(actualType).Interface() == actual -} - -// isNumericType returns true if the type is one of: -// int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, -// float32, float64, complex64, complex128 -func isNumericType(t reflect.Type) bool { - return t.Kind() >= reflect.Int && t.Kind() <= reflect.Complex128 -} - -/* CallerInfo is necessary because the assert functions use the testing object -internally, causing it to print the file:line of the assert method, rather than where -the problem actually occurred in calling code.*/ - -// CallerInfo returns an array of strings containing the file and line number -// of each stack frame leading from the current test to the assert call that -// failed. -func CallerInfo() []string { - - var pc uintptr - var ok bool - var file string - var line int - var name string - - callers := []string{} - for i := 0; ; i++ { - pc, file, line, ok = runtime.Caller(i) - if !ok { - // The breaks below failed to terminate the loop, and we ran off the - // end of the call stack. - break - } - - // This is a huge edge case, but it will panic if this is the case, see #180 - if file == "" { - break - } - - f := runtime.FuncForPC(pc) - if f == nil { - break - } - name = f.Name() - - // testing.tRunner is the standard library function that calls - // tests. Subtests are called directly by tRunner, without going through - // the Test/Benchmark/Example function that contains the t.Run calls, so - // with subtests we should break when we hit tRunner, without adding it - // to the list of callers. - if name == "testing.tRunner" { - break - } - - parts := strings.Split(file, "/") - if len(parts) > 1 { - filename := parts[len(parts)-1] - dir := parts[len(parts)-2] - if (dir != "assert" && dir != "mock" && dir != "require") || filename == "mock_test.go" { - callers = append(callers, fmt.Sprintf("%s:%d", file, line)) - } - } - - // Drop the package - segments := strings.Split(name, ".") - name = segments[len(segments)-1] - if isTest(name, "Test") || - isTest(name, "Benchmark") || - isTest(name, "Example") { - break - } - } - - return callers -} - -// Stolen from the `go test` tool. -// isTest tells whether name looks like a test (or benchmark, according to prefix). -// It is a Test (say) if there is a character after Test that is not a lower-case letter. -// We don't want TesticularCancer. -func isTest(name, prefix string) bool { - if !strings.HasPrefix(name, prefix) { - return false - } - if len(name) == len(prefix) { // "Test" is ok - return true - } - r, _ := utf8.DecodeRuneInString(name[len(prefix):]) - return !unicode.IsLower(r) -} - -func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { - if len(msgAndArgs) == 0 || msgAndArgs == nil { - return "" - } - if len(msgAndArgs) == 1 { - msg := msgAndArgs[0] - if msgAsStr, ok := msg.(string); ok { - return msgAsStr - } - return fmt.Sprintf("%+v", msg) - } - if len(msgAndArgs) > 1 { - return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) - } - return "" -} - -// Aligns the provided message so that all lines after the first line start at the same location as the first line. -// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab). -// The longestLabelLen parameter specifies the length of the longest label in the output (required because this is the -// basis on which the alignment occurs). -func indentMessageLines(message string, longestLabelLen int) string { - outBuf := new(bytes.Buffer) - - for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { - // no need to align first line because it starts at the correct location (after the label) - if i != 0 { - // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab - outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t") - } - outBuf.WriteString(scanner.Text()) - } - - return outBuf.String() -} - -type failNower interface { - FailNow() -} - -// FailNow fails test -func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, failureMessage, msgAndArgs...) - - // We cannot extend TestingT with FailNow() and - // maintain backwards compatibility, so we fallback - // to panicking when FailNow is not available in - // TestingT. - // See issue #263 - - if t, ok := t.(failNower); ok { - t.FailNow() - } else { - panic("test failed and t is missing `FailNow()`") - } - return false -} - -// Fail reports a failure through -func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - content := []labeledContent{ - {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")}, - {"Error", failureMessage}, - } - - // Add test name if the Go version supports it - if n, ok := t.(interface { - Name() string - }); ok { - content = append(content, labeledContent{"Test", n.Name()}) - } - - message := messageFromMsgAndArgs(msgAndArgs...) - if len(message) > 0 { - content = append(content, labeledContent{"Messages", message}) - } - - t.Errorf("\n%s", ""+labeledOutput(content...)) - - return false -} - -type labeledContent struct { - label string - content string -} - -// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner: -// -// \t{{label}}:{{align_spaces}}\t{{content}}\n -// -// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label. -// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this -// alignment is achieved, "\t{{content}}\n" is added for the output. -// -// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line. -func labeledOutput(content ...labeledContent) string { - longestLabel := 0 - for _, v := range content { - if len(v.label) > longestLabel { - longestLabel = len(v.label) - } - } - var output string - for _, v := range content { - output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n" - } - return output -} - -// Implements asserts that an object is implemented by the specified interface. -// -// assert.Implements(t, (*MyInterface)(nil), new(MyObject)) -func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - interfaceType := reflect.TypeOf(interfaceObject).Elem() - - if object == nil { - return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...) - } - if !reflect.TypeOf(object).Implements(interfaceType) { - return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) - } - - return true -} - -// NotImplements asserts that an object does not implement the specified interface. -// -// assert.NotImplements(t, (*MyInterface)(nil), new(MyObject)) -func NotImplements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - interfaceType := reflect.TypeOf(interfaceObject).Elem() - - if object == nil { - return Fail(t, fmt.Sprintf("Cannot check if nil does not implement %v", interfaceType), msgAndArgs...) - } - if reflect.TypeOf(object).Implements(interfaceType) { - return Fail(t, fmt.Sprintf("%T implements %v", object, interfaceType), msgAndArgs...) - } - - return true -} - -// IsType asserts that the specified objects are of the same type. -func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { - return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) - } - - return true -} - -// Equal asserts that two objects are equal. -// -// assert.Equal(t, 123, 123) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). Function equality -// cannot be determined and will always fail. -func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if err := validateEqualArgs(expected, actual); err != nil { - return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)", - expected, actual, err), msgAndArgs...) - } - - if !ObjectsAreEqual(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal: \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true - -} - -// validateEqualArgs checks whether provided arguments can be safely used in the -// Equal/NotEqual functions. -func validateEqualArgs(expected, actual interface{}) error { - if expected == nil && actual == nil { - return nil - } - - if isFunction(expected) || isFunction(actual) { - return errors.New("cannot take func type as argument") - } - return nil -} - -// Same asserts that two pointers reference the same object. -// -// assert.Same(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func Same(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if !samePointers(expected, actual) { - return Fail(t, fmt.Sprintf("Not same: \n"+ - "expected: %p %#v\n"+ - "actual : %p %#v", expected, expected, actual, actual), msgAndArgs...) - } - - return true -} - -// NotSame asserts that two pointers do not reference the same object. -// -// assert.NotSame(t, ptr1, ptr2) -// -// Both arguments must be pointer variables. Pointer variable sameness is -// determined based on the equality of both type and value. -func NotSame(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if samePointers(expected, actual) { - return Fail(t, fmt.Sprintf( - "Expected and actual point to the same object: %p %#v", - expected, expected), msgAndArgs...) - } - return true -} - -// samePointers compares two generic interface objects and returns whether -// they point to the same object -func samePointers(first, second interface{}) bool { - firstPtr, secondPtr := reflect.ValueOf(first), reflect.ValueOf(second) - if firstPtr.Kind() != reflect.Ptr || secondPtr.Kind() != reflect.Ptr { - return false - } - - firstType, secondType := reflect.TypeOf(first), reflect.TypeOf(second) - if firstType != secondType { - return false - } - - // compare pointer addresses - return first == second -} - -// formatUnequalValues takes two values of arbitrary types and returns string -// representations appropriate to be presented to the user. -// -// If the values are not of like type, the returned strings will be prefixed -// with the type name, and the value will be enclosed in parentheses similar -// to a type conversion in the Go grammar. -func formatUnequalValues(expected, actual interface{}) (e string, a string) { - if reflect.TypeOf(expected) != reflect.TypeOf(actual) { - return fmt.Sprintf("%T(%s)", expected, truncatingFormat(expected)), - fmt.Sprintf("%T(%s)", actual, truncatingFormat(actual)) - } - switch expected.(type) { - case time.Duration: - return fmt.Sprintf("%v", expected), fmt.Sprintf("%v", actual) - } - return truncatingFormat(expected), truncatingFormat(actual) -} - -// truncatingFormat formats the data and truncates it if it's too long. -// -// This helps keep formatted error messages lines from exceeding the -// bufio.MaxScanTokenSize max line length that the go testing framework imposes. -func truncatingFormat(data interface{}) string { - value := fmt.Sprintf("%#v", data) - max := bufio.MaxScanTokenSize - 100 // Give us some space the type info too if needed. - if len(value) > max { - value = value[0:max] + "<... truncated>" - } - return value -} - -// EqualValues asserts that two objects are equal or convertible to the same types -// and equal. -// -// assert.EqualValues(t, uint32(123), int32(123)) -func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if !ObjectsAreEqualValues(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal: \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true - -} - -// EqualExportedValues asserts that the types of two objects are equal and their public -// fields are also equal. This is useful for comparing structs that have private fields -// that could potentially differ. -// -// type S struct { -// Exported int -// notExported int -// } -// assert.EqualExportedValues(t, S{1, 2}, S{1, 3}) => true -// assert.EqualExportedValues(t, S{1, 2}, S{2, 3}) => false -func EqualExportedValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - aType := reflect.TypeOf(expected) - bType := reflect.TypeOf(actual) - - if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) - } - - if aType.Kind() == reflect.Ptr { - aType = aType.Elem() - } - if bType.Kind() == reflect.Ptr { - bType = bType.Elem() - } - - if aType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", aType.Kind(), reflect.Struct), msgAndArgs...) - } - - if bType.Kind() != reflect.Struct { - return Fail(t, fmt.Sprintf("Types expected to both be struct or pointer to struct \n\t%v != %v", bType.Kind(), reflect.Struct), msgAndArgs...) - } - - expected = copyExportedFields(expected) - actual = copyExportedFields(actual) - - if !ObjectsAreEqualValues(expected, actual) { - diff := diff(expected, actual) - expected, actual = formatUnequalValues(expected, actual) - return Fail(t, fmt.Sprintf("Not equal (comparing only exported fields): \n"+ - "expected: %s\n"+ - "actual : %s%s", expected, actual, diff), msgAndArgs...) - } - - return true -} - -// Exactly asserts that two objects are equal in value and type. -// -// assert.Exactly(t, int32(123), int64(123)) -func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - aType := reflect.TypeOf(expected) - bType := reflect.TypeOf(actual) - - if aType != bType { - return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...) - } - - return Equal(t, expected, actual, msgAndArgs...) - -} - -// NotNil asserts that the specified object is not nil. -// -// assert.NotNil(t, err) -func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if !isNil(object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Expected value not to be nil.", msgAndArgs...) -} - -// isNil checks if a specified object is nil or not, without Failing. -func isNil(object interface{}) bool { - if object == nil { - return true - } - - value := reflect.ValueOf(object) - switch value.Kind() { - case - reflect.Chan, reflect.Func, - reflect.Interface, reflect.Map, - reflect.Ptr, reflect.Slice, reflect.UnsafePointer: - - return value.IsNil() - } - - return false -} - -// Nil asserts that the specified object is nil. -// -// assert.Nil(t, err) -func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - if isNil(object) { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) -} - -// isEmpty gets whether the specified object is considered empty or not. -func isEmpty(object interface{}) bool { - - // get nil case out of the way - if object == nil { - return true - } - - objValue := reflect.ValueOf(object) - - switch objValue.Kind() { - // collection types are empty when they have no element - case reflect.Chan, reflect.Map, reflect.Slice: - return objValue.Len() == 0 - // pointers are empty if nil or if the value they point to is empty - case reflect.Ptr: - if objValue.IsNil() { - return true - } - deref := objValue.Elem().Interface() - return isEmpty(deref) - // for all other types, compare against the zero value - // array types are empty when they match their zero-initialized state - default: - zero := reflect.Zero(objValue.Type()) - return reflect.DeepEqual(object, zero.Interface()) - } -} - -// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// assert.Empty(t, obj) -func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - pass := isEmpty(object) - if !pass { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) - } - - return pass - -} - -// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either -// a slice or a channel with len == 0. -// -// if assert.NotEmpty(t, obj) { -// assert.Equal(t, "two", obj[1]) -// } -func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { - pass := !isEmpty(object) - if !pass { - if h, ok := t.(tHelper); ok { - h.Helper() - } - Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) - } - - return pass - -} - -// getLen tries to get the length of an object. -// It returns (0, false) if impossible. -func getLen(x interface{}) (length int, ok bool) { - v := reflect.ValueOf(x) - defer func() { - ok = recover() == nil - }() - return v.Len(), true -} - -// Len asserts that the specified object has specific length. -// Len also fails if the object has a type that len() not accept. -// -// assert.Len(t, mySlice, 3) -func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - l, ok := getLen(object) - if !ok { - return Fail(t, fmt.Sprintf("\"%v\" could not be applied builtin len()", object), msgAndArgs...) - } - - if l != length { - return Fail(t, fmt.Sprintf("\"%v\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) - } - return true -} - -// True asserts that the specified value is true. -// -// assert.True(t, myBool) -func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if !value { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Should be true", msgAndArgs...) - } - - return true - -} - -// False asserts that the specified value is false. -// -// assert.False(t, myBool) -func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { - if value { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "Should be false", msgAndArgs...) - } - - return true - -} - -// NotEqual asserts that the specified values are NOT equal. -// -// assert.NotEqual(t, obj1, obj2) -// -// Pointer variable equality is determined based on the equality of the -// referenced values (as opposed to the memory addresses). -func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if err := validateEqualArgs(expected, actual); err != nil { - return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)", - expected, actual, err), msgAndArgs...) - } - - if ObjectsAreEqual(expected, actual) { - return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) - } - - return true - -} - -// NotEqualValues asserts that two objects are not equal even when converted to the same type -// -// assert.NotEqualValues(t, obj1, obj2) -func NotEqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if ObjectsAreEqualValues(expected, actual) { - return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) - } - - return true -} - -// containsElement try loop over the list check if the list includes the element. -// return (false, false) if impossible. -// return (true, false) if element was not found. -// return (true, true) if element was found. -func containsElement(list interface{}, element interface{}) (ok, found bool) { - - listValue := reflect.ValueOf(list) - listType := reflect.TypeOf(list) - if listType == nil { - return false, false - } - listKind := listType.Kind() - defer func() { - if e := recover(); e != nil { - ok = false - found = false - } - }() - - if listKind == reflect.String { - elementValue := reflect.ValueOf(element) - return true, strings.Contains(listValue.String(), elementValue.String()) - } - - if listKind == reflect.Map { - mapKeys := listValue.MapKeys() - for i := 0; i < len(mapKeys); i++ { - if ObjectsAreEqual(mapKeys[i].Interface(), element) { - return true, true - } - } - return true, false - } - - for i := 0; i < listValue.Len(); i++ { - if ObjectsAreEqual(listValue.Index(i).Interface(), element) { - return true, true - } - } - return true, false - -} - -// Contains asserts that the specified string, list(array, slice...) or map contains the -// specified substring or element. -// -// assert.Contains(t, "Hello World", "World") -// assert.Contains(t, ["Hello", "World"], "World") -// assert.Contains(t, {"Hello": "World"}, "Hello") -func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ok, found := containsElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) - } - if !found { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", s, contains), msgAndArgs...) - } - - return true - -} - -// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the -// specified substring or element. -// -// assert.NotContains(t, "Hello World", "Earth") -// assert.NotContains(t, ["Hello", "World"], "Earth") -// assert.NotContains(t, {"Hello": "World"}, "Earth") -func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ok, found := containsElement(s, contains) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", s), msgAndArgs...) - } - if found { - return Fail(t, fmt.Sprintf("%#v should not contain %#v", s, contains), msgAndArgs...) - } - - return true - -} - -// Subset asserts that the specified list(array, slice...) or map contains all -// elements given in the specified subset list(array, slice...) or map. -// -// assert.Subset(t, [1, 2, 3], [1, 2]) -// assert.Subset(t, {"x": 1, "y": 2}, {"x": 1}) -func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if subset == nil { - return true // we consider nil to be equal to the nil set - } - - listKind := reflect.TypeOf(list).Kind() - if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) - } - - subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) - } - - if subsetKind == reflect.Map && listKind == reflect.Map { - subsetMap := reflect.ValueOf(subset) - actualMap := reflect.ValueOf(list) - - for _, k := range subsetMap.MapKeys() { - ev := subsetMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !av.IsValid() { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) - } - if !ObjectsAreEqual(ev.Interface(), av.Interface()) { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, subset), msgAndArgs...) - } - } - - return true - } - - subsetList := reflect.ValueOf(subset) - for i := 0; i < subsetList.Len(); i++ { - element := subsetList.Index(i).Interface() - ok, found := containsElement(list, element) - if !ok { - return Fail(t, fmt.Sprintf("%#v could not be applied builtin len()", list), msgAndArgs...) - } - if !found { - return Fail(t, fmt.Sprintf("%#v does not contain %#v", list, element), msgAndArgs...) - } - } - - return true -} - -// NotSubset asserts that the specified list(array, slice...) or map does NOT -// contain all elements given in the specified subset list(array, slice...) or -// map. -// -// assert.NotSubset(t, [1, 3, 4], [1, 2]) -// assert.NotSubset(t, {"x": 1, "y": 2}, {"z": 3}) -func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if subset == nil { - return Fail(t, "nil is the empty set which is a subset of every set", msgAndArgs...) - } - - listKind := reflect.TypeOf(list).Kind() - if listKind != reflect.Array && listKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...) - } - - subsetKind := reflect.TypeOf(subset).Kind() - if subsetKind != reflect.Array && subsetKind != reflect.Slice && listKind != reflect.Map { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...) - } - - if subsetKind == reflect.Map && listKind == reflect.Map { - subsetMap := reflect.ValueOf(subset) - actualMap := reflect.ValueOf(list) - - for _, k := range subsetMap.MapKeys() { - ev := subsetMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !av.IsValid() { - return true - } - if !ObjectsAreEqual(ev.Interface(), av.Interface()) { - return true - } - } - - return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) - } - - subsetList := reflect.ValueOf(subset) - for i := 0; i < subsetList.Len(); i++ { - element := subsetList.Index(i).Interface() - ok, found := containsElement(list, element) - if !ok { - return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...) - } - if !found { - return true - } - } - - return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...) -} - -// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified -// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements, -// the number of appearances of each of them in both lists should match. -// -// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2]) -func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if isEmpty(listA) && isEmpty(listB) { - return true - } - - if !isList(t, listA, msgAndArgs...) || !isList(t, listB, msgAndArgs...) { - return false - } - - extraA, extraB := diffLists(listA, listB) - - if len(extraA) == 0 && len(extraB) == 0 { - return true - } - - return Fail(t, formatListDiff(listA, listB, extraA, extraB), msgAndArgs...) -} - -// isList checks that the provided value is array or slice. -func isList(t TestingT, list interface{}, msgAndArgs ...interface{}) (ok bool) { - kind := reflect.TypeOf(list).Kind() - if kind != reflect.Array && kind != reflect.Slice { - return Fail(t, fmt.Sprintf("%q has an unsupported type %s, expecting array or slice", list, kind), - msgAndArgs...) - } - return true -} - -// diffLists diffs two arrays/slices and returns slices of elements that are only in A and only in B. -// If some element is present multiple times, each instance is counted separately (e.g. if something is 2x in A and -// 5x in B, it will be 0x in extraA and 3x in extraB). The order of items in both lists is ignored. -func diffLists(listA, listB interface{}) (extraA, extraB []interface{}) { - aValue := reflect.ValueOf(listA) - bValue := reflect.ValueOf(listB) - - aLen := aValue.Len() - bLen := bValue.Len() - - // Mark indexes in bValue that we already used - visited := make([]bool, bLen) - for i := 0; i < aLen; i++ { - element := aValue.Index(i).Interface() - found := false - for j := 0; j < bLen; j++ { - if visited[j] { - continue - } - if ObjectsAreEqual(bValue.Index(j).Interface(), element) { - visited[j] = true - found = true - break - } - } - if !found { - extraA = append(extraA, element) - } - } - - for j := 0; j < bLen; j++ { - if visited[j] { - continue - } - extraB = append(extraB, bValue.Index(j).Interface()) - } - - return -} - -func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) string { - var msg bytes.Buffer - - msg.WriteString("elements differ") - if len(extraA) > 0 { - msg.WriteString("\n\nextra elements in list A:\n") - msg.WriteString(spewConfig.Sdump(extraA)) - } - if len(extraB) > 0 { - msg.WriteString("\n\nextra elements in list B:\n") - msg.WriteString(spewConfig.Sdump(extraB)) - } - msg.WriteString("\n\nlistA:\n") - msg.WriteString(spewConfig.Sdump(listA)) - msg.WriteString("\n\nlistB:\n") - msg.WriteString(spewConfig.Sdump(listB)) - - return msg.String() -} - -// Condition uses a Comparison to assert a complex condition. -func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - result := comp() - if !result { - Fail(t, "Condition failed!", msgAndArgs...) - } - return result -} - -// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics -// methods, and represents a simple func that takes no arguments, and returns nothing. -type PanicTestFunc func() - -// didPanic returns true if the function passed to it panics. Otherwise, it returns false. -func didPanic(f PanicTestFunc) (didPanic bool, message interface{}, stack string) { - didPanic = true - - defer func() { - message = recover() - if didPanic { - stack = string(debug.Stack()) - } - }() - - // call the target function - f() - didPanic = false - - return -} - -// Panics asserts that the code inside the specified PanicTestFunc panics. -// -// assert.Panics(t, func(){ GoCrazy() }) -func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if funcDidPanic, panicValue, _ := didPanic(f); !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - - return true -} - -// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that -// the recovered panic value equals the expected panic value. -// -// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - funcDidPanic, panicValue, panickedStack := didPanic(f) - if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - if panicValue != expected { - return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, expected, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// PanicsWithError asserts that the code inside the specified PanicTestFunc -// panics, and that the recovered panic value is an error that satisfies the -// EqualError comparison. -// -// assert.PanicsWithError(t, "crazy error", func(){ GoCrazy() }) -func PanicsWithError(t TestingT, errString string, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - funcDidPanic, panicValue, panickedStack := didPanic(f) - if !funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...) - } - panicErr, ok := panicValue.(error) - if !ok || panicErr.Error() != errString { - return Fail(t, fmt.Sprintf("func %#v should panic with error message:\t%#v\n\tPanic value:\t%#v\n\tPanic stack:\t%s", f, errString, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. -// -// assert.NotPanics(t, func(){ RemainCalm() }) -func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if funcDidPanic, panicValue, panickedStack := didPanic(f); funcDidPanic { - return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v\n\tPanic stack:\t%s", f, panicValue, panickedStack), msgAndArgs...) - } - - return true -} - -// WithinDuration asserts that the two times are within duration delta of each other. -// -// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second) -func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - dt := expected.Sub(actual) - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -// WithinRange asserts that a time is within a time range (inclusive). -// -// assert.WithinRange(t, time.Now(), time.Now().Add(-time.Second), time.Now().Add(time.Second)) -func WithinRange(t TestingT, actual, start, end time.Time, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if end.Before(start) { - return Fail(t, "Start should be before end", msgAndArgs...) - } - - if actual.Before(start) { - return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is before the range", actual, start, end), msgAndArgs...) - } else if actual.After(end) { - return Fail(t, fmt.Sprintf("Time %v expected to be in time range %v to %v, but is after the range", actual, start, end), msgAndArgs...) - } - - return true -} - -func toFloat(x interface{}) (float64, bool) { - var xf float64 - xok := true - - switch xn := x.(type) { - case uint: - xf = float64(xn) - case uint8: - xf = float64(xn) - case uint16: - xf = float64(xn) - case uint32: - xf = float64(xn) - case uint64: - xf = float64(xn) - case int: - xf = float64(xn) - case int8: - xf = float64(xn) - case int16: - xf = float64(xn) - case int32: - xf = float64(xn) - case int64: - xf = float64(xn) - case float32: - xf = float64(xn) - case float64: - xf = xn - case time.Duration: - xf = float64(xn) - default: - xok = false - } - - return xf, xok -} - -// InDelta asserts that the two numerals are within delta of each other. -// -// assert.InDelta(t, math.Pi, 22/7.0, 0.01) -func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - af, aok := toFloat(expected) - bf, bok := toFloat(actual) - - if !aok || !bok { - return Fail(t, "Parameters must be numerical", msgAndArgs...) - } - - if math.IsNaN(af) && math.IsNaN(bf) { - return true - } - - if math.IsNaN(af) { - return Fail(t, "Expected must not be NaN", msgAndArgs...) - } - - if math.IsNaN(bf) { - return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) - } - - dt := af - bf - if dt < -delta || dt > delta { - return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) - } - - return true -} - -// InDeltaSlice is the same as InDelta, except it compares two slices. -func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Slice || - reflect.TypeOf(expected).Kind() != reflect.Slice { - return Fail(t, "Parameters must be slice", msgAndArgs...) - } - - actualSlice := reflect.ValueOf(actual) - expectedSlice := reflect.ValueOf(expected) - - for i := 0; i < actualSlice.Len(); i++ { - result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...) - if !result { - return result - } - } - - return true -} - -// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys. -func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if expected == nil || actual == nil || - reflect.TypeOf(actual).Kind() != reflect.Map || - reflect.TypeOf(expected).Kind() != reflect.Map { - return Fail(t, "Arguments must be maps", msgAndArgs...) - } - - expectedMap := reflect.ValueOf(expected) - actualMap := reflect.ValueOf(actual) - - if expectedMap.Len() != actualMap.Len() { - return Fail(t, "Arguments must have the same number of keys", msgAndArgs...) - } - - for _, k := range expectedMap.MapKeys() { - ev := expectedMap.MapIndex(k) - av := actualMap.MapIndex(k) - - if !ev.IsValid() { - return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...) - } - - if !av.IsValid() { - return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...) - } - - if !InDelta( - t, - ev.Interface(), - av.Interface(), - delta, - msgAndArgs..., - ) { - return false - } - } - - return true -} - -func calcRelativeError(expected, actual interface{}) (float64, error) { - af, aok := toFloat(expected) - bf, bok := toFloat(actual) - if !aok || !bok { - return 0, fmt.Errorf("Parameters must be numerical") - } - if math.IsNaN(af) && math.IsNaN(bf) { - return 0, nil - } - if math.IsNaN(af) { - return 0, errors.New("expected value must not be NaN") - } - if af == 0 { - return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") - } - if math.IsNaN(bf) { - return 0, errors.New("actual value must not be NaN") - } - - return math.Abs(af-bf) / math.Abs(af), nil -} - -// InEpsilon asserts that expected and actual have a relative error less than epsilon -func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if math.IsNaN(epsilon) { - return Fail(t, "epsilon must not be NaN", msgAndArgs...) - } - actualEpsilon, err := calcRelativeError(expected, actual) - if err != nil { - return Fail(t, err.Error(), msgAndArgs...) - } - if actualEpsilon > epsilon { - return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ - " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...) - } - - return true -} - -// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. -func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - if expected == nil || actual == nil { - return Fail(t, "Parameters must be slice", msgAndArgs...) - } - - expectedSlice := reflect.ValueOf(expected) - actualSlice := reflect.ValueOf(actual) - - if expectedSlice.Type().Kind() != reflect.Slice { - return Fail(t, "Expected value must be slice", msgAndArgs...) - } - - expectedLen := expectedSlice.Len() - if !IsType(t, expected, actual) || !Len(t, actual, expectedLen) { - return false - } - - for i := 0; i < expectedLen; i++ { - if !InEpsilon(t, expectedSlice.Index(i).Interface(), actualSlice.Index(i).Interface(), epsilon, "at index %d", i) { - return false - } - } - - return true -} - -/* - Errors -*/ - -// NoError asserts that a function returned no error (i.e. `nil`). -// -// actualObj, err := SomeFunction() -// if assert.NoError(t, err) { -// assert.Equal(t, expectedObj, actualObj) -// } -func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { - if err != nil { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...) - } - - return true -} - -// Error asserts that a function returned an error (i.e. not `nil`). -// -// actualObj, err := SomeFunction() -// if assert.Error(t, err) { -// assert.Equal(t, expectedError, err) -// } -func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { - if err == nil { - if h, ok := t.(tHelper); ok { - h.Helper() - } - return Fail(t, "An error is expected but got nil.", msgAndArgs...) - } - - return true -} - -// EqualError asserts that a function returned an error (i.e. not `nil`) -// and that it is equal to the provided error. -// -// actualObj, err := SomeFunction() -// assert.EqualError(t, err, expectedErrorString) -func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !Error(t, theError, msgAndArgs...) { - return false - } - expected := errString - actual := theError.Error() - // don't need to use deep equals here, we know they are both strings - if expected != actual { - return Fail(t, fmt.Sprintf("Error message not equal:\n"+ - "expected: %q\n"+ - "actual : %q", expected, actual), msgAndArgs...) - } - return true -} - -// ErrorContains asserts that a function returned an error (i.e. not `nil`) -// and that the error contains the specified substring. -// -// actualObj, err := SomeFunction() -// assert.ErrorContains(t, err, expectedErrorSubString) -func ErrorContains(t TestingT, theError error, contains string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !Error(t, theError, msgAndArgs...) { - return false - } - - actual := theError.Error() - if !strings.Contains(actual, contains) { - return Fail(t, fmt.Sprintf("Error %#v does not contain %#v", actual, contains), msgAndArgs...) - } - - return true -} - -// matchRegexp return true if a specified regexp matches a string. -func matchRegexp(rx interface{}, str interface{}) bool { - - var r *regexp.Regexp - if rr, ok := rx.(*regexp.Regexp); ok { - r = rr - } else { - r = regexp.MustCompile(fmt.Sprint(rx)) - } - - return (r.FindStringIndex(fmt.Sprint(str)) != nil) - -} - -// Regexp asserts that a specified regexp matches a string. -// -// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") -// assert.Regexp(t, "start...$", "it's not starting") -func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - match := matchRegexp(rx, str) - - if !match { - Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) - } - - return match -} - -// NotRegexp asserts that a specified regexp does not match a string. -// -// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") -// assert.NotRegexp(t, "^start", "it's not starting") -func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - match := matchRegexp(rx, str) - - if match { - Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) - } - - return !match - -} - -// Zero asserts that i is the zero value for its type. -func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// NotZero asserts that i is not the zero value for its type. -func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { - return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) - } - return true -} - -// FileExists checks whether a file exists in the given path. It also fails if -// the path points to a directory or there is an error when trying to check the file. -func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) - } - return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) - } - if info.IsDir() { - return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...) - } - return true -} - -// NoFileExists checks whether a file does not exist in a given path. It fails -// if the path points to an existing _file_ only. -func NoFileExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - return true - } - if info.IsDir() { - return true - } - return Fail(t, fmt.Sprintf("file %q exists", path), msgAndArgs...) -} - -// DirExists checks whether a directory exists in the given path. It also fails -// if the path is a file rather a directory or there is an error checking whether it exists. -func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...) - } - return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...) - } - if !info.IsDir() { - return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...) - } - return true -} - -// NoDirExists checks whether a directory does not exist in the given path. -// It fails if the path points to an existing _directory_ only. -func NoDirExists(t TestingT, path string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - info, err := os.Lstat(path) - if err != nil { - if os.IsNotExist(err) { - return true - } - return true - } - if !info.IsDir() { - return true - } - return Fail(t, fmt.Sprintf("directory %q exists", path), msgAndArgs...) -} - -// JSONEq asserts that two JSON strings are equivalent. -// -// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) -func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - var expectedJSONAsInterface, actualJSONAsInterface interface{} - - if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) - } - - if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) - } - - return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) -} - -// YAMLEq asserts that two YAML strings are equivalent. -func YAMLEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - var expectedYAMLAsInterface, actualYAMLAsInterface interface{} - - if err := yaml.Unmarshal([]byte(expected), &expectedYAMLAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid yaml.\nYAML parsing error: '%s'", expected, err.Error()), msgAndArgs...) - } - - if err := yaml.Unmarshal([]byte(actual), &actualYAMLAsInterface); err != nil { - return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid yaml.\nYAML error: '%s'", actual, err.Error()), msgAndArgs...) - } - - return Equal(t, expectedYAMLAsInterface, actualYAMLAsInterface, msgAndArgs...) -} - -func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { - t := reflect.TypeOf(v) - k := t.Kind() - - if k == reflect.Ptr { - t = t.Elem() - k = t.Kind() - } - return t, k -} - -// diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice, array or string. Otherwise it returns an empty string. -func diff(expected interface{}, actual interface{}) string { - if expected == nil || actual == nil { - return "" - } - - et, ek := typeAndKind(expected) - at, _ := typeAndKind(actual) - - if et != at { - return "" - } - - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String { - return "" - } - - var e, a string - - switch et { - case reflect.TypeOf(""): - e = reflect.ValueOf(expected).String() - a = reflect.ValueOf(actual).String() - case reflect.TypeOf(time.Time{}): - e = spewConfigStringerEnabled.Sdump(expected) - a = spewConfigStringerEnabled.Sdump(actual) - default: - e = spewConfig.Sdump(expected) - a = spewConfig.Sdump(actual) - } - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return "\n\nDiff:\n" + diff -} - -func isFunction(arg interface{}) bool { - if arg == nil { - return false - } - return reflect.TypeOf(arg).Kind() == reflect.Func -} - -var spewConfig = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, - DisableMethods: true, - MaxDepth: 10, -} - -var spewConfigStringerEnabled = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, - MaxDepth: 10, -} - -type tHelper interface { - Helper() -} - -// Eventually asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. -// -// assert.Eventually(t, func() bool { return true; }, time.Second, 10*time.Millisecond) -func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ch := make(chan bool, 1) - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - for tick := ticker.C; ; { - select { - case <-timer.C: - return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { ch <- condition() }() - case v := <-ch: - if v { - return true - } - tick = ticker.C - } - } -} - -// CollectT implements the TestingT interface and collects all errors. -type CollectT struct { - errors []error -} - -// Errorf collects the error. -func (c *CollectT) Errorf(format string, args ...interface{}) { - c.errors = append(c.errors, fmt.Errorf(format, args...)) -} - -// FailNow panics. -func (*CollectT) FailNow() { - panic("Assertion failed") -} - -// Deprecated: That was a method for internal usage that should not have been published. Now just panics. -func (*CollectT) Reset() { - panic("Reset() is deprecated") -} - -// Deprecated: That was a method for internal usage that should not have been published. Now just panics. -func (*CollectT) Copy(TestingT) { - panic("Copy() is deprecated") -} - -// EventuallyWithT asserts that given condition will be met in waitFor time, -// periodically checking target function each tick. In contrast to Eventually, -// it supplies a CollectT to the condition function, so that the condition -// function can use the CollectT to call other assertions. -// The condition is considered "met" if no errors are raised in a tick. -// The supplied CollectT collects all errors from one tick (if there are any). -// If the condition is not met before waitFor, the collected errors of -// the last tick are copied to t. -// -// externalValue := false -// go func() { -// time.Sleep(8*time.Second) -// externalValue = true -// }() -// assert.EventuallyWithT(t, func(c *assert.CollectT) { -// // add assertions as needed; any assertion failure will fail the current tick -// assert.True(c, externalValue, "expected 'externalValue' to be true") -// }, 1*time.Second, 10*time.Second, "external state has not changed to 'true'; still false") -func EventuallyWithT(t TestingT, condition func(collect *CollectT), waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - var lastFinishedTickErrs []error - ch := make(chan []error, 1) - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - for tick := ticker.C; ; { - select { - case <-timer.C: - for _, err := range lastFinishedTickErrs { - t.Errorf("%v", err) - } - return Fail(t, "Condition never satisfied", msgAndArgs...) - case <-tick: - tick = nil - go func() { - collect := new(CollectT) - defer func() { - ch <- collect.errors - }() - condition(collect) - }() - case errs := <-ch: - if len(errs) == 0 { - return true - } - // Keep the errors from the last ended condition, so that they can be copied to t if timeout is reached. - lastFinishedTickErrs = errs - tick = ticker.C - } - } -} - -// Never asserts that the given condition doesn't satisfy in waitFor time, -// periodically checking the target function each tick. -// -// assert.Never(t, func() bool { return false; }, time.Second, 10*time.Millisecond) -func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.Duration, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - ch := make(chan bool, 1) - - timer := time.NewTimer(waitFor) - defer timer.Stop() - - ticker := time.NewTicker(tick) - defer ticker.Stop() - - for tick := ticker.C; ; { - select { - case <-timer.C: - return true - case <-tick: - tick = nil - go func() { ch <- condition() }() - case v := <-ch: - if v { - return Fail(t, "Condition satisfied", msgAndArgs...) - } - tick = ticker.C - } - } -} - -// ErrorIs asserts that at least one of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if errors.Is(err, target) { - return true - } - - var expectedText string - if target != nil { - expectedText = target.Error() - } - - chain := buildErrorChainString(err) - - return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+ - "expected: %q\n"+ - "in chain: %s", expectedText, chain, - ), msgAndArgs...) -} - -// NotErrorIs asserts that at none of the errors in err's chain matches target. -// This is a wrapper for errors.Is. -func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if !errors.Is(err, target) { - return true - } - - var expectedText string - if target != nil { - expectedText = target.Error() - } - - chain := buildErrorChainString(err) - - return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+ - "found: %q\n"+ - "in chain: %s", expectedText, chain, - ), msgAndArgs...) -} - -// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value. -// This is a wrapper for errors.As. -func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - if errors.As(err, target) { - return true - } - - chain := buildErrorChainString(err) - - return Fail(t, fmt.Sprintf("Should be in error chain:\n"+ - "expected: %q\n"+ - "in chain: %s", target, chain, - ), msgAndArgs...) -} - -func buildErrorChainString(err error) string { - if err == nil { - return "" - } - - e := errors.Unwrap(err) - chain := fmt.Sprintf("%q", err.Error()) - for e != nil { - chain += fmt.Sprintf("\n\t%q", e.Error()) - e = errors.Unwrap(e) - } - return chain -} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go deleted file mode 100644 index 4953981d..00000000 --- a/vendor/github.com/stretchr/testify/assert/doc.go +++ /dev/null @@ -1,46 +0,0 @@ -// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. -// -// # Example Usage -// -// The following is a complete example using assert in a standard test function: -// -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(t, a, b, "The two words should be the same.") -// -// } -// -// if you assert many times, use the format below: -// -// import ( -// "testing" -// "github.com/stretchr/testify/assert" -// ) -// -// func TestSomething(t *testing.T) { -// assert := assert.New(t) -// -// var a string = "Hello" -// var b string = "Hello" -// -// assert.Equal(a, b, "The two words should be the same.") -// } -// -// # Assertions -// -// Assertions allow you to easily write test code, and are global funcs in the `assert` package. -// All assertion functions take, as the first argument, the `*testing.T` object provided by the -// testing framework. This allows the assertion funcs to write the failings and other details to -// the correct place. -// -// Every assertion function also takes an optional string message as the final argument, -// allowing custom error messages to be appended to the message the assertion method outputs. -package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go deleted file mode 100644 index ac9dc9d1..00000000 --- a/vendor/github.com/stretchr/testify/assert/errors.go +++ /dev/null @@ -1,10 +0,0 @@ -package assert - -import ( - "errors" -) - -// AnError is an error instance useful for testing. If the code does not care -// about error specifics, and only needs to return the error for example, this -// error should be used to make the test code more readable. -var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go deleted file mode 100644 index df189d23..00000000 --- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go +++ /dev/null @@ -1,16 +0,0 @@ -package assert - -// Assertions provides assertion methods around the -// TestingT interface. -type Assertions struct { - t TestingT -} - -// New makes a new Assertions object for the specified TestingT. -func New(t TestingT) *Assertions { - return &Assertions{ - t: t, - } -} - -//go:generate sh -c "cd ../_codegen && go build && cd - && ../_codegen/_codegen -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs" diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go deleted file mode 100644 index 861ed4b7..00000000 --- a/vendor/github.com/stretchr/testify/assert/http_assertions.go +++ /dev/null @@ -1,165 +0,0 @@ -package assert - -import ( - "fmt" - "net/http" - "net/http/httptest" - "net/url" - "strings" -) - -// httpCode is a helper that returns HTTP code of the response. It returns -1 and -// an error if building a new request fails. -func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) { - w := httptest.NewRecorder() - req, err := http.NewRequest(method, url, http.NoBody) - if err != nil { - return -1, err - } - req.URL.RawQuery = values.Encode() - handler(w, req) - return w.Code, nil -} - -// HTTPSuccess asserts that a specified handler returns a success status code. -// -// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent - if !isSuccessCode { - Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isSuccessCode -} - -// HTTPRedirect asserts that a specified handler returns a redirect status code. -// -// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect - if !isRedirectCode { - Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isRedirectCode -} - -// HTTPError asserts that a specified handler returns an error status code. -// -// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - isErrorCode := code >= http.StatusBadRequest - if !isErrorCode { - Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code), msgAndArgs...) - } - - return isErrorCode -} - -// HTTPStatusCode asserts that a specified handler returns a specified status code. -// -// assert.HTTPStatusCode(t, myHandler, "GET", "/notImplemented", nil, 501) -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPStatusCode(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, statuscode int, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - code, err := httpCode(handler, method, url, values) - if err != nil { - Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err), msgAndArgs...) - } - - successful := code == statuscode - if !successful { - Fail(t, fmt.Sprintf("Expected HTTP status code %d for %q but received %d", statuscode, url+"?"+values.Encode(), code), msgAndArgs...) - } - - return successful -} - -// HTTPBody is a helper that returns HTTP body of the response. It returns -// empty string if building a new request fails. -func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { - w := httptest.NewRecorder() - if len(values) > 0 { - url += "?" + values.Encode() - } - req, err := http.NewRequest(method, url, http.NoBody) - if err != nil { - return "" - } - handler(w, req) - return w.Body.String() -} - -// HTTPBodyContains asserts that a specified handler returns a -// body that contains a string. -// -// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if !contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) - } - - return contains -} - -// HTTPBodyNotContains asserts that a specified handler returns a -// body that does not contain a string. -// -// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky") -// -// Returns whether the assertion was successful (true) or not (false). -func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - body := HTTPBody(handler, method, url, values) - - contains := strings.Contains(body, fmt.Sprint(str)) - if contains { - Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body), msgAndArgs...) - } - - return !contains -} diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go deleted file mode 100644 index d6b3c844..00000000 --- a/vendor/github.com/stretchr/testify/mock/doc.go +++ /dev/null @@ -1,44 +0,0 @@ -// Package mock provides a system by which it is possible to mock your objects -// and verify calls are happening as expected. -// -// # Example Usage -// -// The mock package provides an object, Mock, that tracks activity on another object. It is usually -// embedded into a test object as shown below: -// -// type MyTestObject struct { -// // add a Mock object instance -// mock.Mock -// -// // other fields go here as normal -// } -// -// When implementing the methods of an interface, you wire your functions up -// to call the Mock.Called(args...) method, and return the appropriate values. -// -// For example, to mock a method that saves the name and age of a person and returns -// the year of their birth or an error, you might write this: -// -// func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) { -// args := o.Called(firstname, lastname, age) -// return args.Int(0), args.Error(1) -// } -// -// The Int, Error and Bool methods are examples of strongly typed getters that take the argument -// index position. Given this argument list: -// -// (12, true, "Something") -// -// You could read them out strongly typed like this: -// -// args.Int(0) -// args.Bool(1) -// args.String(2) -// -// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion: -// -// return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine) -// -// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those -// cases you should check for nil first. -package mock diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go deleted file mode 100644 index 213bde2e..00000000 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ /dev/null @@ -1,1241 +0,0 @@ -package mock - -import ( - "errors" - "fmt" - "path" - "reflect" - "regexp" - "runtime" - "strings" - "sync" - "time" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" - "github.com/stretchr/objx" - - "github.com/stretchr/testify/assert" -) - -// regex for GCCGO functions -var gccgoRE = regexp.MustCompile(`\.pN\d+_`) - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Logf(format string, args ...interface{}) - Errorf(format string, args ...interface{}) - FailNow() -} - -/* - Call -*/ - -// Call represents a method call and is used for setting expectations, -// as well as recording activity. -type Call struct { - Parent *Mock - - // The name of the method that was or will be called. - Method string - - // Holds the arguments of the method. - Arguments Arguments - - // Holds the arguments that should be returned when - // this method is called. - ReturnArguments Arguments - - // Holds the caller info for the On() call - callerInfo []string - - // The number of times to return the return arguments when setting - // expectations. 0 means to always return the value. - Repeatability int - - // Amount of times this call has been called - totalCalls int - - // Call to this method can be optional - optional bool - - // Holds a channel that will be used to block the Return until it either - // receives a message or is closed. nil means it returns immediately. - WaitFor <-chan time.Time - - waitTime time.Duration - - // Holds a handler used to manipulate arguments content that are passed by - // reference. It's useful when mocking methods such as unmarshalers or - // decoders. - RunFn func(Arguments) - - // PanicMsg holds msg to be used to mock panic on the function call - // if the PanicMsg is set to a non nil string the function call will panic - // irrespective of other settings - PanicMsg *string - - // Calls which must be satisfied before this call can be - requires []*Call -} - -func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments ...interface{}) *Call { - return &Call{ - Parent: parent, - Method: methodName, - Arguments: methodArguments, - ReturnArguments: make([]interface{}, 0), - callerInfo: callerInfo, - Repeatability: 0, - WaitFor: nil, - RunFn: nil, - PanicMsg: nil, - } -} - -func (c *Call) lock() { - c.Parent.mutex.Lock() -} - -func (c *Call) unlock() { - c.Parent.mutex.Unlock() -} - -// Return specifies the return arguments for the expectation. -// -// Mock.On("DoSomething").Return(errors.New("failed")) -func (c *Call) Return(returnArguments ...interface{}) *Call { - c.lock() - defer c.unlock() - - c.ReturnArguments = returnArguments - - return c -} - -// Panic specifies if the function call should fail and the panic message -// -// Mock.On("DoSomething").Panic("test panic") -func (c *Call) Panic(msg string) *Call { - c.lock() - defer c.unlock() - - c.PanicMsg = &msg - - return c -} - -// Once indicates that the mock should only return the value once. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once() -func (c *Call) Once() *Call { - return c.Times(1) -} - -// Twice indicates that the mock should only return the value twice. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice() -func (c *Call) Twice() *Call { - return c.Times(2) -} - -// Times indicates that the mock should only return the indicated number -// of times. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5) -func (c *Call) Times(i int) *Call { - c.lock() - defer c.unlock() - c.Repeatability = i - return c -} - -// WaitUntil sets the channel that will block the mock's return until its closed -// or a message is received. -// -// Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second)) -func (c *Call) WaitUntil(w <-chan time.Time) *Call { - c.lock() - defer c.unlock() - c.WaitFor = w - return c -} - -// After sets how long to block until the call returns -// -// Mock.On("MyMethod", arg1, arg2).After(time.Second) -func (c *Call) After(d time.Duration) *Call { - c.lock() - defer c.unlock() - c.waitTime = d - return c -} - -// Run sets a handler to be called before returning. It can be used when -// mocking a method (such as an unmarshaler) that takes a pointer to a struct and -// sets properties in such struct -// -// Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}")).Return().Run(func(args Arguments) { -// arg := args.Get(0).(*map[string]interface{}) -// arg["foo"] = "bar" -// }) -func (c *Call) Run(fn func(args Arguments)) *Call { - c.lock() - defer c.unlock() - c.RunFn = fn - return c -} - -// Maybe allows the method call to be optional. Not calling an optional method -// will not cause an error while asserting expectations -func (c *Call) Maybe() *Call { - c.lock() - defer c.unlock() - c.optional = true - return c -} - -// On chains a new expectation description onto the mocked interface. This -// allows syntax like. -// -// Mock. -// On("MyMethod", 1).Return(nil). -// On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) -// -//go:noinline -func (c *Call) On(methodName string, arguments ...interface{}) *Call { - return c.Parent.On(methodName, arguments...) -} - -// Unset removes a mock handler from being called. -// -// test.On("func", mock.Anything).Unset() -func (c *Call) Unset() *Call { - var unlockOnce sync.Once - - for _, arg := range c.Arguments { - if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { - panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) - } - } - - c.lock() - defer unlockOnce.Do(c.unlock) - - foundMatchingCall := false - - // in-place filter slice for calls to be removed - iterate from 0'th to last skipping unnecessary ones - var index int // write index - for _, call := range c.Parent.ExpectedCalls { - if call.Method == c.Method { - _, diffCount := call.Arguments.Diff(c.Arguments) - if diffCount == 0 { - foundMatchingCall = true - // Remove from ExpectedCalls - just skip it - continue - } - } - c.Parent.ExpectedCalls[index] = call - index++ - } - // trim slice up to last copied index - c.Parent.ExpectedCalls = c.Parent.ExpectedCalls[:index] - - if !foundMatchingCall { - unlockOnce.Do(c.unlock) - c.Parent.fail("\n\nmock: Could not find expected call\n-----------------------------\n\n%s\n\n", - callString(c.Method, c.Arguments, true), - ) - } - - return c -} - -// NotBefore indicates that the mock should only be called after the referenced -// calls have been called as expected. The referenced calls may be from the -// same mock instance and/or other mock instances. -// -// Mock.On("Do").Return(nil).Notbefore( -// Mock.On("Init").Return(nil) -// ) -func (c *Call) NotBefore(calls ...*Call) *Call { - c.lock() - defer c.unlock() - - for _, call := range calls { - if call.Parent == nil { - panic("not before calls must be created with Mock.On()") - } - } - - c.requires = append(c.requires, calls...) - return c -} - -// Mock is the workhorse used to track activity on another object. -// For an example of its usage, refer to the "Example Usage" section at the top -// of this document. -type Mock struct { - // Represents the calls that are expected of - // an object. - ExpectedCalls []*Call - - // Holds the calls that were made to this mocked object. - Calls []Call - - // test is An optional variable that holds the test struct, to be used when an - // invalid mock call was made. - test TestingT - - // TestData holds any data that might be useful for testing. Testify ignores - // this data completely allowing you to do whatever you like with it. - testData objx.Map - - mutex sync.Mutex -} - -// String provides a %v format string for Mock. -// Note: this is used implicitly by Arguments.Diff if a Mock is passed. -// It exists because go's default %v formatting traverses the struct -// without acquiring the mutex, which is detected by go test -race. -func (m *Mock) String() string { - return fmt.Sprintf("%[1]T<%[1]p>", m) -} - -// TestData holds any data that might be useful for testing. Testify ignores -// this data completely allowing you to do whatever you like with it. -func (m *Mock) TestData() objx.Map { - if m.testData == nil { - m.testData = make(objx.Map) - } - - return m.testData -} - -/* - Setting expectations -*/ - -// Test sets the test struct variable of the mock object -func (m *Mock) Test(t TestingT) { - m.mutex.Lock() - defer m.mutex.Unlock() - m.test = t -} - -// fail fails the current test with the given formatted format and args. -// In case that a test was defined, it uses the test APIs for failing a test, -// otherwise it uses panic. -func (m *Mock) fail(format string, args ...interface{}) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.test == nil { - panic(fmt.Sprintf(format, args...)) - } - m.test.Errorf(format, args...) - m.test.FailNow() -} - -// On starts a description of an expectation of the specified method -// being called. -// -// Mock.On("MyMethod", arg1, arg2) -func (m *Mock) On(methodName string, arguments ...interface{}) *Call { - for _, arg := range arguments { - if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { - panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) - } - } - - m.mutex.Lock() - defer m.mutex.Unlock() - c := newCall(m, methodName, assert.CallerInfo(), arguments...) - m.ExpectedCalls = append(m.ExpectedCalls, c) - return c -} - -// /* -// Recording and responding to activity -// */ - -func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { - var expectedCall *Call - - for i, call := range m.ExpectedCalls { - if call.Method == method { - _, diffCount := call.Arguments.Diff(arguments) - if diffCount == 0 { - expectedCall = call - if call.Repeatability > -1 { - return i, call - } - } - } - } - - return -1, expectedCall -} - -type matchCandidate struct { - call *Call - mismatch string - diffCount int -} - -func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool { - if c.call == nil { - return false - } - if other.call == nil { - return true - } - - if c.diffCount > other.diffCount { - return false - } - if c.diffCount < other.diffCount { - return true - } - - if c.call.Repeatability > 0 && other.call.Repeatability <= 0 { - return true - } - return false -} - -func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) { - var bestMatch matchCandidate - - for _, call := range m.expectedCalls() { - if call.Method == method { - - errInfo, tempDiffCount := call.Arguments.Diff(arguments) - tempCandidate := matchCandidate{ - call: call, - mismatch: errInfo, - diffCount: tempDiffCount, - } - if tempCandidate.isBetterMatchThan(bestMatch) { - bestMatch = tempCandidate - } - } - } - - return bestMatch.call, bestMatch.mismatch -} - -func callString(method string, arguments Arguments, includeArgumentValues bool) string { - var argValsString string - if includeArgumentValues { - var argVals []string - for argIndex, arg := range arguments { - if _, ok := arg.(*FunctionalOptionsArgument); ok { - argVals = append(argVals, fmt.Sprintf("%d: %s", argIndex, arg)) - continue - } - argVals = append(argVals, fmt.Sprintf("%d: %#v", argIndex, arg)) - } - argValsString = fmt.Sprintf("\n\t\t%s", strings.Join(argVals, "\n\t\t")) - } - - return fmt.Sprintf("%s(%s)%s", method, arguments.String(), argValsString) -} - -// Called tells the mock object that a method has been called, and gets an array -// of arguments to return. Panics if the call is unexpected (i.e. not preceded by -// appropriate .On .Return() calls) -// If Call.WaitFor is set, blocks until the channel is closed or receives a message. -func (m *Mock) Called(arguments ...interface{}) Arguments { - // get the calling function's name - pc, _, _, ok := runtime.Caller(1) - if !ok { - panic("Couldn't get the caller information") - } - functionPath := runtime.FuncForPC(pc).Name() - // Next four lines are required to use GCCGO function naming conventions. - // For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock - // uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree - // With GCCGO we need to remove interface information starting from pN

. - if gccgoRE.MatchString(functionPath) { - functionPath = gccgoRE.Split(functionPath, -1)[0] - } - parts := strings.Split(functionPath, ".") - functionName := parts[len(parts)-1] - return m.MethodCalled(functionName, arguments...) -} - -// MethodCalled tells the mock object that the given method has been called, and gets -// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded -// by appropriate .On .Return() calls) -// If Call.WaitFor is set, blocks until the channel is closed or receives a message. -func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments { - m.mutex.Lock() - // TODO: could combine expected and closes in single loop - found, call := m.findExpectedCall(methodName, arguments...) - - if found < 0 { - // expected call found, but it has already been called with repeatable times - if call != nil { - m.mutex.Unlock() - m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(\"%s\").Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - // we have to fail here - because we don't know what to do - // as the return arguments. This is because: - // - // a) this is a totally unexpected call to this method, - // b) the arguments are not what was expected, or - // c) the developer has forgotten to add an accompanying On...Return pair. - closestCall, mismatch := m.findClosestCall(methodName, arguments...) - m.mutex.Unlock() - - if closestCall != nil { - m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s", - callString(methodName, arguments, true), - callString(methodName, closestCall.Arguments, true), - diffArguments(closestCall.Arguments, arguments), - strings.TrimSpace(mismatch), - ) - } else { - m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - } - - for _, requirement := range call.requires { - if satisfied, _ := requirement.Parent.checkExpectation(requirement); !satisfied { - m.mutex.Unlock() - m.fail("mock: Unexpected Method Call\n-----------------------------\n\n%s\n\nMust not be called before%s:\n\n%s", - callString(call.Method, call.Arguments, true), - func() (s string) { - if requirement.totalCalls > 0 { - s = " another call of" - } - if call.Parent != requirement.Parent { - s += " method from another mock instance" - } - return - }(), - callString(requirement.Method, requirement.Arguments, true), - ) - } - } - - if call.Repeatability == 1 { - call.Repeatability = -1 - } else if call.Repeatability > 1 { - call.Repeatability-- - } - call.totalCalls++ - - // add the call - m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments...)) - m.mutex.Unlock() - - // block if specified - if call.WaitFor != nil { - <-call.WaitFor - } else { - time.Sleep(call.waitTime) - } - - m.mutex.Lock() - panicMsg := call.PanicMsg - m.mutex.Unlock() - if panicMsg != nil { - panic(*panicMsg) - } - - m.mutex.Lock() - runFn := call.RunFn - m.mutex.Unlock() - - if runFn != nil { - runFn(arguments) - } - - m.mutex.Lock() - returnArgs := call.ReturnArguments - m.mutex.Unlock() - - return returnArgs -} - -/* - Assertions -*/ - -type assertExpectationiser interface { - AssertExpectations(TestingT) bool -} - -// AssertExpectationsForObjects asserts that everything specified with On and Return -// of the specified objects was in fact called as expected. -// -// Calls may have occurred in any order. -func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - for _, obj := range testObjects { - if m, ok := obj.(*Mock); ok { - t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") - obj = m - } - m := obj.(assertExpectationiser) - if !m.AssertExpectations(t) { - t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m)) - return false - } - } - return true -} - -// AssertExpectations asserts that everything specified with On and Return was -// in fact called as expected. Calls may have occurred in any order. -func (m *Mock) AssertExpectations(t TestingT) bool { - if s, ok := t.(interface{ Skipped() bool }); ok && s.Skipped() { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - - m.mutex.Lock() - defer m.mutex.Unlock() - var failedExpectations int - - // iterate through each expectation - expectedCalls := m.expectedCalls() - for _, expectedCall := range expectedCalls { - satisfied, reason := m.checkExpectation(expectedCall) - if !satisfied { - failedExpectations++ - t.Logf(reason) - } - } - - if failedExpectations != 0 { - t.Errorf("FAIL: %d out of %d expectation(s) were met.\n\tThe code you are testing needs to make %d more call(s).\n\tat: %s", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo()) - } - - return failedExpectations == 0 -} - -func (m *Mock) checkExpectation(call *Call) (bool, string) { - if !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - if call.Repeatability > 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - return true, fmt.Sprintf("PASS:\t%s(%s)", call.Method, call.Arguments.String()) -} - -// AssertNumberOfCalls asserts that the method was called expectedCalls times. -func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - var actualCalls int - for _, call := range m.calls() { - if call.Method == methodName { - actualCalls++ - } - } - return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) -} - -// AssertCalled asserts that the method was called. -// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. -func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if !m.methodWasCalled(methodName, arguments) { - var calledWithArgs []string - for _, call := range m.calls() { - calledWithArgs = append(calledWithArgs, fmt.Sprintf("%v", call.Arguments)) - } - if len(calledWithArgs) == 0 { - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments)) - } - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n"))) - } - return true -} - -// AssertNotCalled asserts that the method was not called. -// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. -func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if m.methodWasCalled(methodName, arguments) { - return assert.Fail(t, "Should not have called with given arguments", - fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments)) - } - return true -} - -// IsMethodCallable checking that the method can be called -// If the method was called more than `Repeatability` return false -func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - - for _, v := range m.ExpectedCalls { - if v.Method != methodName { - continue - } - if len(arguments) != len(v.Arguments) { - continue - } - if v.Repeatability < v.totalCalls { - continue - } - if isArgsEqual(v.Arguments, arguments) { - return true - } - } - return false -} - -// isArgsEqual compares arguments -func isArgsEqual(expected Arguments, args []interface{}) bool { - if len(expected) != len(args) { - return false - } - for i, v := range args { - if !reflect.DeepEqual(expected[i], v) { - return false - } - } - return true -} - -func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool { - for _, call := range m.calls() { - if call.Method == methodName { - - _, differences := Arguments(expected).Diff(call.Arguments) - - if differences == 0 { - // found the expected call - return true - } - - } - } - // we didn't find the expected call - return false -} - -func (m *Mock) expectedCalls() []*Call { - return append([]*Call{}, m.ExpectedCalls...) -} - -func (m *Mock) calls() []Call { - return append([]Call{}, m.Calls...) -} - -/* - Arguments -*/ - -// Arguments holds an array of method arguments or return values. -type Arguments []interface{} - -const ( - // Anything is used in Diff and Assert when the argument being tested - // shouldn't be taken into consideration. - Anything = "mock.Anything" -) - -// AnythingOfTypeArgument contains the type of an argument -// for use when type checking. Used in Diff and Assert. -// -// Deprecated: this is an implementation detail that must not be used. Use [AnythingOfType] instead. -type AnythingOfTypeArgument = anythingOfTypeArgument - -// anythingOfTypeArgument is a string that contains the type of an argument -// for use when type checking. Used in Diff and Assert. -type anythingOfTypeArgument string - -// AnythingOfType returns a special value containing the -// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String]. -// -// Used in Diff and Assert. -// -// For example: -// -// Assert(t, AnythingOfType("string"), AnythingOfType("int")) -func AnythingOfType(t string) AnythingOfTypeArgument { - return anythingOfTypeArgument(t) -} - -// IsTypeArgument is a struct that contains the type of an argument -// for use when type checking. This is an alternative to AnythingOfType. -// Used in Diff and Assert. -type IsTypeArgument struct { - t reflect.Type -} - -// IsType returns an IsTypeArgument object containing the type to check for. -// You can provide a zero-value of the type to check. This is an -// alternative to AnythingOfType. Used in Diff and Assert. -// -// For example: -// Assert(t, IsType(""), IsType(0)) -func IsType(t interface{}) *IsTypeArgument { - return &IsTypeArgument{t: reflect.TypeOf(t)} -} - -// FunctionalOptionsArgument is a struct that contains the type and value of an functional option argument -// for use when type checking. -type FunctionalOptionsArgument struct { - value interface{} -} - -// String returns the string representation of FunctionalOptionsArgument -func (f *FunctionalOptionsArgument) String() string { - var name string - tValue := reflect.ValueOf(f.value) - if tValue.Len() > 0 { - name = "[]" + reflect.TypeOf(tValue.Index(0).Interface()).String() - } - - return strings.Replace(fmt.Sprintf("%#v", f.value), "[]interface {}", name, 1) -} - -// FunctionalOptions returns an FunctionalOptionsArgument object containing the functional option type -// and the values to check of -// -// For example: -// Assert(t, FunctionalOptions("[]foo.FunctionalOption", foo.Opt1(), foo.Opt2())) -func FunctionalOptions(value ...interface{}) *FunctionalOptionsArgument { - return &FunctionalOptionsArgument{ - value: value, - } -} - -// argumentMatcher performs custom argument matching, returning whether or -// not the argument is matched by the expectation fixture function. -type argumentMatcher struct { - // fn is a function which accepts one argument, and returns a bool. - fn reflect.Value -} - -func (f argumentMatcher) Matches(argument interface{}) bool { - expectType := f.fn.Type().In(0) - expectTypeNilSupported := false - switch expectType.Kind() { - case reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr: - expectTypeNilSupported = true - } - - argType := reflect.TypeOf(argument) - var arg reflect.Value - if argType == nil { - arg = reflect.New(expectType).Elem() - } else { - arg = reflect.ValueOf(argument) - } - - if argType == nil && !expectTypeNilSupported { - panic(errors.New("attempting to call matcher with nil for non-nil expected type")) - } - if argType == nil || argType.AssignableTo(expectType) { - result := f.fn.Call([]reflect.Value{arg}) - return result[0].Bool() - } - return false -} - -func (f argumentMatcher) String() string { - return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).String()) -} - -// MatchedBy can be used to match a mock call based on only certain properties -// from a complex struct or some calculation. It takes a function that will be -// evaluated with the called argument and will return true when there's a match -// and false otherwise. -// -// Example: -// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) -// -// |fn|, must be a function accepting a single argument (of the expected type) -// which returns a bool. If |fn| doesn't match the required signature, -// MatchedBy() panics. -func MatchedBy(fn interface{}) argumentMatcher { - fnType := reflect.TypeOf(fn) - - if fnType.Kind() != reflect.Func { - panic(fmt.Sprintf("assert: arguments: %s is not a func", fn)) - } - if fnType.NumIn() != 1 { - panic(fmt.Sprintf("assert: arguments: %s does not take exactly one argument", fn)) - } - if fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool { - panic(fmt.Sprintf("assert: arguments: %s does not return a bool", fn)) - } - - return argumentMatcher{fn: reflect.ValueOf(fn)} -} - -// Get Returns the argument at the specified index. -func (args Arguments) Get(index int) interface{} { - if index+1 > len(args) { - panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) - } - return args[index] -} - -// Is gets whether the objects match the arguments specified. -func (args Arguments) Is(objects ...interface{}) bool { - for i, obj := range args { - if obj != objects[i] { - return false - } - } - return true -} - -// Diff gets a string describing the differences between the arguments -// and the specified objects. -// -// Returns the diff string and number of differences found. -func (args Arguments) Diff(objects []interface{}) (string, int) { - // TODO: could return string as error and nil for No difference - - output := "\n" - var differences int - - maxArgCount := len(args) - if len(objects) > maxArgCount { - maxArgCount = len(objects) - } - - for i := 0; i < maxArgCount; i++ { - var actual, expected interface{} - var actualFmt, expectedFmt string - - if len(objects) <= i { - actual = "(Missing)" - actualFmt = "(Missing)" - } else { - actual = objects[i] - actualFmt = fmt.Sprintf("(%[1]T=%[1]v)", actual) - } - - if len(args) <= i { - expected = "(Missing)" - expectedFmt = "(Missing)" - } else { - expected = args[i] - expectedFmt = fmt.Sprintf("(%[1]T=%[1]v)", expected) - } - - if matcher, ok := expected.(argumentMatcher); ok { - var matches bool - func() { - defer func() { - if r := recover(); r != nil { - actualFmt = fmt.Sprintf("panic in argument matcher: %v", r) - } - }() - matches = matcher.Matches(actual) - }() - if matches { - output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher) - } else { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher) - } - } else { - switch expected := expected.(type) { - case anythingOfTypeArgument: - // type checking - if reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) - } - case *IsTypeArgument: - actualT := reflect.TypeOf(actual) - if actualT != expected.t { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected.t.Name(), actualT.Name(), actualFmt) - } - case *FunctionalOptionsArgument: - t := expected.value - - var name string - tValue := reflect.ValueOf(t) - if tValue.Len() > 0 { - name = "[]" + reflect.TypeOf(tValue.Index(0).Interface()).String() - } - - tName := reflect.TypeOf(t).Name() - if name != reflect.TypeOf(actual).String() && tValue.Len() != 0 { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt) - } else { - if ef, af := assertOpts(t, actual); ef == "" && af == "" { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, tName, tName) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, af, ef) - } - } - - default: - if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) - } - } - } - - } - - if differences == 0 { - return "No differences.", differences - } - - return output, differences -} - -// Assert compares the arguments with the specified objects and fails if -// they do not exactly match. -func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - // get the differences - diff, diffCount := args.Diff(objects) - - if diffCount == 0 { - return true - } - - // there are differences... report them... - t.Logf(diff) - t.Errorf("%sArguments do not match.", assert.CallerInfo()) - - return false -} - -// String gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -// -// If no index is provided, String() returns a complete string representation -// of the arguments. -func (args Arguments) String(indexOrNil ...int) string { - if len(indexOrNil) == 0 { - // normal String() method - return a string representation of the args - var argsStr []string - for _, arg := range args { - argsStr = append(argsStr, fmt.Sprintf("%T", arg)) // handles nil nicely - } - return strings.Join(argsStr, ",") - } else if len(indexOrNil) == 1 { - // Index has been specified - get the argument at that index - index := indexOrNil[0] - var s string - var ok bool - if s, ok = args.Get(index).(string); !ok { - panic(fmt.Sprintf("assert: arguments: String(%d) failed because object wasn't correct type: %s", index, args.Get(index))) - } - return s - } - - panic(fmt.Sprintf("assert: arguments: Wrong number of arguments passed to String. Must be 0 or 1, not %d", len(indexOrNil))) -} - -// Int gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Int(index int) int { - var s int - var ok bool - if s, ok = args.Get(index).(int); !ok { - panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) - } - return s -} - -// Error gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Error(index int) error { - obj := args.Get(index) - var s error - var ok bool - if obj == nil { - return nil - } - if s, ok = obj.(error); !ok { - panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) - } - return s -} - -// Bool gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Bool(index int) bool { - var s bool - var ok bool - if s, ok = args.Get(index).(bool); !ok { - panic(fmt.Sprintf("assert: arguments: Bool(%d) failed because object wasn't correct type: %v", index, args.Get(index))) - } - return s -} - -func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { - t := reflect.TypeOf(v) - k := t.Kind() - - if k == reflect.Ptr { - t = t.Elem() - k = t.Kind() - } - return t, k -} - -func diffArguments(expected Arguments, actual Arguments) string { - if len(expected) != len(actual) { - return fmt.Sprintf("Provided %v arguments, mocked for %v arguments", len(expected), len(actual)) - } - - for x := range expected { - if diffString := diff(expected[x], actual[x]); diffString != "" { - return fmt.Sprintf("Difference found in argument %v:\n\n%s", x, diffString) - } - } - - return "" -} - -// diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice or array. Otherwise it returns an empty string. -func diff(expected interface{}, actual interface{}) string { - if expected == nil || actual == nil { - return "" - } - - et, ek := typeAndKind(expected) - at, _ := typeAndKind(actual) - - if et != at { - return "" - } - - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { - return "" - } - - e := spewConfig.Sdump(expected) - a := spewConfig.Sdump(actual) - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return diff -} - -var spewConfig = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, -} - -type tHelper interface { - Helper() -} - -func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) { - expectedOpts := reflect.ValueOf(expected) - actualOpts := reflect.ValueOf(actual) - var expectedNames []string - for i := 0; i < expectedOpts.Len(); i++ { - expectedNames = append(expectedNames, funcName(expectedOpts.Index(i).Interface())) - } - var actualNames []string - for i := 0; i < actualOpts.Len(); i++ { - actualNames = append(actualNames, funcName(actualOpts.Index(i).Interface())) - } - if !assert.ObjectsAreEqual(expectedNames, actualNames) { - expectedFmt = fmt.Sprintf("%v", expectedNames) - actualFmt = fmt.Sprintf("%v", actualNames) - return - } - - for i := 0; i < expectedOpts.Len(); i++ { - expectedOpt := expectedOpts.Index(i).Interface() - actualOpt := actualOpts.Index(i).Interface() - - expectedFunc := expectedNames[i] - actualFunc := actualNames[i] - if expectedFunc != actualFunc { - expectedFmt = expectedFunc - actualFmt = actualFunc - return - } - - ot := reflect.TypeOf(expectedOpt) - var expectedValues []reflect.Value - var actualValues []reflect.Value - if ot.NumIn() == 0 { - return - } - - for i := 0; i < ot.NumIn(); i++ { - vt := ot.In(i).Elem() - expectedValues = append(expectedValues, reflect.New(vt)) - actualValues = append(actualValues, reflect.New(vt)) - } - - reflect.ValueOf(expectedOpt).Call(expectedValues) - reflect.ValueOf(actualOpt).Call(actualValues) - - for i := 0; i < ot.NumIn(); i++ { - if !assert.ObjectsAreEqual(expectedValues[i].Interface(), actualValues[i].Interface()) { - expectedFmt = fmt.Sprintf("%s %+v", expectedNames[i], expectedValues[i].Interface()) - actualFmt = fmt.Sprintf("%s %+v", expectedNames[i], actualValues[i].Interface()) - return - } - } - } - - return "", "" -} - -func funcName(opt interface{}) string { - n := runtime.FuncForPC(reflect.ValueOf(opt).Pointer()).Name() - return strings.TrimSuffix(path.Base(n), path.Ext(n)) -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 69bc864c..0589a45e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -234,10 +234,6 @@ github.com/datawire/ambassador/pkg/api/getambassador.io/v2 # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/deepmap/oapi-codegen v1.9.1 -## explicit; go 1.16 -github.com/deepmap/oapi-codegen/pkg/runtime -github.com/deepmap/oapi-codegen/pkg/types # github.com/denverdino/aliyungo v0.0.0-20230411124812-ab98a9173ace ## explicit; go 1.15 github.com/denverdino/aliyungo/metadata @@ -260,12 +256,6 @@ github.com/evanphx/json-patch ## explicit; go 1.18 github.com/evanphx/json-patch/v5 github.com/evanphx/json-patch/v5/internal/json -# github.com/exoscale/egoscale v0.102.3 -## explicit; go 1.20 -github.com/exoscale/egoscale/v2 -github.com/exoscale/egoscale/v2/api -github.com/exoscale/egoscale/v2/oapi -github.com/exoscale/egoscale/version # github.com/fatih/structs v1.1.0 ## explicit github.com/fatih/structs @@ -349,9 +339,6 @@ github.com/goccy/go-json/internal/runtime # github.com/gofrs/flock v0.8.1 ## explicit github.com/gofrs/flock -# github.com/gofrs/uuid v4.4.0+incompatible -## explicit -github.com/gofrs/uuid # github.com/gogo/protobuf v1.3.2 ## explicit; go 1.15 github.com/gogo/protobuf/gogoproto @@ -450,6 +437,8 @@ github.com/gophercloud/gophercloud/openstack/identity/v3/extensions/oauth1 github.com/gophercloud/gophercloud/openstack/identity/v3/tokens github.com/gophercloud/gophercloud/openstack/utils github.com/gophercloud/gophercloud/pagination +# github.com/gorilla/mux v1.8.0 +## explicit; go 1.12 # github.com/hashicorp/errwrap v1.1.0 ## explicit github.com/hashicorp/errwrap @@ -702,9 +691,6 @@ github.com/pkg/browser # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors -# github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 -## explicit -github.com/pmezard/go-difflib/difflib # github.com/projectcontour/contour v1.28.2 ## explicit; go 1.21 github.com/projectcontour/contour/apis/projectcontour/v1 @@ -795,13 +781,6 @@ github.com/spf13/viper/internal/encoding/javaproperties github.com/spf13/viper/internal/encoding/json github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml -# github.com/stretchr/objx v0.5.2 -## explicit; go 1.20 -github.com/stretchr/objx -# github.com/stretchr/testify v1.9.0 -## explicit; go 1.17 -github.com/stretchr/testify/assert -github.com/stretchr/testify/mock # github.com/subosito/gotenv v1.6.0 ## explicit; go 1.18 github.com/subosito/gotenv @@ -1847,7 +1826,6 @@ sigs.k8s.io/external-dns/provider/digitalocean sigs.k8s.io/external-dns/provider/dnsimple sigs.k8s.io/external-dns/provider/dyn sigs.k8s.io/external-dns/provider/dyn/soap -sigs.k8s.io/external-dns/provider/exoscale sigs.k8s.io/external-dns/provider/gandi sigs.k8s.io/external-dns/provider/godaddy sigs.k8s.io/external-dns/provider/google diff --git a/vendor/sigs.k8s.io/external-dns/provider/exoscale/exoscale.go b/vendor/sigs.k8s.io/external-dns/provider/exoscale/exoscale.go deleted file mode 100644 index 6e13f14f..00000000 --- a/vendor/sigs.k8s.io/external-dns/provider/exoscale/exoscale.go +++ /dev/null @@ -1,344 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -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. -*/ - -package exoscale - -import ( - "context" - "strings" - - egoscale "github.com/exoscale/egoscale/v2" - exoapi "github.com/exoscale/egoscale/v2/api" - log "github.com/sirupsen/logrus" - - "sigs.k8s.io/external-dns/endpoint" - "sigs.k8s.io/external-dns/plan" - "sigs.k8s.io/external-dns/provider" -) - -// EgoscaleClientI for replaceable implementation -type EgoscaleClientI interface { - ListDNSDomainRecords(context.Context, string, string) ([]egoscale.DNSDomainRecord, error) - ListDNSDomains(context.Context, string) ([]egoscale.DNSDomain, error) - CreateDNSDomainRecord(context.Context, string, string, *egoscale.DNSDomainRecord) (*egoscale.DNSDomainRecord, error) - DeleteDNSDomainRecord(context.Context, string, string, *egoscale.DNSDomainRecord) error - UpdateDNSDomainRecord(context.Context, string, string, *egoscale.DNSDomainRecord) error -} - -// ExoscaleProvider initialized as dns provider with no records -type ExoscaleProvider struct { - provider.BaseProvider - domain endpoint.DomainFilter - client EgoscaleClientI - apiEnv string - apiZone string - filter *zoneFilter - OnApplyChanges func(changes *plan.Changes) - dryRun bool -} - -// ExoscaleOption for Provider options -type ExoscaleOption func(*ExoscaleProvider) - -// NewExoscaleProvider returns ExoscaleProvider DNS provider interface implementation -func NewExoscaleProvider(env, zone, key, secret string, dryRun bool, opts ...ExoscaleOption) (*ExoscaleProvider, error) { - client, err := egoscale.NewClient( - key, - secret, - ) - if err != nil { - return nil, err - } - - return NewExoscaleProviderWithClient(client, env, zone, dryRun, opts...), nil -} - -// NewExoscaleProviderWithClient returns ExoscaleProvider DNS provider interface implementation (Client provided) -func NewExoscaleProviderWithClient(client EgoscaleClientI, env, zone string, dryRun bool, opts ...ExoscaleOption) *ExoscaleProvider { - ep := &ExoscaleProvider{ - filter: &zoneFilter{}, - OnApplyChanges: func(changes *plan.Changes) {}, - domain: endpoint.NewDomainFilter([]string{""}), - client: client, - apiEnv: env, - apiZone: zone, - dryRun: dryRun, - } - for _, opt := range opts { - opt(ep) - } - return ep -} - -func (ep *ExoscaleProvider) getZones(ctx context.Context) (map[string]string, error) { - ctx = exoapi.WithEndpoint(ctx, exoapi.NewReqEndpoint(ep.apiEnv, ep.apiZone)) - domains, err := ep.client.ListDNSDomains(ctx, ep.apiZone) - if err != nil { - return nil, err - } - - zones := map[string]string{} - for _, domain := range domains { - zones[*domain.ID] = *domain.UnicodeName - } - - return zones, nil -} - -// ApplyChanges simply modifies DNS via exoscale API -func (ep *ExoscaleProvider) ApplyChanges(ctx context.Context, changes *plan.Changes) error { - ep.OnApplyChanges(changes) - - if ep.dryRun { - log.Infof("Will NOT delete these records: %+v", changes.Delete) - log.Infof("Will NOT create these records: %+v", changes.Create) - log.Infof("Will NOT update these records: %+v", merge(changes.UpdateOld, changes.UpdateNew)) - return nil - } - - ctx = exoapi.WithEndpoint(ctx, exoapi.NewReqEndpoint(ep.apiEnv, ep.apiZone)) - - zones, err := ep.getZones(ctx) - if err != nil { - return err - } - - for _, epoint := range changes.Create { - if !ep.domain.Match(epoint.DNSName) { - continue - } - - zoneID, name := ep.filter.EndpointZoneID(epoint, zones) - if zoneID == "" { - continue - } - - // API does not accept 0 as default TTL but wants nil pointer instead - var ttl *int64 - if epoint.RecordTTL != 0 { - t := int64(epoint.RecordTTL) - ttl = &t - } - record := egoscale.DNSDomainRecord{ - Name: &name, - Type: &epoint.RecordType, - TTL: ttl, - Content: &epoint.Targets[0], - } - _, err := ep.client.CreateDNSDomainRecord(ctx, ep.apiZone, zoneID, &record) - if err != nil { - return err - } - } - - for _, epoint := range changes.UpdateNew { - if !ep.domain.Match(epoint.DNSName) { - continue - } - - zoneID, name := ep.filter.EndpointZoneID(epoint, zones) - if zoneID == "" { - continue - } - - records, err := ep.client.ListDNSDomainRecords(ctx, ep.apiZone, zoneID) - if err != nil { - return err - } - - for _, record := range records { - if *record.Name != name { - continue - } - - record.Type = &epoint.RecordType - record.Content = &epoint.Targets[0] - if epoint.RecordTTL != 0 { - ttl := int64(epoint.RecordTTL) - record.TTL = &ttl - } - - err = ep.client.UpdateDNSDomainRecord(ctx, ep.apiZone, zoneID, &record) - if err != nil { - return err - } - - break - } - } - - for _, epoint := range changes.UpdateOld { - // Since Exoscale "Patches", we ignore UpdateOld - // We leave this logging here for information - log.Debugf("UPDATE-OLD (ignored) for epoint: %+v", epoint) - } - - for _, epoint := range changes.Delete { - if !ep.domain.Match(epoint.DNSName) { - continue - } - - zoneID, name := ep.filter.EndpointZoneID(epoint, zones) - if zoneID == "" { - continue - } - - records, err := ep.client.ListDNSDomainRecords(ctx, ep.apiZone, zoneID) - if err != nil { - return err - } - - for _, record := range records { - if *record.Name != name { - continue - } - - err = ep.client.DeleteDNSDomainRecord(ctx, ep.apiZone, zoneID, &egoscale.DNSDomainRecord{ID: record.ID}) - if err != nil { - return err - } - - break - } - } - - return nil -} - -// Records returns the list of endpoints -func (ep *ExoscaleProvider) Records(ctx context.Context) ([]*endpoint.Endpoint, error) { - ctx = exoapi.WithEndpoint(ctx, exoapi.NewReqEndpoint(ep.apiEnv, ep.apiZone)) - endpoints := make([]*endpoint.Endpoint, 0) - - domains, err := ep.client.ListDNSDomains(ctx, ep.apiZone) - if err != nil { - return nil, err - } - - for _, domain := range domains { - records, err := ep.client.ListDNSDomainRecords(ctx, ep.apiZone, *domain.ID) - if err != nil { - return nil, err - } - - for _, record := range records { - switch *record.Type { - case "A", "CNAME", "TXT": - break - default: - continue - } - - e := endpoint.NewEndpointWithTTL((*record.Name)+"."+(*domain.UnicodeName), *record.Type, endpoint.TTL(*record.TTL), *record.Content) - endpoints = append(endpoints, e) - } - } - - log.Infof("called Records() with %d items", len(endpoints)) - return endpoints, nil -} - -// ExoscaleWithDomain modifies the domain on which dns zones are filtered -func ExoscaleWithDomain(domainFilter endpoint.DomainFilter) ExoscaleOption { - return func(p *ExoscaleProvider) { - p.domain = domainFilter - } -} - -// ExoscaleWithLogging injects logging when ApplyChanges is called -func ExoscaleWithLogging() ExoscaleOption { - return func(p *ExoscaleProvider) { - p.OnApplyChanges = func(changes *plan.Changes) { - for _, v := range changes.Create { - log.Infof("CREATE: %v", v) - } - for _, v := range changes.UpdateOld { - log.Infof("UPDATE (old): %v", v) - } - for _, v := range changes.UpdateNew { - log.Infof("UPDATE (new): %v", v) - } - for _, v := range changes.Delete { - log.Infof("DELETE: %v", v) - } - } - } -} - -type zoneFilter struct { - domain string -} - -// Zones filters map[zoneID]zoneName for names having f.domain as suffix -func (f *zoneFilter) Zones(zones map[string]string) map[string]string { - result := map[string]string{} - for zoneID, zoneName := range zones { - if strings.HasSuffix(zoneName, f.domain) { - result[zoneID] = zoneName - } - } - return result -} - -// EndpointZoneID determines zoneID for endpoint from map[zoneID]zoneName by taking longest suffix zoneName match in endpoint DNSName -// returns empty string if no matches are found -func (f *zoneFilter) EndpointZoneID(endpoint *endpoint.Endpoint, zones map[string]string) (zoneID string, name string) { - var matchZoneID string - var matchZoneName string - for zoneID, zoneName := range zones { - if strings.HasSuffix(endpoint.DNSName, "."+zoneName) && len(zoneName) > len(matchZoneName) { - matchZoneName = zoneName - matchZoneID = zoneID - name = strings.TrimSuffix(endpoint.DNSName, "."+zoneName) - } - } - return matchZoneID, name -} - -func merge(updateOld, updateNew []*endpoint.Endpoint) []*endpoint.Endpoint { - findMatch := func(template *endpoint.Endpoint) *endpoint.Endpoint { - for _, new := range updateNew { - if template.DNSName == new.DNSName && - template.RecordType == new.RecordType { - return new - } - } - return nil - } - - var result []*endpoint.Endpoint - for _, old := range updateOld { - matchingNew := findMatch(old) - if matchingNew == nil { - // no match, shouldn't happen - continue - } - - if !matchingNew.Targets.Same(old.Targets) { - // new target: always update, TTL will be overwritten too if necessary - result = append(result, matchingNew) - continue - } - - if matchingNew.RecordTTL != 0 && matchingNew.RecordTTL != old.RecordTTL { - // same target, but new non-zero TTL set in k8s, must update - // probably would happen only if there is a bug in the code calling the provider - result = append(result, matchingNew) - } - } - - return result -}