diff --git a/.gitattributes b/.gitattributes
index b7513274c..9562349f4 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1 @@
-vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go eol=crlf
-
+# vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go eol=crlf
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index 06359239c..90d7c64bf 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -46,6 +46,10 @@ HOW TO WRITE A GOOD ISSUE?
For the Traefik Docker image:
docker run [IMAGE] version
ex: docker run traefik version
+
+For the alpine Traefik Docker image:
+ docker run [IMAGE] traefik version
+ ex: docker run traefik traefik version
-->
```
diff --git a/.github/ISSUE_TEMPLATE/bugs.md b/.github/ISSUE_TEMPLATE/bugs.md
index 9affd6da0..b9542989e 100644
--- a/.github/ISSUE_TEMPLATE/bugs.md
+++ b/.github/ISSUE_TEMPLATE/bugs.md
@@ -44,6 +44,10 @@ HOW TO WRITE A GOOD ISSUE?
For the Traefik Docker image:
docker run [IMAGE] version
ex: docker run traefik version
+
+For the alpine Traefik Docker image:
+ docker run [IMAGE] traefik version
+ ex: docker run traefik traefik version
-->
```
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c004d0567..733a8ab04 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,31 @@
# Change Log
+## [v1.6.0-rc5](https://github.com/containous/traefik/tree/v1.6.0-rc5) (2018-04-12)
+[All Commits](https://github.com/containous/traefik/compare/v1.6.0-rc4...v1.6.0-rc5)
+
+**Enhancements:**
+- **[acme]** Generate wildcard certificate with SANs in ACME ([#3167](https://github.com/containous/traefik/pull/3167) by [nmengin](https://github.com/nmengin))
+- **[ecs]** Factorize labels managements. ([#3159](https://github.com/containous/traefik/pull/3159) by [ldez](https://github.com/ldez))
+
+**Bug fixes:**
+- **[acme]** Update lego. ([#3158](https://github.com/containous/traefik/pull/3158) by [ldez](https://github.com/ldez))
+- **[acme]** Fix acme.json file automatic creation ([#3156](https://github.com/containous/traefik/pull/3156) by [nmengin](https://github.com/nmengin))
+- **[acme]** Minor updates to dumpcerts.sh ([#3116](https://github.com/containous/traefik/pull/3116) by [mathuin](https://github.com/mathuin))
+- **[acme]** Add TTL and custom Timeout in DigitalOcean DNS provider ([#3143](https://github.com/containous/traefik/pull/3143) by [ldez](https://github.com/ldez))
+- **[acme]** Add ACME certificates only on ACME EntryPoint ([#3136](https://github.com/containous/traefik/pull/3136) by [nmengin](https://github.com/nmengin))
+- **[consul,docker,ecs,eureka,k8s,kv,marathon,mesos,rancher]** Server weight zero ([#3130](https://github.com/containous/traefik/pull/3130) by [ldez](https://github.com/ldez))
+- **[k8s]** Limit label selector to Ingress factory. ([#3137](https://github.com/containous/traefik/pull/3137) by [timoreimann](https://github.com/timoreimann))
+- **[middleware,consul,consulcatalog,docker,ecs,kv,marathon,mesos,rancher]** Fix: error pages ([#3138](https://github.com/containous/traefik/pull/3138) by [ldez](https://github.com/ldez))
+- **[webui]** Remove useless ACME tab from UI. ([#3154](https://github.com/containous/traefik/pull/3154) by [ldez](https://github.com/ldez))
+
+**Documentation:**
+- **[k8s]** Update kubernetes.md ([#3171](https://github.com/containous/traefik/pull/3171) by [andreyfedoseev](https://github.com/andreyfedoseev))
+- Update some examples ([#3150](https://github.com/containous/traefik/pull/3150) by [zaporylie](https://github.com/zaporylie))
+- Normalize parameter names in configs ([#3132](https://github.com/containous/traefik/pull/3132) by [kachkaev](https://github.com/kachkaev))
+
+**Misc:**
+- **[oxy]** Disable closeNotify when method GET for http pipelining ([#3108](https://github.com/containous/traefik/pull/3108) by [Juliens](https://github.com/Juliens))
+
## [v1.6.0-rc4](https://github.com/containous/traefik/tree/v1.6.0-rc4) (2018-04-04)
[All Commits](https://github.com/containous/traefik/compare/v1.6.0-rc3...v1.6.0-rc4)
diff --git a/Gopkg.lock b/Gopkg.lock
index ed124f4f4..98158747f 100644
--- a/Gopkg.lock
+++ b/Gopkg.lock
@@ -24,8 +24,12 @@
[[projects]]
name = "github.com/Azure/azure-sdk-for-go"
- packages = ["arm/dns"]
- revision = "f7bb4db3ea4c73dc58bd284c38ea644a79324be0"
+ packages = [
+ "services/dns/mgmt/2017-09-01/dns",
+ "version"
+ ]
+ revision = "068ec4d616be5b2175509bf1fb3e4c8ea160d5c8"
+ version = "v15.0.1"
[[projects]]
branch = "master"
@@ -45,8 +49,8 @@
"autorest/date",
"autorest/to"
]
- revision = "f6be1abbb5abd0517522f850dd785990d373da7e"
- version = "v9.0.0"
+ revision = "9ad9326b278af8fa5cc67c30c0ce9a58cc0862b2"
+ version = "v10.6.0"
[[projects]]
branch = "master"
@@ -140,6 +144,17 @@
]
revision = "063d875e3c5fd734fa2aa12fac83829f62acfc70"
+[[projects]]
+ name = "github.com/akamai/AkamaiOPEN-edgegrid-golang"
+ packages = [
+ "client-v1",
+ "configdns-v1",
+ "edgegrid",
+ "jsonhooks-v1"
+ ]
+ revision = "a494eba1efa1f38338393727dff63389a6a66534"
+ version = "v0.6.0"
+
[[projects]]
name = "github.com/aokoli/goutils"
packages = ["."]
@@ -193,6 +208,7 @@
"service/dynamodb/dynamodbiface",
"service/ec2",
"service/ecs",
+ "service/lightsail",
"service/route53",
"service/sts"
]
@@ -247,8 +263,8 @@
[[projects]]
name = "github.com/containous/traefik-extra-service-fabric"
packages = ["."]
- revision = "29a6d70ad0f15175efbaa5fd93d8afdd8b373b93"
- version = "v1.1.1"
+ revision = "503022efdc178146d598911092af75690510a80c"
+ version = "v1.1.3"
[[projects]]
name = "github.com/coreos/bbolt"
@@ -300,8 +316,8 @@
[[projects]]
name = "github.com/dgrijalva/jwt-go"
packages = ["."]
- revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c"
- version = "v3.0.0"
+ revision = "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e"
+ version = "v3.2.0"
[[projects]]
name = "github.com/dnsimple/dnsimple-go"
@@ -914,6 +930,12 @@
packages = ["."]
revision = "db96455566f05ffe42bd6ac671f05eeb1152b45d"
+[[projects]]
+ branch = "master"
+ name = "github.com/namedotcom/go"
+ packages = ["namecom"]
+ revision = "08470befbe04613bd4b44cb6978b05d50294c4d4"
+
[[projects]]
branch = "master"
name = "github.com/ogier/pflag"
@@ -1120,6 +1142,12 @@
]
revision = "37e84520dcf74488f67654f9c775b9752c232dc1"
+[[projects]]
+ branch = "master"
+ name = "github.com/tuvistavie/securerandom"
+ packages = ["."]
+ revision = "15512123a948d62f6361bd84818e11f2ad84059a"
+
[[projects]]
name = "github.com/tv42/zbase32"
packages = ["."]
@@ -1188,7 +1216,7 @@
"roundrobin",
"utils"
]
- revision = "dacf34285ce530b272e9fe04d2f45f52e6374e36"
+ revision = "6956548a7fa4272adeadf828455109c53933ea86"
[[projects]]
name = "github.com/vulcand/predicate"
@@ -1214,28 +1242,34 @@
revision = "0c8571ac0ce161a5feb57375a9cdf148c98c0f70"
[[projects]]
- branch = "acmev2"
+ branch = "containous-fork"
name = "github.com/xenolf/lego"
packages = [
- "acme",
"acmev2",
"providers/dns",
"providers/dns/auroradns",
"providers/dns/azure",
+ "providers/dns/bluecat",
"providers/dns/cloudflare",
"providers/dns/cloudxns",
"providers/dns/digitalocean",
"providers/dns/dnsimple",
"providers/dns/dnsmadeeasy",
"providers/dns/dnspod",
+ "providers/dns/duckdns",
"providers/dns/dyn",
+ "providers/dns/exec",
"providers/dns/exoscale",
+ "providers/dns/fastdns",
"providers/dns/gandi",
"providers/dns/gandiv5",
+ "providers/dns/glesys",
"providers/dns/godaddy",
"providers/dns/googlecloud",
+ "providers/dns/lightsail",
"providers/dns/linode",
"providers/dns/namecheap",
+ "providers/dns/namedotcom",
"providers/dns/ns1",
"providers/dns/otc",
"providers/dns/ovh",
@@ -1245,7 +1279,8 @@
"providers/dns/route53",
"providers/dns/vultr"
]
- revision = "a149e7d6506feb4003da7093cbf818c6b75ed4a4"
+ revision = "2817d2131186742bc98830c73a5d9c255b3f4537"
+ source = "github.com/containous/lego"
[[projects]]
branch = "master"
@@ -1403,6 +1438,12 @@
revision = "5b3e00af70a9484542169a976dcab8d03e601a17"
version = "v1.30.0"
+[[projects]]
+ branch = "v1"
+ name = "gopkg.in/mattes/go-expand-tilde.v1"
+ packages = ["."]
+ revision = "cb884138e64c9a8bf5c7d6106d74b0fca082df0c"
+
[[projects]]
name = "gopkg.in/ns1/ns1-go.v2"
packages = [
@@ -1415,16 +1456,6 @@
]
revision = "c563826f4cbef9c11bebeb9f20a3f7afe9c1e2f4"
-[[projects]]
- name = "gopkg.in/square/go-jose.v1"
- packages = [
- ".",
- "cipher",
- "json"
- ]
- revision = "aa2e30fdd1fe9dd3394119af66451ae790d50e0d"
- version = "v1.1.0"
-
[[projects]]
name = "gopkg.in/square/go-jose.v2"
packages = [
@@ -1644,6 +1675,6 @@
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
- inputs-digest = "593d67272ac35ca0fa59df7f2ac077a81ea842b3181b00acffa20553bfe6f2e0"
+ inputs-digest = "c441208e9bf330e85e2939b383515f58a4957286960b43c444e6f512d1ff94ee"
solver-name = "gps-cdcl"
solver-version = 1
diff --git a/Gopkg.toml b/Gopkg.toml
index 1383e2927..9ed7426f7 100644
--- a/Gopkg.toml
+++ b/Gopkg.toml
@@ -66,7 +66,7 @@
[[constraint]]
name = "github.com/containous/traefik-extra-service-fabric"
- version = "1.1.1"
+ version = "1.1.3"
[[constraint]]
name = "github.com/coreos/go-systemd"
@@ -181,8 +181,9 @@
name = "github.com/vulcand/oxy"
[[constraint]]
- branch = "acmev2"
+ branch = "containous-fork"
name = "github.com/xenolf/lego"
+ source = "github.com/containous/lego"
[[constraint]]
name = "google.golang.org/grpc"
diff --git a/README.md b/README.md
index 21465d20a..00a875695 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ _(But if you'd rather configure some of your routes manually, Træfik supports t
- [Kubernetes](https://docs.traefik.io/configuration/backends/kubernetes)
- [Mesos](https://docs.traefik.io/configuration/backends/mesos) / [Marathon](https://docs.traefik.io/configuration/backends/marathon)
- [Rancher](https://docs.traefik.io/configuration/backends/rancher) (API, Metadata)
-- [Service Fabric](https://docs.traefik.io/configuration/backends/servicefabric)
+- [Azure Service Fabric](https://docs.traefik.io/configuration/backends/servicefabric)
- [Consul Catalog](https://docs.traefik.io/configuration/backends/consulcatalog)
- [Consul](https://docs.traefik.io/configuration/backends/consul) / [Etcd](https://docs.traefik.io/configuration/backends/etcd) / [Zookeeper](https://docs.traefik.io/configuration/backends/zookeeper) / [BoltDB](https://docs.traefik.io/configuration/backends/boltdb)
- [Eureka](https://docs.traefik.io/configuration/backends/eureka)
diff --git a/acme/acme.go b/acme/acme.go
index 8e8634654..805b2b744 100644
--- a/acme/acme.go
+++ b/acme/acme.go
@@ -26,7 +26,7 @@ import (
"github.com/containous/traefik/tls/generate"
"github.com/containous/traefik/types"
"github.com/eapache/channels"
- "github.com/xenolf/lego/acmev2"
+ acme "github.com/xenolf/lego/acmev2"
"github.com/xenolf/lego/providers/dns"
)
@@ -62,20 +62,6 @@ type ACME struct {
}
func (a *ACME) init() error {
- // FIXME temporary fix, waiting for https://github.com/xenolf/lego/pull/478
- acme.HTTPClient = http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: (&net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- }).Dial,
- TLSHandshakeTimeout: 15 * time.Second,
- ResponseHeaderTimeout: 15 * time.Second,
- ExpectContinueTimeout: 1 * time.Second,
- },
- }
-
if a.ACMELogging {
acme.Logger = fmtlog.New(os.Stderr, "legolog: ", fmtlog.LstdFlags)
} else {
@@ -651,6 +637,7 @@ func (a *ACME) runJobs() {
// getValidDomains checks if given domain is allowed to generate a ACME certificate and return it
func (a *ACME) getValidDomains(domains []string, wildcardAllowed bool) ([]string, error) {
+ // Check if the domains array is empty or contains only one empty value
if len(domains) == 0 || (len(domains) == 1 && len(domains[0]) == 0) {
return nil, errors.New("unable to generate a certificate when no domain is given")
}
@@ -663,15 +650,14 @@ func (a *ACME) getValidDomains(domains []string, wildcardAllowed bool) ([]string
if a.DNSChallenge == nil && len(a.DNSProvider) == 0 {
return nil, fmt.Errorf("unable to generate a wildcard certificate for domain %q : ACME needs a DNSChallenge", strings.Join(domains, ","))
}
-
- if len(domains) > 1 {
- return nil, fmt.Errorf("unable to generate a wildcard certificate for domain %q : SANs are not allowed", strings.Join(domains, ","))
+ if strings.HasPrefix(domains[0], "*.*") {
+ return nil, fmt.Errorf("unable to generate a wildcard certificate for domain %q : ACME does not allow '*.*' wildcard domain", strings.Join(domains, ","))
}
- } else {
- for _, san := range domains[1:] {
- if strings.HasPrefix(san, "*") {
- return nil, fmt.Errorf("unable to generate a certificate in ACME provider for domains %q: SANs can not be a wildcard domain", strings.Join(domains, ","))
- }
+ }
+ for _, san := range domains[1:] {
+ if strings.HasPrefix(san, "*") {
+ return nil, fmt.Errorf("unable to generate a certificate for domains %q: SANs can not be a wildcard domain", strings.Join(domains, ","))
+
}
}
@@ -710,31 +696,37 @@ func (a *ACME) deleteUnnecessaryDomains() {
keepDomain = false
}
break
- } else if strings.HasPrefix(domain.Main, "*") && domain.SANs == nil {
- // Check if domains can be validated by the wildcard domain
-
- var newDomainsToCheck []string
-
- // Check if domains can be validated by the wildcard domain
- domainsMap := make(map[string]*tls.Certificate)
- domainsMap[domain.Main] = &tls.Certificate{}
-
- for _, domainProcessed := range domainToCheck.ToStrArray() {
- if isDomainAlreadyChecked(domainProcessed, domainsMap) {
- log.Warnf("Domain %q will not be processed by ACME because it is validated by the wildcard %q", domainProcessed, domain.Main)
- continue
- }
- newDomainsToCheck = append(newDomainsToCheck, domainProcessed)
- }
-
- // Delete the domain if both Main and SANs can be validated by the wildcard domain
- // otherwise keep the unchecked values
- if newDomainsToCheck == nil {
- keepDomain = false
- break
- }
- domainToCheck.Set(newDomainsToCheck)
}
+
+ var newDomainsToCheck []string
+
+ // Check if domains can be validated by the wildcard domain
+ domainsMap := make(map[string]*tls.Certificate)
+ domainsMap[domain.Main] = &tls.Certificate{}
+ if len(domain.SANs) > 0 {
+ domainsMap[strings.Join(domain.SANs, ",")] = &tls.Certificate{}
+ }
+
+ for _, domainProcessed := range domainToCheck.ToStrArray() {
+ if idxDomain < idxDomainToCheck && isDomainAlreadyChecked(domainProcessed, domainsMap) {
+ // The domain is duplicated in a CN
+ log.Warnf("Domain %q is duplicated in the configuration or validated by the domain %v. It will be processed once.", domainProcessed, domain)
+ continue
+ } else if domain.Main != domainProcessed && strings.HasPrefix(domain.Main, "*") && types.MatchDomain(domainProcessed, domain.Main) {
+ // Check if a wildcard can validate the domain
+ log.Warnf("Domain %q will not be processed by ACME provider because it is validated by the wildcard %q", domainProcessed, domain.Main)
+ continue
+ }
+ newDomainsToCheck = append(newDomainsToCheck, domainProcessed)
+ }
+
+ // Delete the domain if both Main and SANs can be validated by the wildcard domain
+ // otherwise keep the unchecked values
+ if newDomainsToCheck == nil {
+ keepDomain = false
+ break
+ }
+ domainToCheck.Set(newDomainsToCheck)
}
if keepDomain {
diff --git a/acme/acme_test.go b/acme/acme_test.go
index 076308c82..8c7c78280 100644
--- a/acme/acme_test.go
+++ b/acme/acme_test.go
@@ -14,7 +14,7 @@ import (
"github.com/containous/traefik/tls/generate"
"github.com/containous/traefik/types"
"github.com/stretchr/testify/assert"
- "github.com/xenolf/lego/acmev2"
+ acme "github.com/xenolf/lego/acmev2"
)
func TestDomainsSet(t *testing.T) {
@@ -417,11 +417,27 @@ func TestAcme_getValidDomain(t *testing.T) {
expectedDomains: nil,
},
{
- desc: "unexpected SANs",
- domains: []string{"*.traefik.wtf", "foo.traefik.wtf"},
+ desc: "unauthorized wildcard with SAN",
+ domains: []string{"*.*.traefik.wtf", "foo.traefik.wtf"},
dnsChallenge: &acmeprovider.DNSChallenge{},
wildcardAllowed: true,
- expectedErr: "unable to generate a wildcard certificate for domain \"*.traefik.wtf,foo.traefik.wtf\" : SANs are not allowed",
+ expectedErr: "unable to generate a wildcard certificate for domain \"*.*.traefik.wtf,foo.traefik.wtf\" : ACME does not allow '*.*' wildcard domain",
+ expectedDomains: nil,
+ },
+ {
+ desc: "wildcard with SANs",
+ domains: []string{"*.traefik.wtf", "traefik.wtf"},
+ dnsChallenge: &acmeprovider.DNSChallenge{},
+ wildcardAllowed: true,
+ expectedErr: "",
+ expectedDomains: []string{"*.traefik.wtf", "traefik.wtf"},
+ },
+ {
+ desc: "unexpected SANs",
+ domains: []string{"*.traefik.wtf", "*.acme.wtf"},
+ dnsChallenge: &acmeprovider.DNSChallenge{},
+ wildcardAllowed: true,
+ expectedErr: "unable to generate a certificate for domains \"*.traefik.wtf,*.acme.wtf\": SANs can not be a wildcard domain",
expectedDomains: nil,
},
}
diff --git a/acme/localStore.go b/acme/localStore.go
index bb4c1bdc1..e3a3fdd4b 100644
--- a/acme/localStore.go
+++ b/acme/localStore.go
@@ -26,7 +26,7 @@ func NewLocalStore(file string) *LocalStore {
func (s *LocalStore) Get() (*Account, error) {
account := &Account{}
- hasData, err := checkFile(s.file)
+ hasData, err := acme.CheckFile(s.file)
if err != nil {
return nil, err
}
diff --git a/autogen/gentemplates/gen.go b/autogen/gentemplates/gen.go
index 7d129c2a7..1c6f6129e 100644
--- a/autogen/gentemplates/gen.go
+++ b/autogen/gentemplates/gen.go
@@ -231,7 +231,7 @@ var _templatesConsul_catalogTmpl = []byte(`[backends]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
@@ -632,7 +632,7 @@ var _templatesDockerTmpl = []byte(`{{$backendServers := .Servers}}
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
@@ -884,7 +884,7 @@ var _templatesEcsTmpl = []byte(`[backends]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
@@ -1588,7 +1588,7 @@ var _templatesMarathonTmpl = []byte(`{{ $apps := .Applications }}
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
@@ -1826,7 +1826,7 @@ var _templatesMesosTmpl = []byte(`[backends]
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
@@ -2117,7 +2117,7 @@ var _templatesRancherTmpl = []byte(`{{ $backendServers := .Backends }}
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/cmd/traefik/traefik.go b/cmd/traefik/traefik.go
index 4f8547bcc..9fe1854fc 100644
--- a/cmd/traefik/traefik.go
+++ b/cmd/traefik/traefik.go
@@ -35,6 +35,7 @@ import (
"github.com/coreos/go-systemd/daemon"
"github.com/ogier/pflag"
"github.com/sirupsen/logrus"
+ "github.com/vulcand/oxy/roundrobin"
)
func main() {
@@ -155,6 +156,10 @@ func runCmd(globalConfiguration *configuration.GlobalConfiguration, configFile s
http.DefaultTransport.(*http.Transport).Proxy = http.ProxyFromEnvironment
+ if globalConfiguration.AllowMinWeightZero {
+ roundrobin.SetDefaultWeight(0)
+ }
+
globalConfiguration.SetEffectiveConfiguration(configFile)
globalConfiguration.ValidateConfiguration()
diff --git a/configuration/configuration.go b/configuration/configuration.go
index c93ecb1b7..d6f1f14ed 100644
--- a/configuration/configuration.go
+++ b/configuration/configuration.go
@@ -78,6 +78,7 @@ type GlobalConfiguration struct {
HealthCheck *HealthCheckConfig `description:"Health check parameters" export:"true"`
RespondingTimeouts *RespondingTimeouts `description:"Timeouts for incoming requests to the Traefik instance" export:"true"`
ForwardingTimeouts *ForwardingTimeouts `description:"Timeouts for requests forwarded to the backend servers" export:"true"`
+ AllowMinWeightZero bool `description:"Allow weight to take 0 as minimum real value." export:"true"` // Deprecated
Web *WebCompatibility `description:"(Deprecated) Enable Web backend with default settings" export:"true"` // Deprecated
Docker *docker.Provider `description:"Enable Docker backend with default settings" export:"true"`
File *file.Provider `description:"Enable File backend with default settings" export:"true"`
diff --git a/contrib/scripts/dumpcerts.sh b/contrib/scripts/dumpcerts.sh
index e763b63fc..42f465630 100755
--- a/contrib/scripts/dumpcerts.sh
+++ b/contrib/scripts/dumpcerts.sh
@@ -66,7 +66,7 @@ ${USAGE}" >&2
bad_acme() {
echo "
-There was a problem parsing your acme.json file. $1
+There was a problem parsing your acme.json file.
${USAGE}" >&2
exit 2
diff --git a/docs/basics.md b/docs/basics.md
index 800f944e1..5a8b98d85 100644
--- a/docs/basics.md
+++ b/docs/basics.md
@@ -170,7 +170,7 @@ Here is an example of frontends definition:
- Three frontends are defined: `frontend1`, `frontend2` and `frontend3`
- `frontend1` will forward the traffic to the `backend2` if the rule `Host:test.localhost,test2.localhost` is matched
-- `frontend2` will forward the traffic to the `backend1` if the rule `Host:localhost,{subdomain:[a-z]+}.localhost` is matched (forwarding client `Host` header to the backend)
+- `frontend2` will forward the traffic to the `backend1` if the rule `HostRegexp:localhost,{subdomain:[a-z]+}.localhost` is matched (forwarding client `Host` header to the backend)
- `frontend3` will forward the traffic to the `backend2` if the rules `Host:test3.localhost` **AND** `Path:/test` are matched
#### Combining multiple rules
@@ -645,18 +645,18 @@ Once a day (the first call begins 10 minutes after the start of Træfik), we col
swarmMode = true
[Docker.TLS]
- CA = "dockerCA"
- Cert = "dockerCert"
- Key = "dockerKey"
- InsecureSkipVerify = true
+ ca = "dockerCA"
+ cert = "dockerCert"
+ key = "dockerKey"
+ insecureSkipVerify = true
[ECS]
- Domain = "foo.bar"
- ExposedByDefault = true
- Clusters = ["foo-bar"]
- Region = "us-west-2"
- AccessKeyID = "AccessKeyID"
- SecretAccessKey = "SecretAccessKey"
+ domain = "foo.bar"
+ exposedByDefault = true
+ clusters = ["foo-bar"]
+ region = "us-west-2"
+ accessKeyID = "AccessKeyID"
+ secretAccessKey = "SecretAccessKey"
```
- Obfuscated and anonymous configuration:
@@ -669,24 +669,24 @@ Once a day (the first call begins 10 minutes after the start of Træfik), we col
[api]
[Docker]
- Endpoint = "xxxx"
- Domain = "xxxx"
- ExposedByDefault = true
- SwarmMode = true
+ endpoint = "xxxx"
+ domain = "xxxx"
+ exposedByDefault = true
+ swarmMode = true
[Docker.TLS]
- CA = "xxxx"
- Cert = "xxxx"
- Key = "xxxx"
- InsecureSkipVerify = false
+ ca = "xxxx"
+ cert = "xxxx"
+ key = "xxxx"
+ insecureSkipVerify = false
[ECS]
- Domain = "xxxx"
- ExposedByDefault = true
- Clusters = []
- Region = "us-west-2"
- AccessKeyID = "xxxx"
- SecretAccessKey = "xxxx"
+ domain = "xxxx"
+ exposedByDefault = true
+ clusters = []
+ region = "us-west-2"
+ accessKeyID = "xxxx"
+ secretAccessKey = "xxxx"
```
### Show me the code !
diff --git a/docs/benchmarks.md b/docs/benchmarks.md
index 032810e93..6e3bc42cf 100644
--- a/docs/benchmarks.md
+++ b/docs/benchmarks.md
@@ -118,7 +118,7 @@ server {
Here is the `traefik.toml` file used:
```toml
-MaxIdleConnsPerHost = 100000
+maxIdleConnsPerHost = 100000
defaultEntryPoints = ["http"]
[entryPoints]
diff --git a/docs/configuration/acme.md b/docs/configuration/acme.md
index d089a7409..aadf4873a 100644
--- a/docs/configuration/acme.md
+++ b/docs/configuration/acme.md
@@ -112,7 +112,7 @@ entryPoint = "https"
#
entryPoint = "http"
-# Use a DNS-01/DNS-02 acme challenge rather than HTTP-01 challenge.
+# Use a DNS-01/DNS-01 acme challenge rather than HTTP-01 challenge.
# Note : Mandatory for wildcard certificates generation.
#
# Optional
@@ -264,7 +264,7 @@ defaultEntryPoints = ["http", "https"]
### `dnsChallenge`
-Use `DNS-01/DNS-02` challenge to generate/renew ACME certificates.
+Use `DNS-01/DNS-01` challenge to generate/renew ACME certificates.
```toml
[acme]
@@ -276,7 +276,7 @@ Use `DNS-01/DNS-02` challenge to generate/renew ACME certificates.
```
!!! note
- ACME wildcard certificates can only be generated thanks to a `DNS-02` challenge.
+ ACME wildcard certificates can only be generated thanks to a `DNS-01` challenge.
#### `provider`
@@ -286,21 +286,28 @@ Select the provider that matches the DNS domain that will host the challenge TXT
|--------------------------------------------------------|----------------|---------------------------------------------------------------------------------------------------------------------------|
| [Auroradns](https://www.pcextreme.com/aurora/dns) | `auroradns` | `AURORA_USER_ID`, `AURORA_KEY`, `AURORA_ENDPOINT` |
| [Azure](https://azure.microsoft.com/services/dns/) | `azure` | `AZURE_CLIENT_ID`, `AZURE_CLIENT_SECRET`, `AZURE_SUBSCRIPTION_ID`, `AZURE_TENANT_ID`, `AZURE_RESOURCE_GROUP` |
+| [Blue Cat](https://www.bluecatnetworks.com/) | `bluecat` | `BLUECAT_SERVER_URL`, `BLUECAT_USER_NAME`, `BLUECAT_PASSWORD`, `BLUECAT_CONFIG_NAME`, `BLUECAT_DNS_VIEW` |
| [Cloudflare](https://www.cloudflare.com) | `cloudflare` | `CLOUDFLARE_EMAIL`, `CLOUDFLARE_API_KEY` - The Cloudflare `Global API Key` needs to be used and not the `Origin CA Key` |
| [CloudXNS](https://www.cloudxns.net) | `cloudxns` | `CLOUDXNS_API_KEY`, `CLOUDXNS_SECRET_KEY` |
| [DigitalOcean](https://www.digitalocean.com) | `digitalocean` | `DO_AUTH_TOKEN` |
| [DNSimple](https://dnsimple.com) | `dnsimple` | `DNSIMPLE_OAUTH_TOKEN`, `DNSIMPLE_BASE_URL` |
| [DNS Made Easy](https://dnsmadeeasy.com) | `dnsmadeeasy` | `DNSMADEEASY_API_KEY`, `DNSMADEEASY_API_SECRET`, `DNSMADEEASY_SANDBOX` |
| [DNSPod](http://www.dnspod.net/) | `dnspod` | `DNSPOD_API_KEY` |
+| [Duck DNS](https://www.duckdns.org/) | `duckdns` | `DUCKDNS_TOKEN` |
| [Dyn](https://dyn.com) | `dyn` | `DYN_CUSTOMER_NAME`, `DYN_USER_NAME`, `DYN_PASSWORD` |
+| External Program | `exec` | `EXEC_PATH` |
| [Exoscale](https://www.exoscale.ch) | `exoscale` | `EXOSCALE_API_KEY`, `EXOSCALE_API_SECRET`, `EXOSCALE_ENDPOINT` |
+| [Fast DNS](https://www.akamai.com/) | `fastdns` | `AKAMAI_CLIENT_TOKEN`, `AKAMAI_CLIENT_SECRET`, `AKAMAI_ACCESS_TOKEN` |
| [Gandi](https://www.gandi.net) | `gandi` | `GANDI_API_KEY` |
| [Gandi V5](http://doc.livedns.gandi.net) | `gandiv5` | `GANDIV5_API_KEY` |
+| [Glesys](https://glesys.com/) | `glesys` | `GLESYS_API_USER`, `GLESYS_API_KEY`, `GLESYS_DOMAIN` |
| [GoDaddy](https://godaddy.com/domains) | `godaddy` | `GODADDY_API_KEY`, `GODADDY_API_SECRET` |
| [Google Cloud DNS](https://cloud.google.com/dns/docs/) | `gcloud` | `GCE_PROJECT`, `GCE_SERVICE_ACCOUNT_FILE` |
+| [Lightsail](https://aws.amazon.com/lightsail/) | `lightsail` | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `DNS_ZONE` |
| [Linode](https://www.linode.com) | `linode` | `LINODE_API_KEY` |
| manual | - | none, but run Træfik interactively & turn on `acmeLogging` to see instructions & press Enter. |
| [Namecheap](https://www.namecheap.com) | `namecheap` | `NAMECHEAP_API_USER`, `NAMECHEAP_API_KEY` |
+| [name.com](https://www.name.com/) | `namedotcom` | `NAMECOM_USERNAME`, `NAMECOM_API_TOKEN`, `NAMECOM_SERVER` |
| [Ns1](https://ns1.com/) | `ns1` | `NS1_API_KEY` |
| [Open Telekom Cloud](https://cloud.telekom.de/en/) | `otc` | `OTC_DOMAIN_NAME`, `OTC_USER_NAME`, `OTC_PASSWORD`, `OTC_PROJECT_NAME`, `OTC_IDENTITY_ENDPOINT` |
| [OVH](https://www.ovh.com) | `ovh` | `OVH_ENDPOINT`, `OVH_APPLICATION_KEY`, `OVH_APPLICATION_SECRET`, `OVH_CONSUMER_KEY` |
@@ -390,14 +397,18 @@ CA server to use.
main = "local3.com"
[[acme.domains]]
main = "*.local4.com"
+ sans = ["local4.com", "test1.test1.local4.com"]
# ...
```
#### Wildcard domains
-Wildcard domain has to be defined as a main domain **with no SANs** (alternative domains).
+Wildcard domain has to be defined as a main domain.
All domains must have A/AAAA records pointing to Træfik.
+Due to ACME limitation, it's not possible to define a wildcard as a SAN (alternative domains).
+It's neither possible to define a wildcard on a wildcard domain (for example `*.*.local.com`).
+
!!! warning
Note that Let's Encrypt has [rate limiting](https://letsencrypt.org/docs/rate-limits).
@@ -428,9 +439,9 @@ Each domain & SANs will lead to a certificate request.
[ACME V2](https://community.letsencrypt.org/t/acme-v2-and-wildcard-certificate-support-is-live/55579) allows wildcard certificate support.
However, this feature needs a specific configuration.
-### DNS-02 Challenge
+### DNS-01 Challenge
-As described in [Let's Encrypt post](https://community.letsencrypt.org/t/staging-endpoint-for-acme-v2/49605), wildcard certificates can only be generated through a `DNS-02`Challenge.
+As described in [Let's Encrypt post](https://community.letsencrypt.org/t/staging-endpoint-for-acme-v2/49605), wildcard certificates can only be generated through a `DNS-01` Challenge.
This challenge is linked to the Træfik option `acme.dnsChallenge`.
```toml
@@ -447,16 +458,88 @@ For more information about this option, please refer to the [dnsChallenge sectio
### Wildcard domain
Wildcard domains can currently be provided only by to the `acme.domains` option.
-Theses domains can not have SANs.
```toml
[acme]
# ...
[[acme.domains]]
- main = "*local1.com"
+ main = "*.local1.com"
+ sans = ["local1.com"]
[[acme.domains]]
main = "*.local2.com"
# ...
```
For more information about this option, please refer to the [domains section](/configuration/acme/#domains).
+
+### Limitations
+
+Let's Encrypt wildcard support have some limitations to take into account :
+
+- Wildcard domain can not be a SAN (alternative domain),
+- Wildcard domain on a wildcard domain is forbidden (for example `*.*.local.com`),
+- A DNS-01 Challenge is executed for each domain (CN and SANs), DNS provider can not manage correctly this behavior as explained in the [DNS provider support section](/configuration/acme/#dns-provider-support)
+
+
+### DNS provider support
+
+All DNS providers allow creating ACME wildcard certificates.
+However, many troubles can appear for wildcard domains with SANs.
+
+If a wildcard domain is defined with it root domain as SAN, as described below, 2 DNS-01 Challenges will be executed.
+
+```toml
+[acme]
+# ...
+[[acme.domains]]
+ main = "*.local1.com"
+ sans = ["local1.com"]
+# ...
+```
+
+When a DNS-01 Challenge is done, Let's Encrypt checks if a TXT record is created with a given name and a given value.
+When a certificate is generated for a wildcard domain is defined with it root domain as SAN, the requested TXT record name for both the wildcard domain and the root domain is the same.
+
+The [DNS RFC](https://community.letsencrypt.org/t/wildcard-issuance-two-txt-records-for-the-same-name/54528/2) allows this behavior.
+But all DNS providers keep TXT records values in a cache with a TTL.
+In function of the parameters given by the Træfik ACME client library ([LEGO](https://github.com/xenolf/lego)), the TXT record TTL can be superior to challenge Timeout.
+In that event, the DNS-01 Challenge will not work correctly.
+
+[LEGO](https://github.com/xenolf/lego) will involve in the way to be adapted to all of DNS providers.
+Meanwhile, the table described below contains all the DNS providers supported by Træfik and indicates if they allow generating certificates for a wildcard domain and its root domain.
+Do not hesitate to complete it.
+
+| Provider Name | Provider code | Wildcard and Root Domain Support |
+|--------------------------------------------------------|----------------|----------------------------------|
+| [Auroradns](https://www.pcextreme.com/aurora/dns) | `auroradns` | Not tested yet |
+| [Azure](https://azure.microsoft.com/services/dns/) | `azure` | Not tested yet |
+| [Blue Cat](https://www.bluecatnetworks.com/) | `bluecat` | Not tested yet |
+| [Cloudflare](https://www.cloudflare.com) | `cloudflare` | YES |
+| [CloudXNS](https://www.cloudxns.net) | `cloudxns` | Not tested yet |
+| [DigitalOcean](https://www.digitalocean.com) | `digitalocean` | YES |
+| [DNSimple](https://dnsimple.com) | `dnsimple` | Not tested yet |
+| [DNS Made Easy](https://dnsmadeeasy.com) | `dnsmadeeasy` | Not tested yet |
+| [DNSPod](http://www.dnspod.net/) | `dnspod` | Not tested yet |
+| [Duck DNS](https://www.duckdns.org/) | `duckdns` | Not tested yet |
+| [Dyn](https://dyn.com) | `dyn` | Not tested yet |
+| External Program | `exec` | Not tested yet |
+| [Exoscale](https://www.exoscale.ch) | `exoscale` | Not tested yet |
+| [Fast DNS](https://www.akamai.com/) | `fastdns` | Not tested yet |
+| [Gandi](https://www.gandi.net) | `gandi` | Not tested yet |
+| [Gandi V5](http://doc.livedns.gandi.net) | `gandiv5` | Not tested yet |
+| [Glesys](https://glesys.com/) | `glesys` | Not tested yet |
+| [GoDaddy](https://godaddy.com/domains) | `godaddy` | Not tested yet |
+| [Google Cloud DNS](https://cloud.google.com/dns/docs/) | `gcloud` | YES |
+| [Lightsail](https://aws.amazon.com/lightsail/) | `lightsail` | Not tested yet |
+| [Linode](https://www.linode.com) | `linode` | Not tested yet |
+| manual | - | YES |
+| [Namecheap](https://www.namecheap.com) | `namecheap` | Not tested yet |
+| [name.com](https://www.name.com/) | `namedotcom` | Not tested yet |
+| [Ns1](https://ns1.com/) | `ns1` | Not tested yet |
+| [Open Telekom Cloud](https://cloud.telekom.de/en/) | `otc` | Not tested yet |
+| [OVH](https://www.ovh.com) | `ovh` | YES |
+| [PowerDNS](https://www.powerdns.com) | `pdns` | Not tested yet |
+| [Rackspace](https://www.rackspace.com/cloud/dns) | `rackspace` | Not tested yet |
+| [RFC2136](https://tools.ietf.org/html/rfc2136) | `rfc2136` | Not tested yet |
+| [Route 53](https://aws.amazon.com/route53/) | `route53` | YES |
+| [VULTR](https://www.vultr.com) | `vultr` | Not tested yet |
diff --git a/docs/configuration/backends/boltdb.md b/docs/configuration/backends/boltdb.md
index 05423ef43..70db84362 100644
--- a/docs/configuration/backends/boltdb.md
+++ b/docs/configuration/backends/boltdb.md
@@ -53,7 +53,7 @@ filename = "boltdb.tmpl"
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/boltdb.crt"
# key = "/etc/ssl/boltdb.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
diff --git a/docs/configuration/backends/consul.md b/docs/configuration/backends/consul.md
index 08de60c8c..816813fd1 100644
--- a/docs/configuration/backends/consul.md
+++ b/docs/configuration/backends/consul.md
@@ -53,7 +53,7 @@ prefix = "traefik"
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/consul.crt"
# key = "/etc/ssl/consul.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
diff --git a/docs/configuration/backends/consulcatalog.md b/docs/configuration/backends/consulcatalog.md
index de6a01259..4712bc6e1 100644
--- a/docs/configuration/backends/consulcatalog.md
+++ b/docs/configuration/backends/consulcatalog.md
@@ -57,7 +57,7 @@ prefix = "traefik"
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/consul.crt"
# key = "/etc/ssl/consul.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
# Override default configuration template.
# For advanced users :)
diff --git a/docs/configuration/backends/docker.md b/docs/configuration/backends/docker.md
index 221152757..eeba988a5 100644
--- a/docs/configuration/backends/docker.md
+++ b/docs/configuration/backends/docker.md
@@ -54,7 +54,7 @@ watch = true
# Optional
# Default: true
#
-exposedbydefault = true
+exposedByDefault = true
# Use the IP address from the binded port instead of the inner network one.
# For specific use-case :)
@@ -69,7 +69,7 @@ usebindportip = true
# Optional
# Default: false
#
-swarmmode = false
+swarmMode = false
# Enable docker TLS connection.
#
@@ -79,7 +79,7 @@ swarmmode = false
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/docker.crt"
# key = "/etc/ssl/docker.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
@@ -89,7 +89,7 @@ To enable constraints see [backend-specific constraints section](/configuration/
```toml
################################################################
-# Docker Swarmmode configuration backend
+# Docker Swarm Mode configuration backend
################################################################
# Enable Docker configuration backend.
@@ -123,7 +123,7 @@ watch = true
# Optional
# Default: false
#
-swarmmode = true
+swarmMode = true
# Override default configuration template.
# For advanced users :)
@@ -146,7 +146,7 @@ swarmmode = true
# Optional
# Default: true
#
-exposedbydefault = false
+exposedByDefault = false
# Enable docker TLS connection.
#
@@ -156,7 +156,7 @@ exposedbydefault = false
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/docker.crt"
# key = "/etc/ssl/docker.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
diff --git a/docs/configuration/backends/dynamodb.md b/docs/configuration/backends/dynamodb.md
index 23224f719..269f2a688 100644
--- a/docs/configuration/backends/dynamodb.md
+++ b/docs/configuration/backends/dynamodb.md
@@ -39,13 +39,13 @@ watch = true
#
refreshSeconds = 15
-# AccessKeyID to use when connecting to AWS.
+# Access Key ID to use when connecting to AWS.
#
# Optional
#
accessKeyID = "abc"
-# SecretAccessKey to use when connecting to AWS.
+# Secret Access Key to use when connecting to AWS.
#
# Optional
#
diff --git a/docs/configuration/backends/ecs.md b/docs/configuration/backends/ecs.md
index e08b8f254..12c718892 100644
--- a/docs/configuration/backends/ecs.md
+++ b/docs/configuration/backends/ecs.md
@@ -66,13 +66,13 @@ exposedByDefault = false
#
region = "us-east-1"
-# AccessKeyID to use when connecting to AWS.
+# Access Key ID to use when connecting to AWS.
#
# Optional
#
accessKeyID = "abc"
-# SecretAccessKey to use when connecting to AWS.
+# Secret Access Key to use when connecting to AWS.
#
# Optional
#
@@ -95,7 +95,7 @@ secretAccessKey = "123"
# templateVersion = "2"
```
-If `AccessKeyID`/`SecretAccessKey` is not given credentials will be resolved in the following order:
+If `accessKeyID`/`secretAccessKey` is not given credentials will be resolved in the following order:
- From environment variables; `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN`.
- Shared credentials, determined by `AWS_PROFILE` and `AWS_SHARED_CREDENTIALS_FILE`, defaults to `default` and `~/.aws/credentials`.
diff --git a/docs/configuration/backends/etcd.md b/docs/configuration/backends/etcd.md
index 4e4330e48..1defc4a6b 100644
--- a/docs/configuration/backends/etcd.md
+++ b/docs/configuration/backends/etcd.md
@@ -63,7 +63,7 @@ useAPIV3 = true
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/etcd.crt"
# key = "/etc/ssl/etcd.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
diff --git a/docs/configuration/backends/kubernetes.md b/docs/configuration/backends/kubernetes.md
index 781a3c796..caa5d3f57 100644
--- a/docs/configuration/backends/kubernetes.md
+++ b/docs/configuration/backends/kubernetes.md
@@ -114,7 +114,7 @@ If the service port defined in the ingress spec is 443, then the backend communi
!!! note
Please note that by enabling TLS communication between traefik and your pods, you will have to have trusted certificates that have the proper trust chain and IP subject name.
If this is not an option, you may need to skip TLS certificate verification.
- See the [InsecureSkipVerify](/configuration/commons/#main-section) setting for more details.
+ See the [insecureSkipVerify](/configuration/commons/#main-section) setting for more details.
## Annotations
diff --git a/docs/configuration/backends/marathon.md b/docs/configuration/backends/marathon.md
index d394012b9..ac84293d3 100644
--- a/docs/configuration/backends/marathon.md
+++ b/docs/configuration/backends/marathon.md
@@ -103,7 +103,7 @@ domain = "marathon.localhost"
# CA = "/etc/ssl/ca.crt"
# Cert = "/etc/ssl/marathon.cert"
# Key = "/etc/ssl/marathon.key"
-# InsecureSkipVerify = true
+# insecureSkipVerify = true
# DCOSToken for DCOS environment.
# This will override the Authorization header.
diff --git a/docs/configuration/backends/mesos.md b/docs/configuration/backends/mesos.md
index 9fd465fd8..eef67246b 100644
--- a/docs/configuration/backends/mesos.md
+++ b/docs/configuration/backends/mesos.md
@@ -62,34 +62,34 @@ domain = "mesos.localhost"
# Optional
#
# [mesos.TLS]
-# InsecureSkipVerify = true
+# insecureSkipVerify = true
# Zookeeper timeout (in seconds).
#
# Optional
# Default: 30
#
-# ZkDetectionTimeout = 30
+# zkDetectionTimeout = 30
# Polling interval (in seconds).
#
# Optional
# Default: 30
#
-# RefreshSeconds = 30
+# refreshSeconds = 30
# IP sources (e.g. host, docker, mesos, netinfo).
#
# Optional
#
-# IPSources = "host"
+# ipSources = "host"
# HTTP Timeout (in seconds).
#
# Optional
# Default: 30
#
-# StateTimeoutSecond = "30"
+# stateTimeoutSecond = "30"
# Convert groups to subdomains.
# Default behavior: /foo/bar/myapp => foo-bar-myapp.{defaultDomain}
diff --git a/docs/configuration/backends/rancher.md b/docs/configuration/backends/rancher.md
index 6a2aefff9..2cec99c26 100644
--- a/docs/configuration/backends/rancher.md
+++ b/docs/configuration/backends/rancher.md
@@ -77,7 +77,7 @@ To enable constraints see [backend-specific constraints section](/configuration/
#
[rancher.metadata]
-# Poll the Rancher metadata service for changes every `rancher.RefreshSeconds`.
+# Poll the Rancher metadata service for changes every `rancher.refreshSeconds`.
# NOTE: this is less accurate than the default long polling technique which
# will provide near instantaneous updates to Traefik
#
diff --git a/docs/configuration/backends/servicefabric.md b/docs/configuration/backends/servicefabric.md
index 203cb7f35..8cb12f4ae 100644
--- a/docs/configuration/backends/servicefabric.md
+++ b/docs/configuration/backends/servicefabric.md
@@ -1,33 +1,33 @@
-# Service Fabric Backend
+# Azure Service Fabric Backend
-Træfik can be configured to use Service Fabric as a backend configuration.
+Træfik can be configured to use Azure Service Fabric as a backend configuration.
See [this repository for an example deployment package and further documentation.](https://aka.ms/traefikonsf)
-## Service Fabric
+## Azure Service Fabric
```toml
################################################################
-# Service Fabric provider
+# Azure Service Fabric provider
################################################################
-# Enable Service Fabric configuration backend
+# Enable Azure Service Fabric configuration backend
[serviceFabric]
-# Service Fabric Management Endpoint
+# Azure Service Fabric Management Endpoint
#
# Required
#
clusterManagementUrl = "https://localhost:19080"
-# Service Fabric Management Endpoint API Version
+# Azure Service Fabric Management Endpoint API Version
#
# Required
# Default: "3.0"
#
apiVersion = "3.0"
-# Service Fabric Polling Interval (in seconds)
+# Azure Service Fabric Polling Interval (in seconds)
#
# Required
# Default: 10
@@ -42,7 +42,7 @@ refreshSeconds = 10
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/servicefabric.crt"
# key = "/etc/ssl/servicefabric.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
## Labels
diff --git a/docs/configuration/backends/zookeeper.md b/docs/configuration/backends/zookeeper.md
index 5d31ae3bc..36f3ac773 100644
--- a/docs/configuration/backends/zookeeper.md
+++ b/docs/configuration/backends/zookeeper.md
@@ -53,7 +53,7 @@ prefix = "traefik"
# ca = "/etc/ssl/ca.crt"
# cert = "/etc/ssl/zookeeper.crt"
# key = "/etc/ssl/zookeeper.key"
-# insecureskipverify = true
+# insecureSkipVerify = true
```
To enable constraints see [backend-specific constraints section](/configuration/commons/#backend-specific).
diff --git a/docs/configuration/commons.md b/docs/configuration/commons.md
index b5f15836a..860aecb9c 100644
--- a/docs/configuration/commons.md
+++ b/docs/configuration/commons.md
@@ -38,14 +38,14 @@
# Optional
# Default: "2s"
#
-# ProvidersThrottleDuration = "2s"
+# providersThrottleDuration = "2s"
# Controls the maximum idle (keep-alive) connections to keep per-host.
#
# Optional
# Default: 200
#
-# MaxIdleConnsPerHost = 200
+# maxIdleConnsPerHost = 200
# If set to true invalid SSL certificates are accepted for backends.
# This disables detection of man-in-the-middle attacks so should only be used on secure backend networks.
@@ -53,14 +53,14 @@
# Optional
# Default: false
#
-# InsecureSkipVerify = true
+# insecureSkipVerify = true
-# Register Certificates in the RootCA.
+# Register Certificates in the rootCA.
#
# Optional
# Default: []
#
-# RootCAs = [ "/mycert.cert" ]
+# rootCAs = [ "/mycert.cert" ]
# Entrypoints to be used by frontends that do not specify any entrypoint.
# Each frontend can specify its own entrypoints.
@@ -69,6 +69,15 @@
# Default: ["http"]
#
# defaultEntryPoints = ["http", "https"]
+
+# Allow the use of 0 as server weight.
+# - false: a weight 0 means internally a weight of 1.
+# - true: a weight 0 means internally a weight of 0 (a server with a weight of 0 is removed from the available servers).
+#
+# Optional
+# Default: false
+#
+# AllowMinWeightZero = true
```
- `graceTimeOut`: Duration to give active requests a chance to finish before Traefik stops.
@@ -76,19 +85,19 @@ Can be provided in a format supported by [time.ParseDuration](https://golang.org
If no units are provided, the value is parsed assuming seconds.
**Note:** in this time frame no new requests are accepted.
-- `ProvidersThrottleDuration`: Backends throttle duration: minimum duration in seconds between 2 events from providers before applying a new configuration.
+- `providersThrottleDuration`: Backends throttle duration: minimum duration in seconds between 2 events from providers before applying a new configuration.
It avoids unnecessary reloads if multiples events are sent in a short amount of time.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
-- `MaxIdleConnsPerHost`: Controls the maximum idle (keep-alive) connections to keep per-host.
+- `maxIdleConnsPerHost`: Controls the maximum idle (keep-alive) connections to keep per-host.
If zero, `DefaultMaxIdleConnsPerHost` from the Go standard library net/http module is used.
If you encounter 'too many open files' errors, you can either increase this value or change the `ulimit`.
-- `InsecureSkipVerify` : If set to true invalid SSL certificates are accepted for backends.
+- `insecureSkipVerify` : If set to true invalid SSL certificates are accepted for backends.
**Note:** This disables detection of man-in-the-middle attacks so should only be used on secure backend networks.
-- `RootCAs`: Register Certificates in the RootCA. This certificates will be use for backends calls.
+- `rootCAs`: Register Certificates in the RootCA. This certificates will be use for backends calls.
**Note** You can use file path or cert content directly
- `defaultEntryPoints`: Entrypoints to be used by frontends that do not specify any entrypoint.
@@ -386,24 +395,24 @@ If no units are provided, the value is parsed assuming seconds.
### Idle Timeout (deprecated)
-Use [respondingTimeouts](/configuration/commons/#responding-timeouts) instead of `IdleTimeout`.
+Use [respondingTimeouts](/configuration/commons/#responding-timeouts) instead of `idleTimeout`.
In the case both settings are configured, the deprecated option will be overwritten.
-`IdleTimeout` is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself.
+`idleTimeout` is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself.
This is set to enforce closing of stale client connections.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
```toml
-# IdleTimeout
+# idleTimeout
#
# DEPRECATED - see [respondingTimeouts] section.
#
# Optional
# Default: "180s"
#
-IdleTimeout = "360s"
+idleTimeout = "360s"
```
diff --git a/docs/configuration/tracing.md b/docs/configuration/tracing.md
index 83bc235c4..b8d2d50a3 100644
--- a/docs/configuration/tracing.md
+++ b/docs/configuration/tracing.md
@@ -15,28 +15,28 @@ Træfik supports two backends: Jaeger and Zipkin.
#
# Default: "jaeger"
#
- Backend = "jaeger"
+ backend = "jaeger"
# Service name used in Jaeger backend
#
# Default: "traefik"
#
- ServiceName = "traefik"
+ serviceName = "traefik"
[tracing.jaeger]
- # SamplingServerURL is the address of jaeger-agent's HTTP sampling server
+ # Sampling Server URL is the address of jaeger-agent's HTTP sampling server
#
# Default: "http://localhost:5778/sampling"
#
- SamplingServerURL = "http://localhost:5778/sampling"
+ samplingServerURL = "http://localhost:5778/sampling"
# Sampling Type specifies the type of the sampler: const, probabilistic, rateLimiting
#
# Default: "const"
#
- SamplingType = "const"
+ samplingType = "const"
- # SamplingParam Param is a value passed to the sampler.
+ # Sampling Param is a value passed to the sampler.
# Valid values for Param field are:
# - for "const" sampler, 0 or 1 for always false/true respectively
# - for "probabilistic" sampler, a probability between 0 and 1
@@ -44,13 +44,13 @@ Træfik supports two backends: Jaeger and Zipkin.
#
# Default: 1.0
#
- SamplingParam = 1.0
+ samplingParam = 1.0
- # LocalAgentHostPort instructs reporter to send spans to jaeger-agent at this address
+ # Local Agent Host Port instructs reporter to send spans to jaeger-agent at this address
#
# Default: "127.0.0.1:6832"
#
- LocalAgentHostPort = "127.0.0.1:6832"
+ localAgentHostPort = "127.0.0.1:6832"
```
## Zipkin
@@ -62,36 +62,36 @@ Træfik supports two backends: Jaeger and Zipkin.
#
# Default: "jaeger"
#
- Backend = "zipkin"
+ backend = "zipkin"
# Service name used in Zipkin backend
#
# Default: "traefik"
#
- ServiceName = "traefik"
+ serviceName = "traefik"
[tracing.zipkin]
# Zipking HTTP endpoint used to send data
#
# Default: "http://localhost:9411/api/v1/spans"
#
- HTTPEndpoint = "http://localhost:9411/api/v1/spans"
+ httpEndpoint = "http://localhost:9411/api/v1/spans"
# Enable Zipkin debug
#
# Default: false
#
- Debug = false
+ debug = false
# Use ZipKin SameSpan RPC style traces
#
# Default: false
#
- SameSpan = false
+ sameSpan = false
# Use ZipKin 128 bit root span IDs
#
# Default: true
#
- ID128Bit = true
+ id128Bit = true
```
diff --git a/docs/index.md b/docs/index.md
index f18d0ee4e..f402a3e70 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -52,7 +52,7 @@ _(But if you'd rather configure some of your routes manually, Træfik supports t
- [Kubernetes](/configuration/backends/kubernetes/)
- [Mesos](/configuration/backends/mesos/) / [Marathon](/configuration/backends/marathon/)
- [Rancher](/configuration/backends/rancher/) (API, Metadata)
-- [Service Fabric](/configuration/backends/servicefabric/)
+- [Azure Service Fabric](/configuration/backends/servicefabric/)
- [Consul Catalog](/configuration/backends/consulcatalog/)
- [Consul](/configuration/backends/consul/) / [Etcd](/configuration/backends/etcd/) / [Zookeeper](/configuration/backends/zookeeper/) / [BoltDB](/configuration/backends/boltdb/)
- [Eureka](/configuration/backends/eureka/)
diff --git a/docs/user-guide/cluster-docker-consul.md b/docs/user-guide/cluster-docker-consul.md
index b41534fcc..429432c8a 100644
--- a/docs/user-guide/cluster-docker-consul.md
+++ b/docs/user-guide/cluster-docker-consul.md
@@ -77,12 +77,12 @@ TL;DR:
```shell
$ traefik \
--docker \
- --docker.swarmmode \
+ --docker.swarmMode \
--docker.domain=mydomain.ca \
--docker.watch
```
-To enable docker and swarm-mode support, you need to add `--docker` and `--docker.swarmmode` flags.
+To enable docker and swarm-mode support, you need to add `--docker` and `--docker.swarmMode` flags.
To watch docker events, add `--docker.watch`.
### Full docker-compose file
@@ -101,11 +101,11 @@ services:
- "--acme.storage=/etc/traefik/acme/acme.json"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- - "--acme.OnHostRule=true"
+ - "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=contact@mydomain.ca"
- "--docker"
- - "--docker.swarmmode"
+ - "--docker.swarmMode"
- "--docker.domain=mydomain.ca"
- "--docker.watch"
volumes:
@@ -211,11 +211,11 @@ services:
- "--acme.storage=traefik/acme/account"
- "--acme.entryPoint=https"
- "--acme.httpChallenge.entryPoint=http"
- - "--acme.OnHostRule=true"
+ - "--acme.onHostRule=true"
- "--acme.onDemand=false"
- "--acme.email=foobar@example.com"
- "--docker"
- - "--docker.swarmmode"
+ - "--docker.swarmMode"
- "--docker.domain=example.com"
- "--docker.watch"
- "--consul"
diff --git a/docs/user-guide/docker-and-lets-encrypt.md b/docs/user-guide/docker-and-lets-encrypt.md
index d44610626..364b43fe1 100644
--- a/docs/user-guide/docker-and-lets-encrypt.md
+++ b/docs/user-guide/docker-and-lets-encrypt.md
@@ -97,13 +97,13 @@ defaultEntryPoints = ["https","http"]
endpoint = "unix:///var/run/docker.sock"
domain = "my-awesome-app.org"
watch = true
-exposedbydefault = false
+exposedByDefault = false
[acme]
email = "your-email-here@my-awesome-app.org"
storage = "acme.json"
entryPoint = "https"
-OnHostRule = true
+onHostRule = true
[acme.httpChallenge]
entryPoint = "http"
```
@@ -250,7 +250,7 @@ Træfik will create a frontend to listen to incoming HTTP requests which contain
- Always specify the correct port where the container expects HTTP traffic using `traefik.port` label.
If a container exposes multiple ports, Træfik may forward traffic to the wrong port.
Even if a container only exposes one port, you should always write configuration defensively and explicitly.
-- Should you choose to enable the `exposedbydefault` flag in the `traefik.toml` configuration, be aware that all containers that are placed in the same network as Træfik will automatically be reachable from the outside world, for everyone and everyone to see.
+- Should you choose to enable the `exposedByDefault` flag in the `traefik.toml` configuration, be aware that all containers that are placed in the same network as Træfik will automatically be reachable from the outside world, for everyone and everyone to see.
Usually, this is a bad idea.
- With the `traefik.frontend.auth.basic` label, it's possible for Træfik to provide a HTTP basic-auth challenge for the endpoints you provide the label for.
- Træfik has built-in support to automatically export [Prometheus](https://prometheus.io) metrics
diff --git a/docs/user-guide/examples.md b/docs/user-guide/examples.md
index 61116dcfd..16d7a8ff5 100644
--- a/docs/user-guide/examples.md
+++ b/docs/user-guide/examples.md
@@ -89,7 +89,7 @@ This configuration allows generating Let's Encrypt certificates (thanks to `HTTP
Træfik generates these certificates when it starts and it needs to be restart if new domains are added.
-### OnHostRule option (with HTTP challenge)
+### onHostRule option (with HTTP challenge)
```toml
[entryPoints]
@@ -225,7 +225,7 @@ These variables are described [in this section](/configuration/acme/#provider).
More information about wildcard certificates are available [in this section](/configuration/acme/#wildcard-domain).
-### OnHostRule option and provided certificates (with HTTP challenge)
+### onHostRule option and provided certificates (with HTTP challenge)
```toml
[entryPoints]
@@ -358,7 +358,7 @@ defaultEntryPoints = ["http"]
users = ["test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"]
```
-## Override the Traefik HTTP server IdleTimeout and/or throttle configurations from re-loading too quickly
+## Override the Traefik HTTP server idleTimeout and/or throttle configurations from re-loading too quickly
```toml
providersThrottleDuration = "5s"
diff --git a/docs/user-guide/grpc.md b/docs/user-guide/grpc.md
index 02c9531a8..4046b9a7e 100644
--- a/docs/user-guide/grpc.md
+++ b/docs/user-guide/grpc.md
@@ -45,7 +45,7 @@ At last, we configure our Træfik instance to use both self-signed certificates.
defaultEntryPoints = ["https"]
# For secure connection on backend.local
-RootCAs = [ "./backend.cert" ]
+rootCAs = [ "./backend.cert" ]
[entryPoints]
[entryPoints.https]
@@ -76,7 +76,7 @@ RootCAs = [ "./backend.cert" ]
```
!!! warning
- With some backends, the server URLs use the IP, so you may need to configure `InsecureSkipVerify` instead of the `RootCAS` to activate HTTPS without hostname verification.
+ With some backends, the server URLs use the IP, so you may need to configure `insecureSkipVerify` instead of the `rootCAS` to activate HTTPS without hostname verification.
## Conclusion
diff --git a/docs/user-guide/kubernetes.md b/docs/user-guide/kubernetes.md
index 1d428542e..8b5b19fef 100644
--- a/docs/user-guide/kubernetes.md
+++ b/docs/user-guide/kubernetes.md
@@ -398,7 +398,7 @@ It's possible to protect access to Træfik through basic authentication. (See th
### Creating the Secret
-A. Use `htpasswd` to create a file containing the username and the base64-encoded password:
+A. Use `htpasswd` to create a file containing the username and the MD5-encoded password:
```shell
htpasswd -c ./auth myusername
diff --git a/docs/user-guide/swarm-mode.md b/docs/user-guide/swarm-mode.md
index ac74036f7..9aef2b1d4 100644
--- a/docs/user-guide/swarm-mode.md
+++ b/docs/user-guide/swarm-mode.md
@@ -87,7 +87,7 @@ docker-machine ssh manager "docker service create \
--network traefik-net \
traefik \
--docker \
- --docker.swarmmode \
+ --docker.swarmMode \
--docker.domain=traefik \
--docker.watch \
--api"
@@ -101,7 +101,7 @@ Let's explain this command:
| `--constraint=node.role==manager` | we ask docker to schedule Træfik on a manager node. |
| `--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock` | we bind mount the docker socket where Træfik is scheduled to be able to speak to the daemon. |
| `--network traefik-net` | we attach the Træfik service (and thus the underlying container) to the `traefik-net` network. |
-| `--docker` | enable docker backend, and `--docker.swarmmode` to enable the swarm mode on Træfik. |
+| `--docker` | enable docker backend, and `--docker.swarmMode` to enable the swarm mode on Træfik. |
| `--api | activate the webUI on port 8080 |
diff --git a/examples/accessLog/traefik.ab.toml b/examples/accessLog/traefik.ab.toml
index 7b0287c64..31aa930bf 100644
--- a/examples/accessLog/traefik.ab.toml
+++ b/examples/accessLog/traefik.ab.toml
@@ -29,10 +29,13 @@ entryPoint = "api"
method = "drr"
[backends.backend.servers.server1]
url = "http://127.0.0.1:8081"
+ weight = 1
[backends.backend.servers.server2]
url = "http://127.0.0.1:8082"
+ weight = 1
[backends.backend.servers.server3]
url = "http://127.0.0.1:8083"
+ weight = 1
[frontends]
[frontends.frontend]
backend = "backend"
diff --git a/examples/accessLog/traefik.example.toml b/examples/accessLog/traefik.example.toml
index c56709f03..2d2bcd02d 100644
--- a/examples/accessLog/traefik.example.toml
+++ b/examples/accessLog/traefik.example.toml
@@ -27,18 +27,24 @@ entryPoint = "api"
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:8081"
+ weight = 1
+
[backends.backend2]
[backends.backend2.LoadBalancer]
method = "drr"
[backends.backend2.servers.server1]
url = "http://127.0.0.1:8082"
+ weight = 1
[backends.backend2.servers.server2]
url = "http://127.0.0.1:8083"
+ weight = 1
+
[frontends]
[frontends.frontend1]
backend = "backend1"
[frontends.frontend1.routes.test_1]
rule = "Path: /test1"
+
[frontends.frontend2]
backend = "backend2"
passHostHeader = true
diff --git a/examples/acme/acme.toml b/examples/acme/acme.toml
index 7428f9336..875c86d39 100644
--- a/examples/acme/acme.toml
+++ b/examples/acme/acme.toml
@@ -16,7 +16,7 @@ email = "test@traefik.io"
storage = "/etc/traefik/conf/acme.json"
entryPoint = "https"
onDemand = false
-OnHostRule = true
+onHostRule = true
caServer = "http://traefik.boulder.com:4001/directory"
[acme.httpChallenge]
entryPoint="http"
@@ -27,6 +27,6 @@ caServer = "http://traefik.boulder.com:4001/directory"
endpoint = "unix:///var/run/docker.sock"
domain = "traefik.localhost.com"
watch = true
-exposedbydefault = false
+exposedByDefault = false
diff --git a/examples/cluster/traefik.toml.tmpl b/examples/cluster/traefik.toml.tmpl
index 95b1c639a..963b5aba1 100644
--- a/examples/cluster/traefik.toml.tmpl
+++ b/examples/cluster/traefik.toml.tmpl
@@ -13,7 +13,7 @@ defaultEntryPoints = ["http", "https"]
email = "test@traefik.io"
storage = "traefik/acme/account"
entryPoint = "https"
-OnHostRule = true
+onHostRule = true
caServer = "http://traefik.boulder.com:4001/directory"
[acme.httpChallenge]
entryPoint="http"
@@ -25,4 +25,4 @@ entryPoint="http"
endpoint = "unix:///var/run/docker.sock"
domain = "localhost.com"
watch = true
-exposedbydefault = false
+exposedByDefault = false
diff --git a/integration/acme_test.go b/integration/acme_test.go
index 73ae9cf8f..395fc7f6c 100644
--- a/integration/acme_test.go
+++ b/integration/acme_test.go
@@ -195,6 +195,8 @@ func (s *AcmeSuite) retrieveAcmeCertificate(c *check.C, testCase AcmeTestCase) {
err := cmd.Start()
c.Assert(err, checker.IsNil)
defer cmd.Process.Kill()
+ // A real file is needed to have the right mode on acme.json file
+ defer os.Remove("/tmp/acme.json")
backend := startTestServer("9010", http.StatusOK)
defer backend.Close()
diff --git a/integration/fixtures/acme/acme_http01.toml b/integration/fixtures/acme/acme_http01.toml
index 287cd207e..017e07e44 100644
--- a/integration/fixtures/acme/acme_http01.toml
+++ b/integration/fixtures/acme/acme_http01.toml
@@ -12,10 +12,10 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
+onHostRule = {{.OnHostRule}}
caServer = "http://{{.BoulderHost}}:4001/directory"
[acme.httpchallenge]
entrypoint="http"
@@ -26,6 +26,7 @@ caServer = "http://{{.BoulderHost}}:4001/directory"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/acme/acme_http01_web.toml b/integration/fixtures/acme/acme_http01_web.toml
index 1b8af748a..95316afaf 100644
--- a/integration/fixtures/acme/acme_http01_web.toml
+++ b/integration/fixtures/acme/acme_http01_web.toml
@@ -11,10 +11,10 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
+onHostRule = {{.OnHostRule}}
caServer = "http://{{.BoulderHost}}:4001/directory"
[acme.httpchallenge]
entrypoint="http"
@@ -28,6 +28,7 @@ path="/traefik"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/acme/acme_provided.toml b/integration/fixtures/acme/acme_provided.toml
index 108f23427..3e83e0928 100644
--- a/integration/fixtures/acme/acme_provided.toml
+++ b/integration/fixtures/acme/acme_provided.toml
@@ -14,10 +14,10 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
+onHostRule = {{.OnHostRule}}
caServer = "http://{{.BoulderHost}}:4001/directory"
[acme.httpChallenge]
entryPoint="http"
@@ -28,6 +28,7 @@ entryPoint="http"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/acme/acme_provided_dynamic.toml b/integration/fixtures/acme/acme_provided_dynamic.toml
index 29e923835..552b840d3 100644
--- a/integration/fixtures/acme/acme_provided_dynamic.toml
+++ b/integration/fixtures/acme/acme_provided_dynamic.toml
@@ -12,10 +12,10 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
+onHostRule = {{.OnHostRule}}
caServer = "http://{{.BoulderHost}}:4001/directory"
[acme.httpChallenge]
entryPoint="http"
diff --git a/integration/fixtures/acme/certificates.toml b/integration/fixtures/acme/certificates.toml
index 79d937723..0708d0d80 100644
--- a/integration/fixtures/acme/certificates.toml
+++ b/integration/fixtures/acme/certificates.toml
@@ -2,6 +2,7 @@
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/acme/no_challenge_acme.toml b/integration/fixtures/acme/no_challenge_acme.toml
index c986f6352..2480bdaf8 100644
--- a/integration/fixtures/acme/no_challenge_acme.toml
+++ b/integration/fixtures/acme/no_challenge_acme.toml
@@ -14,9 +14,9 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
-OnHostRule = true
+onHostRule = true
caServer = "http://{{.BoulderHost}}:4001/directory"
# No challenge defined
@@ -26,6 +26,7 @@ caServer = "http://{{.BoulderHost}}:4001/directory"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/acme/wrong_acme.toml b/integration/fixtures/acme/wrong_acme.toml
index abff4d71b..4137ca3eb 100644
--- a/integration/fixtures/acme/wrong_acme.toml
+++ b/integration/fixtures/acme/wrong_acme.toml
@@ -14,9 +14,9 @@ defaultEntryPoints = ["http", "https"]
[acme]
email = "test@traefik.io"
-storage = "/dev/null"
+storage = "/tmp/acme.json"
entryPoint = "https"
-OnHostRule = true
+onHostRule = true
caServer = "http://wrongurl:4001/directory"
[file]
@@ -25,6 +25,7 @@ caServer = "http://wrongurl:4001/directory"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/docker/simple.toml b/integration/fixtures/docker/simple.toml
index d0640b357..cc668ba07 100644
--- a/integration/fixtures/docker/simple.toml
+++ b/integration/fixtures/docker/simple.toml
@@ -14,4 +14,4 @@ logLevel = "DEBUG"
endpoint = "{{.DockerHost}}"
domain = "docker.localhost"
-exposedbydefault = true
+exposedByDefault = true
diff --git a/integration/fixtures/dynamodb/simple.toml b/integration/fixtures/dynamodb/simple.toml
index cc8e2af75..a9b440c0d 100644
--- a/integration/fixtures/dynamodb/simple.toml
+++ b/integration/fixtures/dynamodb/simple.toml
@@ -9,10 +9,10 @@ logLevel = "DEBUG"
address = ":8081"
[dynamodb]
- AccessKeyID = "key"
- SecretAccessKey = "secret"
- Endpoint = "{{.DynamoURL}}"
- Region = "us-east-1"
+ accessKeyID = "key"
+ secretAccessKey = "secret"
+ endpoint = "{{.DynamoURL}}"
+ region = "us-east-1"
[api]
entryPoint = "api"
diff --git a/integration/fixtures/error_pages/error.toml b/integration/fixtures/error_pages/error.toml
index 9eef45f1c..7dd432da6 100644
--- a/integration/fixtures/error_pages/error.toml
+++ b/integration/fixtures/error_pages/error.toml
@@ -11,17 +11,20 @@ logLevel = "DEBUG"
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:8989474"
+ weight = 1
[backends.error]
[backends.error.servers.error]
url = "http://{{.Server2}}:80"
+ weight = 1
+
[frontends]
- [frontends.frontend1]
- passHostHeader = true
- backend = "backend1"
- [frontends.frontend1.routes.test_1]
- rule = "Host:test.local"
- [frontends.frontend1.errors]
- [frontends.frontend1.errors.networks]
- status = ["500-502", "503-599"]
- backend = "error"
- query = "/50x.html"
+ [frontends.frontend1]
+ passHostHeader = true
+ backend = "backend1"
+ [frontends.frontend1.routes.test_1]
+ rule = "Host:test.local"
+ [frontends.frontend1.errors]
+ [frontends.frontend1.errors.networks]
+ status = ["500-502", "503-599"]
+ backend = "error"
+ query = "/50x.html"
diff --git a/integration/fixtures/error_pages/simple.toml b/integration/fixtures/error_pages/simple.toml
index c67dc95b5..372a8f874 100644
--- a/integration/fixtures/error_pages/simple.toml
+++ b/integration/fixtures/error_pages/simple.toml
@@ -11,17 +11,20 @@ logLevel = "DEBUG"
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:80"
+ weight = 1
[backends.error]
[backends.error.servers.error]
url = "http://{{.Server2}}:80"
+ weight = 1
+
[frontends]
- [frontends.frontend1]
- passHostHeader = true
- backend = "backend1"
+ [frontends.frontend1]
+ passHostHeader = true
+ backend = "backend1"
[frontends.frontend1.routes.test_1]
rule = "Host:test.local"
[frontends.frontend1.errors]
- [frontends.frontend1.errors.networks]
- status = ["500-502", "503-599"]
- backend = "error"
- query = "/50x.html"
+ [frontends.frontend1.errors.networks]
+ status = ["500-502", "503-599"]
+ backend = "error"
+ query = "/50x.html"
diff --git a/integration/fixtures/file/dir/simple1.toml b/integration/fixtures/file/dir/simple1.toml
index 05bfdd9ea..0de06d25c 100644
--- a/integration/fixtures/file/dir/simple1.toml
+++ b/integration/fixtures/file/dir/simple1.toml
@@ -3,6 +3,7 @@
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://172.17.0.2:80"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/file/dir/simple2.toml b/integration/fixtures/file/dir/simple2.toml
index 52d698b2b..e02f63550 100644
--- a/integration/fixtures/file/dir/simple2.toml
+++ b/integration/fixtures/file/dir/simple2.toml
@@ -3,6 +3,7 @@
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://172.17.0.2:80"
+ weight = 1
[frontends]
[frontends.frontend2]
diff --git a/integration/fixtures/grpc/config.toml b/integration/fixtures/grpc/config.toml
index fa5231b6f..79729a042 100644
--- a/integration/fixtures/grpc/config.toml
+++ b/integration/fixtures/grpc/config.toml
@@ -1,6 +1,6 @@
defaultEntryPoints = ["https"]
-RootCAs = [ """{{ .CertContent }}""" ]
+rootCAs = [ """{{ .CertContent }}""" ]
[entryPoints]
[entryPoints.https]
@@ -19,6 +19,7 @@ RootCAs = [ """{{ .CertContent }}""" ]
[backends.backend1]
[backends.backend1.servers.server1]
url = "https://127.0.0.1:{{ .GRPCServerPort }}"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/grpc/config_insecure.toml b/integration/fixtures/grpc/config_insecure.toml
index bffc3d50d..0ff8a6c1b 100644
--- a/integration/fixtures/grpc/config_insecure.toml
+++ b/integration/fixtures/grpc/config_insecure.toml
@@ -1,6 +1,6 @@
defaultEntryPoints = ["https"]
-InsecureSkipVerify = true
+insecureSkipVerify = true
[entryPoints]
[entryPoints.https]
@@ -19,6 +19,7 @@ InsecureSkipVerify = true
[backends.backend1]
[backends.backend1.servers.server1]
url = "https://127.0.0.1:{{ .GRPCServerPort }}"
+ weight = 1
[frontends]
diff --git a/integration/fixtures/healthcheck/multiple-entrypoints-drr.toml b/integration/fixtures/healthcheck/multiple-entrypoints-drr.toml
index 4489c5749..d2d70b319 100644
--- a/integration/fixtures/healthcheck/multiple-entrypoints-drr.toml
+++ b/integration/fixtures/healthcheck/multiple-entrypoints-drr.toml
@@ -20,8 +20,10 @@ logLevel = "DEBUG"
interval = "1s"
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:80"
+ weight = 1
[backends.backend1.servers.server2]
url = "http://{{.Server2}}:80"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/healthcheck/multiple-entrypoints-wrr.toml b/integration/fixtures/healthcheck/multiple-entrypoints-wrr.toml
index beb8bdb55..27614feb3 100644
--- a/integration/fixtures/healthcheck/multiple-entrypoints-wrr.toml
+++ b/integration/fixtures/healthcheck/multiple-entrypoints-wrr.toml
@@ -20,8 +20,10 @@ logLevel = "DEBUG"
interval = "1s"
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:80"
+ weight = 1
[backends.backend1.servers.server2]
url = "http://{{.Server2}}:80"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/healthcheck/port_overload.toml b/integration/fixtures/healthcheck/port_overload.toml
index 3619988b6..f2d839d04 100644
--- a/integration/fixtures/healthcheck/port_overload.toml
+++ b/integration/fixtures/healthcheck/port_overload.toml
@@ -17,6 +17,7 @@ logLevel = "DEBUG"
interval = "1s"
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:81"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/healthcheck/simple.toml b/integration/fixtures/healthcheck/simple.toml
index b28cce1b3..1553e01b8 100644
--- a/integration/fixtures/healthcheck/simple.toml
+++ b/integration/fixtures/healthcheck/simple.toml
@@ -16,8 +16,10 @@ logLevel = "DEBUG"
interval = "1s"
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:80"
+ weight = 1
[backends.backend1.servers.server2]
url = "http://{{.Server2}}:80"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/clientca/https_1ca1config.toml b/integration/fixtures/https/clientca/https_1ca1config.toml
index c85f4cd95..3030fea31 100644
--- a/integration/fixtures/https/clientca/https_1ca1config.toml
+++ b/integration/fixtures/https/clientca/https_1ca1config.toml
@@ -24,9 +24,11 @@ defaultEntryPoints = ["https"]
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://127.0.0.1:9020"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/clientca/https_2ca1config.toml b/integration/fixtures/https/clientca/https_2ca1config.toml
index 5b8c92617..96abe1ada 100644
--- a/integration/fixtures/https/clientca/https_2ca1config.toml
+++ b/integration/fixtures/https/clientca/https_2ca1config.toml
@@ -23,9 +23,11 @@ defaultEntryPoints = ["https"]
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://127.0.0.1:9020"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/clientca/https_2ca2config.toml b/integration/fixtures/https/clientca/https_2ca2config.toml
index 4e3dff814..9f4541965 100644
--- a/integration/fixtures/https/clientca/https_2ca2config.toml
+++ b/integration/fixtures/https/clientca/https_2ca2config.toml
@@ -24,9 +24,11 @@ defaultEntryPoints = ["https"]
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://127.0.0.1:9020"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/dynamic_https.toml b/integration/fixtures/https/dynamic_https.toml
index ad530081a..a97bee293 100644
--- a/integration/fixtures/https/dynamic_https.toml
+++ b/integration/fixtures/https/dynamic_https.toml
@@ -2,9 +2,11 @@
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://127.0.0.1:9020"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/https_sni.toml b/integration/fixtures/https/https_sni.toml
index fc0b86a13..e840259b0 100644
--- a/integration/fixtures/https/https_sni.toml
+++ b/integration/fixtures/https/https_sni.toml
@@ -21,9 +21,11 @@ defaultEntryPoints = ["https"]
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server1]
url = "http://127.0.0.1:9020"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/rootcas/https.toml b/integration/fixtures/https/rootcas/https.toml
index 07e3b6203..e29329249 100644
--- a/integration/fixtures/https/rootcas/https.toml
+++ b/integration/fixtures/https/rootcas/https.toml
@@ -3,7 +3,7 @@ logLevel = "DEBUG"
defaultEntryPoints = ["http"]
# Use certificate in net/internal/testcert.go
-RootCAs = [ """
+rootCAs = [ """
-----BEGIN CERTIFICATE-----
MIICEzCCAXygAwIBAgIQMIMChMLGrR+QvmQvpwAU6zANBgkqhkiG9w0BAQsFADAS
MRAwDgYDVQQKEwdBY21lIENvMCAXDTcwMDEwMTAwMDAwMFoYDzIwODQwMTI5MTYw
@@ -32,6 +32,7 @@ fblo6RBxUQ==
[backends.backend1]
[backends.backend1.servers.server1]
url = "{{ .BackendHost }}"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/https/rootcas/https_with_file.toml b/integration/fixtures/https/rootcas/https_with_file.toml
index c0815c37f..cd26a49b4 100644
--- a/integration/fixtures/https/rootcas/https_with_file.toml
+++ b/integration/fixtures/https/rootcas/https_with_file.toml
@@ -3,7 +3,7 @@ logLevel = "DEBUG"
defaultEntryPoints = ["http"]
# Use certificate in net/internal/testcert.go
-RootCAs = [ "fixtures/https/rootcas/local.crt"]
+rootCAs = [ "fixtures/https/rootcas/local.crt"]
[entryPoints]
[entryPoints.http]
@@ -17,6 +17,8 @@ RootCAs = [ "fixtures/https/rootcas/local.crt"]
[backends.backend1]
[backends.backend1.servers.server1]
url = "{{ .BackendHost }}"
+ weight = 1
+
[frontends]
[frontends.frontend1]
backend = "backend1"
diff --git a/integration/fixtures/log_rotation_config.toml b/integration/fixtures/log_rotation_config.toml
index 78a21d9e2..c24dce4a9 100644
--- a/integration/fixtures/log_rotation_config.toml
+++ b/integration/fixtures/log_rotation_config.toml
@@ -27,12 +27,14 @@ entryPoint = "api"
################################################################
# rules
################################################################
- [backends]
- [backends.backend1]
- [backends.backend1.servers.server1]
- url = "http://127.0.0.1:8081"
- [frontends]
- [frontends.frontend1]
- backend = "backend1"
- [frontends.frontend1.routes.test_1]
- rule = "Path: /test1"
+[backends]
+ [backends.backend1]
+ [backends.backend1.servers.server1]
+ url = "http://127.0.0.1:8081"
+ weight = 1
+
+[frontends]
+ [frontends.frontend1]
+ backend = "backend1"
+ [frontends.frontend1.routes.test_1]
+ rule = "Path: /test1"
diff --git a/integration/fixtures/multiple_provider.toml b/integration/fixtures/multiple_provider.toml
index 8b197261d..1c89a1017 100644
--- a/integration/fixtures/multiple_provider.toml
+++ b/integration/fixtures/multiple_provider.toml
@@ -11,7 +11,7 @@ debug=true
[docker]
endpoint = "unix:///var/run/docker.sock"
watch = true
-exposedbydefault = false
+exposedByDefault = false
[file]
[frontends]
@@ -19,7 +19,9 @@ exposedbydefault = false
backend = "backend-test"
[frontends.frontend-1.routes.test_1]
rule = "PathPrefix:/file"
+
[backends]
[backends.backend-test]
[backends.backend-test.servers.website]
- url = "http://{{ .IP }}"
+ url = "http://{{ .IP }}"
+ weight = 1
diff --git a/integration/fixtures/provideracme/acme.toml b/integration/fixtures/provideracme/acme.toml
index 9e8629142..012a6386f 100644
--- a/integration/fixtures/provideracme/acme.toml
+++ b/integration/fixtures/provideracme/acme.toml
@@ -11,16 +11,16 @@ defaultEntryPoints = ["http", "https"]
[acme]
-email = "test@traefik.io"
-storage = "/dev/null"
-entryPoint = "https"
-onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
-caServer = "http://{{.BoulderHost}}:4001/directory"
-[acme.httpChallenge]
-entryPoint="http"
-[[acme.domains]]
-main = "traefik.acme.wtf"
+ email = "test@traefik.io"
+ storage = "/tmp/acme.json"
+ entryPoint = "https"
+ onDemand = {{.OnDemand}}
+ onHostRule = {{.OnHostRule}}
+ caServer = "http://{{.BoulderHost}}:4001/directory"
+ [acme.httpChallenge]
+ entryPoint="http"
+ [[acme.domains]]
+ main = "traefik.acme.wtf"
[api]
@@ -31,6 +31,7 @@ main = "traefik.acme.wtf"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/provideracme/acme_insan.toml b/integration/fixtures/provideracme/acme_insan.toml
index 71bea57ab..3ddc5b545 100644
--- a/integration/fixtures/provideracme/acme_insan.toml
+++ b/integration/fixtures/provideracme/acme_insan.toml
@@ -11,17 +11,17 @@ defaultEntryPoints = ["http", "https"]
[acme]
-email = "test@traefik.io"
-storage = "/dev/null"
-entryPoint = "https"
-onDemand = false
-OnHostRule = false
-caServer = "http://{{.BoulderHost}}:4001/directory"
-[acme.httpChallenge]
-entryPoint="http"
-[[acme.domains]]
-main = "acme.wtf"
-sans = [ "traefik.acme.wtf" ]
+ email = "test@traefik.io"
+ storage = "/tmp/acme.json"
+ entryPoint = "https"
+ onDemand = false
+ onHostRule = false
+ caServer = "http://{{.BoulderHost}}:4001/directory"
+ [acme.httpChallenge]
+ entryPoint="http"
+ [[acme.domains]]
+ main = "acme.wtf"
+ sans = [ "traefik.acme.wtf" ]
[api]
@@ -32,6 +32,7 @@ sans = [ "traefik.acme.wtf" ]
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/provideracme/acme_onhost.toml b/integration/fixtures/provideracme/acme_onhost.toml
index 54322cf92..26992769d 100644
--- a/integration/fixtures/provideracme/acme_onhost.toml
+++ b/integration/fixtures/provideracme/acme_onhost.toml
@@ -11,14 +11,14 @@ defaultEntryPoints = ["http", "https"]
[acme]
-email = "test@traefik.io"
-storage = "/dev/null"
-entryPoint = "https"
-onDemand = {{.OnDemand}}
-OnHostRule = {{.OnHostRule}}
-caServer = "http://{{.BoulderHost}}:4001/directory"
-[acme.httpChallenge]
-entryPoint="http"
+ email = "test@traefik.io"
+ storage = "/tmp/acme.jsonl"
+ entryPoint = "https"
+ onDemand = {{.OnDemand}}
+ onHostRule = {{.OnHostRule}}
+ caServer = "http://{{.BoulderHost}}:4001/directory"
+ [acme.httpChallenge]
+ entryPoint="http"
[api]
@@ -28,6 +28,7 @@ entryPoint="http"
[backends.backend]
[backends.backend.servers.server1]
url = "http://127.0.0.1:9010"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/proxy-protocol/with.toml b/integration/fixtures/proxy-protocol/with.toml
index 5520e9f30..f5a1ef57a 100644
--- a/integration/fixtures/proxy-protocol/with.toml
+++ b/integration/fixtures/proxy-protocol/with.toml
@@ -2,22 +2,23 @@ logLevel = "DEBUG"
defaultEntryPoints = ["http"]
[entryPoints]
-[entryPoints.http]
-address = ":8000"
-[entryPoints.http.proxyProtocol]
-trustedIPs = ["{{.HaproxyIP}}"]
+ [entryPoints.http]
+ address = ":8000"
+ [entryPoints.http.proxyProtocol]
+ trustedIPs = ["{{.HaproxyIP}}"]
[api]
[file]
[backends]
-[backends.backend1]
-[backends.backend1.servers.server1]
-url = "http://{{.WhoamiIP}}"
+ [backends.backend1]
+ [backends.backend1.servers.server1]
+ url = "http://{{.WhoamiIP}}"
+ weight = 1
[frontends]
-[frontends.frontend1]
-backend = "backend1"
-[frontends.frontend1.routes.test_1]
-rule = "Path:/whoami"
+ [frontends.frontend1]
+ backend = "backend1"
+ [frontends.frontend1.routes.test_1]
+ rule = "Path:/whoami"
diff --git a/integration/fixtures/proxy-protocol/without.toml b/integration/fixtures/proxy-protocol/without.toml
index 40d7f7902..666c441a4 100644
--- a/integration/fixtures/proxy-protocol/without.toml
+++ b/integration/fixtures/proxy-protocol/without.toml
@@ -2,22 +2,23 @@ logLevel = "DEBUG"
defaultEntryPoints = ["http"]
[entryPoints]
-[entryPoints.http]
-address = ":8000"
-[entryPoints.http.proxyProtocol]
-trustedIPs = ["1.2.3.4"]
+ [entryPoints.http]
+ address = ":8000"
+ [entryPoints.http.proxyProtocol]
+ trustedIPs = ["1.2.3.4"]
[api]
[file]
[backends]
-[backends.backend1]
-[backends.backend1.servers.server1]
-url = "http://{{.WhoamiIP}}"
+ [backends.backend1]
+ [backends.backend1.servers.server1]
+ url = "http://{{.WhoamiIP}}"
+ weight = 1
[frontends]
-[frontends.frontend1]
-backend = "backend1"
-[frontends.frontend1.routes.test_1]
-rule = "Path:/whoami"
+ [frontends.frontend1]
+ backend = "backend1"
+ [frontends.frontend1.routes.test_1]
+ rule = "Path:/whoami"
diff --git a/integration/fixtures/ratelimit/simple.toml b/integration/fixtures/ratelimit/simple.toml
index 0a87d1f38..99d3525f6 100644
--- a/integration/fixtures/ratelimit/simple.toml
+++ b/integration/fixtures/ratelimit/simple.toml
@@ -12,19 +12,21 @@ logLevel = "DEBUG"
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://{{.Server1}}:80"
+ weight = 1
+
[frontends]
- [frontends.frontend1]
- passHostHeader = true
- backend = "backend1"
+ [frontends.frontend1]
+ passHostHeader = true
+ backend = "backend1"
[frontends.frontend1.routes.test_1]
rule = "Path:/"
[frontends.frontend1.ratelimit]
extractorfunc = "client.ip"
- [frontends.frontend1.ratelimit.rateset.rateset1]
- period = "60s"
- average = 4
- burst = 5
- [frontends.frontend1.ratelimit.rateset.rateset2]
- period = "3s"
- average = 1
- burst = 2
+ [frontends.frontend1.ratelimit.rateset.rateset1]
+ period = "60s"
+ average = 4
+ burst = 5
+ [frontends.frontend1.ratelimit.rateset.rateset2]
+ period = "3s"
+ average = 1
+ burst = 2
diff --git a/integration/fixtures/reqacceptgrace.toml b/integration/fixtures/reqacceptgrace.toml
index 81333c38f..67df4326c 100644
--- a/integration/fixtures/reqacceptgrace.toml
+++ b/integration/fixtures/reqacceptgrace.toml
@@ -17,6 +17,7 @@ logLevel = "DEBUG"
[backends.backend]
[backends.backend.servers.server]
url = "{{.Server}}"
+ weight = 1
[frontends]
[frontends.frontend]
diff --git a/integration/fixtures/retry/simple.toml b/integration/fixtures/retry/simple.toml
index 571f0ecb9..4bdd52552 100644
--- a/integration/fixtures/retry/simple.toml
+++ b/integration/fixtures/retry/simple.toml
@@ -15,8 +15,10 @@ logLevel = "DEBUG"
[backends.backend1]
[backends.backend1.servers.server1]
url = "http://{{.WhoamiEndpoint}}:8080" # not valid
+ weight = 1
[backends.backend1.servers.server2]
url = "http://{{.WhoamiEndpoint}}:80"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/simple_stats.toml b/integration/fixtures/simple_stats.toml
index b5e38511b..d749fa4c4 100644
--- a/integration/fixtures/simple_stats.toml
+++ b/integration/fixtures/simple_stats.toml
@@ -5,26 +5,29 @@ debug=true
address = ":8000"
[api]
+
[file]
- [backends]
- [backends.backend1]
- [backends.backend1.servers.server1]
- url = "{{ .Server1 }}"
+
+ [backends]
+ [backends.backend1]
+ [backends.backend1.servers.server1]
+ url = "{{ .Server1 }}"
+ weight = 1
+
[backends.backend2]
- [backends.backend2.servers.server1]
- url = "{{ .Server2 }}"
+ [backends.backend2.servers.server1]
+ url = "{{ .Server2 }}"
+ weight = 1
- [frontends]
- [frontends.frontend1]
- entrypoints=["http"]
+ [frontends]
+ [frontends.frontend1]
+ entrypoints=["http"]
+ backend = "backend1"
+ [frontends.frontend1.routes.test_1]
+ rule = "PathPrefix:/whoami"
- backend = "backend1"
- [frontends.frontend1.routes.test_1]
- rule = "PathPrefix:/whoami"
-
- [frontends.frontend2]
- backend = "backend2"
- entrypoints=["traefik"]
-
- [frontends.frontend2.routes.test_1]
- rule = "PathPrefix:/whoami"
+ [frontends.frontend2]
+ backend = "backend2"
+ entrypoints=["traefik"]
+ [frontends.frontend2.routes.test_1]
+ rule = "PathPrefix:/whoami"
diff --git a/integration/fixtures/timeout/forwarding_timeouts.toml b/integration/fixtures/timeout/forwarding_timeouts.toml
index 97893ab59..73b3673e9 100644
--- a/integration/fixtures/timeout/forwarding_timeouts.toml
+++ b/integration/fixtures/timeout/forwarding_timeouts.toml
@@ -22,9 +22,11 @@ responseHeaderTimeout = "300ms"
# Non-routable IP address that should always deliver a dial timeout.
# See: https://stackoverflow.com/questions/100841/artificially-create-a-connection-timeout-error#answer-904609
url = "http://50.255.255.1"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server2]
url = "http://{{.TimeoutEndpoint}}:9000"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/tracing/simple.toml b/integration/fixtures/tracing/simple.toml
index b7bbb79cf..f7145e212 100644
--- a/integration/fixtures/tracing/simple.toml
+++ b/integration/fixtures/tracing/simple.toml
@@ -6,32 +6,38 @@ debug = true
[api]
[entryPoints]
- [entryPoints.http]
+ [entryPoints.http]
address = ":8000"
[tracing]
- backend = "{{.TracingBackend}}"
- servicename = "tracing"
+ backend = "{{.TracingBackend}}"
+ servicename = "tracing"
[tracing.zipkin]
- HTTPEndpoint = "http://{{.ZipkinIP}}:9411/api/v1/spans"
- debug = true
+ httpEndpoint = "http://{{.ZipkinIP}}:9411/api/v1/spans"
+ debug = true
[tracing.jaeger]
- SamplingType = "const"
- SamplingParam = 1.0
+ samplingType = "const"
+ samplingParam = 1.0
+
[retry]
- attempts = 3
+ attempts = 3
+
[file]
[backends]
[backends.backend1]
[backends.backend1.servers.server-ratelimit]
url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}"
+ weight = 1
[backends.backend2]
[backends.backend2.servers.server-retry]
url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}"
+ weight = 1
[backends.backend3]
[backends.backend3.servers.server-auth]
url = "http://{{.WhoAmiIP}}:{{.WhoAmiPort}}"
+ weight = 1
+
[frontends]
[frontends.frontend1]
passHostHeader = true
diff --git a/integration/fixtures/websocket/config.toml b/integration/fixtures/websocket/config.toml
index 6650a1bf5..965f3d641 100644
--- a/integration/fixtures/websocket/config.toml
+++ b/integration/fixtures/websocket/config.toml
@@ -6,7 +6,6 @@ logLevel = "DEBUG"
[entryPoints.http]
address = ":8000"
-
[api]
[file]
@@ -15,6 +14,7 @@ logLevel = "DEBUG"
[backends.backend1]
[backends.backend1.servers.server1]
url = "{{ .WebsocketServer }}"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/integration/fixtures/websocket/config_https.toml b/integration/fixtures/websocket/config_https.toml
index 21c40a473..d1954a578 100644
--- a/integration/fixtures/websocket/config_https.toml
+++ b/integration/fixtures/websocket/config_https.toml
@@ -1,7 +1,7 @@
defaultEntryPoints = ["wss"]
logLevel = "DEBUG"
-InsecureSkipVerify=true
+insecureSkipVerify=true
[entryPoints]
[entryPoints.wss]
@@ -19,6 +19,7 @@ InsecureSkipVerify=true
[backends.backend1]
[backends.backend1.servers.server1]
url = "{{ .WebsocketServer }}"
+ weight = 1
[frontends]
[frontends.frontend1]
diff --git a/middlewares/error_pages.go b/middlewares/error_pages.go
deleted file mode 100644
index 735aa6f24..000000000
--- a/middlewares/error_pages.go
+++ /dev/null
@@ -1,174 +0,0 @@
-package middlewares
-
-import (
- "bufio"
- "bytes"
- "net"
- "net/http"
- "strconv"
- "strings"
-
- "github.com/containous/traefik/log"
- "github.com/containous/traefik/types"
- "github.com/vulcand/oxy/forward"
- "github.com/vulcand/oxy/utils"
-)
-
-// Compile time validation that the response recorder implements http interfaces correctly.
-var _ Stateful = &errorPagesResponseRecorderWithCloseNotify{}
-
-//ErrorPagesHandler is a middleware that provides the custom error pages
-type ErrorPagesHandler struct {
- HTTPCodeRanges types.HTTPCodeRanges
- BackendURL string
- errorPageForwarder *forward.Forwarder
-}
-
-//NewErrorPagesHandler initializes the utils.ErrorHandler for the custom error pages
-func NewErrorPagesHandler(errorPage *types.ErrorPage, backendURL string) (*ErrorPagesHandler, error) {
- fwd, err := forward.New()
- if err != nil {
- return nil, err
- }
-
- httpCodeRanges, err := types.NewHTTPCodeRanges(errorPage.Status)
- if err != nil {
- return nil, err
- }
-
- return &ErrorPagesHandler{
- HTTPCodeRanges: httpCodeRanges,
- BackendURL: backendURL + errorPage.Query,
- errorPageForwarder: fwd},
- nil
-}
-
-func (ep *ErrorPagesHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
- recorder := newErrorPagesResponseRecorder(w)
-
- next.ServeHTTP(recorder, req)
-
- w.WriteHeader(recorder.GetCode())
- //check the recorder code against the configured http status code ranges
- for _, block := range ep.HTTPCodeRanges {
- if recorder.GetCode() >= block[0] && recorder.GetCode() <= block[1] {
- log.Errorf("Caught HTTP Status Code %d, returning error page", recorder.GetCode())
- finalURL := strings.Replace(ep.BackendURL, "{status}", strconv.Itoa(recorder.GetCode()), -1)
- if newReq, err := http.NewRequest(http.MethodGet, finalURL, nil); err != nil {
- w.Write([]byte(http.StatusText(recorder.GetCode())))
- } else {
- ep.errorPageForwarder.ServeHTTP(w, newReq)
- }
- return
- }
- }
-
- //did not catch a configured status code so proceed with the request
- utils.CopyHeaders(w.Header(), recorder.Header())
- w.Write(recorder.GetBody().Bytes())
-}
-
-type errorPagesResponseRecorder interface {
- http.ResponseWriter
- http.Flusher
- GetCode() int
- GetBody() *bytes.Buffer
- IsStreamingResponseStarted() bool
-}
-
-// newErrorPagesResponseRecorder returns an initialized responseRecorder.
-func newErrorPagesResponseRecorder(rw http.ResponseWriter) errorPagesResponseRecorder {
- recorder := &errorPagesResponseRecorderWithoutCloseNotify{
- HeaderMap: make(http.Header),
- Body: new(bytes.Buffer),
- Code: http.StatusOK,
- responseWriter: rw,
- }
- if _, ok := rw.(http.CloseNotifier); ok {
- return &errorPagesResponseRecorderWithCloseNotify{recorder}
- }
- return recorder
-}
-
-// errorPagesResponseRecorderWithoutCloseNotify is an implementation of http.ResponseWriter that
-// records its mutations for later inspection.
-type errorPagesResponseRecorderWithoutCloseNotify struct {
- Code int // the HTTP response code from WriteHeader
- HeaderMap http.Header // the HTTP response headers
- Body *bytes.Buffer // if non-nil, the bytes.Buffer to append written data to
-
- responseWriter http.ResponseWriter
- err error
- streamingResponseStarted bool
-}
-
-type errorPagesResponseRecorderWithCloseNotify struct {
- *errorPagesResponseRecorderWithoutCloseNotify
-}
-
-// CloseNotify returns a channel that receives at most a
-// single value (true) when the client connection has gone
-// away.
-func (rw *errorPagesResponseRecorderWithCloseNotify) CloseNotify() <-chan bool {
- return rw.responseWriter.(http.CloseNotifier).CloseNotify()
-}
-
-// Header returns the response headers.
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) Header() http.Header {
- m := rw.HeaderMap
- if m == nil {
- m = make(http.Header)
- rw.HeaderMap = m
- }
- return m
-}
-
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) GetCode() int {
- return rw.Code
-}
-
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) GetBody() *bytes.Buffer {
- return rw.Body
-}
-
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) IsStreamingResponseStarted() bool {
- return rw.streamingResponseStarted
-}
-
-// Write always succeeds and writes to rw.Body, if not nil.
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) Write(buf []byte) (int, error) {
- if rw.err != nil {
- return 0, rw.err
- }
- return rw.Body.Write(buf)
-}
-
-// WriteHeader sets rw.Code.
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) WriteHeader(code int) {
- rw.Code = code
-}
-
-// Hijack hijacks the connection
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {
- return rw.responseWriter.(http.Hijacker).Hijack()
-}
-
-// Flush sends any buffered data to the client.
-func (rw *errorPagesResponseRecorderWithoutCloseNotify) Flush() {
- if !rw.streamingResponseStarted {
- utils.CopyHeaders(rw.responseWriter.Header(), rw.Header())
- rw.responseWriter.WriteHeader(rw.Code)
- rw.streamingResponseStarted = true
- }
-
- _, err := rw.responseWriter.Write(rw.Body.Bytes())
- if err != nil {
- log.Errorf("Error writing response in responseRecorder: %s", err)
- rw.err = err
- }
- rw.Body.Reset()
- flusher, ok := rw.responseWriter.(http.Flusher)
- if ok {
- flusher.Flush()
- }
-}
diff --git a/middlewares/error_pages_test.go b/middlewares/error_pages_test.go
deleted file mode 100644
index 0c6c25b74..000000000
--- a/middlewares/error_pages_test.go
+++ /dev/null
@@ -1,202 +0,0 @@
-package middlewares
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "strconv"
- "testing"
-
- "github.com/containous/traefik/types"
- "github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
- "github.com/urfave/negroni"
-)
-
-func TestErrorPage(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, "Test Server")
- }))
- defer ts.Close()
-
- testErrorPage := &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}}
-
- testHandler, err := NewErrorPagesHandler(testErrorPage, ts.URL)
- require.NoError(t, err)
-
- assert.Equal(t, testHandler.BackendURL, ts.URL+"/test", "Should be equal")
-
- recorder := httptest.NewRecorder()
- req, err := http.NewRequest(http.MethodGet, ts.URL+"/test", nil)
- require.NoError(t, err)
-
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- fmt.Fprintln(w, "traefik")
- })
- n := negroni.New()
- n.Use(testHandler)
- n.UseHandler(handler)
-
- n.ServeHTTP(recorder, req)
-
- assert.Equal(t, http.StatusOK, recorder.Code, "HTTP status")
- assert.Contains(t, recorder.Body.String(), "traefik")
-
- // ----
-
- handler500 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusInternalServerError)
- fmt.Fprintln(w, "oops")
- })
- recorder500 := httptest.NewRecorder()
- n500 := negroni.New()
- n500.Use(testHandler)
- n500.UseHandler(handler500)
-
- n500.ServeHTTP(recorder500, req)
-
- assert.Equal(t, http.StatusInternalServerError, recorder500.Code, "HTTP status Internal Server Error")
- assert.Contains(t, recorder500.Body.String(), "Test Server")
- assert.NotContains(t, recorder500.Body.String(), "oops", "Should not return the oops page")
-
- handler502 := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusBadGateway)
- fmt.Fprintln(w, "oops")
- })
- recorder502 := httptest.NewRecorder()
- n502 := negroni.New()
- n502.Use(testHandler)
- n502.UseHandler(handler502)
-
- n502.ServeHTTP(recorder502, req)
-
- assert.Equal(t, http.StatusBadGateway, recorder502.Code, "HTTP status Bad Gateway")
- assert.Contains(t, recorder502.Body.String(), "oops")
- assert.NotContains(t, recorder502.Body.String(), "Test Server", "Should return the oops page since we have not configured the 502 code")
-}
-
-func TestErrorPageQuery(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
- fmt.Fprintln(w, "503 Test Server")
- } else {
- fmt.Fprintln(w, "Failed")
- }
-
- }))
- defer ts.Close()
-
- testErrorPage := &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503-503"}}
-
- testHandler, err := NewErrorPagesHandler(testErrorPage, ts.URL)
- require.NoError(t, err)
-
- assert.Equal(t, testHandler.BackendURL, ts.URL+"/{status}", "Should be equal")
-
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusServiceUnavailable)
- fmt.Fprintln(w, "oops")
- })
-
- recorder := httptest.NewRecorder()
-
- req, err := http.NewRequest(http.MethodGet, ts.URL+"/test", nil)
- require.NoError(t, err)
-
- n := negroni.New()
- n.Use(testHandler)
- n.UseHandler(handler)
-
- n.ServeHTTP(recorder, req)
-
- assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status Service Unavailable")
- assert.Contains(t, recorder.Body.String(), "503 Test Server")
- assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
-}
-
-func TestErrorPageSingleCode(t *testing.T) {
- ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
- fmt.Fprintln(w, "503 Test Server")
- } else {
- fmt.Fprintln(w, "Failed")
- }
-
- }))
- defer ts.Close()
-
- testErrorPage := &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503"}}
-
- testHandler, err := NewErrorPagesHandler(testErrorPage, ts.URL)
- require.NoError(t, err)
-
- assert.Equal(t, testHandler.BackendURL, ts.URL+"/{status}", "Should be equal")
-
- handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- w.WriteHeader(http.StatusServiceUnavailable)
- fmt.Fprintln(w, "oops")
- })
-
- recorder := httptest.NewRecorder()
-
- req, err := http.NewRequest(http.MethodGet, ts.URL+"/test", nil)
- require.NoError(t, err)
-
- n := negroni.New()
- n.Use(testHandler)
- n.UseHandler(handler)
-
- n.ServeHTTP(recorder, req)
-
- assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status Service Unavailable")
- assert.Contains(t, recorder.Body.String(), "503 Test Server")
- assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
-}
-
-func TestNewErrorPagesResponseRecorder(t *testing.T) {
- testCases := []struct {
- desc string
- rw http.ResponseWriter
- expected http.ResponseWriter
- }{
- {
- desc: "Without Close Notify",
- rw: httptest.NewRecorder(),
- expected: &errorPagesResponseRecorderWithoutCloseNotify{},
- },
- {
- desc: "With Close Notify",
- rw: &mockRWCloseNotify{},
- expected: &errorPagesResponseRecorderWithCloseNotify{},
- },
- }
-
- for _, test := range testCases {
- test := test
- t.Run(test.desc, func(t *testing.T) {
- t.Parallel()
-
- rec := newErrorPagesResponseRecorder(test.rw)
-
- assert.IsType(t, rec, test.expected)
- })
- }
-}
-
-type mockRWCloseNotify struct{}
-
-func (m *mockRWCloseNotify) CloseNotify() <-chan bool {
- panic("implement me")
-}
-
-func (m *mockRWCloseNotify) Header() http.Header {
- panic("implement me")
-}
-
-func (m *mockRWCloseNotify) Write([]byte) (int, error) {
- panic("implement me")
-}
-
-func (m *mockRWCloseNotify) WriteHeader(int) {
- panic("implement me")
-}
diff --git a/middlewares/errorpages/error_pages.go b/middlewares/errorpages/error_pages.go
new file mode 100644
index 000000000..49c218639
--- /dev/null
+++ b/middlewares/errorpages/error_pages.go
@@ -0,0 +1,205 @@
+package errorpages
+
+import (
+ "bufio"
+ "bytes"
+ "net"
+ "net/http"
+ "strconv"
+ "strings"
+
+ "github.com/containous/traefik/log"
+ "github.com/containous/traefik/middlewares"
+ "github.com/containous/traefik/types"
+ "github.com/pkg/errors"
+ "github.com/vulcand/oxy/forward"
+ "github.com/vulcand/oxy/utils"
+)
+
+// Compile time validation that the response recorder implements http interfaces correctly.
+var _ middlewares.Stateful = &responseRecorderWithCloseNotify{}
+
+// Handler is a middleware that provides the custom error pages
+type Handler struct {
+ BackendName string
+ backendHandler http.Handler
+ httpCodeRanges types.HTTPCodeRanges
+ backendURL string
+ backendQuery string
+ FallbackURL string // Deprecated
+}
+
+// NewHandler initializes the utils.ErrorHandler for the custom error pages
+func NewHandler(errorPage *types.ErrorPage, backendName string) (*Handler, error) {
+ if len(backendName) == 0 {
+ return nil, errors.New("error pages: backend name is mandatory ")
+ }
+
+ httpCodeRanges, err := types.NewHTTPCodeRanges(errorPage.Status)
+ if err != nil {
+ return nil, err
+ }
+
+ return &Handler{
+ BackendName: backendName,
+ httpCodeRanges: httpCodeRanges,
+ backendQuery: errorPage.Query,
+ backendURL: "http://0.0.0.0",
+ }, nil
+}
+
+// PostLoad adds backend handler if available
+func (h *Handler) PostLoad(backendHandler http.Handler) error {
+ if backendHandler == nil {
+ fwd, err := forward.New()
+ if err != nil {
+ return err
+ }
+
+ h.backendHandler = fwd
+ h.backendURL = h.FallbackURL
+ } else {
+ h.backendHandler = backendHandler
+ }
+
+ return nil
+}
+
+func (h *Handler) ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
+ if h.backendHandler == nil {
+ log.Error("Error pages: no backend handler.")
+ next.ServeHTTP(w, req)
+ return
+ }
+
+ recorder := newResponseRecorder(w)
+ next.ServeHTTP(recorder, req)
+
+ w.WriteHeader(recorder.GetCode())
+
+ // check the recorder code against the configured http status code ranges
+ for _, block := range h.httpCodeRanges {
+ if recorder.GetCode() >= block[0] && recorder.GetCode() <= block[1] {
+ log.Errorf("Caught HTTP Status Code %d, returning error page", recorder.GetCode())
+
+ var query string
+ if len(h.backendQuery) > 0 {
+ query = "/" + strings.TrimPrefix(h.backendQuery, "/")
+ query = strings.Replace(query, "{status}", strconv.Itoa(recorder.GetCode()), -1)
+ }
+
+ if newReq, err := http.NewRequest(http.MethodGet, h.backendURL+query, nil); err != nil {
+ w.Write([]byte(http.StatusText(recorder.GetCode())))
+ } else {
+ h.backendHandler.ServeHTTP(w, newReq)
+ }
+ return
+ }
+ }
+
+ // did not catch a configured status code so proceed with the request
+ utils.CopyHeaders(w.Header(), recorder.Header())
+ w.Write(recorder.GetBody().Bytes())
+}
+
+type responseRecorder interface {
+ http.ResponseWriter
+ http.Flusher
+ GetCode() int
+ GetBody() *bytes.Buffer
+ IsStreamingResponseStarted() bool
+}
+
+// newResponseRecorder returns an initialized responseRecorder.
+func newResponseRecorder(rw http.ResponseWriter) responseRecorder {
+ recorder := &responseRecorderWithoutCloseNotify{
+ HeaderMap: make(http.Header),
+ Body: new(bytes.Buffer),
+ Code: http.StatusOK,
+ responseWriter: rw,
+ }
+ if _, ok := rw.(http.CloseNotifier); ok {
+ return &responseRecorderWithCloseNotify{recorder}
+ }
+ return recorder
+}
+
+// responseRecorderWithoutCloseNotify is an implementation of http.ResponseWriter that
+// records its mutations for later inspection.
+type responseRecorderWithoutCloseNotify struct {
+ Code int // the HTTP response code from WriteHeader
+ HeaderMap http.Header // the HTTP response headers
+ Body *bytes.Buffer // if non-nil, the bytes.Buffer to append written data to
+
+ responseWriter http.ResponseWriter
+ err error
+ streamingResponseStarted bool
+}
+
+type responseRecorderWithCloseNotify struct {
+ *responseRecorderWithoutCloseNotify
+}
+
+// CloseNotify returns a channel that receives at most a
+// single value (true) when the client connection has gone away.
+func (rw *responseRecorderWithCloseNotify) CloseNotify() <-chan bool {
+ return rw.responseWriter.(http.CloseNotifier).CloseNotify()
+}
+
+// Header returns the response headers.
+func (rw *responseRecorderWithoutCloseNotify) Header() http.Header {
+ if rw.HeaderMap == nil {
+ rw.HeaderMap = make(http.Header)
+ }
+ return rw.HeaderMap
+}
+
+func (rw *responseRecorderWithoutCloseNotify) GetCode() int {
+ return rw.Code
+}
+
+func (rw *responseRecorderWithoutCloseNotify) GetBody() *bytes.Buffer {
+ return rw.Body
+}
+
+func (rw *responseRecorderWithoutCloseNotify) IsStreamingResponseStarted() bool {
+ return rw.streamingResponseStarted
+}
+
+// Write always succeeds and writes to rw.Body, if not nil.
+func (rw *responseRecorderWithoutCloseNotify) Write(buf []byte) (int, error) {
+ if rw.err != nil {
+ return 0, rw.err
+ }
+ return rw.Body.Write(buf)
+}
+
+// WriteHeader sets rw.Code.
+func (rw *responseRecorderWithoutCloseNotify) WriteHeader(code int) {
+ rw.Code = code
+}
+
+// Hijack hijacks the connection
+func (rw *responseRecorderWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {
+ return rw.responseWriter.(http.Hijacker).Hijack()
+}
+
+// Flush sends any buffered data to the client.
+func (rw *responseRecorderWithoutCloseNotify) Flush() {
+ if !rw.streamingResponseStarted {
+ utils.CopyHeaders(rw.responseWriter.Header(), rw.Header())
+ rw.responseWriter.WriteHeader(rw.Code)
+ rw.streamingResponseStarted = true
+ }
+
+ _, err := rw.responseWriter.Write(rw.Body.Bytes())
+ if err != nil {
+ log.Errorf("Error writing response in responseRecorder: %s", err)
+ rw.err = err
+ }
+ rw.Body.Reset()
+
+ if flusher, ok := rw.responseWriter.(http.Flusher); ok {
+ flusher.Flush()
+ }
+}
diff --git a/middlewares/errorpages/error_pages_test.go b/middlewares/errorpages/error_pages_test.go
new file mode 100644
index 000000000..4700e5b3b
--- /dev/null
+++ b/middlewares/errorpages/error_pages_test.go
@@ -0,0 +1,383 @@
+package errorpages
+
+import (
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "strconv"
+ "testing"
+
+ "github.com/containous/traefik/testhelpers"
+ "github.com/containous/traefik/types"
+ "github.com/stretchr/testify/assert"
+ "github.com/stretchr/testify/require"
+ "github.com/urfave/negroni"
+)
+
+func TestHandler(t *testing.T) {
+ testCases := []struct {
+ desc string
+ errorPage *types.ErrorPage
+ backendCode int
+ backendErrorHandler http.HandlerFunc
+ validate func(t *testing.T, recorder *httptest.ResponseRecorder)
+ }{
+ {
+ desc: "no error",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusOK,
+ backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusOK, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), http.StatusText(http.StatusOK))
+ },
+ },
+ {
+ desc: "in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusInternalServerError,
+ backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusInternalServerError, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My error page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ {
+ desc: "not in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusBadGateway,
+ backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusBadGateway, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), http.StatusText(http.StatusBadGateway))
+ assert.NotContains(t, recorder.Body.String(), "Test Server", "Should return the oops page since we have not configured the 502 code")
+ },
+ },
+ {
+ desc: "query replacement",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503-503"}},
+ backendCode: http.StatusServiceUnavailable,
+ backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
+ fmt.Fprintln(w, "My 503 page.")
+ } else {
+ fmt.Fprintln(w, "Failed")
+ }
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ {
+ desc: "Single code",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503"}},
+ backendCode: http.StatusServiceUnavailable,
+ backendErrorHandler: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
+ fmt.Fprintln(w, "My 503 page.")
+ } else {
+ fmt.Fprintln(w, "Failed")
+ }
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ }
+
+ for _, test := range testCases {
+ test := test
+ t.Run(test.desc, func(t *testing.T) {
+ t.Parallel()
+
+ errorPageHandler, err := NewHandler(test.errorPage, "test")
+ require.NoError(t, err)
+
+ errorPageHandler.backendHandler = test.backendErrorHandler
+
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(test.backendCode)
+ fmt.Fprintln(w, http.StatusText(test.backendCode))
+ })
+
+ req := testhelpers.MustNewRequest(http.MethodGet, "http://localhost/test", nil)
+
+ n := negroni.New()
+ n.Use(errorPageHandler)
+ n.UseHandler(handler)
+
+ recorder := httptest.NewRecorder()
+ n.ServeHTTP(recorder, req)
+
+ test.validate(t, recorder)
+ })
+ }
+}
+
+func TestHandlerOldWay(t *testing.T) {
+ testCases := []struct {
+ desc string
+ errorPage *types.ErrorPage
+ backendCode int
+ errorPageForwarder http.HandlerFunc
+ validate func(t *testing.T, recorder *httptest.ResponseRecorder)
+ }{
+ {
+ desc: "no error",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusOK,
+ errorPageForwarder: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusOK, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "OK")
+ },
+ },
+ {
+ desc: "in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusInternalServerError,
+ errorPageForwarder: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusInternalServerError, recorder.Code)
+ assert.Contains(t, recorder.Body.String(), "My error page.")
+ assert.NotContains(t, recorder.Body.String(), http.StatusText(http.StatusInternalServerError), "Should not return the oops page")
+ },
+ },
+ {
+ desc: "not in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusBadGateway,
+ errorPageForwarder: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ fmt.Fprintln(w, "My error page.")
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusBadGateway, recorder.Code)
+ assert.Contains(t, recorder.Body.String(), http.StatusText(http.StatusBadGateway))
+ assert.NotContains(t, recorder.Body.String(), "My error page.", "Should return the oops page since we have not configured the 502 code")
+ },
+ },
+ {
+ desc: "query replacement",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503-503"}},
+ backendCode: http.StatusServiceUnavailable,
+ errorPageForwarder: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
+ fmt.Fprintln(w, "My 503 page.")
+ } else {
+ fmt.Fprintln(w, "Failed")
+ }
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ {
+ desc: "Single code",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503"}},
+ backendCode: http.StatusServiceUnavailable,
+ errorPageForwarder: http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
+ fmt.Fprintln(w, "My 503 page.")
+ } else {
+ fmt.Fprintln(w, "Failed")
+ }
+ }),
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ }
+
+ req := testhelpers.MustNewRequest(http.MethodGet, "http://localhost/test", nil)
+
+ for _, test := range testCases {
+ test := test
+ t.Run(test.desc, func(t *testing.T) {
+ t.Parallel()
+
+ errorPageHandler, err := NewHandler(test.errorPage, "test")
+ require.NoError(t, err)
+ errorPageHandler.FallbackURL = "http://localhost"
+
+ errorPageHandler.PostLoad(test.errorPageForwarder)
+
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(test.backendCode)
+ fmt.Fprintln(w, http.StatusText(test.backendCode))
+ })
+
+ n := negroni.New()
+ n.Use(errorPageHandler)
+ n.UseHandler(handler)
+
+ recorder := httptest.NewRecorder()
+ n.ServeHTTP(recorder, req)
+
+ test.validate(t, recorder)
+ })
+ }
+}
+
+func TestHandlerOldWayIntegration(t *testing.T) {
+ errorPagesServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ if r.URL.RequestURI() == "/"+strconv.Itoa(503) {
+ fmt.Fprintln(w, "My 503 page.")
+ } else {
+ fmt.Fprintln(w, "Test Server")
+ }
+ }))
+ defer errorPagesServer.Close()
+
+ testCases := []struct {
+ desc string
+ errorPage *types.ErrorPage
+ backendCode int
+ validate func(t *testing.T, recorder *httptest.ResponseRecorder)
+ }{
+ {
+ desc: "no error",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusOK,
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusOK, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "OK")
+ },
+ },
+ {
+ desc: "in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusInternalServerError,
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusInternalServerError, recorder.Code)
+ assert.Contains(t, recorder.Body.String(), "Test Server")
+ assert.NotContains(t, recorder.Body.String(), http.StatusText(http.StatusInternalServerError), "Should not return the oops page")
+ },
+ },
+ {
+ desc: "not in the range",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/test", Status: []string{"500-501", "503-599"}},
+ backendCode: http.StatusBadGateway,
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusBadGateway, recorder.Code)
+ assert.Contains(t, recorder.Body.String(), http.StatusText(http.StatusBadGateway))
+ assert.NotContains(t, recorder.Body.String(), "Test Server", "Should return the oops page since we have not configured the 502 code")
+ },
+ },
+ {
+ desc: "query replacement",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503-503"}},
+ backendCode: http.StatusServiceUnavailable,
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ {
+ desc: "Single code",
+ errorPage: &types.ErrorPage{Backend: "error", Query: "/{status}", Status: []string{"503"}},
+ backendCode: http.StatusServiceUnavailable,
+ validate: func(t *testing.T, recorder *httptest.ResponseRecorder) {
+ assert.Equal(t, http.StatusServiceUnavailable, recorder.Code, "HTTP status")
+ assert.Contains(t, recorder.Body.String(), "My 503 page.")
+ assert.NotContains(t, recorder.Body.String(), "oops", "Should not return the oops page")
+ },
+ },
+ }
+
+ req := testhelpers.MustNewRequest(http.MethodGet, errorPagesServer.URL+"/test", nil)
+
+ for _, test := range testCases {
+ test := test
+ t.Run(test.desc, func(t *testing.T) {
+
+ errorPageHandler, err := NewHandler(test.errorPage, "test")
+ require.NoError(t, err)
+ errorPageHandler.FallbackURL = errorPagesServer.URL
+
+ err = errorPageHandler.PostLoad(nil)
+ require.NoError(t, err)
+
+ handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.WriteHeader(test.backendCode)
+ fmt.Fprintln(w, http.StatusText(test.backendCode))
+ })
+
+ n := negroni.New()
+ n.Use(errorPageHandler)
+ n.UseHandler(handler)
+
+ recorder := httptest.NewRecorder()
+ n.ServeHTTP(recorder, req)
+
+ test.validate(t, recorder)
+ })
+ }
+}
+
+func TestNewResponseRecorder(t *testing.T) {
+ testCases := []struct {
+ desc string
+ rw http.ResponseWriter
+ expected http.ResponseWriter
+ }{
+ {
+ desc: "Without Close Notify",
+ rw: httptest.NewRecorder(),
+ expected: &responseRecorderWithoutCloseNotify{},
+ },
+ {
+ desc: "With Close Notify",
+ rw: &mockRWCloseNotify{},
+ expected: &responseRecorderWithCloseNotify{},
+ },
+ }
+
+ for _, test := range testCases {
+ test := test
+ t.Run(test.desc, func(t *testing.T) {
+ t.Parallel()
+
+ rec := newResponseRecorder(test.rw)
+
+ assert.IsType(t, rec, test.expected)
+ })
+ }
+}
+
+type mockRWCloseNotify struct{}
+
+func (m *mockRWCloseNotify) CloseNotify() <-chan bool {
+ panic("implement me")
+}
+
+func (m *mockRWCloseNotify) Header() http.Header {
+ panic("implement me")
+}
+
+func (m *mockRWCloseNotify) Write([]byte) (int, error) {
+ panic("implement me")
+}
+
+func (m *mockRWCloseNotify) WriteHeader(int) {
+ panic("implement me")
+}
diff --git a/mkdocs.yml b/mkdocs.yml
index 8055a78b4..1379b428b 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -84,7 +84,7 @@ pages:
- 'Backend: Mesos': 'configuration/backends/mesos.md'
- 'Backend: Rancher': 'configuration/backends/rancher.md'
- 'Backend: Rest': 'configuration/backends/rest.md'
- - 'Backend: Service Fabric': 'configuration/backends/servicefabric.md'
+ - 'Backend: Azure Service Fabric': 'configuration/backends/servicefabric.md'
- 'Backend: Zookeeper': 'configuration/backends/zookeeper.md'
- 'API / Dashboard': 'configuration/api.md'
- 'Ping': 'configuration/ping.md'
diff --git a/provider/acme/local_store.go b/provider/acme/local_store.go
index 4156cd965..4d638d001 100644
--- a/provider/acme/local_store.go
+++ b/provider/acme/local_store.go
@@ -16,7 +16,7 @@ var _ Store = (*LocalStore)(nil)
type LocalStore struct {
filename string
storedData *StoredData
- SaveDataChan chan *StoredData
+ SaveDataChan chan *StoredData `json:"-"`
}
// NewLocalStore initializes a new LocalStore with a file name
@@ -30,31 +30,38 @@ func (s *LocalStore) get() (*StoredData, error) {
if s.storedData == nil {
s.storedData = &StoredData{HTTPChallenges: make(map[string]map[string][]byte)}
- f, err := os.Open(s.filename)
- if err != nil {
- return nil, err
- }
- defer f.Close()
-
- file, err := ioutil.ReadAll(f)
+ hasData, err := CheckFile(s.filename)
if err != nil {
return nil, err
}
- if len(file) > 0 {
- if err := json.Unmarshal(file, s.storedData); err != nil {
- return nil, err
- }
- }
- // Check if ACME Account is in ACME V1 format
- if s.storedData.Account != nil && s.storedData.Account.Registration != nil {
- isOldRegistration, err := regexp.MatchString(RegistrationURLPathV1Regexp, s.storedData.Account.Registration.URI)
+ if hasData {
+ f, err := os.Open(s.filename)
if err != nil {
return nil, err
}
- if isOldRegistration {
- s.storedData.Account = nil
- s.SaveDataChan <- s.storedData
+ defer f.Close()
+
+ file, err := ioutil.ReadAll(f)
+ if err != nil {
+ return nil, err
+ }
+
+ if len(file) > 0 {
+ if err := json.Unmarshal(file, s.storedData); err != nil {
+ return nil, err
+ }
+ }
+ // Check if ACME Account is in ACME V1 format
+ if s.storedData.Account != nil && s.storedData.Account.Registration != nil {
+ isOldRegistration, err := regexp.MatchString(RegistrationURLPathV1Regexp, s.storedData.Account.Registration.URI)
+ if err != nil {
+ return nil, err
+ }
+ if isOldRegistration {
+ s.storedData.Account = nil
+ s.SaveDataChan <- s.storedData
+ }
}
}
}
diff --git a/acme/localStore_unix.go b/provider/acme/local_store_unix.go
similarity index 61%
rename from acme/localStore_unix.go
rename to provider/acme/local_store_unix.go
index a0d7e1a13..0dbb787be 100644
--- a/acme/localStore_unix.go
+++ b/provider/acme/local_store_unix.go
@@ -7,10 +7,17 @@ import (
"os"
)
-// Check file permissions and content size
-func checkFile(name string) (bool, error) {
+// CheckFile checks file permissions and content size
+func CheckFile(name string) (bool, error) {
f, err := os.Open(name)
if err != nil {
+ if os.IsNotExist(err) {
+ f, err = os.Create(name)
+ if err != nil {
+ return false, err
+ }
+ return false, f.Chmod(0600)
+ }
return false, err
}
defer f.Close()
diff --git a/acme/localStore_windows.go b/provider/acme/local_store_windows.go
similarity index 54%
rename from acme/localStore_windows.go
rename to provider/acme/local_store_windows.go
index 06df0cc5b..1804578a3 100644
--- a/acme/localStore_windows.go
+++ b/provider/acme/local_store_windows.go
@@ -2,11 +2,18 @@ package acme
import "os"
-// Check file content size
+// CheckFile checks file content size
// Do not check file permissions on Windows right now
-func checkFile(name string) (bool, error) {
+func CheckFile(name string) (bool, error) {
f, err := os.Open(name)
if err != nil {
+ if os.IsNotExist(err) {
+ f, err = os.Create(name)
+ if err != nil {
+ return false, err
+ }
+ return false, f.Chmod(0600)
+ }
return false, err
}
defer f.Close()
diff --git a/provider/acme/provider.go b/provider/acme/provider.go
index c45db2d77..26fc66ccd 100644
--- a/provider/acme/provider.go
+++ b/provider/acme/provider.go
@@ -23,7 +23,7 @@ import (
traefikTLS "github.com/containous/traefik/tls"
"github.com/containous/traefik/types"
"github.com/pkg/errors"
- "github.com/xenolf/lego/acmev2"
+ acme "github.com/xenolf/lego/acmev2"
"github.com/xenolf/lego/providers/dns"
)
@@ -116,7 +116,7 @@ func (p *Provider) init() error {
p.certificates, err = p.Store.GetCertificates()
if err != nil {
- return fmt.Errorf("unable to get ACME account : %v", err)
+ return fmt.Errorf("unable to get ACME certificates : %v", err)
}
p.watchCertificate()
@@ -424,7 +424,7 @@ func (p *Provider) refreshCertificates() {
for _, cert := range p.certificates {
certificate := &traefikTLS.Certificate{CertFile: traefikTLS.FileOrContent(cert.Certificate), KeyFile: traefikTLS.FileOrContent(cert.Key)}
- config.Configuration.TLS = append(config.Configuration.TLS, &traefikTLS.Configuration{Certificate: certificate})
+ config.Configuration.TLS = append(config.Configuration.TLS, &traefikTLS.Configuration{Certificate: certificate, EntryPoints: []string{p.EntryPoint}})
}
p.configurationChan <- config
}
@@ -565,16 +565,16 @@ func (p *Provider) getValidDomains(domain types.Domain, wildcardAllowed bool) ([
if p.DNSChallenge == nil {
return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : ACME needs a DNSChallenge", strings.Join(domains, ","))
}
- if len(domain.SANs) > 0 {
- return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : SANs are not allowed", strings.Join(domains, ","))
- }
- } else {
- for _, san := range domain.SANs {
- if strings.HasPrefix(san, "*") {
- return nil, fmt.Errorf("unable to generate a certificate in ACME provider for domains %q: SANs can not be a wildcard domain", strings.Join(domains, ","))
- }
+ if strings.HasPrefix(domain.Main, "*.*") {
+ return nil, fmt.Errorf("unable to generate a wildcard certificate in ACME provider for domain %q : ACME does not allow '*.*' wildcard domain", strings.Join(domains, ","))
}
}
+ for _, san := range domain.SANs {
+ if strings.HasPrefix(san, "*") {
+ return nil, fmt.Errorf("unable to generate a certificate in ACME provider for domains %q: SAN %q can not be a wildcard domain", strings.Join(domains, ","), san)
+ }
+ }
+
domains = fun.Map(types.CanonicalDomain, domains).([]string)
return domains, nil
}
@@ -610,26 +610,31 @@ func (p *Provider) deleteUnnecessaryDomains() {
keepDomain = false
}
break
- } else if strings.HasPrefix(domain.Main, "*") && domain.SANs == nil {
-
- // Check if domains can be validated by the wildcard domain
- var newDomainsToCheck []string
- for _, domainProcessed := range domainToCheck.ToStrArray() {
- if isDomainAlreadyChecked(domainProcessed, domain.ToStrArray()) {
- log.Warnf("Domain %q will not be processed by ACME provider because it is validated by the wildcard %q", domainProcessed, domain.Main)
- continue
- }
- newDomainsToCheck = append(newDomainsToCheck, domainProcessed)
- }
-
- // Delete the domain if both Main and SANs can be validated by the wildcard domain
- // otherwise keep the unchecked values
- if newDomainsToCheck == nil {
- keepDomain = false
- break
- }
- domainToCheck.Set(newDomainsToCheck)
}
+
+ // Check if CN or SANS to check already exists
+ // or can not be checked by a wildcard
+ var newDomainsToCheck []string
+ for _, domainProcessed := range domainToCheck.ToStrArray() {
+ if idxDomain < idxDomainToCheck && isDomainAlreadyChecked(domainProcessed, domain.ToStrArray()) {
+ // The domain is duplicated in a CN
+ log.Warnf("Domain %q is duplicated in the configuration or validated by the domain %v. It will be processed once.", domainProcessed, domain)
+ continue
+ } else if domain.Main != domainProcessed && strings.HasPrefix(domain.Main, "*") && isDomainAlreadyChecked(domainProcessed, []string{domain.Main}) {
+ // Check if a wildcard can validate the domain
+ log.Warnf("Domain %q will not be processed by ACME provider because it is validated by the wildcard %q", domainProcessed, domain.Main)
+ continue
+ }
+ newDomainsToCheck = append(newDomainsToCheck, domainProcessed)
+ }
+
+ // Delete the domain if both Main and SANs can be validated by the wildcard domain
+ // otherwise keep the unchecked values
+ if newDomainsToCheck == nil {
+ keepDomain = false
+ break
+ }
+ domainToCheck.Set(newDomainsToCheck)
}
if keepDomain {
diff --git a/provider/acme/provider_test.go b/provider/acme/provider_test.go
index 97f3318a5..2f6a3db96 100644
--- a/provider/acme/provider_test.go
+++ b/provider/acme/provider_test.go
@@ -207,11 +207,27 @@ func TestGetValidDomain(t *testing.T) {
expectedDomains: nil,
},
{
- desc: "unexpected SANs",
- domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}},
+ desc: "unauthorized wildcard with SAN",
+ domains: types.Domain{Main: "*.*.traefik.wtf", SANs: []string{"foo.traefik.wtf"}},
dnsChallenge: &DNSChallenge{},
wildcardAllowed: true,
- expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.traefik.wtf,foo.traefik.wtf\" : SANs are not allowed",
+ expectedErr: "unable to generate a wildcard certificate in ACME provider for domain \"*.*.traefik.wtf,foo.traefik.wtf\" : ACME does not allow '*.*' wildcard domain",
+ expectedDomains: nil,
+ },
+ {
+ desc: "wildcard and SANs",
+ domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"traefik.wtf"}},
+ dnsChallenge: &DNSChallenge{},
+ wildcardAllowed: true,
+ expectedErr: "",
+ expectedDomains: []string{"*.traefik.wtf", "traefik.wtf"},
+ },
+ {
+ desc: "unexpected SANs",
+ domains: types.Domain{Main: "*.traefik.wtf", SANs: []string{"*.acme.wtf"}},
+ dnsChallenge: &DNSChallenge{},
+ wildcardAllowed: true,
+ expectedErr: "unable to generate a certificate in ACME provider for domains \"*.traefik.wtf,*.acme.wtf\": SAN \"*.acme.wtf\" can not be a wildcard domain",
expectedDomains: nil,
},
}
@@ -251,8 +267,8 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
Main: "*.foo.acme.wtf",
},
{
- Main: "acme.wtf",
- SANs: []string{"traefik.acme.wtf", "bar.foo"},
+ Main: "acme02.wtf",
+ SANs: []string{"traefik.acme02.wtf", "bar.foo"},
},
},
expectedDomains: []types.Domain{
@@ -262,15 +278,38 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
},
{
Main: "*.foo.acme.wtf",
+ SANs: []string{},
},
{
- Main: "acme.wtf",
- SANs: []string{"traefik.acme.wtf", "bar.foo"},
+ Main: "acme02.wtf",
+ SANs: []string{"traefik.acme02.wtf", "bar.foo"},
},
},
},
{
- desc: "2 domains with same values",
+ desc: "wildcard and root domain",
+ domains: []types.Domain{
+ {
+ Main: "acme.wtf",
+ },
+ {
+ Main: "*.acme.wtf",
+ SANs: []string{"acme.wtf"},
+ },
+ },
+ expectedDomains: []types.Domain{
+ {
+ Main: "acme.wtf",
+ SANs: []string{},
+ },
+ {
+ Main: "*.acme.wtf",
+ SANs: []string{},
+ },
+ },
+ },
+ {
+ desc: "2 equals domains",
domains: []types.Domain{
{
Main: "acme.wtf",
@@ -288,6 +327,29 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
},
},
},
+ {
+ desc: "2 domains with same values",
+ domains: []types.Domain{
+ {
+ Main: "acme.wtf",
+ SANs: []string{"traefik.acme.wtf"},
+ },
+ {
+ Main: "acme.wtf",
+ SANs: []string{"traefik.acme.wtf", "foo.bar"},
+ },
+ },
+ expectedDomains: []types.Domain{
+ {
+ Main: "acme.wtf",
+ SANs: []string{"traefik.acme.wtf"},
+ },
+ {
+ Main: "foo.bar",
+ SANs: []string{},
+ },
+ },
+ },
{
desc: "domain totally checked by wildcard",
domains: []types.Domain{
@@ -302,6 +364,25 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
expectedDomains: []types.Domain{
{
Main: "*.acme.wtf",
+ SANs: []string{},
+ },
+ },
+ },
+ {
+ desc: "duplicated wildcard",
+ domains: []types.Domain{
+ {
+ Main: "*.acme.wtf",
+ SANs: []string{"acme.wtf"},
+ },
+ {
+ Main: "*.acme.wtf",
+ },
+ },
+ expectedDomains: []types.Domain{
+ {
+ Main: "*.acme.wtf",
+ SANs: []string{"acme.wtf"},
},
},
},
@@ -315,6 +396,10 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
{
Main: "*.acme.wtf",
},
+ {
+ Main: "who.acme.wtf",
+ SANs: []string{"traefik.acme.wtf", "bar.acme.wtf"},
+ },
},
expectedDomains: []types.Domain{
{
@@ -323,6 +408,7 @@ func TestDeleteUnnecessaryDomains(t *testing.T) {
},
{
Main: "*.acme.wtf",
+ SANs: []string{},
},
},
},
diff --git a/provider/consulcatalog/config.go b/provider/consulcatalog/config.go
index ea5bea174..ce5e1bee9 100644
--- a/provider/consulcatalog/config.go
+++ b/provider/consulcatalog/config.go
@@ -39,8 +39,8 @@ func (p *Provider) buildConfigurationV2(catalog []catalogUpdate) *types.Configur
"getFrontendRule": p.getFrontendRule,
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
"getFrontEndEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getWhiteList": label.GetWhiteList,
"getRedirect": label.GetRedirect,
@@ -192,7 +192,7 @@ func getServerName(node *api.ServiceEntry, index int) string {
}
func (p *Provider) getWeight(tags []string) int {
- weight := p.getIntAttribute(label.SuffixWeight, tags, label.DefaultWeightInt)
+ weight := p.getIntAttribute(label.SuffixWeight, tags, label.DefaultWeight)
// Deprecated
deprecatedWeightTag := "backend." + label.SuffixWeight
@@ -200,7 +200,7 @@ func (p *Provider) getWeight(tags []string) int {
log.Warnf("Deprecated configuration found: %s. Please use %s.",
p.getPrefixedName(deprecatedWeightTag), p.getPrefixedName(label.SuffixWeight))
- weight = p.getIntAttribute(deprecatedWeightTag, tags, label.DefaultWeightInt)
+ weight = p.getIntAttribute(deprecatedWeightTag, tags, label.DefaultWeight)
}
return weight
diff --git a/provider/consulcatalog/deprecated_config.go b/provider/consulcatalog/deprecated_config.go
index 181674dc1..bec2918bc 100644
--- a/provider/consulcatalog/deprecated_config.go
+++ b/provider/consulcatalog/deprecated_config.go
@@ -36,8 +36,8 @@ func (p *Provider) buildConfigurationV1(catalog []catalogUpdate) *types.Configur
"getFrontendRule": p.getFrontendRuleV1,
"getBasicAuth": p.getFuncSliceAttribute(label.SuffixFrontendAuthBasic),
"getEntryPoints": getEntryPointsV1,
- "getPriority": p.getFuncIntAttribute(label.SuffixFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": p.getFuncBoolAttribute(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": p.getFuncIntAttribute(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": p.getFuncBoolAttribute(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": p.getFuncBoolAttribute(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
}
diff --git a/provider/docker/config.go b/provider/docker/config.go
index 4615030f5..bc6155a84 100644
--- a/provider/docker/config.go
+++ b/provider/docker/config.go
@@ -40,8 +40,8 @@ func (p *Provider) buildConfigurationV2(containersInspected []dockerData) *types
// Frontend functions
"getBackendName": getBackendName,
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
@@ -318,7 +318,7 @@ func (p *Provider) getServers(containers []dockerData) map[string]types.Server {
servers[provider.Normalize(serverName)] = types.Server{
URL: fmt.Sprintf("%s://%s:%s", protocol, ip, port),
- Weight: label.GetIntValue(container.SegmentLabels, label.TraefikWeight, label.DefaultWeightInt),
+ Weight: label.GetIntValue(container.SegmentLabels, label.TraefikWeight, label.DefaultWeight),
}
}
diff --git a/provider/docker/config_container_docker_test.go b/provider/docker/config_container_docker_test.go
index d6b96f3b1..d05497235 100644
--- a/provider/docker/config_container_docker_test.go
+++ b/provider/docker/config_container_docker_test.go
@@ -57,7 +57,7 @@ func TestDockerBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-test": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -236,12 +236,12 @@ func TestDockerBuildConfiguration(t *testing.T) {
"foo": {
Status: []string{"404"},
Query: "foo_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
"bar": {
Status: []string{"500", "600"},
Query: "bar_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
},
RateLimit: &types.RateLimit{
diff --git a/provider/docker/config_container_swarm_test.go b/provider/docker/config_container_swarm_test.go
index 5cab4c4a3..056f47549 100644
--- a/provider/docker/config_container_swarm_test.go
+++ b/provider/docker/config_container_swarm_test.go
@@ -59,7 +59,7 @@ func TestSwarmBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-test": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -243,12 +243,12 @@ func TestSwarmBuildConfiguration(t *testing.T) {
"foo": {
Status: []string{"404"},
Query: "foo_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
"bar": {
Status: []string{"500", "600"},
Query: "bar_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
},
RateLimit: &types.RateLimit{
diff --git a/provider/docker/config_segment_test.go b/provider/docker/config_segment_test.go
index babdc04d5..02e6c6311 100644
--- a/provider/docker/config_segment_test.go
+++ b/provider/docker/config_segment_test.go
@@ -59,7 +59,7 @@ func TestSegmentBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-sauternes-foo-0": {
URL: "http://127.0.0.1:2503",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -193,12 +193,12 @@ func TestSegmentBuildConfiguration(t *testing.T) {
"foo": {
Status: []string{"404"},
Query: "foo_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
"bar": {
Status: []string{"500", "600"},
Query: "bar_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
},
RateLimit: &types.RateLimit{
diff --git a/provider/docker/deprecated_config.go b/provider/docker/deprecated_config.go
index 9cbd29f52..2e4308a78 100644
--- a/provider/docker/deprecated_config.go
+++ b/provider/docker/deprecated_config.go
@@ -21,7 +21,7 @@ func (p *Provider) buildConfigurationV1(containersInspected []dockerData) *types
// Backend functions
"getIPAddress": p.getIPAddress,
"getPort": getPortV1,
- "getWeight": getFuncIntLabelV1(label.TraefikWeight, label.DefaultWeightInt),
+ "getWeight": getFuncIntLabelV1(label.TraefikWeight, label.DefaultWeight),
"getProtocol": getFuncStringLabelV1(label.TraefikProtocol, label.DefaultProtocol),
"hasCircuitBreakerLabel": hasFuncV1(label.TraefikBackendCircuitBreakerExpression),
@@ -38,8 +38,8 @@ func (p *Provider) buildConfigurationV1(containersInspected []dockerData) *types
// Frontend functions
"getBackend": getBackendNameV1,
"getBackendName": getBackendNameV1,
- "getPriority": getFuncIntLabelV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": getFuncBoolLabelV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": getFuncIntLabelV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": getFuncBoolLabelV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": getFuncBoolLabelV1(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getEntryPoints": getFuncSliceStringLabelV1(label.TraefikFrontendEntryPoints),
"getBasicAuth": getFuncSliceStringLabelV1(label.TraefikFrontendAuthBasic),
@@ -100,15 +100,15 @@ func (p *Provider) buildConfigurationV1(containersInspected []dockerData) *types
// Services - Backend server functions
"getServicePort": getServicePortV1,
"getServiceProtocol": getFuncServiceStringLabelV1(label.SuffixProtocol, label.DefaultProtocol),
- "getServiceWeight": getFuncServiceStringLabelV1(label.SuffixWeight, label.DefaultWeight),
+ "getServiceWeight": getFuncServiceIntLabelV1(label.SuffixWeight, label.DefaultWeight),
// Services - Frontend functions
"getServiceEntryPoints": getFuncServiceSliceStringLabelV1(label.SuffixFrontendEntryPoints),
"getServiceWhitelistSourceRange": getFuncServiceSliceStringLabelV1(label.SuffixFrontendWhiteListSourceRange),
"getServiceBasicAuth": getFuncServiceSliceStringLabelV1(label.SuffixFrontendAuthBasic),
"getServiceFrontendRule": p.getServiceFrontendRuleV1,
- "getServicePassHostHeader": getFuncServiceBoolLabelV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getServicePassHostHeader": getFuncServiceBoolLabelV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
"getServicePassTLSCert": getFuncServiceBoolLabelV1(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
- "getServicePriority": getFuncServiceIntLabelV1(label.SuffixFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getServicePriority": getFuncServiceIntLabelV1(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
"hasServiceRedirect": hasServiceRedirectV1,
"getServiceRedirectEntryPoint": getFuncServiceStringLabelV1(label.SuffixFrontendRedirectEntryPoint, ""),
"getServiceRedirectReplacement": getFuncServiceStringLabelV1(label.SuffixFrontendRedirectReplacement, ""),
diff --git a/provider/docker/deprecated_container_docker_test.go b/provider/docker/deprecated_container_docker_test.go
index 6aeef186d..db275f42d 100644
--- a/provider/docker/deprecated_container_docker_test.go
+++ b/provider/docker/deprecated_container_docker_test.go
@@ -56,7 +56,7 @@ func TestDockerBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-test": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -584,17 +584,17 @@ func TestDockerGetFuncStringLabelV1(t *testing.T) {
}{
{
container: containerJSON(),
- labelName: label.TraefikWeight,
- defaultValue: label.DefaultWeight,
- expected: "0",
+ labelName: label.TraefikProtocol,
+ defaultValue: label.DefaultProtocol,
+ expected: "http",
},
{
container: containerJSON(labels(map[string]string{
- label.TraefikWeight: "10",
+ label.TraefikProtocol: "https",
})),
- labelName: label.TraefikWeight,
- defaultValue: label.DefaultWeight,
- expected: "10",
+ labelName: label.TraefikProtocol,
+ defaultValue: label.DefaultProtocol,
+ expected: "https",
},
}
diff --git a/provider/docker/deprecated_container_swarm_test.go b/provider/docker/deprecated_container_swarm_test.go
index 387cd803b..151e4b10e 100644
--- a/provider/docker/deprecated_container_swarm_test.go
+++ b/provider/docker/deprecated_container_swarm_test.go
@@ -57,7 +57,7 @@ func TestSwarmBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-test": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -420,19 +420,19 @@ func TestSwarmGetFuncStringLabelV1(t *testing.T) {
}{
{
service: swarmService(),
- labelName: label.TraefikWeight,
- defaultValue: label.DefaultWeight,
+ labelName: label.TraefikProtocol,
+ defaultValue: label.DefaultProtocol,
networks: map[string]*docker.NetworkResource{},
- expected: "0",
+ expected: "http",
},
{
service: swarmService(serviceLabels(map[string]string{
- label.TraefikWeight: "10",
+ label.TraefikProtocol: "https",
})),
- labelName: label.TraefikWeight,
- defaultValue: label.DefaultWeight,
+ labelName: label.TraefikProtocol,
+ defaultValue: label.DefaultProtocol,
networks: map[string]*docker.NetworkResource{},
- expected: "10",
+ expected: "https",
},
}
diff --git a/provider/docker/deprecated_service_test.go b/provider/docker/deprecated_service_test.go
index 552c6640b..83b903506 100644
--- a/provider/docker/deprecated_service_test.go
+++ b/provider/docker/deprecated_service_test.go
@@ -59,7 +59,7 @@ func TestDockerServiceBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"service-0": {
URL: "http://127.0.0.1:2503",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -272,25 +272,25 @@ func TestDockerGetFuncServiceStringLabelV1(t *testing.T) {
}{
{
container: containerJSON(),
- suffixLabel: label.SuffixWeight,
- defaultValue: label.DefaultWeight,
- expected: "0",
+ suffixLabel: label.SuffixProtocol,
+ defaultValue: label.DefaultProtocol,
+ expected: "http",
},
{
container: containerJSON(labels(map[string]string{
- label.TraefikWeight: "200",
+ label.TraefikProtocol: "https",
})),
- suffixLabel: label.SuffixWeight,
- defaultValue: label.DefaultWeight,
- expected: "200",
+ suffixLabel: label.SuffixProtocol,
+ defaultValue: label.DefaultProtocol,
+ expected: "https",
},
{
container: containerJSON(labels(map[string]string{
- "traefik.myservice.weight": "31337",
+ label.Prefix + "myservice." + label.SuffixProtocol: "https",
})),
- suffixLabel: label.SuffixWeight,
- defaultValue: label.DefaultWeight,
- expected: "31337",
+ suffixLabel: label.SuffixProtocol,
+ defaultValue: label.DefaultProtocol,
+ expected: "https",
},
}
diff --git a/provider/ecs/config.go b/provider/ecs/config.go
index 6a226dbd2..cdb1cef35 100644
--- a/provider/ecs/config.go
+++ b/provider/ecs/config.go
@@ -8,13 +8,26 @@ import (
"github.com/BurntSushi/ty/fun"
"github.com/aws/aws-sdk-go/aws"
+ "github.com/aws/aws-sdk-go/service/ec2"
+ "github.com/containous/traefik/log"
"github.com/containous/traefik/provider"
"github.com/containous/traefik/provider/label"
"github.com/containous/traefik/types"
)
// buildConfiguration fills the config template with the given instances
-func (p *Provider) buildConfigurationV2(services map[string][]ecsInstance) (*types.Configuration, error) {
+func (p *Provider) buildConfigurationV2(instances []ecsInstance) (*types.Configuration, error) {
+ services := make(map[string][]ecsInstance)
+ for _, instance := range instances {
+ if p.filterInstance(instance) {
+ if serviceInstances, ok := services[instance.Name]; ok {
+ services[instance.Name] = append(serviceInstances, instance)
+ } else {
+ services[instance.Name] = []ecsInstance{instance}
+ }
+ }
+ }
+
var ecsFuncMap = template.FuncMap{
// Backend functions
"getHost": getHost,
@@ -29,9 +42,9 @@ func (p *Provider) buildConfigurationV2(services map[string][]ecsInstance) (*typ
// Frontend functions
"filterFrontends": filterFrontends,
"getFrontendRule": p.getFrontendRule,
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
"getRedirect": label.GetRedirect,
@@ -48,6 +61,35 @@ func (p *Provider) buildConfigurationV2(services map[string][]ecsInstance) (*typ
})
}
+func (p *Provider) filterInstance(i ecsInstance) bool {
+ if labelPort := label.GetStringValue(i.TraefikLabels, label.TraefikPort, ""); len(i.container.NetworkBindings) == 0 && labelPort == "" {
+ log.Debugf("Filtering ecs instance without port %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if i.machine == nil || i.machine.State == nil || i.machine.State.Name == nil {
+ log.Debugf("Filtering ecs instance with missing ec2 information %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if aws.StringValue(i.machine.State.Name) != ec2.InstanceStateNameRunning {
+ log.Debugf("Filtering ecs instance with an incorrect state %s (%s) (state = %s)", i.Name, i.ID, aws.StringValue(i.machine.State.Name))
+ return false
+ }
+
+ if i.machine.PrivateIpAddress == nil {
+ log.Debugf("Filtering ecs instance without an ip address %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if !isEnabled(i, p.ExposedByDefault) {
+ log.Debugf("Filtering disabled ecs instance %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ return true
+}
+
func (p *Provider) getFrontendRule(i ecsInstance) string {
defaultRule := "Host:" + strings.ToLower(strings.Replace(i.Name, "_", "-", -1)) + "." + p.Domain
return label.GetStringValue(i.TraefikLabels, label.TraefikFrontendRule, defaultRule)
@@ -91,7 +133,7 @@ func getServers(instances []ecsInstance) map[string]types.Server {
serverName := provider.Normalize(fmt.Sprintf("server-%s-%s", instance.Name, instance.ID))
servers[serverName] = types.Server{
URL: fmt.Sprintf("%s://%s:%s", protocol, host, port),
- Weight: label.GetIntValue(instance.TraefikLabels, label.TraefikWeight, 0),
+ Weight: label.GetIntValue(instance.TraefikLabels, label.TraefikWeight, label.DefaultWeight),
}
}
diff --git a/provider/ecs/config_root.go b/provider/ecs/config_root.go
index 318feddfd..622edfcfc 100644
--- a/provider/ecs/config_root.go
+++ b/provider/ecs/config_root.go
@@ -4,9 +4,9 @@ import (
"github.com/containous/traefik/types"
)
-func (p *Provider) buildConfiguration(services map[string][]ecsInstance) (*types.Configuration, error) {
+func (p *Provider) buildConfiguration(instances []ecsInstance) (*types.Configuration, error) {
if p.TemplateVersion == 1 {
- return p.buildConfigurationV1(services)
+ return p.buildConfigurationV1(instances)
}
- return p.buildConfigurationV2(services)
+ return p.buildConfigurationV2(instances)
}
diff --git a/provider/ecs/config_test.go b/provider/ecs/config_test.go
index 95c745c82..796742cca 100644
--- a/provider/ecs/config_test.go
+++ b/provider/ecs/config_test.go
@@ -15,21 +15,24 @@ import (
func TestBuildConfiguration(t *testing.T) {
testCases := []struct {
- desc string
- services map[string][]ecsInstance
- expected *types.Configuration
- err error
+ desc string
+ instances []ecsInstance
+ expected *types.Configuration
+ err error
}{
{
desc: "config parsed successfully",
- services: map[string][]ecsInstance{
- "testing": {{
+ instances: []ecsInstance{
+ {
Name: "instance",
ID: "1",
containerDefinition: &ecs.ContainerDefinition{
DockerLabels: map[string]*string{},
},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -37,23 +40,24 @@ func TestBuildConfiguration(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
- "backend-testing": {
+ "backend-instance": {
Servers: map[string]types.Server{
"server-instance-1": {
- URL: "http://10.0.0.1:1337",
+ URL: "http://10.0.0.1:1337",
+ Weight: label.DefaultWeight,
}},
},
},
Frontends: map[string]*types.Frontend{
- "frontend-testing": {
+ "frontend-instance": {
EntryPoints: []string{},
- Backend: "backend-testing",
+ Backend: "backend-instance",
Routes: map[string]types.Route{
- "route-frontend-testing": {
+ "route-frontend-instance": {
Rule: "Host:instance.",
},
},
@@ -65,8 +69,8 @@ func TestBuildConfiguration(t *testing.T) {
},
{
desc: "config parsed successfully with health check labels",
- services: map[string][]ecsInstance{
- "testing": {{
+ instances: []ecsInstance{
+ {
Name: "instance",
ID: "1",
containerDefinition: &ecs.ContainerDefinition{
@@ -75,6 +79,9 @@ func TestBuildConfiguration(t *testing.T) {
label.TraefikBackendHealthCheckInterval: aws.String("1s"),
}},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -82,27 +89,28 @@ func TestBuildConfiguration(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
- "backend-testing": {
+ "backend-instance": {
HealthCheck: &types.HealthCheck{
Path: "/health",
Interval: "1s",
},
Servers: map[string]types.Server{
"server-instance-1": {
- URL: "http://10.0.0.1:1337",
+ URL: "http://10.0.0.1:1337",
+ Weight: label.DefaultWeight,
}},
},
},
Frontends: map[string]*types.Frontend{
- "frontend-testing": {
+ "frontend-instance": {
EntryPoints: []string{},
- Backend: "backend-testing",
+ Backend: "backend-instance",
Routes: map[string]types.Route{
- "route-frontend-testing": {
+ "route-frontend-instance": {
Rule: "Host:instance.",
},
},
@@ -114,8 +122,8 @@ func TestBuildConfiguration(t *testing.T) {
},
{
desc: "when all labels are set",
- services: map[string][]ecsInstance{
- "testing-instance": {{
+ instances: []ecsInstance{
+ {
Name: "testing-instance",
ID: "6",
containerDefinition: &ecs.ContainerDefinition{
@@ -193,6 +201,9 @@ func TestBuildConfiguration(t *testing.T) {
label.Prefix + label.BaseFrontendRateLimit + "bar." + label.SuffixRateLimitBurst: aws.String("9"),
}},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -200,7 +211,7 @@ func TestBuildConfiguration(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
@@ -308,14 +319,14 @@ func TestBuildConfiguration(t *testing.T) {
"500",
"600",
},
- Backend: "foobar",
+ Backend: "backend-foobar",
Query: "bar_query",
},
"foo": {
Status: []string{
"404",
},
- Backend: "foobar",
+ Backend: "backend-foobar",
Query: "foo_query",
},
},
@@ -351,11 +362,11 @@ func TestBuildConfiguration(t *testing.T) {
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
- p := &Provider{}
+ p := &Provider{ExposedByDefault: true}
- services := fakeLoadTraefikLabels(test.services)
+ instances := fakeLoadTraefikLabels(test.instances)
- got, err := p.buildConfiguration(services)
+ got, err := p.buildConfiguration(instances)
assert.Equal(t, test.err, err) // , err.Error()
assert.Equal(t, test.expected, got, test.desc)
})
@@ -363,27 +374,6 @@ func TestBuildConfiguration(t *testing.T) {
}
func TestFilterInstance(t *testing.T) {
- nilPrivateIP := simpleEcsInstance(map[string]*string{})
- nilPrivateIP.machine.PrivateIpAddress = nil
-
- nilMachine := simpleEcsInstance(map[string]*string{})
- nilMachine.machine = nil
-
- nilMachineState := simpleEcsInstance(map[string]*string{})
- nilMachineState.machine.State = nil
-
- nilMachineStateName := simpleEcsInstance(map[string]*string{})
- nilMachineStateName.machine.State.Name = nil
-
- invalidMachineState := simpleEcsInstance(map[string]*string{})
- invalidMachineState.machine.State.Name = aws.String(ec2.InstanceStateNameStopped)
-
- noNetwork := simpleEcsInstanceNoNetwork(map[string]*string{})
-
- noNetworkWithLabel := simpleEcsInstanceNoNetwork(map[string]*string{
- label.TraefikPort: aws.String("80"),
- })
-
testCases := []struct {
desc string
instanceInfo ecsInstance
@@ -419,44 +409,66 @@ func TestFilterInstance(t *testing.T) {
expected: true,
},
{
- desc: "Instance with nil private ip and exposed by default enabled should be filtered",
- instanceInfo: nilPrivateIP,
+ desc: "Instance with nil private ip and exposed by default enabled should be filtered",
+ instanceInfo: func() ecsInstance {
+ nilPrivateIP := simpleEcsInstance(map[string]*string{})
+ nilPrivateIP.machine.PrivateIpAddress = nil
+ return nilPrivateIP
+ }(),
exposedByDefault: true,
expected: false,
},
{
- desc: "Instance with nil machine and exposed by default enabled should be filtered",
- instanceInfo: nilMachine,
+ desc: "Instance with nil machine and exposed by default enabled should be filtered",
+ instanceInfo: func() ecsInstance {
+ nilMachine := simpleEcsInstance(map[string]*string{})
+ nilMachine.machine = nil
+ return nilMachine
+ }(),
exposedByDefault: true,
expected: false,
},
{
- desc: "Instance with nil machine state and exposed by default enabled should be filtered",
- instanceInfo: nilMachineState,
+ desc: "Instance with nil machine state and exposed by default enabled should be filtered",
+ instanceInfo: func() ecsInstance {
+ nilMachineState := simpleEcsInstance(map[string]*string{})
+ nilMachineState.machine.State = nil
+ return nilMachineState
+ }(),
exposedByDefault: true,
expected: false,
},
{
- desc: "Instance with nil machine state name and exposed by default enabled should be filtered",
- instanceInfo: nilMachineStateName,
+ desc: "Instance with nil machine state name and exposed by default enabled should be filtered",
+ instanceInfo: func() ecsInstance {
+ nilMachineStateName := simpleEcsInstance(map[string]*string{})
+ nilMachineStateName.machine.State.Name = nil
+ return nilMachineStateName
+ }(),
exposedByDefault: true,
expected: false,
},
{
- desc: "Instance with invalid machine state and exposed by default enabled should be filtered",
- instanceInfo: invalidMachineState,
+ desc: "Instance with invalid machine state and exposed by default enabled should be filtered",
+ instanceInfo: func() ecsInstance {
+ invalidMachineState := simpleEcsInstance(map[string]*string{})
+ invalidMachineState.machine.State.Name = aws.String(ec2.InstanceStateNameStopped)
+ return invalidMachineState
+ }(),
exposedByDefault: true,
expected: false,
},
{
desc: "Instance with no port mappings should be filtered",
- instanceInfo: noNetwork,
+ instanceInfo: simpleEcsInstanceNoNetwork(map[string]*string{}),
exposedByDefault: true,
expected: false,
},
{
- desc: "Instance with no port mapping and with label should not be filtered",
- instanceInfo: noNetworkWithLabel,
+ desc: "Instance with no port mapping and with label should not be filtered",
+ instanceInfo: simpleEcsInstanceNoNetwork(map[string]*string{
+ label.TraefikPort: aws.String("80"),
+ }),
exposedByDefault: true,
expected: true,
},
@@ -470,6 +482,7 @@ func TestFilterInstance(t *testing.T) {
prov := &Provider{
ExposedByDefault: test.exposedByDefault,
}
+
actual := prov.filterInstance(test.instanceInfo)
assert.Equal(t, test.expected, actual)
})
@@ -756,15 +769,11 @@ func simpleEcsInstanceNoNetwork(labels map[string]*string) ecsInstance {
})
}
-func fakeLoadTraefikLabels(services map[string][]ecsInstance) map[string][]ecsInstance {
- result := make(map[string][]ecsInstance)
- for name, srcInstances := range services {
- var instances []ecsInstance
- for _, instance := range srcInstances {
- instance.TraefikLabels = aws.StringValueMap(instance.containerDefinition.DockerLabels)
- instances = append(instances, instance)
- }
- result[name] = instances
+func fakeLoadTraefikLabels(instances []ecsInstance) []ecsInstance {
+ var result []ecsInstance
+ for _, instance := range instances {
+ instance.TraefikLabels = aws.StringValueMap(instance.containerDefinition.DockerLabels)
+ result = append(result, instance)
}
return result
}
diff --git a/provider/ecs/deprecated_config.go b/provider/ecs/deprecated_config.go
index 14cc0e0be..2bde17dec 100644
--- a/provider/ecs/deprecated_config.go
+++ b/provider/ecs/deprecated_config.go
@@ -5,6 +5,7 @@ import (
"text/template"
"github.com/aws/aws-sdk-go/aws"
+ "github.com/aws/aws-sdk-go/service/ec2"
"github.com/containous/traefik/log"
"github.com/containous/traefik/provider/label"
"github.com/containous/traefik/types"
@@ -12,14 +13,25 @@ import (
// buildConfiguration fills the config template with the given instances
// Deprecated
-func (p *Provider) buildConfigurationV1(services map[string][]ecsInstance) (*types.Configuration, error) {
+func (p *Provider) buildConfigurationV1(instances []ecsInstance) (*types.Configuration, error) {
+ services := make(map[string][]ecsInstance)
+ for _, instance := range instances {
+ if p.filterInstanceV1(instance) {
+ if serviceInstances, ok := services[instance.Name]; ok {
+ services[instance.Name] = append(serviceInstances, instance)
+ } else {
+ services[instance.Name] = []ecsInstance{instance}
+ }
+ }
+ }
+
var ecsFuncMap = template.FuncMap{
// Backend functions
"getHost": getHost,
"getPort": getPort,
"getProtocol": getFuncStringValueV1(label.TraefikProtocol, label.DefaultProtocol),
- "getWeight": getFuncIntValueV1(label.TraefikWeight, label.DefaultWeightInt),
+ "getWeight": getFuncIntValueV1(label.TraefikWeight, label.DefaultWeight),
"getLoadBalancerMethod": getFuncFirstStringValueV1(label.TraefikBackendLoadBalancerMethod, label.DefaultBackendLoadBalancerMethod),
"getLoadBalancerSticky": getStickyV1,
"hasStickinessLabel": getFuncFirstBoolValueV1(label.TraefikBackendLoadBalancerStickiness, false),
@@ -31,9 +43,9 @@ func (p *Provider) buildConfigurationV1(services map[string][]ecsInstance) (*typ
// Frontend functions
"filterFrontends": filterFrontends,
"getFrontendRule": p.getFrontendRule,
- "getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": getFuncBoolValueV1(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
- "getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
"getBasicAuth": getFuncSliceStringV1(label.TraefikFrontendAuthBasic),
"getEntryPoints": getFuncSliceStringV1(label.TraefikFrontendEntryPoints),
}
@@ -45,6 +57,35 @@ func (p *Provider) buildConfigurationV1(services map[string][]ecsInstance) (*typ
})
}
+func (p *Provider) filterInstanceV1(i ecsInstance) bool {
+ if labelPort := getStringValueV1(i, label.TraefikPort, ""); len(i.container.NetworkBindings) == 0 && labelPort == "" {
+ log.Debugf("Filtering ecs instance without port %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if i.machine == nil || i.machine.State == nil || i.machine.State.Name == nil {
+ log.Debugf("Filtering ecs instance in an missing ec2 information %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if aws.StringValue(i.machine.State.Name) != ec2.InstanceStateNameRunning {
+ log.Debugf("Filtering ecs instance in an incorrect state %s (%s) (state = %s)", i.Name, i.ID, aws.StringValue(i.machine.State.Name))
+ return false
+ }
+
+ if i.machine.PrivateIpAddress == nil {
+ log.Debugf("Filtering ecs instance without an ip address %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ if !isEnabled(i, p.ExposedByDefault) {
+ log.Debugf("Filtering disabled ecs instance %s (%s)", i.Name, i.ID)
+ return false
+ }
+
+ return true
+}
+
// TODO: Deprecated
// replaced by Stickiness
// Deprecated
diff --git a/provider/ecs/deprecated_config_test.go b/provider/ecs/deprecated_config_test.go
index 0e73bf05b..0f346e58a 100644
--- a/provider/ecs/deprecated_config_test.go
+++ b/provider/ecs/deprecated_config_test.go
@@ -13,21 +13,24 @@ import (
func TestBuildConfigurationV1(t *testing.T) {
testCases := []struct {
- desc string
- services map[string][]ecsInstance
- expected *types.Configuration
- err error
+ desc string
+ instances []ecsInstance
+ expected *types.Configuration
+ err error
}{
{
desc: "config parsed successfully",
- services: map[string][]ecsInstance{
- "testing": {{
+ instances: []ecsInstance{
+ {
Name: "testing",
ID: "1",
containerDefinition: &ecs.ContainerDefinition{
DockerLabels: map[string]*string{},
},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -35,14 +38,15 @@ func TestBuildConfigurationV1(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
"backend-testing": {
Servers: map[string]types.Server{
"server-testing1": {
- URL: "http://10.0.0.1:1337",
+ URL: "http://10.0.0.1:1337",
+ Weight: label.DefaultWeight,
}},
LoadBalancer: &types.LoadBalancer{
Method: "wrr",
@@ -66,8 +70,8 @@ func TestBuildConfigurationV1(t *testing.T) {
},
{
desc: "config parsed successfully with health check labels",
- services: map[string][]ecsInstance{
- "testing": {{
+ instances: []ecsInstance{
+ {
Name: "testing",
ID: "1",
containerDefinition: &ecs.ContainerDefinition{
@@ -76,6 +80,9 @@ func TestBuildConfigurationV1(t *testing.T) {
label.TraefikBackendHealthCheckInterval: aws.String("1s"),
}},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -83,7 +90,7 @@ func TestBuildConfigurationV1(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
@@ -94,7 +101,8 @@ func TestBuildConfigurationV1(t *testing.T) {
},
Servers: map[string]types.Server{
"server-testing1": {
- URL: "http://10.0.0.1:1337",
+ URL: "http://10.0.0.1:1337",
+ Weight: label.DefaultWeight,
}},
LoadBalancer: &types.LoadBalancer{
Method: "wrr",
@@ -118,8 +126,8 @@ func TestBuildConfigurationV1(t *testing.T) {
},
{
desc: "when all labels are set",
- services: map[string][]ecsInstance{
- "testing-instance": {{
+ instances: []ecsInstance{
+ {
Name: "testing-instance",
ID: "6",
containerDefinition: &ecs.ContainerDefinition{
@@ -144,6 +152,9 @@ func TestBuildConfigurationV1(t *testing.T) {
label.TraefikFrontendRule: aws.String("Host:traefik.io"),
}},
machine: &ec2.Instance{
+ State: &ec2.InstanceState{
+ Name: aws.String(ec2.InstanceStateNameRunning),
+ },
PrivateIpAddress: aws.String("10.0.0.1"),
},
container: &ecs.Container{
@@ -151,7 +162,7 @@ func TestBuildConfigurationV1(t *testing.T) {
HostPort: aws.Int64(1337),
}},
},
- }},
+ },
},
expected: &types.Configuration{
Backends: map[string]*types.Backend{
@@ -204,11 +215,11 @@ func TestBuildConfigurationV1(t *testing.T) {
t.Run(test.desc, func(t *testing.T) {
t.Parallel()
- provider := &Provider{}
+ provider := &Provider{ExposedByDefault: true}
- services := fakeLoadTraefikLabels(test.services)
+ instances := fakeLoadTraefikLabels(test.instances)
- got, err := provider.buildConfigurationV1(services)
+ got, err := provider.buildConfigurationV1(instances)
assert.Equal(t, test.err, err) // , err.Error()
assert.Equal(t, test.expected, got, test.desc)
})
diff --git a/provider/ecs/ecs.go b/provider/ecs/ecs.go
index 187e3d88d..8be3d1e8f 100644
--- a/provider/ecs/ecs.go
+++ b/provider/ecs/ecs.go
@@ -6,7 +6,6 @@ import (
"strings"
"time"
- "github.com/BurntSushi/ty/fun"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
@@ -19,7 +18,6 @@ import (
"github.com/containous/traefik/job"
"github.com/containous/traefik/log"
"github.com/containous/traefik/provider"
- "github.com/containous/traefik/provider/label"
"github.com/containous/traefik/safe"
"github.com/containous/traefik/types"
)
@@ -105,7 +103,6 @@ func (p *Provider) createClient() (*awsClient, error) {
// Provide allows the ecs provider to provide configurations to traefik
// using the given configuration channel.
func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *safe.Pool, constraints types.Constraints) error {
-
p.Constraints = append(p.Constraints, constraints...)
handleCanceled := func(ctx context.Context, err error) error {
@@ -179,26 +176,6 @@ func wrapAws(ctx context.Context, req *request.Request) error {
return req.Send()
}
-func (p *Provider) loadECSConfig(ctx context.Context, client *awsClient) (*types.Configuration, error) {
- instances, err := p.listInstances(ctx, client)
- if err != nil {
- return nil, err
- }
-
- instances = fun.Filter(p.filterInstance, instances).([]ecsInstance)
-
- services := make(map[string][]ecsInstance)
-
- for _, instance := range instances {
- if serviceInstances, ok := services[instance.Name]; ok {
- services[instance.Name] = append(serviceInstances, instance)
- } else {
- services[instance.Name] = []ecsInstance{instance}
- }
- }
- return p.buildConfiguration(services)
-}
-
// Find all running Provider tasks in a cluster, also collect the task definitions (for docker labels)
// and the EC2 instance data
func (p *Provider) listInstances(ctx context.Context, client *awsClient) ([]ecsInstance, error) {
@@ -401,34 +378,13 @@ func (p *Provider) lookupTaskDefinitions(ctx context.Context, client *awsClient,
return taskDefinitions, nil
}
-func (p *Provider) filterInstance(i ecsInstance) bool {
-
- if labelPort := getStringValueV1(i, label.TraefikPort, ""); len(i.container.NetworkBindings) == 0 && labelPort == "" {
- log.Debugf("Filtering ecs instance without port %s (%s)", i.Name, i.ID)
- return false
+func (p *Provider) loadECSConfig(ctx context.Context, client *awsClient) (*types.Configuration, error) {
+ instances, err := p.listInstances(ctx, client)
+ if err != nil {
+ return nil, err
}
- if i.machine == nil || i.machine.State == nil || i.machine.State.Name == nil {
- log.Debugf("Filtering ecs instance in an missing ec2 information %s (%s)", i.Name, i.ID)
- return false
- }
-
- if aws.StringValue(i.machine.State.Name) != ec2.InstanceStateNameRunning {
- log.Debugf("Filtering ecs instance in an incorrect state %s (%s) (state = %s)", i.Name, i.ID, aws.StringValue(i.machine.State.Name))
- return false
- }
-
- if i.machine.PrivateIpAddress == nil {
- log.Debugf("Filtering ecs instance without an ip address %s (%s)", i.Name, i.ID)
- return false
- }
-
- if !isEnabled(i, p.ExposedByDefault) {
- log.Debugf("Filtering disabled ecs instance %s (%s)", i.Name, i.ID)
- return false
- }
-
- return true
+ return p.buildConfiguration(instances)
}
// Provider expects no more than 100 parameters be passed to a DescribeTask call; thus, pack
diff --git a/provider/eureka/config.go b/provider/eureka/config.go
index 8e27665c8..f5bfa99e4 100644
--- a/provider/eureka/config.go
+++ b/provider/eureka/config.go
@@ -52,6 +52,6 @@ func getProtocol(instance eureka.InstanceInfo) string {
return label.DefaultProtocol
}
-func getWeight(instance eureka.InstanceInfo) string {
- return label.GetStringValue(instance.Metadata.Map, label.TraefikWeight, label.DefaultWeight)
+func getWeight(instance eureka.InstanceInfo) int {
+ return label.GetIntValue(instance.Metadata.Map, label.TraefikWeight, label.DefaultWeight)
}
diff --git a/provider/eureka/config_test.go b/provider/eureka/config_test.go
index 9c029f844..222c7898d 100644
--- a/provider/eureka/config_test.go
+++ b/provider/eureka/config_test.go
@@ -91,11 +91,11 @@ func TestGetProtocol(t *testing.T) {
func TestGetWeight(t *testing.T) {
testCases := []struct {
- expectedWeight string
+ expectedWeight int
instanceInfo eureka.InstanceInfo
}{
{
- expectedWeight: "0",
+ expectedWeight: label.DefaultWeight,
instanceInfo: eureka.InstanceInfo{
Port: &eureka.Port{
Port: 80, Enabled: true,
@@ -106,7 +106,7 @@ func TestGetWeight(t *testing.T) {
},
},
{
- expectedWeight: "10",
+ expectedWeight: 10,
instanceInfo: eureka.InstanceInfo{
Port: &eureka.Port{
Port: 80, Enabled: true,
diff --git a/provider/kubernetes/builder_configuration_test.go b/provider/kubernetes/builder_configuration_test.go
index b9b32f512..4e53e9a1f 100644
--- a/provider/kubernetes/builder_configuration_test.go
+++ b/provider/kubernetes/builder_configuration_test.go
@@ -5,6 +5,7 @@ import (
"time"
"github.com/containous/flaeg"
+ "github.com/containous/traefik/provider/label"
"github.com/containous/traefik/tls"
"github.com/containous/traefik/types"
"github.com/stretchr/testify/assert"
@@ -448,11 +449,11 @@ func sampleConfiguration() *types.Configuration {
Servers: map[string]types.Server{
"http://10.10.0.1:8080": {
URL: "http://10.10.0.1:8080",
- Weight: 1,
+ Weight: label.DefaultWeight,
},
"http://10.21.0.1:8080": {
URL: "http://10.21.0.1:8080",
- Weight: 1,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -464,7 +465,7 @@ func sampleConfiguration() *types.Configuration {
Servers: map[string]types.Server{
"https://example.com": {
URL: "https://example.com",
- Weight: 1,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -476,11 +477,11 @@ func sampleConfiguration() *types.Configuration {
Servers: map[string]types.Server{
"https://10.15.0.1:8443": {
URL: "https://10.15.0.1:8443",
- Weight: 1,
+ Weight: label.DefaultWeight,
},
"https://10.15.0.2:9443": {
URL: "https://10.15.0.2:9443",
- Weight: 1,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
diff --git a/provider/kubernetes/client.go b/provider/kubernetes/client.go
index e3cb8254f..885f14b81 100644
--- a/provider/kubernetes/client.go
+++ b/provider/kubernetes/client.go
@@ -39,7 +39,7 @@ func (reh *resourceEventHandler) OnDelete(obj interface{}) {
// WatchAll starts the watch of the Provider resources and updates the stores.
// The stores can then be accessed via the Get* functions.
type Client interface {
- WatchAll(namespaces Namespaces, labelSelector string, stopCh <-chan struct{}) (<-chan interface{}, error)
+ WatchAll(namespaces Namespaces, stopCh <-chan struct{}) (<-chan interface{}, error)
GetIngresses() []*extensionsv1beta1.Ingress
GetService(namespace, name string) (*corev1.Service, bool, error)
GetSecret(namespace, name string) (*corev1.Secret, bool, error)
@@ -47,21 +47,22 @@ type Client interface {
}
type clientImpl struct {
- clientset *kubernetes.Clientset
- factories map[string]informers.SharedInformerFactory
- isNamespaceAll bool
+ clientset *kubernetes.Clientset
+ factories map[string]informers.SharedInformerFactory
+ ingressLabelSelector labels.Selector
+ isNamespaceAll bool
}
-func newClientImpl(clientset *kubernetes.Clientset) Client {
+func newClientImpl(clientset *kubernetes.Clientset) *clientImpl {
return &clientImpl{
clientset: clientset,
factories: make(map[string]informers.SharedInformerFactory),
}
}
-// NewInClusterClient returns a new Provider client that is expected to run
+// newInClusterClient returns a new Provider client that is expected to run
// inside the cluster.
-func NewInClusterClient(endpoint string) (Client, error) {
+func newInClusterClient(endpoint string) (*clientImpl, error) {
config, err := rest.InClusterConfig()
if err != nil {
return nil, fmt.Errorf("failed to create in-cluster configuration: %s", err)
@@ -74,10 +75,10 @@ func NewInClusterClient(endpoint string) (Client, error) {
return createClientFromConfig(config)
}
-// NewExternalClusterClient returns a new Provider client that may run outside
+// newExternalClusterClient returns a new Provider client that may run outside
// of the cluster.
// The endpoint parameter must not be empty.
-func NewExternalClusterClient(endpoint, token, caFilePath string) (Client, error) {
+func newExternalClusterClient(endpoint, token, caFilePath string) (*clientImpl, error) {
if endpoint == "" {
return nil, errors.New("endpoint missing for external cluster client")
}
@@ -99,7 +100,7 @@ func NewExternalClusterClient(endpoint, token, caFilePath string) (Client, error
return createClientFromConfig(config)
}
-func createClientFromConfig(c *rest.Config) (Client, error) {
+func createClientFromConfig(c *rest.Config) (*clientImpl, error) {
clientset, err := kubernetes.NewForConfig(c)
if err != nil {
return nil, err
@@ -109,24 +110,17 @@ func createClientFromConfig(c *rest.Config) (Client, error) {
}
// WatchAll starts namespace-specific controllers for all relevant kinds.
-func (c *clientImpl) WatchAll(namespaces Namespaces, labelSelector string, stopCh <-chan struct{}) (<-chan interface{}, error) {
+func (c *clientImpl) WatchAll(namespaces Namespaces, stopCh <-chan struct{}) (<-chan interface{}, error) {
eventCh := make(chan interface{}, 1)
- _, err := labels.Parse(labelSelector)
- if err != nil {
- return nil, err
- }
-
if len(namespaces) == 0 {
namespaces = Namespaces{metav1.NamespaceAll}
c.isNamespaceAll = true
}
- eventHandler := newResourceEventHandler(eventCh)
+ eventHandler := c.newResourceEventHandler(eventCh)
for _, ns := range namespaces {
- factory := informers.NewFilteredSharedInformerFactory(c.clientset, resyncPeriod, ns, func(opts *metav1.ListOptions) {
- opts.LabelSelector = labelSelector
- })
+ factory := informers.NewFilteredSharedInformerFactory(c.clientset, resyncPeriod, ns, nil)
factory.Extensions().V1beta1().Ingresses().Informer().AddEventHandler(eventHandler)
factory.Core().V1().Services().Informer().AddEventHandler(eventHandler)
factory.Core().V1().Endpoints().Informer().AddEventHandler(eventHandler)
@@ -161,7 +155,7 @@ func (c *clientImpl) WatchAll(namespaces Namespaces, labelSelector string, stopC
func (c *clientImpl) GetIngresses() []*extensionsv1beta1.Ingress {
var result []*extensionsv1beta1.Ingress
for ns, factory := range c.factories {
- ings, err := factory.Extensions().V1beta1().Ingresses().Lister().List(labels.Everything())
+ ings, err := factory.Extensions().V1beta1().Ingresses().Lister().List(c.ingressLabelSelector)
if err != nil {
log.Errorf("Failed to list ingresses in namespace %s: %s", ns, err)
}
@@ -215,8 +209,18 @@ func (c *clientImpl) lookupNamespace(ns string) string {
return ns
}
-func newResourceEventHandler(events chan<- interface{}) cache.ResourceEventHandler {
- return &resourceEventHandler{events}
+func (c *clientImpl) newResourceEventHandler(events chan<- interface{}) cache.ResourceEventHandler {
+ return &cache.FilteringResourceEventHandler{
+ FilterFunc: func(obj interface{}) bool {
+ // Ignore Ingresses that do not match our custom label selector.
+ if ing, ok := obj.(*extensionsv1beta1.Ingress); ok {
+ lbls := labels.Set(ing.GetLabels())
+ return c.ingressLabelSelector.Matches(lbls)
+ }
+ return true
+ },
+ Handler: &resourceEventHandler{events},
+ }
}
// eventHandlerFunc will pass the obj on to the events channel or drop it.
diff --git a/provider/kubernetes/client_mock_test.go b/provider/kubernetes/client_mock_test.go
index 22b58b8f1..c968e0d56 100644
--- a/provider/kubernetes/client_mock_test.go
+++ b/provider/kubernetes/client_mock_test.go
@@ -61,6 +61,6 @@ func (c clientMock) GetSecret(namespace, name string) (*corev1.Secret, bool, err
return nil, false, nil
}
-func (c clientMock) WatchAll(namespaces Namespaces, labelString string, stopCh <-chan struct{}) (<-chan interface{}, error) {
+func (c clientMock) WatchAll(namespaces Namespaces, stopCh <-chan struct{}) (<-chan interface{}, error) {
return c.watchChan, nil
}
diff --git a/provider/kubernetes/kubernetes.go b/provider/kubernetes/kubernetes.go
index 3c92bdfc0..41c944a8a 100644
--- a/provider/kubernetes/kubernetes.go
+++ b/provider/kubernetes/kubernetes.go
@@ -24,6 +24,7 @@ import (
"gopkg.in/yaml.v2"
corev1 "k8s.io/api/core/v1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
+ "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
)
@@ -45,24 +46,37 @@ type Provider struct {
DisablePassHostHeaders bool `description:"Kubernetes disable PassHost Headers" export:"true"`
EnablePassTLSCert bool `description:"Kubernetes enable Pass TLS Client Certs" export:"true"`
Namespaces Namespaces `description:"Kubernetes namespaces" export:"true"`
- LabelSelector string `description:"Kubernetes api label selector to use" export:"true"`
+ LabelSelector string `description:"Kubernetes Ingress label selector to use" export:"true"`
IngressClass string `description:"Value of kubernetes.io/ingress.class annotation to watch for" export:"true"`
lastConfiguration safe.Safe
}
-func (p *Provider) newK8sClient() (Client, error) {
+func (p *Provider) newK8sClient(ingressLabelSelector string) (Client, error) {
+ ingLabelSel, err := labels.Parse(ingressLabelSelector)
+ if err != nil {
+ return nil, fmt.Errorf("invalid ingress label selector: %q", ingressLabelSelector)
+ }
+ log.Infof("ingress label selector is: %q", ingLabelSel)
+
withEndpoint := ""
if p.Endpoint != "" {
withEndpoint = fmt.Sprintf(" with endpoint %v", p.Endpoint)
}
+ var cl *clientImpl
if os.Getenv("KUBERNETES_SERVICE_HOST") != "" && os.Getenv("KUBERNETES_SERVICE_PORT") != "" {
log.Infof("Creating in-cluster Provider client%s", withEndpoint)
- return NewInClusterClient(p.Endpoint)
+ cl, err = newInClusterClient(p.Endpoint)
+ } else {
+ log.Infof("Creating cluster-external Provider client%s", withEndpoint)
+ cl, err = newExternalClusterClient(p.Endpoint, p.Token, p.CertAuthFilePath)
}
- log.Infof("Creating cluster-external Provider client%s", withEndpoint)
- return NewExternalClusterClient(p.Endpoint, p.Token, p.CertAuthFilePath)
+ if err == nil {
+ cl.ingressLabelSelector = ingLabelSel
+ }
+
+ return cl, err
}
// Provide allows the k8s provider to provide configurations to traefik
@@ -83,7 +97,8 @@ func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *s
return fmt.Errorf("value for IngressClass has to be empty or start with the prefix %q, instead found %q", traefikDefaultIngressClass, p.IngressClass)
}
- k8sClient, err := p.newK8sClient()
+ log.Debugf("Using Ingress label selector: %q", p.LabelSelector)
+ k8sClient, err := p.newK8sClient(p.LabelSelector)
if err != nil {
return err
}
@@ -94,8 +109,7 @@ func (p *Provider) Provide(configurationChan chan<- types.ConfigMessage, pool *s
for {
stopWatch := make(chan struct{}, 1)
defer close(stopWatch)
- log.Debugf("Using label selector: '%s'", p.LabelSelector)
- eventsChan, err := k8sClient.WatchAll(p.Namespaces, p.LabelSelector, stopWatch)
+ eventsChan, err := k8sClient.WatchAll(p.Namespaces, stopWatch)
if err != nil {
log.Errorf("Error watching kubernetes events: %v", err)
timer := time.NewTimer(1 * time.Second)
@@ -267,7 +281,7 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
templateObjects.Backends[baseName].Servers[name] = types.Server{
URL: url,
- Weight: 1,
+ Weight: label.DefaultWeight,
}
} else {
endpoints, exists, err := k8sClient.GetEndpoints(service.Namespace, service.Name)
@@ -295,7 +309,7 @@ func (p *Provider) loadIngresses(k8sClient Client) (*types.Configuration, error)
}
templateObjects.Backends[baseName].Servers[name] = types.Server{
URL: url,
- Weight: 1,
+ Weight: label.DefaultWeight,
}
}
}
diff --git a/provider/kv/filler_test.go b/provider/kv/filler_test.go
index 806bdbead..8e6f7820c 100644
--- a/provider/kv/filler_test.go
+++ b/provider/kv/filler_test.go
@@ -116,9 +116,9 @@ func TestFiller(t *testing.T) {
{Key: "traefik/backends/backend.with.dot.too/servers", Value: []byte("")},
{Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot", Value: []byte("")},
{Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot.without.url", Value: []byte("")},
- {Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot.without.url/weight", Value: []byte("0")},
+ {Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot.without.url/weight", Value: []byte("1")},
{Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot/url", Value: []byte("http://172.17.0.2:80")},
- {Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot/weight", Value: []byte("0")},
+ {Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot/weight", Value: []byte("1")},
{Key: "traefik/frontends/frontend.with.dot", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/backend", Value: []byte("backend.with.dot.too")},
{Key: "traefik/frontends/frontend.with.dot/errors", Value: []byte("")},
@@ -157,8 +157,8 @@ func TestFiller(t *testing.T) {
withLimit("bar", "3", "6", "9"))),
backend("backend.with.dot.too",
withPair("servers/server.with.dot/url", "http://172.17.0.2:80"),
- withPair("servers/server.with.dot/weight", "0"),
- withPair("servers/server.with.dot.without.url/weight", "0")),
+ withPair("servers/server.with.dot/weight", "1"),
+ withPair("servers/server.with.dot.without.url/weight", "1")),
)
assert.EqualValues(t, expected, pairs1)
@@ -181,8 +181,8 @@ func TestFiller(t *testing.T) {
withPair("ratelimit/rateset/bar/period", "9")),
entry("backends/backend.with.dot.too",
withPair("servers/server.with.dot/url", "http://172.17.0.2:80"),
- withPair("servers/server.with.dot/weight", "0"),
- withPair("servers/server.with.dot.without.url/weight", "0")),
+ withPair("servers/server.with.dot/weight", "1"),
+ withPair("servers/server.with.dot.without.url/weight", "1")),
)
assert.EqualValues(t, expected, pairs2)
}
diff --git a/provider/kv/kv_config.go b/provider/kv/kv_config.go
index 2a629ffa6..10e657a8a 100644
--- a/provider/kv/kv_config.go
+++ b/provider/kv/kv_config.go
@@ -42,7 +42,7 @@ func (p *Provider) buildConfiguration() *types.Configuration {
// Frontend functions
"getBackendName": p.getFuncString(pathFrontendBackend, ""),
- "getPriority": p.getFuncInt(pathFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPriority": p.getFuncInt(pathFrontendPriority, label.DefaultFrontendPriority),
"getPassHostHeader": p.getPassHostHeader(),
"getPassTLSCert": p.getFuncBool(pathFrontendPassTLSCert, label.DefaultPassTLSCert),
"getEntryPoints": p.getFuncList(pathFrontendEntryPoints),
@@ -89,12 +89,12 @@ func (p *Provider) getPassHostHeader() func(rootPath string) bool {
value, err := strconv.ParseBool(rawValue)
if err != nil {
log.Errorf("Invalid value for %s %s: %s", rootPath, pathFrontendPassHostHeader, rawValue)
- return label.DefaultPassHostHeaderBool
+ return label.DefaultPassHostHeader
}
return value
}
- return p.getBool(label.DefaultPassHostHeaderBool, rootPath, pathFrontendPassHostHeaderDeprecated)
+ return p.getBool(label.DefaultPassHostHeader, rootPath, pathFrontendPassHostHeaderDeprecated)
}
}
@@ -402,7 +402,7 @@ func (p *Provider) getServers(rootPath string) map[string]types.Server {
serverName := p.last(serverKey)
servers[serverName] = types.Server{
URL: serverURL,
- Weight: p.getInt(0, serverKey, pathBackendServerWeight),
+ Weight: p.getInt(label.DefaultWeight, serverKey, pathBackendServerWeight),
}
}
diff --git a/provider/kv/kv_config_test.go b/provider/kv/kv_config_test.go
index ff3b35986..1bf28ac3f 100644
--- a/provider/kv/kv_config_test.go
+++ b/provider/kv/kv_config_test.go
@@ -32,8 +32,8 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair("routes/route.with.dot/rule", "Host:test.localhost")),
backend("backend.with.dot.too",
withPair("servers/server.with.dot/url", "http://172.17.0.2:80"),
- withPair("servers/server.with.dot/weight", "0"),
- withPair("servers/server.with.dot.without.url/weight", "0")),
+ withPair("servers/server.with.dot/weight", strconv.Itoa(label.DefaultWeight)),
+ withPair("servers/server.with.dot.without.url/weight", strconv.Itoa(label.DefaultWeight))),
),
expected: &types.Configuration{
Backends: map[string]*types.Backend{
@@ -42,7 +42,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server.with.dot": {
URL: "http://172.17.0.2:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -82,8 +82,8 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair(pathBackendBufferingMemRequestBodyBytes, "2097152"),
withPair(pathBackendBufferingRetryExpression, "IsNetworkError() && Attempts() <= 2"),
withPair("servers/server1/url", "http://172.17.0.2:80"),
- withPair("servers/server1/weight", "0"),
- withPair("servers/server2/weight", "0")),
+ withPair("servers/server1/weight", strconv.Itoa(label.DefaultWeight)),
+ withPair("servers/server2/weight", strconv.Itoa(label.DefaultWeight))),
frontend("frontend1",
withPair(pathFrontendBackend, "backend1"),
withPair(pathFrontendPriority, "6"),
@@ -148,7 +148,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server1": {
URL: "http://172.17.0.2:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: &types.CircuitBreaker{
@@ -2012,7 +2012,7 @@ func TestProviderGetServers(t *testing.T) {
expected: map[string]types.Server{
"server1": {
URL: "http://172.17.0.2:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -2027,7 +2027,7 @@ func TestProviderGetServers(t *testing.T) {
expected: map[string]types.Server{
"server1": {
URL: "http://172.17.0.2:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server2": {
URL: "http://172.17.0.3:80",
diff --git a/provider/label/label.go b/provider/label/label.go
index ff1fe368e..71f9e1a64 100644
--- a/provider/label/label.go
+++ b/provider/label/label.go
@@ -17,19 +17,21 @@ const (
// Default values
const (
- DefaultWeight = "0" // TODO [breaking] use int value
- DefaultWeightInt = 0 // TODO rename to DefaultWeight
+ DefaultWeight = 1
DefaultProtocol = "http"
- DefaultPassHostHeader = "true" // TODO [breaking] use bool value
- DefaultPassHostHeaderBool = true // TODO rename to DefaultPassHostHeader
+ DefaultPassHostHeader = true
DefaultPassTLSCert = false
- DefaultFrontendPriority = "0" // TODO [breaking] int value
- DefaultFrontendPriorityInt = 0 // TODO rename to DefaultFrontendPriority
+ DefaultFrontendPriority = 0
DefaultCircuitBreakerExpression = "NetworkErrorRatio() > 1"
DefaultBackendLoadBalancerMethod = "wrr"
DefaultBackendMaxconnExtractorFunc = "request.host"
DefaultBackendLoadbalancerStickinessCookieName = ""
DefaultBackendHealthCheckPort = 0
+
+ // TODO need to be remove in extra-service-fabric
+ DefaultWeightInt = 1 // Deprecated
+ DefaultPassHostHeaderBool = true // Deprecated
+ DefaultFrontendPriorityInt = 0 // Deprecated
)
var (
diff --git a/provider/label/label_test.go b/provider/label/label_test.go
index 6c6670f53..13a4476d4 100644
--- a/provider/label/label_test.go
+++ b/provider/label/label_test.go
@@ -602,17 +602,17 @@ func TestGetFuncString(t *testing.T) {
}{
{
labels: nil,
- labelName: TraefikWeight,
- defaultValue: DefaultWeight,
- expected: "0",
+ labelName: TraefikProtocol,
+ defaultValue: DefaultProtocol,
+ expected: "http",
},
{
labels: map[string]string{
- TraefikWeight: "10",
+ TraefikProtocol: "https",
},
- labelName: TraefikWeight,
- defaultValue: DefaultWeight,
- expected: "10",
+ labelName: TraefikProtocol,
+ defaultValue: DefaultProtocol,
+ expected: "https",
},
}
diff --git a/provider/marathon/config.go b/provider/marathon/config.go
index b9c1c9259..128d26768 100644
--- a/provider/marathon/config.go
+++ b/provider/marathon/config.go
@@ -43,9 +43,9 @@ func (p *Provider) buildConfigurationV2(applications *marathon.Applications) *ty
"getSegmentNameSuffix": getSegmentNameSuffix,
"getFrontendRule": p.getFrontendRule,
"getFrontendName": p.getFrontendName,
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
"getRedirect": label.GetRedirect,
@@ -339,7 +339,7 @@ func (p *Provider) getServer(app appData, task marathon.Task) (string, *types.Se
return serverName, &types.Server{
URL: fmt.Sprintf("%s://%s:%v", protocol, host, port),
- Weight: label.GetIntValue(app.SegmentLabels, label.TraefikWeight, label.DefaultWeightInt),
+ Weight: label.GetIntValue(app.SegmentLabels, label.TraefikWeight, label.DefaultWeight),
}, nil
}
diff --git a/provider/marathon/config_test.go b/provider/marathon/config_test.go
index a6f5ac6d1..709dd13b8 100644
--- a/provider/marathon/config_test.go
+++ b/provider/marathon/config_test.go
@@ -60,7 +60,7 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-app-taskID": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -119,7 +119,7 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-app-taskID": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: nil,
@@ -152,7 +152,7 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-app-taskID": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -307,14 +307,14 @@ func TestBuildConfiguration(t *testing.T) {
"500",
"600",
},
- Backend: "foobar",
+ Backend: "backendfoobar",
Query: "bar_query",
},
"foo": {
Status: []string{
"404",
},
- Backend: "foobar",
+ Backend: "backendfoobar",
Query: "foo_query",
},
},
@@ -420,11 +420,11 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-foo-v000-taskID-service-main": {
URL: "http://localhost:8080",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-foo-v001-taskID-service-main": {
URL: "http://localhost:8081",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -503,7 +503,7 @@ func TestBuildConfigurationSegments(t *testing.T) {
Servers: map[string]types.Server{
"server-app-taskID-service-web": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: &types.MaxConn{
@@ -515,7 +515,7 @@ func TestBuildConfigurationSegments(t *testing.T) {
Servers: map[string]types.Server{
"server-app-taskID-service-admin": {
URL: "http://localhost:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: &types.MaxConn{
@@ -674,14 +674,14 @@ func TestBuildConfigurationSegments(t *testing.T) {
"500",
"600",
},
- Backend: "foobar",
+ Backend: "backendfoobar",
Query: "bar_query",
},
"foo": {
Status: []string{
"404",
},
- Backend: "foobar",
+ Backend: "backendfoobar",
Query: "foo_query",
},
},
@@ -1278,15 +1278,15 @@ func TestGetServers(t *testing.T) {
expected: map[string]types.Server{
"server-A": {
URL: "http://1.1.1.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-B": {
URL: "http://1.1.1.2:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-C": {
URL: "http://1.1.1.3:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
diff --git a/provider/marathon/deprecated_config.go b/provider/marathon/deprecated_config.go
index c63962eb6..2e5b0a3a0 100644
--- a/provider/marathon/deprecated_config.go
+++ b/provider/marathon/deprecated_config.go
@@ -27,7 +27,7 @@ func (p *Provider) buildConfigurationV1(applications *marathon.Applications) *ty
"getPort": getPortV1,
"getServers": p.getServersV1,
- "getWeight": getFuncIntServiceV1(label.SuffixWeight, label.DefaultWeightInt),
+ "getWeight": getFuncIntServiceV1(label.SuffixWeight, label.DefaultWeight),
"getProtocol": getFuncStringServiceV1(label.SuffixProtocol, label.DefaultProtocol),
"hasCircuitBreakerLabels": hasFuncV1(label.TraefikBackendCircuitBreakerExpression),
"getCircuitBreakerExpression": getFuncStringV1(label.TraefikBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
@@ -46,9 +46,9 @@ func (p *Provider) buildConfigurationV1(applications *marathon.Applications) *ty
// Frontend functions
"getServiceNames": getServiceNamesV1,
"getServiceNameSuffix": getSegmentNameSuffix,
- "getPassHostHeader": getFuncBoolServiceV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPassHostHeader": getFuncBoolServiceV1(label.SuffixFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": getFuncBoolServiceV1(label.SuffixFrontendPassTLSCert, label.DefaultPassTLSCert),
- "getPriority": getFuncIntServiceV1(label.SuffixFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPriority": getFuncIntServiceV1(label.SuffixFrontendPriority, label.DefaultFrontendPriority),
"getEntryPoints": getFuncSliceStringServiceV1(label.SuffixFrontendEntryPoints),
"getFrontendRule": p.getFrontendRuleV1,
"getFrontendName": p.getFrontendNameV1,
@@ -323,7 +323,7 @@ func (p *Provider) getServersV1(application marathon.Application, serviceName st
serverName := provider.Normalize("server-" + task.ID + getSegmentNameSuffix(serviceName))
servers[serverName] = types.Server{
URL: fmt.Sprintf("%s://%s:%v", protocol, host, port),
- Weight: label.GetIntValue(labels, getLabelNameV1(serviceName, label.SuffixWeight), label.DefaultWeightInt),
+ Weight: label.GetIntValue(labels, getLabelNameV1(serviceName, label.SuffixWeight), label.DefaultWeight),
}
}
diff --git a/provider/marathon/deprecated_config_test.go b/provider/marathon/deprecated_config_test.go
index b03aa8f49..d6328e3b9 100644
--- a/provider/marathon/deprecated_config_test.go
+++ b/provider/marathon/deprecated_config_test.go
@@ -56,7 +56,7 @@ func TestBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-task": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -112,7 +112,7 @@ func TestBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-task": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: nil,
@@ -143,7 +143,7 @@ func TestBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-task": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -306,7 +306,7 @@ func TestBuildConfigurationServicesV1(t *testing.T) {
Servers: map[string]types.Server{
"server-task-service-web": {
URL: "http://localhost:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: &types.MaxConn{
@@ -318,7 +318,7 @@ func TestBuildConfigurationServicesV1(t *testing.T) {
Servers: map[string]types.Server{
"server-task-service-admin": {
URL: "http://localhost:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
MaxConn: &types.MaxConn{
diff --git a/provider/mesos/config.go b/provider/mesos/config.go
index 34f484b8d..7f825e505 100644
--- a/provider/mesos/config.go
+++ b/provider/mesos/config.go
@@ -39,8 +39,8 @@ func (p *Provider) buildConfigurationV2(tasks []state.Task) *types.Configuration
"getFrontEndName": getFrontendName,
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getFrontendRule": p.getFrontendRule,
"getRedirect": label.GetRedirect,
@@ -184,7 +184,7 @@ func (p *Provider) getServers(tasks []taskData) map[string]types.Server {
serverName := "server-" + getID(task)
servers[serverName] = types.Server{
URL: fmt.Sprintf("%s://%s:%s", protocol, host, port),
- Weight: getIntValue(task.TraefikLabels, label.TraefikWeight, label.DefaultWeightInt, math.MaxInt32),
+ Weight: getIntValue(task.TraefikLabels, label.TraefikWeight, label.DefaultWeight, math.MaxInt32),
}
}
diff --git a/provider/mesos/config_test.go b/provider/mesos/config_test.go
index 335858723..2fd96a0e4 100644
--- a/provider/mesos/config_test.go
+++ b/provider/mesos/config_test.go
@@ -90,11 +90,11 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-ID1": {
URL: "http://10.10.10.10:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-ID2": {
URL: "http://10.10.10.11:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -102,11 +102,11 @@ func TestBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-ID3": {
URL: "http://20.10.10.10:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-ID4": {
URL: "http://20.10.10.11:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -260,12 +260,12 @@ func TestBuildConfiguration(t *testing.T) {
"foo": {
Status: []string{"404"},
Query: "foo_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
"bar": {
Status: []string{"500", "600"},
Query: "bar_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
},
RateLimit: &types.RateLimit{
@@ -617,7 +617,7 @@ func TestGetServers(t *testing.T) {
expected: map[string]types.Server{
"server-ID1": {
URL: "http://10.10.10.10:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-ID2": {
URL: "http://10.10.10.11:81",
diff --git a/provider/mesos/deprecated_config.go b/provider/mesos/deprecated_config.go
index c7f22ee0d..cbd18ee41 100644
--- a/provider/mesos/deprecated_config.go
+++ b/provider/mesos/deprecated_config.go
@@ -24,7 +24,7 @@ func (p *Provider) buildConfigurationV1(tasks []state.Task) *types.Configuration
"getBackendName": getBackendNameV1,
"getHost": p.getHostV1,
"getProtocol": getFuncApplicationStringValueV1(label.TraefikProtocol, label.DefaultProtocol),
- "getWeight": getFuncApplicationIntValueV1(label.TraefikWeight, label.DefaultWeightInt),
+ "getWeight": getFuncApplicationIntValueV1(label.TraefikWeight, label.DefaultWeight),
"getBackend": getBackendV1,
"getPort": p.getPort,
@@ -33,8 +33,8 @@ func (p *Provider) buildConfigurationV1(tasks []state.Task) *types.Configuration
"getFrontEndName": getFrontendNameV1,
"getEntryPoints": getFuncSliceStringValueV1(label.TraefikFrontendEntryPoints),
"getBasicAuth": getFuncSliceStringValueV1(label.TraefikFrontendAuthBasic),
- "getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": getFuncIntValueV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": getFuncBoolValueV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getFrontendRule": p.getFrontendRuleV1,
}
diff --git a/provider/mesos/deprecated_config_test.go b/provider/mesos/deprecated_config_test.go
index 1366b8587..e2166097a 100644
--- a/provider/mesos/deprecated_config_test.go
+++ b/provider/mesos/deprecated_config_test.go
@@ -86,11 +86,11 @@ func TestBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-ID1": {
URL: "http://10.10.10.10:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-ID2": {
URL: "http://10.10.10.11:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
@@ -98,11 +98,11 @@ func TestBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-ID3": {
URL: "http://20.10.10.10:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
"server-ID4": {
URL: "http://20.10.10.11:81",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
diff --git a/provider/provider_test.go b/provider/provider_test.go
index 3e52f3cb5..b1b1ddaec 100644
--- a/provider/provider_test.go
+++ b/provider/provider_test.go
@@ -23,27 +23,25 @@ func (p *myProvider) Foo() string {
func TestConfigurationErrors(t *testing.T) {
templateErrorFile, err := ioutil.TempFile("", "provider-configuration-error")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
+
defer os.RemoveAll(templateErrorFile.Name())
+
data := []byte("Not a valid template {{ Bar }}")
+
err = ioutil.WriteFile(templateErrorFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
templateInvalidTOMLFile, err := ioutil.TempFile("", "provider-configuration-error")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
+
defer os.RemoveAll(templateInvalidTOMLFile.Name())
+
data = []byte(`Hello {{ .Name }}
{{ Foo }}`)
+
err = ioutil.WriteFile(templateInvalidTOMLFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
invalids := []struct {
provider *myProvider
@@ -54,10 +52,9 @@ func TestConfigurationErrors(t *testing.T) {
}{
{
provider: &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: "/non/existent/template.tmpl",
},
- nil,
},
expectedError: "open /non/existent/template.tmpl: no such file or directory",
},
@@ -68,19 +65,17 @@ func TestConfigurationErrors(t *testing.T) {
},
{
provider: &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateErrorFile.Name(),
},
- nil,
},
expectedError: `function "Bar" not defined`,
},
{
provider: &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateInvalidTOMLFile.Name(),
},
- nil,
},
expectedError: "Near line 1 (last key parsed 'Hello'): expected key separator '=', but got '<' instead",
funcMap: template.FuncMap{
@@ -97,18 +92,17 @@ func TestConfigurationErrors(t *testing.T) {
if err == nil || !strings.Contains(err.Error(), invalid.expectedError) {
t.Fatalf("should have generate an error with %q, got %v", invalid.expectedError, err)
}
- if configuration != nil {
- t.Fatalf("shouldn't have return a configuration object : %v", configuration)
- }
+
+ assert.Nil(t, configuration)
}
}
func TestGetConfiguration(t *testing.T) {
templateFile, err := ioutil.TempFile("", "provider-configuration")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
+
defer os.RemoveAll(templateFile.Name())
+
data := []byte(`[backends]
[backends.backend1]
[backends.backend1.circuitbreaker]
@@ -127,120 +121,103 @@ func TestGetConfiguration(t *testing.T) {
[frontends.frontend11.routes.test_2]
rule = "Path"
value = "/test"`)
+
err = ioutil.WriteFile(templateFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
provider := &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateFile.Name(),
},
- nil,
}
+
configuration, err := provider.GetConfiguration(templateFile.Name(), nil, nil)
- if err != nil {
- t.Fatalf("Shouldn't have error out, got %v", err)
- }
- if configuration == nil {
- t.Fatal("Configuration should not be nil, but was")
- }
+ require.NoError(t, err)
+
+ assert.NotNil(t, configuration)
}
func TestGetConfigurationReturnsCorrectMaxConnConfiguration(t *testing.T) {
templateFile, err := ioutil.TempFile("", "provider-configuration")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
+
defer os.RemoveAll(templateFile.Name())
+
data := []byte(`[backends]
[backends.backend1]
[backends.backend1.maxconn]
amount = 10
extractorFunc = "request.host"`)
+
err = ioutil.WriteFile(templateFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
provider := &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateFile.Name(),
},
- nil,
}
+
configuration, err := provider.GetConfiguration(templateFile.Name(), nil, nil)
- if err != nil {
- t.Fatalf("Shouldn't have error out, got %v", err)
- }
- if configuration == nil {
- t.Fatal("Configuration should not be nil, but was")
- }
+ require.NoError(t, err)
- if configuration.Backends["backend1"].MaxConn.Amount != 10 {
- t.Fatal("Configuration did not parse MaxConn.Amount properly")
- }
-
- if configuration.Backends["backend1"].MaxConn.ExtractorFunc != "request.host" {
- t.Fatal("Configuration did not parse MaxConn.ExtractorFunc properly")
- }
+ require.NotNil(t, configuration)
+ require.Contains(t, configuration.Backends, "backend1")
+ assert.EqualValues(t, 10, configuration.Backends["backend1"].MaxConn.Amount)
+ assert.Equal(t, "request.host", configuration.Backends["backend1"].MaxConn.ExtractorFunc)
}
func TestNilClientTLS(t *testing.T) {
- provider := &myProvider{
- BaseProvider{
+ p := &myProvider{
+ BaseProvider: BaseProvider{
Filename: "",
},
- nil,
- }
- _, err := provider.TLS.CreateTLSConfig()
- if err != nil {
- t.Fatal("CreateTLSConfig should assume that consumer does not want a TLS configuration if input is nil")
}
+
+ _, err := p.TLS.CreateTLSConfig()
+ require.NoError(t, err, "CreateTLSConfig should assume that consumer does not want a TLS configuration if input is nil")
}
func TestInsecureSkipVerifyClientTLS(t *testing.T) {
- provider := &myProvider{
- BaseProvider{
+ p := &myProvider{
+ BaseProvider: BaseProvider{
Filename: "",
},
- &types.ClientTLS{
+ TLS: &types.ClientTLS{
InsecureSkipVerify: true,
},
}
- config, err := provider.TLS.CreateTLSConfig()
- if err != nil {
- t.Fatal("CreateTLSConfig should assume that consumer does not want a TLS configuration if input is nil")
- }
- if !config.InsecureSkipVerify {
- t.Fatal("CreateTLSConfig should support setting only InsecureSkipVerify property")
- }
+
+ config, err := p.TLS.CreateTLSConfig()
+ require.NoError(t, err, "CreateTLSConfig should assume that consumer does not want a TLS configuration if input is nil")
+
+ assert.True(t, config.InsecureSkipVerify, "CreateTLSConfig should support setting only InsecureSkipVerify property")
}
func TestInsecureSkipVerifyFalseClientTLS(t *testing.T) {
- provider := &myProvider{
- BaseProvider{
+ p := &myProvider{
+ BaseProvider: BaseProvider{
Filename: "",
},
- &types.ClientTLS{
+ TLS: &types.ClientTLS{
InsecureSkipVerify: false,
},
}
- _, err := provider.TLS.CreateTLSConfig()
- if err == nil {
- t.Fatal("CreateTLSConfig should error if consumer does not set a TLS cert or key configuration and not chooses InsecureSkipVerify to be true")
- }
- t.Log(err)
+
+ _, err := p.TLS.CreateTLSConfig()
+ assert.Errorf(t, err, "CreateTLSConfig should error if consumer does not set a TLS cert or key configuration and not chooses InsecureSkipVerify to be true")
}
func TestMatchingConstraints(t *testing.T) {
- cases := []struct {
+ testCases := []struct {
+ desc string
constraints types.Constraints
tags []string
expected bool
}{
// simple test: must match
{
+ desc: "tag==us-east-1 with us-east-1",
constraints: types.Constraints{
{
Key: "tag",
@@ -255,6 +232,7 @@ func TestMatchingConstraints(t *testing.T) {
},
// simple test: must match but does not match
{
+ desc: "tag==us-east-1 with us-east-2",
constraints: types.Constraints{
{
Key: "tag",
@@ -269,6 +247,7 @@ func TestMatchingConstraints(t *testing.T) {
},
// simple test: must not match
{
+ desc: "tag!=us-east-1 with us-east-1",
constraints: types.Constraints{
{
Key: "tag",
@@ -283,6 +262,7 @@ func TestMatchingConstraints(t *testing.T) {
},
// complex test: globbing
{
+ desc: "tag!=us-east-* with us-east-1",
constraints: types.Constraints{
{
Key: "tag",
@@ -297,6 +277,7 @@ func TestMatchingConstraints(t *testing.T) {
},
// complex test: multiple constraints
{
+ desc: "tag==us-east-* & tag!=api with us-east-1 & api",
constraints: types.Constraints{
{
Key: "tag",
@@ -317,26 +298,23 @@ func TestMatchingConstraints(t *testing.T) {
},
}
- for i, c := range cases {
- provider := myProvider{
- BaseProvider{
- Constraints: c.constraints,
+ for _, test := range testCases {
+ p := myProvider{
+ BaseProvider: BaseProvider{
+ Constraints: test.constraints,
},
- nil,
- }
- actual, _ := provider.MatchConstraints(c.tags)
- if actual != c.expected {
- t.Fatalf("test #%v: expected %t, got %t, for %#v", i, c.expected, actual, c.constraints)
}
+
+ actual, _ := p.MatchConstraints(test.tags)
+ assert.Equal(t, test.expected, actual)
}
}
func TestDefaultFuncMap(t *testing.T) {
templateFile, err := ioutil.TempFile("", "provider-configuration")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
defer os.RemoveAll(templateFile.Name())
+
data := []byte(`
[backends]
[backends.{{ "backend-1" | replace "-" "" }}]
@@ -360,38 +338,30 @@ func TestDefaultFuncMap(t *testing.T) {
[frontends.frontend-1.routes.test_2]
rule = "Path"
value = "/test"`)
+
err = ioutil.WriteFile(templateFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
provider := &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateFile.Name(),
},
- nil,
}
+
configuration, err := provider.GetConfiguration(templateFile.Name(), nil, nil)
- if err != nil {
- t.Fatalf("Shouldn't have error out, got %v", err)
- }
- if configuration == nil {
- t.Fatal("Configuration should not be nil, but was")
- }
- if _, ok := configuration.Backends["backend1"]; !ok {
- t.Fatal("backend1 should exists, but it not")
- }
- if _, ok := configuration.Frontends["frontend-1"]; !ok {
- t.Fatal("Frontend frontend-1 should exists, but it not")
- }
+ require.NoError(t, err)
+
+ require.NotNil(t, configuration)
+ assert.Contains(t, configuration.Backends, "backend1")
+ assert.Contains(t, configuration.Frontends, "frontend-1")
}
func TestSprigFunctions(t *testing.T) {
templateFile, err := ioutil.TempFile("", "provider-configuration")
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
+
defer os.RemoveAll(templateFile.Name())
+
data := []byte(`
{{$backend_name := trimAll "-" uuidv4}}
[backends]
@@ -408,30 +378,22 @@ func TestSprigFunctions(t *testing.T) {
[frontends.frontend-1.routes.test_2]
rule = "Path"
value = "/test"`)
+
err = ioutil.WriteFile(templateFile.Name(), data, 0700)
- if err != nil {
- t.Fatal(err)
- }
+ require.NoError(t, err)
provider := &myProvider{
- BaseProvider{
+ BaseProvider: BaseProvider{
Filename: templateFile.Name(),
},
- nil,
}
+
configuration, err := provider.GetConfiguration(templateFile.Name(), nil, nil)
- if err != nil {
- t.Fatalf("Shouldn't have error out, got %v", err)
- }
- if configuration == nil {
- t.Fatal("Configuration should not be nil, but was")
- }
- if len(configuration.Backends) != 1 {
- t.Fatal("one backend should be defined, but it's not")
- }
- if _, ok := configuration.Frontends["frontend-1"]; !ok {
- t.Fatal("Frontend frontend-1 should exists, but it not")
- }
+ require.NoError(t, err)
+
+ require.NotNil(t, configuration)
+ assert.Len(t, configuration.Backends, 1)
+ assert.Contains(t, configuration.Frontends, "frontend-1")
}
func TestBaseProvider_GetConfiguration(t *testing.T) {
diff --git a/provider/rancher/config.go b/provider/rancher/config.go
index 110e6db94..494637d10 100644
--- a/provider/rancher/config.go
+++ b/provider/rancher/config.go
@@ -29,8 +29,8 @@ func (p *Provider) buildConfigurationV2(services []rancherData) *types.Configura
// Frontend functions
"getBackendName": getBackendName,
"getFrontendRule": p.getFrontendRule,
- "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": label.GetFuncInt(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": label.GetFuncBool(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getPassTLSCert": label.GetFuncBool(label.TraefikFrontendPassTLSCert, label.DefaultPassTLSCert),
"getEntryPoints": label.GetFuncSliceString(label.TraefikFrontendEntryPoints),
"getBasicAuth": label.GetFuncSliceString(label.TraefikFrontendAuthBasic),
@@ -170,7 +170,7 @@ func getServers(service rancherData) map[string]types.Server {
protocol := label.GetStringValue(service.SegmentLabels, label.TraefikProtocol, label.DefaultProtocol)
port := label.GetStringValue(service.SegmentLabels, label.TraefikPort, "")
- weight := label.GetIntValue(service.SegmentLabels, label.TraefikWeight, label.DefaultWeightInt)
+ weight := label.GetIntValue(service.SegmentLabels, label.TraefikWeight, label.DefaultWeight)
serverName := "server-" + strconv.Itoa(index)
servers[serverName] = types.Server{
diff --git a/provider/rancher/config_test.go b/provider/rancher/config_test.go
index 88aca6fb6..9be47c337 100644
--- a/provider/rancher/config_test.go
+++ b/provider/rancher/config_test.go
@@ -179,12 +179,12 @@ func TestProviderBuildConfiguration(t *testing.T) {
"foo": {
Status: []string{"404"},
Query: "foo_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
"bar": {
Status: []string{"500", "600"},
Query: "bar_query",
- Backend: "foobar",
+ Backend: "backend-foobar",
},
},
RateLimit: &types.RateLimit{
@@ -371,12 +371,12 @@ func TestProviderBuildConfiguration(t *testing.T) {
Errors: map[string]*types.ErrorPage{
"bar": {
Status: []string{"500", "600"},
- Backend: "foobar",
+ Backend: "backend-foobar",
Query: "bar_query",
},
"foo": {
Status: []string{"404"},
- Backend: "foobar",
+ Backend: "backend-foobar",
Query: "foo_query",
},
},
@@ -454,7 +454,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
Servers: map[string]types.Server{
"server-0": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
@@ -855,7 +855,7 @@ func TestGetServers(t *testing.T) {
expected: map[string]types.Server{
"server-0": {
URL: "http://10.10.10.0:",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
},
diff --git a/provider/rancher/deprecated_config.go b/provider/rancher/deprecated_config.go
index fa30b3fad..2e04ca7b8 100644
--- a/provider/rancher/deprecated_config.go
+++ b/provider/rancher/deprecated_config.go
@@ -18,7 +18,7 @@ func (p *Provider) buildConfigurationV1(services []rancherData) *types.Configura
// Backend functions
"getPort": getFuncStringV1(label.TraefikPort, ""),
"getProtocol": getFuncStringV1(label.TraefikProtocol, label.DefaultProtocol),
- "getWeight": getFuncIntV1(label.TraefikWeight, label.DefaultWeightInt),
+ "getWeight": getFuncIntV1(label.TraefikWeight, label.DefaultWeight),
"hasCircuitBreakerLabel": hasFuncV1(label.TraefikBackendCircuitBreakerExpression),
"getCircuitBreakerExpression": getFuncStringV1(label.TraefikBackendCircuitBreakerExpression, label.DefaultCircuitBreakerExpression),
"hasLoadBalancerLabel": hasLoadBalancerLabel,
@@ -33,8 +33,8 @@ func (p *Provider) buildConfigurationV1(services []rancherData) *types.Configura
// Frontend functions
"getBackend": getBackendNameV1,
"getFrontendRule": p.getFrontendRuleV1,
- "getPriority": getFuncIntV1(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
- "getPassHostHeader": getFuncBoolV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
+ "getPriority": getFuncIntV1(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
+ "getPassHostHeader": getFuncBoolV1(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
"getEntryPoints": getFuncSliceStringV1(label.TraefikFrontendEntryPoints),
"getBasicAuth": getFuncSliceStringV1(label.TraefikFrontendAuthBasic),
"hasRedirect": hasRedirect,
diff --git a/provider/rancher/deprecated_config_test.go b/provider/rancher/deprecated_config_test.go
index ab9d6d4af..6c92a889a 100644
--- a/provider/rancher/deprecated_config_test.go
+++ b/provider/rancher/deprecated_config_test.go
@@ -149,7 +149,7 @@ func TestProviderBuildConfigurationV1(t *testing.T) {
Servers: map[string]types.Server{
"server-0": {
URL: "http://127.0.0.1:80",
- Weight: 0,
+ Weight: label.DefaultWeight,
},
},
CircuitBreaker: nil,
diff --git a/server/server.go b/server/server.go
index 30ea7bf6f..4893ad725 100644
--- a/server/server.go
+++ b/server/server.go
@@ -30,6 +30,7 @@ import (
"github.com/containous/traefik/middlewares"
"github.com/containous/traefik/middlewares/accesslog"
mauth "github.com/containous/traefik/middlewares/auth"
+ "github.com/containous/traefik/middlewares/errorpages"
"github.com/containous/traefik/middlewares/redirect"
"github.com/containous/traefik/middlewares/tracing"
"github.com/containous/traefik/provider"
@@ -54,9 +55,7 @@ import (
"golang.org/x/net/http2"
)
-var (
- httpServerLogger = stdlog.New(log.WriterLevel(logrus.DebugLevel), "", 0)
-)
+var httpServerLogger = stdlog.New(log.WriterLevel(logrus.DebugLevel), "", 0)
// Server is the reverse-proxy/load-balancer engine
type Server struct {
@@ -912,6 +911,8 @@ func (s *Server) loadConfig(configurations types.Configurations, globalConfigura
redirectHandlers := make(map[string]negroni.Handler)
backends := map[string]http.Handler{}
backendsHealthCheck := map[string]*healthcheck.BackendHealthCheck{}
+ var errorPageHandlers []*errorpages.Handler
+
errorHandler := NewRecordingErrorHandler(middlewares.DefaultNetErrorRecorder{})
for providerName, config := range configurations {
@@ -1089,46 +1090,57 @@ func (s *Server) loadConfig(configurations types.Configurations, globalConfigura
}
if len(frontend.Errors) > 0 {
- for _, errorPage := range frontend.Errors {
- if config.Backends[errorPage.Backend] != nil && config.Backends[errorPage.Backend].Servers["error"].URL != "" {
- errorPageHandler, err := middlewares.NewErrorPagesHandler(errorPage, config.Backends[errorPage.Backend].Servers["error"].URL)
- if err != nil {
- log.Errorf("Error creating custom error page middleware, %v", err)
- } else {
- n.Use(errorPageHandler)
- }
+ for errorPageName, errorPage := range frontend.Errors {
+ if frontend.Backend == errorPage.Backend {
+ log.Errorf("Error when creating error page %q for frontend %q: error pages backend %q is the same as backend for the frontend (infinite call risk).",
+ errorPageName, frontendName, errorPage.Backend)
+ } else if config.Backends[errorPage.Backend] == nil {
+ log.Errorf("Error when creating error page %q for frontend %q: the backend %q doesn't exist.",
+ errorPageName, errorPage.Backend)
} else {
- log.Errorf("Error Page is configured for Frontend %s, but either Backend %s is not set or Backend URL is missing", frontendName, errorPage.Backend)
+ errorPagesHandler, err := errorpages.NewHandler(errorPage, entryPointName+providerName+errorPage.Backend)
+ if err != nil {
+ log.Errorf("Error creating error pages: %v", err)
+ } else {
+ if errorPageServer, ok := config.Backends[errorPage.Backend].Servers["error"]; ok {
+ errorPagesHandler.FallbackURL = errorPageServer.URL
+ }
+
+ errorPageHandlers = append(errorPageHandlers, errorPagesHandler)
+ n.Use(errorPagesHandler)
+ }
}
}
}
if frontend.RateLimit != nil && len(frontend.RateLimit.RateSet) > 0 {
lb, err = s.buildRateLimiter(lb, frontend.RateLimit)
- lb = s.wrapHTTPHandlerWithAccessLog(lb, fmt.Sprintf("rate limit for %s", frontendName))
if err != nil {
log.Errorf("Error creating rate limiter: %v", err)
log.Errorf("Skipping frontend %s...", frontendName)
continue frontend
}
+ lb = s.wrapHTTPHandlerWithAccessLog(lb, fmt.Sprintf("rate limit for %s", frontendName))
}
maxConns := config.Backends[frontend.Backend].MaxConn
if maxConns != nil && maxConns.Amount != 0 {
extractFunc, err := utils.NewExtractor(maxConns.ExtractorFunc)
if err != nil {
- log.Errorf("Error creating connlimit: %v", err)
+ log.Errorf("Error creating connection limit: %v", err)
log.Errorf("Skipping frontend %s...", frontendName)
continue frontend
}
- log.Debugf("Creating load-balancer connlimit")
+
+ log.Debugf("Creating load-balancer connection limit")
+
lb, err = connlimit.New(lb, extractFunc, maxConns.Amount)
- lb = s.wrapHTTPHandlerWithAccessLog(lb, fmt.Sprintf("connection limit for %s", frontendName))
if err != nil {
- log.Errorf("Error creating connlimit: %v", err)
+ log.Errorf("Error creating connection limit: %v", err)
log.Errorf("Skipping frontend %s...", frontendName)
continue frontend
}
+ lb = s.wrapHTTPHandlerWithAccessLog(lb, fmt.Sprintf("connection limit for %s", frontendName))
}
if globalConfiguration.Retry != nil {
@@ -1229,15 +1241,25 @@ func (s *Server) loadConfig(configurations types.Configurations, globalConfigura
}
}
}
+
+ for _, errorPageHandler := range errorPageHandlers {
+ if handler, ok := backends[errorPageHandler.BackendName]; ok {
+ errorPageHandler.PostLoad(handler)
+ } else {
+ errorPageHandler.PostLoad(nil)
+ }
+ }
+
healthcheck.GetHealthCheck(s.metricsRegistry).SetBackendsConfiguration(s.routinesPool.Ctx(), backendsHealthCheck)
+
// Get new certificates list sorted per entrypoints
// Update certificates
entryPointsCertificates, err := s.loadHTTPSConfiguration(configurations, globalConfiguration.DefaultEntryPoints)
+
// Sort routes and update certificates
for serverEntryPointName, serverEntryPoint := range serverEntryPoints {
serverEntryPoint.httpRouter.GetHandler().SortRoutes()
- _, exists := entryPointsCertificates[serverEntryPointName]
- if exists {
+ if _, exists := entryPointsCertificates[serverEntryPointName]; exists {
serverEntryPoint.certs.Set(entryPointsCertificates[serverEntryPointName])
}
}
diff --git a/server/server_test.go b/server/server_test.go
index b0d326d57..71c8cbca3 100644
--- a/server/server_test.go
+++ b/server/server_test.go
@@ -16,6 +16,7 @@ import (
"github.com/containous/traefik/healthcheck"
"github.com/containous/traefik/metrics"
"github.com/containous/traefik/middlewares"
+ "github.com/containous/traefik/provider/label"
"github.com/containous/traefik/rules"
"github.com/containous/traefik/testhelpers"
"github.com/containous/traefik/tls"
@@ -1220,7 +1221,7 @@ func buildBackend(backendBuilders ...func(*types.Backend)) *types.Backend {
func withServer(name, url string) func(backend *types.Backend) {
return func(be *types.Backend) {
- be.Servers[name] = types.Server{URL: url}
+ be.Servers[name] = types.Server{URL: url, Weight: label.DefaultWeight}
}
}
diff --git a/templates/consul_catalog.tmpl b/templates/consul_catalog.tmpl
index cea3bd5c6..ed30f0582 100644
--- a/templates/consul_catalog.tmpl
+++ b/templates/consul_catalog.tmpl
@@ -96,7 +96,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/templates/docker.tmpl b/templates/docker.tmpl
index 307275914..72387dbef 100644
--- a/templates/docker.tmpl
+++ b/templates/docker.tmpl
@@ -97,7 +97,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/templates/ecs.tmpl b/templates/ecs.tmpl
index 719e56f55..5b59889f5 100644
--- a/templates/ecs.tmpl
+++ b/templates/ecs.tmpl
@@ -96,7 +96,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/templates/marathon.tmpl b/templates/marathon.tmpl
index 83e04a9be..d9dfc3d6a 100644
--- a/templates/marathon.tmpl
+++ b/templates/marathon.tmpl
@@ -99,7 +99,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/templates/mesos.tmpl b/templates/mesos.tmpl
index 9ea840d7c..30e3cac4e 100644
--- a/templates/mesos.tmpl
+++ b/templates/mesos.tmpl
@@ -99,7 +99,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/templates/rancher.tmpl b/templates/rancher.tmpl
index e78e5d9aa..f275fe940 100644
--- a/templates/rancher.tmpl
+++ b/templates/rancher.tmpl
@@ -97,7 +97,7 @@
status = [{{range $page.Status }}
"{{.}}",
{{end}}]
- backend = "{{ $page.Backend }}"
+ backend = "backend-{{ $page.Backend }}"
query = "{{ $page.Query }}"
{{end}}
{{end}}
diff --git a/tls/generate/generate.go b/tls/generate/generate.go
index 8aa8bfbdb..d0660cba5 100644
--- a/tls/generate/generate.go
+++ b/tls/generate/generate.go
@@ -72,7 +72,7 @@ func derCert(privKey *rsa.PrivateKey, expiration time.Time, domain string) ([]by
}
if expiration.IsZero() {
- expiration = time.Now().Add(365)
+ expiration = time.Now().Add(365 * (24 * time.Hour))
}
template := x509.Certificate{
diff --git a/traefik.sample.toml b/traefik.sample.toml
index 8385ccbc5..788a12b4a 100644
--- a/traefik.sample.toml
+++ b/traefik.sample.toml
@@ -151,4 +151,4 @@
# Optional
# Default: true
#
-# exposedbydefault = true
+# exposedByDefault = true
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go
deleted file mode 100755
index a81f49b8e..000000000
--- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/models.go
+++ /dev/null
@@ -1,338 +0,0 @@
-package dns
-
-// Copyright (c) Microsoft and contributors. All rights reserved.
-//
-// 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.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator.
-// Changes may cause incorrect behavior and will be lost if the code is regenerated.
-
-import (
- "github.com/Azure/go-autorest/autorest"
- "github.com/Azure/go-autorest/autorest/to"
- "net/http"
-)
-
-// HTTPStatusCode enumerates the values for http status code.
-type HTTPStatusCode string
-
-const (
- // Accepted specifies the accepted state for http status code.
- Accepted HTTPStatusCode = "Accepted"
- // Ambiguous specifies the ambiguous state for http status code.
- Ambiguous HTTPStatusCode = "Ambiguous"
- // BadGateway specifies the bad gateway state for http status code.
- BadGateway HTTPStatusCode = "BadGateway"
- // BadRequest specifies the bad request state for http status code.
- BadRequest HTTPStatusCode = "BadRequest"
- // Conflict specifies the conflict state for http status code.
- Conflict HTTPStatusCode = "Conflict"
- // Continue specifies the continue state for http status code.
- Continue HTTPStatusCode = "Continue"
- // Created specifies the created state for http status code.
- Created HTTPStatusCode = "Created"
- // ExpectationFailed specifies the expectation failed state for http status code.
- ExpectationFailed HTTPStatusCode = "ExpectationFailed"
- // Forbidden specifies the forbidden state for http status code.
- Forbidden HTTPStatusCode = "Forbidden"
- // Found specifies the found state for http status code.
- Found HTTPStatusCode = "Found"
- // GatewayTimeout specifies the gateway timeout state for http status code.
- GatewayTimeout HTTPStatusCode = "GatewayTimeout"
- // Gone specifies the gone state for http status code.
- Gone HTTPStatusCode = "Gone"
- // HTTPVersionNotSupported specifies the http version not supported state for http status code.
- HTTPVersionNotSupported HTTPStatusCode = "HttpVersionNotSupported"
- // InternalServerError specifies the internal server error state for http status code.
- InternalServerError HTTPStatusCode = "InternalServerError"
- // LengthRequired specifies the length required state for http status code.
- LengthRequired HTTPStatusCode = "LengthRequired"
- // MethodNotAllowed specifies the method not allowed state for http status code.
- MethodNotAllowed HTTPStatusCode = "MethodNotAllowed"
- // Moved specifies the moved state for http status code.
- Moved HTTPStatusCode = "Moved"
- // MovedPermanently specifies the moved permanently state for http status code.
- MovedPermanently HTTPStatusCode = "MovedPermanently"
- // MultipleChoices specifies the multiple choices state for http status code.
- MultipleChoices HTTPStatusCode = "MultipleChoices"
- // NoContent specifies the no content state for http status code.
- NoContent HTTPStatusCode = "NoContent"
- // NonAuthoritativeInformation specifies the non authoritative information state for http status code.
- NonAuthoritativeInformation HTTPStatusCode = "NonAuthoritativeInformation"
- // NotAcceptable specifies the not acceptable state for http status code.
- NotAcceptable HTTPStatusCode = "NotAcceptable"
- // NotFound specifies the not found state for http status code.
- NotFound HTTPStatusCode = "NotFound"
- // NotImplemented specifies the not implemented state for http status code.
- NotImplemented HTTPStatusCode = "NotImplemented"
- // NotModified specifies the not modified state for http status code.
- NotModified HTTPStatusCode = "NotModified"
- // OK specifies the ok state for http status code.
- OK HTTPStatusCode = "OK"
- // PartialContent specifies the partial content state for http status code.
- PartialContent HTTPStatusCode = "PartialContent"
- // PaymentRequired specifies the payment required state for http status code.
- PaymentRequired HTTPStatusCode = "PaymentRequired"
- // PreconditionFailed specifies the precondition failed state for http status code.
- PreconditionFailed HTTPStatusCode = "PreconditionFailed"
- // ProxyAuthenticationRequired specifies the proxy authentication required state for http status code.
- ProxyAuthenticationRequired HTTPStatusCode = "ProxyAuthenticationRequired"
- // Redirect specifies the redirect state for http status code.
- Redirect HTTPStatusCode = "Redirect"
- // RedirectKeepVerb specifies the redirect keep verb state for http status code.
- RedirectKeepVerb HTTPStatusCode = "RedirectKeepVerb"
- // RedirectMethod specifies the redirect method state for http status code.
- RedirectMethod HTTPStatusCode = "RedirectMethod"
- // RequestedRangeNotSatisfiable specifies the requested range not satisfiable state for http status code.
- RequestedRangeNotSatisfiable HTTPStatusCode = "RequestedRangeNotSatisfiable"
- // RequestEntityTooLarge specifies the request entity too large state for http status code.
- RequestEntityTooLarge HTTPStatusCode = "RequestEntityTooLarge"
- // RequestTimeout specifies the request timeout state for http status code.
- RequestTimeout HTTPStatusCode = "RequestTimeout"
- // RequestURITooLong specifies the request uri too long state for http status code.
- RequestURITooLong HTTPStatusCode = "RequestUriTooLong"
- // ResetContent specifies the reset content state for http status code.
- ResetContent HTTPStatusCode = "ResetContent"
- // SeeOther specifies the see other state for http status code.
- SeeOther HTTPStatusCode = "SeeOther"
- // ServiceUnavailable specifies the service unavailable state for http status code.
- ServiceUnavailable HTTPStatusCode = "ServiceUnavailable"
- // SwitchingProtocols specifies the switching protocols state for http status code.
- SwitchingProtocols HTTPStatusCode = "SwitchingProtocols"
- // TemporaryRedirect specifies the temporary redirect state for http status code.
- TemporaryRedirect HTTPStatusCode = "TemporaryRedirect"
- // Unauthorized specifies the unauthorized state for http status code.
- Unauthorized HTTPStatusCode = "Unauthorized"
- // UnsupportedMediaType specifies the unsupported media type state for http status code.
- UnsupportedMediaType HTTPStatusCode = "UnsupportedMediaType"
- // Unused specifies the unused state for http status code.
- Unused HTTPStatusCode = "Unused"
- // UpgradeRequired specifies the upgrade required state for http status code.
- UpgradeRequired HTTPStatusCode = "UpgradeRequired"
- // UseProxy specifies the use proxy state for http status code.
- UseProxy HTTPStatusCode = "UseProxy"
-)
-
-// OperationStatus enumerates the values for operation status.
-type OperationStatus string
-
-const (
- // Failed specifies the failed state for operation status.
- Failed OperationStatus = "Failed"
- // InProgress specifies the in progress state for operation status.
- InProgress OperationStatus = "InProgress"
- // Succeeded specifies the succeeded state for operation status.
- Succeeded OperationStatus = "Succeeded"
-)
-
-// RecordType enumerates the values for record type.
-type RecordType string
-
-const (
- // A specifies the a state for record type.
- A RecordType = "A"
- // AAAA specifies the aaaa state for record type.
- AAAA RecordType = "AAAA"
- // CNAME specifies the cname state for record type.
- CNAME RecordType = "CNAME"
- // MX specifies the mx state for record type.
- MX RecordType = "MX"
- // NS specifies the ns state for record type.
- NS RecordType = "NS"
- // PTR specifies the ptr state for record type.
- PTR RecordType = "PTR"
- // SOA specifies the soa state for record type.
- SOA RecordType = "SOA"
- // SRV specifies the srv state for record type.
- SRV RecordType = "SRV"
- // TXT specifies the txt state for record type.
- TXT RecordType = "TXT"
-)
-
-// AaaaRecord is an AAAA record.
-type AaaaRecord struct {
- Ipv6Address *string `json:"ipv6Address,omitempty"`
-}
-
-// ARecord is an A record.
-type ARecord struct {
- Ipv4Address *string `json:"ipv4Address,omitempty"`
-}
-
-// CloudError is
-type CloudError struct {
- Error *CloudErrorBody `json:"error,omitempty"`
-}
-
-// CloudErrorBody is
-type CloudErrorBody struct {
- Code *string `json:"code,omitempty"`
- Message *string `json:"message,omitempty"`
- Target *string `json:"target,omitempty"`
- Details *[]CloudErrorBody `json:"details,omitempty"`
-}
-
-// CnameRecord is a CNAME record.
-type CnameRecord struct {
- Cname *string `json:"cname,omitempty"`
-}
-
-// MxRecord is an MX record.
-type MxRecord struct {
- Preference *int32 `json:"preference,omitempty"`
- Exchange *string `json:"exchange,omitempty"`
-}
-
-// NsRecord is an NS record.
-type NsRecord struct {
- Nsdname *string `json:"nsdname,omitempty"`
-}
-
-// PtrRecord is a PTR record.
-type PtrRecord struct {
- Ptrdname *string `json:"ptrdname,omitempty"`
-}
-
-// RecordSet is describes a DNS record set (a collection of DNS records with the same name and type).
-type RecordSet struct {
- autorest.Response `json:"-"`
- ID *string `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Type *string `json:"type,omitempty"`
- Etag *string `json:"etag,omitempty"`
- *RecordSetProperties `json:"properties,omitempty"`
-}
-
-// RecordSetListResult is the response to a record set List operation.
-type RecordSetListResult struct {
- autorest.Response `json:"-"`
- Value *[]RecordSet `json:"value,omitempty"`
- NextLink *string `json:"nextLink,omitempty"`
-}
-
-// RecordSetListResultPreparer prepares a request to retrieve the next set of results. It returns
-// nil if no more results exist.
-func (client RecordSetListResult) RecordSetListResultPreparer() (*http.Request, error) {
- if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
- return nil, nil
- }
- return autorest.Prepare(&http.Request{},
- autorest.AsJSON(),
- autorest.AsGet(),
- autorest.WithBaseURL(to.String(client.NextLink)))
-}
-
-// RecordSetProperties is represents the properties of the records in the record set.
-type RecordSetProperties struct {
- Metadata *map[string]*string `json:"metadata,omitempty"`
- TTL *int64 `json:"TTL,omitempty"`
- ARecords *[]ARecord `json:"ARecords,omitempty"`
- AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"`
- MxRecords *[]MxRecord `json:"MXRecords,omitempty"`
- NsRecords *[]NsRecord `json:"NSRecords,omitempty"`
- PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"`
- SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"`
- TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"`
- CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"`
- SoaRecord *SoaRecord `json:"SOARecord,omitempty"`
-}
-
-// RecordSetUpdateParameters is parameters supplied to update a record set.
-type RecordSetUpdateParameters struct {
- RecordSet *RecordSet `json:"RecordSet,omitempty"`
-}
-
-// Resource is
-type Resource struct {
- ID *string `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Type *string `json:"type,omitempty"`
- Location *string `json:"location,omitempty"`
- Tags *map[string]*string `json:"tags,omitempty"`
-}
-
-// SoaRecord is an SOA record.
-type SoaRecord struct {
- Host *string `json:"host,omitempty"`
- Email *string `json:"email,omitempty"`
- SerialNumber *int64 `json:"serialNumber,omitempty"`
- RefreshTime *int64 `json:"refreshTime,omitempty"`
- RetryTime *int64 `json:"retryTime,omitempty"`
- ExpireTime *int64 `json:"expireTime,omitempty"`
- MinimumTTL *int64 `json:"minimumTTL,omitempty"`
-}
-
-// SrvRecord is an SRV record.
-type SrvRecord struct {
- Priority *int32 `json:"priority,omitempty"`
- Weight *int32 `json:"weight,omitempty"`
- Port *int32 `json:"port,omitempty"`
- Target *string `json:"target,omitempty"`
-}
-
-// SubResource is
-type SubResource struct {
- ID *string `json:"id,omitempty"`
-}
-
-// TxtRecord is a TXT record.
-type TxtRecord struct {
- Value *[]string `json:"value,omitempty"`
-}
-
-// Zone is describes a DNS zone.
-type Zone struct {
- autorest.Response `json:"-"`
- ID *string `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Type *string `json:"type,omitempty"`
- Location *string `json:"location,omitempty"`
- Tags *map[string]*string `json:"tags,omitempty"`
- Etag *string `json:"etag,omitempty"`
- *ZoneProperties `json:"properties,omitempty"`
-}
-
-// ZoneDeleteResult is the response to a Zone Delete operation.
-type ZoneDeleteResult struct {
- autorest.Response `json:"-"`
- AzureAsyncOperation *string `json:"azureAsyncOperation,omitempty"`
- Status OperationStatus `json:"status,omitempty"`
- StatusCode HTTPStatusCode `json:"statusCode,omitempty"`
- RequestID *string `json:"requestId,omitempty"`
-}
-
-// ZoneListResult is the response to a Zone List or ListAll operation.
-type ZoneListResult struct {
- autorest.Response `json:"-"`
- Value *[]Zone `json:"value,omitempty"`
- NextLink *string `json:"nextLink,omitempty"`
-}
-
-// ZoneListResultPreparer prepares a request to retrieve the next set of results. It returns
-// nil if no more results exist.
-func (client ZoneListResult) ZoneListResultPreparer() (*http.Request, error) {
- if client.NextLink == nil || len(to.String(client.NextLink)) <= 0 {
- return nil, nil
- }
- return autorest.Prepare(&http.Request{},
- autorest.AsJSON(),
- autorest.AsGet(),
- autorest.WithBaseURL(to.String(client.NextLink)))
-}
-
-// ZoneProperties is represents the properties of the zone.
-type ZoneProperties struct {
- MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"`
- NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"`
- NameServers *[]string `json:"nameServers,omitempty"`
-}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/client.go
old mode 100755
new mode 100644
similarity index 77%
rename from vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go
rename to vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/client.go
index 714b698b5..482d2f943
--- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/client.go
+++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/client.go
@@ -1,4 +1,4 @@
-// Package dns implements the Azure ARM Dns service API version 2016-04-01.
+// Package dns implements the Azure ARM Dns service API version 2017-09-01.
//
// The DNS Management Client.
package dns
@@ -29,21 +29,21 @@ const (
DefaultBaseURI = "https://management.azure.com"
)
-// ManagementClient is the base client for Dns.
-type ManagementClient struct {
+// BaseClient is the base client for Dns.
+type BaseClient struct {
autorest.Client
BaseURI string
SubscriptionID string
}
-// New creates an instance of the ManagementClient client.
-func New(subscriptionID string) ManagementClient {
+// New creates an instance of the BaseClient client.
+func New(subscriptionID string) BaseClient {
return NewWithBaseURI(DefaultBaseURI, subscriptionID)
}
-// NewWithBaseURI creates an instance of the ManagementClient client.
-func NewWithBaseURI(baseURI string, subscriptionID string) ManagementClient {
- return ManagementClient{
+// NewWithBaseURI creates an instance of the BaseClient client.
+func NewWithBaseURI(baseURI string, subscriptionID string) BaseClient {
+ return BaseClient{
Client: autorest.NewClientWithUserAgent(UserAgent()),
BaseURI: baseURI,
SubscriptionID: subscriptionID,
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go
new file mode 100644
index 000000000..53d57a6ad
--- /dev/null
+++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go
@@ -0,0 +1,763 @@
+package dns
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// 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.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+import (
+ "encoding/json"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "github.com/Azure/go-autorest/autorest/to"
+ "net/http"
+)
+
+// RecordType enumerates the values for record type.
+type RecordType string
+
+const (
+ // A ...
+ A RecordType = "A"
+ // AAAA ...
+ AAAA RecordType = "AAAA"
+ // CAA ...
+ CAA RecordType = "CAA"
+ // CNAME ...
+ CNAME RecordType = "CNAME"
+ // MX ...
+ MX RecordType = "MX"
+ // NS ...
+ NS RecordType = "NS"
+ // PTR ...
+ PTR RecordType = "PTR"
+ // SOA ...
+ SOA RecordType = "SOA"
+ // SRV ...
+ SRV RecordType = "SRV"
+ // TXT ...
+ TXT RecordType = "TXT"
+)
+
+// PossibleRecordTypeValues returns an array of possible values for the RecordType const type.
+func PossibleRecordTypeValues() []RecordType {
+ return []RecordType{A, AAAA, CAA, CNAME, MX, NS, PTR, SOA, SRV, TXT}
+}
+
+// AaaaRecord an AAAA record.
+type AaaaRecord struct {
+ // Ipv6Address - The IPv6 address of this AAAA record.
+ Ipv6Address *string `json:"ipv6Address,omitempty"`
+}
+
+// ARecord an A record.
+type ARecord struct {
+ // Ipv4Address - The IPv4 address of this A record.
+ Ipv4Address *string `json:"ipv4Address,omitempty"`
+}
+
+// CaaRecord a CAA record.
+type CaaRecord struct {
+ // Flags - The flags for this CAA record as an integer between 0 and 255.
+ Flags *int32 `json:"flags,omitempty"`
+ // Tag - The tag for this CAA record.
+ Tag *string `json:"tag,omitempty"`
+ // Value - The value for this CAA record.
+ Value *string `json:"value,omitempty"`
+}
+
+// CloudError an error message
+type CloudError struct {
+ // Error - The error message body
+ Error *CloudErrorBody `json:"error,omitempty"`
+}
+
+// CloudErrorBody the body of an error message
+type CloudErrorBody struct {
+ // Code - The error code
+ Code *string `json:"code,omitempty"`
+ // Message - A description of what caused the error
+ Message *string `json:"message,omitempty"`
+ // Target - The target resource of the error message
+ Target *string `json:"target,omitempty"`
+ // Details - Extra error information
+ Details *[]CloudErrorBody `json:"details,omitempty"`
+}
+
+// CnameRecord a CNAME record.
+type CnameRecord struct {
+ // Cname - The canonical name for this CNAME record.
+ Cname *string `json:"cname,omitempty"`
+}
+
+// MxRecord an MX record.
+type MxRecord struct {
+ // Preference - The preference value for this MX record.
+ Preference *int32 `json:"preference,omitempty"`
+ // Exchange - The domain name of the mail host for this MX record.
+ Exchange *string `json:"exchange,omitempty"`
+}
+
+// NsRecord an NS record.
+type NsRecord struct {
+ // Nsdname - The name server name for this NS record.
+ Nsdname *string `json:"nsdname,omitempty"`
+}
+
+// PtrRecord a PTR record.
+type PtrRecord struct {
+ // Ptrdname - The PTR target domain name for this PTR record.
+ Ptrdname *string `json:"ptrdname,omitempty"`
+}
+
+// RecordSet describes a DNS record set (a collection of DNS records with the same name and type).
+type RecordSet struct {
+ autorest.Response `json:"-"`
+ // ID - The ID of the record set.
+ ID *string `json:"id,omitempty"`
+ // Name - The name of the record set.
+ Name *string `json:"name,omitempty"`
+ // Type - The type of the record set.
+ Type *string `json:"type,omitempty"`
+ // Etag - The etag of the record set.
+ Etag *string `json:"etag,omitempty"`
+ // RecordSetProperties - The properties of the record set.
+ *RecordSetProperties `json:"properties,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for RecordSet.
+func (rs RecordSet) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if rs.ID != nil {
+ objectMap["id"] = rs.ID
+ }
+ if rs.Name != nil {
+ objectMap["name"] = rs.Name
+ }
+ if rs.Type != nil {
+ objectMap["type"] = rs.Type
+ }
+ if rs.Etag != nil {
+ objectMap["etag"] = rs.Etag
+ }
+ if rs.RecordSetProperties != nil {
+ objectMap["properties"] = rs.RecordSetProperties
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for RecordSet struct.
+func (rs *RecordSet) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ rs.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ rs.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ rs.Type = &typeVar
+ }
+ case "etag":
+ if v != nil {
+ var etag string
+ err = json.Unmarshal(*v, &etag)
+ if err != nil {
+ return err
+ }
+ rs.Etag = &etag
+ }
+ case "properties":
+ if v != nil {
+ var recordSetProperties RecordSetProperties
+ err = json.Unmarshal(*v, &recordSetProperties)
+ if err != nil {
+ return err
+ }
+ rs.RecordSetProperties = &recordSetProperties
+ }
+ }
+ }
+
+ return nil
+}
+
+// RecordSetListResult the response to a record set List operation.
+type RecordSetListResult struct {
+ autorest.Response `json:"-"`
+ // Value - Information about the record sets in the response.
+ Value *[]RecordSet `json:"value,omitempty"`
+ // NextLink - The continuation token for the next page of results.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// RecordSetListResultIterator provides access to a complete listing of RecordSet values.
+type RecordSetListResultIterator struct {
+ i int
+ page RecordSetListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *RecordSetListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter RecordSetListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter RecordSetListResultIterator) Response() RecordSetListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter RecordSetListResultIterator) Value() RecordSet {
+ if !iter.page.NotDone() {
+ return RecordSet{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (rslr RecordSetListResult) IsEmpty() bool {
+ return rslr.Value == nil || len(*rslr.Value) == 0
+}
+
+// recordSetListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (rslr RecordSetListResult) recordSetListResultPreparer() (*http.Request, error) {
+ if rslr.NextLink == nil || len(to.String(rslr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(rslr.NextLink)))
+}
+
+// RecordSetListResultPage contains a page of RecordSet values.
+type RecordSetListResultPage struct {
+ fn func(RecordSetListResult) (RecordSetListResult, error)
+ rslr RecordSetListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *RecordSetListResultPage) Next() error {
+ next, err := page.fn(page.rslr)
+ if err != nil {
+ return err
+ }
+ page.rslr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page RecordSetListResultPage) NotDone() bool {
+ return !page.rslr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page RecordSetListResultPage) Response() RecordSetListResult {
+ return page.rslr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page RecordSetListResultPage) Values() []RecordSet {
+ if page.rslr.IsEmpty() {
+ return nil
+ }
+ return *page.rslr.Value
+}
+
+// RecordSetProperties represents the properties of the records in the record set.
+type RecordSetProperties struct {
+ // Metadata - The metadata attached to the record set.
+ Metadata map[string]*string `json:"metadata"`
+ // TTL - The TTL (time-to-live) of the records in the record set.
+ TTL *int64 `json:"TTL,omitempty"`
+ // Fqdn - Fully qualified domain name of the record set.
+ Fqdn *string `json:"fqdn,omitempty"`
+ // ARecords - The list of A records in the record set.
+ ARecords *[]ARecord `json:"ARecords,omitempty"`
+ // AaaaRecords - The list of AAAA records in the record set.
+ AaaaRecords *[]AaaaRecord `json:"AAAARecords,omitempty"`
+ // MxRecords - The list of MX records in the record set.
+ MxRecords *[]MxRecord `json:"MXRecords,omitempty"`
+ // NsRecords - The list of NS records in the record set.
+ NsRecords *[]NsRecord `json:"NSRecords,omitempty"`
+ // PtrRecords - The list of PTR records in the record set.
+ PtrRecords *[]PtrRecord `json:"PTRRecords,omitempty"`
+ // SrvRecords - The list of SRV records in the record set.
+ SrvRecords *[]SrvRecord `json:"SRVRecords,omitempty"`
+ // TxtRecords - The list of TXT records in the record set.
+ TxtRecords *[]TxtRecord `json:"TXTRecords,omitempty"`
+ // CnameRecord - The CNAME record in the record set.
+ CnameRecord *CnameRecord `json:"CNAMERecord,omitempty"`
+ // SoaRecord - The SOA record in the record set.
+ SoaRecord *SoaRecord `json:"SOARecord,omitempty"`
+ // CaaRecords - The list of CAA records in the record set.
+ CaaRecords *[]CaaRecord `json:"caaRecords,omitempty"`
+}
+
+// MarshalJSON is the custom marshaler for RecordSetProperties.
+func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if rsp.Metadata != nil {
+ objectMap["metadata"] = rsp.Metadata
+ }
+ if rsp.TTL != nil {
+ objectMap["TTL"] = rsp.TTL
+ }
+ if rsp.Fqdn != nil {
+ objectMap["fqdn"] = rsp.Fqdn
+ }
+ if rsp.ARecords != nil {
+ objectMap["ARecords"] = rsp.ARecords
+ }
+ if rsp.AaaaRecords != nil {
+ objectMap["AAAARecords"] = rsp.AaaaRecords
+ }
+ if rsp.MxRecords != nil {
+ objectMap["MXRecords"] = rsp.MxRecords
+ }
+ if rsp.NsRecords != nil {
+ objectMap["NSRecords"] = rsp.NsRecords
+ }
+ if rsp.PtrRecords != nil {
+ objectMap["PTRRecords"] = rsp.PtrRecords
+ }
+ if rsp.SrvRecords != nil {
+ objectMap["SRVRecords"] = rsp.SrvRecords
+ }
+ if rsp.TxtRecords != nil {
+ objectMap["TXTRecords"] = rsp.TxtRecords
+ }
+ if rsp.CnameRecord != nil {
+ objectMap["CNAMERecord"] = rsp.CnameRecord
+ }
+ if rsp.SoaRecord != nil {
+ objectMap["SOARecord"] = rsp.SoaRecord
+ }
+ if rsp.CaaRecords != nil {
+ objectMap["caaRecords"] = rsp.CaaRecords
+ }
+ return json.Marshal(objectMap)
+}
+
+// RecordSetUpdateParameters parameters supplied to update a record set.
+type RecordSetUpdateParameters struct {
+ // RecordSet - Specifies information about the record set being updated.
+ RecordSet *RecordSet `json:"RecordSet,omitempty"`
+}
+
+// Resource common properties of an Azure Resource Manager resource
+type Resource struct {
+ // ID - Resource ID.
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name.
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type.
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location.
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags.
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Resource.
+func (r Resource) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if r.ID != nil {
+ objectMap["id"] = r.ID
+ }
+ if r.Name != nil {
+ objectMap["name"] = r.Name
+ }
+ if r.Type != nil {
+ objectMap["type"] = r.Type
+ }
+ if r.Location != nil {
+ objectMap["location"] = r.Location
+ }
+ if r.Tags != nil {
+ objectMap["tags"] = r.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// SoaRecord an SOA record.
+type SoaRecord struct {
+ // Host - The domain name of the authoritative name server for this SOA record.
+ Host *string `json:"host,omitempty"`
+ // Email - The email contact for this SOA record.
+ Email *string `json:"email,omitempty"`
+ // SerialNumber - The serial number for this SOA record.
+ SerialNumber *int64 `json:"serialNumber,omitempty"`
+ // RefreshTime - The refresh value for this SOA record.
+ RefreshTime *int64 `json:"refreshTime,omitempty"`
+ // RetryTime - The retry time for this SOA record.
+ RetryTime *int64 `json:"retryTime,omitempty"`
+ // ExpireTime - The expire time for this SOA record.
+ ExpireTime *int64 `json:"expireTime,omitempty"`
+ // MinimumTTL - The minimum value for this SOA record. By convention this is used to determine the negative caching duration.
+ MinimumTTL *int64 `json:"minimumTTL,omitempty"`
+}
+
+// SrvRecord an SRV record.
+type SrvRecord struct {
+ // Priority - The priority value for this SRV record.
+ Priority *int32 `json:"priority,omitempty"`
+ // Weight - The weight value for this SRV record.
+ Weight *int32 `json:"weight,omitempty"`
+ // Port - The port value for this SRV record.
+ Port *int32 `json:"port,omitempty"`
+ // Target - The target domain name for this SRV record.
+ Target *string `json:"target,omitempty"`
+}
+
+// SubResource a reference to a another resource
+type SubResource struct {
+ // ID - Resource Id.
+ ID *string `json:"id,omitempty"`
+}
+
+// TxtRecord a TXT record.
+type TxtRecord struct {
+ // Value - The text value of this TXT record.
+ Value *[]string `json:"value,omitempty"`
+}
+
+// Zone describes a DNS zone.
+type Zone struct {
+ autorest.Response `json:"-"`
+ // Etag - The etag of the zone.
+ Etag *string `json:"etag,omitempty"`
+ // ZoneProperties - The properties of the zone.
+ *ZoneProperties `json:"properties,omitempty"`
+ // ID - Resource ID.
+ ID *string `json:"id,omitempty"`
+ // Name - Resource name.
+ Name *string `json:"name,omitempty"`
+ // Type - Resource type.
+ Type *string `json:"type,omitempty"`
+ // Location - Resource location.
+ Location *string `json:"location,omitempty"`
+ // Tags - Resource tags.
+ Tags map[string]*string `json:"tags"`
+}
+
+// MarshalJSON is the custom marshaler for Zone.
+func (z Zone) MarshalJSON() ([]byte, error) {
+ objectMap := make(map[string]interface{})
+ if z.Etag != nil {
+ objectMap["etag"] = z.Etag
+ }
+ if z.ZoneProperties != nil {
+ objectMap["properties"] = z.ZoneProperties
+ }
+ if z.ID != nil {
+ objectMap["id"] = z.ID
+ }
+ if z.Name != nil {
+ objectMap["name"] = z.Name
+ }
+ if z.Type != nil {
+ objectMap["type"] = z.Type
+ }
+ if z.Location != nil {
+ objectMap["location"] = z.Location
+ }
+ if z.Tags != nil {
+ objectMap["tags"] = z.Tags
+ }
+ return json.Marshal(objectMap)
+}
+
+// UnmarshalJSON is the custom unmarshaler for Zone struct.
+func (z *Zone) UnmarshalJSON(body []byte) error {
+ var m map[string]*json.RawMessage
+ err := json.Unmarshal(body, &m)
+ if err != nil {
+ return err
+ }
+ for k, v := range m {
+ switch k {
+ case "etag":
+ if v != nil {
+ var etag string
+ err = json.Unmarshal(*v, &etag)
+ if err != nil {
+ return err
+ }
+ z.Etag = &etag
+ }
+ case "properties":
+ if v != nil {
+ var zoneProperties ZoneProperties
+ err = json.Unmarshal(*v, &zoneProperties)
+ if err != nil {
+ return err
+ }
+ z.ZoneProperties = &zoneProperties
+ }
+ case "id":
+ if v != nil {
+ var ID string
+ err = json.Unmarshal(*v, &ID)
+ if err != nil {
+ return err
+ }
+ z.ID = &ID
+ }
+ case "name":
+ if v != nil {
+ var name string
+ err = json.Unmarshal(*v, &name)
+ if err != nil {
+ return err
+ }
+ z.Name = &name
+ }
+ case "type":
+ if v != nil {
+ var typeVar string
+ err = json.Unmarshal(*v, &typeVar)
+ if err != nil {
+ return err
+ }
+ z.Type = &typeVar
+ }
+ case "location":
+ if v != nil {
+ var location string
+ err = json.Unmarshal(*v, &location)
+ if err != nil {
+ return err
+ }
+ z.Location = &location
+ }
+ case "tags":
+ if v != nil {
+ var tags map[string]*string
+ err = json.Unmarshal(*v, &tags)
+ if err != nil {
+ return err
+ }
+ z.Tags = tags
+ }
+ }
+ }
+
+ return nil
+}
+
+// ZoneListResult the response to a Zone List or ListAll operation.
+type ZoneListResult struct {
+ autorest.Response `json:"-"`
+ // Value - Information about the DNS zones.
+ Value *[]Zone `json:"value,omitempty"`
+ // NextLink - The continuation token for the next page of results.
+ NextLink *string `json:"nextLink,omitempty"`
+}
+
+// ZoneListResultIterator provides access to a complete listing of Zone values.
+type ZoneListResultIterator struct {
+ i int
+ page ZoneListResultPage
+}
+
+// Next advances to the next value. If there was an error making
+// the request the iterator does not advance and the error is returned.
+func (iter *ZoneListResultIterator) Next() error {
+ iter.i++
+ if iter.i < len(iter.page.Values()) {
+ return nil
+ }
+ err := iter.page.Next()
+ if err != nil {
+ iter.i--
+ return err
+ }
+ iter.i = 0
+ return nil
+}
+
+// NotDone returns true if the enumeration should be started or is not yet complete.
+func (iter ZoneListResultIterator) NotDone() bool {
+ return iter.page.NotDone() && iter.i < len(iter.page.Values())
+}
+
+// Response returns the raw server response from the last page request.
+func (iter ZoneListResultIterator) Response() ZoneListResult {
+ return iter.page.Response()
+}
+
+// Value returns the current value or a zero-initialized value if the
+// iterator has advanced beyond the end of the collection.
+func (iter ZoneListResultIterator) Value() Zone {
+ if !iter.page.NotDone() {
+ return Zone{}
+ }
+ return iter.page.Values()[iter.i]
+}
+
+// IsEmpty returns true if the ListResult contains no values.
+func (zlr ZoneListResult) IsEmpty() bool {
+ return zlr.Value == nil || len(*zlr.Value) == 0
+}
+
+// zoneListResultPreparer prepares a request to retrieve the next set of results.
+// It returns nil if no more results exist.
+func (zlr ZoneListResult) zoneListResultPreparer() (*http.Request, error) {
+ if zlr.NextLink == nil || len(to.String(zlr.NextLink)) < 1 {
+ return nil, nil
+ }
+ return autorest.Prepare(&http.Request{},
+ autorest.AsJSON(),
+ autorest.AsGet(),
+ autorest.WithBaseURL(to.String(zlr.NextLink)))
+}
+
+// ZoneListResultPage contains a page of Zone values.
+type ZoneListResultPage struct {
+ fn func(ZoneListResult) (ZoneListResult, error)
+ zlr ZoneListResult
+}
+
+// Next advances to the next page of values. If there was an error making
+// the request the page does not advance and the error is returned.
+func (page *ZoneListResultPage) Next() error {
+ next, err := page.fn(page.zlr)
+ if err != nil {
+ return err
+ }
+ page.zlr = next
+ return nil
+}
+
+// NotDone returns true if the page enumeration should be started or is not yet complete.
+func (page ZoneListResultPage) NotDone() bool {
+ return !page.zlr.IsEmpty()
+}
+
+// Response returns the raw server response from the last page request.
+func (page ZoneListResultPage) Response() ZoneListResult {
+ return page.zlr
+}
+
+// Values returns the slice of values for the current page or nil if there are no values.
+func (page ZoneListResultPage) Values() []Zone {
+ if page.zlr.IsEmpty() {
+ return nil
+ }
+ return *page.zlr.Value
+}
+
+// ZoneProperties represents the properties of the zone.
+type ZoneProperties struct {
+ // MaxNumberOfRecordSets - The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
+ MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"`
+ // NumberOfRecordSets - The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
+ NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"`
+ // NameServers - The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored.
+ NameServers *[]string `json:"nameServers,omitempty"`
+}
+
+// ZonesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation.
+type ZonesDeleteFuture struct {
+ azure.Future
+ req *http.Request
+}
+
+// Result returns the result of the asynchronous operation.
+// If the operation has not completed it will return an error.
+func (future ZonesDeleteFuture) Result(client ZonesClient) (ar autorest.Response, err error) {
+ var done bool
+ done, err = future.Done(client)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Polling failure")
+ return
+ }
+ if !done {
+ return ar, azure.NewAsyncOpIncompleteError("dns.ZonesDeleteFuture")
+ }
+ if future.PollingMethod() == azure.PollingLocation {
+ ar, err = client.DeleteResponder(future.Response())
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Failure responding to request")
+ }
+ return
+ }
+ var req *http.Request
+ var resp *http.Response
+ if future.PollingURL() != "" {
+ req, err = http.NewRequest(http.MethodGet, future.PollingURL(), nil)
+ if err != nil {
+ return
+ }
+ } else {
+ req = autorest.ChangeToGet(future.req)
+ }
+ resp, err = autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", resp, "Failure sending request")
+ return
+ }
+ ar, err = client.DeleteResponder(resp)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", resp, "Failure responding to request")
+ }
+ return
+}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go
old mode 100755
new mode 100644
similarity index 66%
rename from vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go
rename to vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go
index 8d59929f7..45ea7a8c8
--- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/recordsets.go
+++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go
@@ -18,6 +18,7 @@ package dns
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
+ "context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
@@ -25,7 +26,7 @@ import (
// RecordSetsClient is the the DNS Management Client.
type RecordSetsClient struct {
- ManagementClient
+ BaseClient
}
// NewRecordSetsClient creates an instance of the RecordSetsClient client.
@@ -41,14 +42,14 @@ func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) Recor
// CreateOrUpdate creates or updates a record set within a DNS zone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the type
-// of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created when the
-// DNS zone is created). parameters is parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of the
-// record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to prevent
-// accidentally overwritting any concurrent changes. ifNoneMatch is set to '*' to allow a new record set to be created,
-// but to prevent updating an existing record set. Other values will be ignored.
-func (client RecordSetsClient) CreateOrUpdate(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) {
- req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
+// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the
+// type of DNS record in this record set. Record sets of type SOA can be updated but not created (they are created
+// when the DNS zone is created). parameters is parameters supplied to the CreateOrUpdate operation. ifMatch is the
+// etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag
+// value to prevent accidentally overwritting any concurrent changes. ifNoneMatch is set to '*' to allow a new
+// record set to be created, but to prevent updating an existing record set. Other values will be ignored.
+func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) {
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "CreateOrUpdate", nil, "Failure preparing request")
return
@@ -70,7 +71,7 @@ func (client RecordSetsClient) CreateOrUpdate(resourceGroupName string, zoneName
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
-func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) {
+func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recordType": autorest.Encode("path", recordType),
"relativeRecordSetName": relativeRecordSetName,
@@ -79,13 +80,13 @@ func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string,
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
- autorest.AsJSON(),
+ autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters),
@@ -99,13 +100,14 @@ func (client RecordSetsClient) CreateOrUpdatePreparer(resourceGroupName string,
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@@ -114,7 +116,7 @@ func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (res
err = autorest.Respond(
resp,
client.ByInspecting(),
- azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),
autorest.ByUnmarshallingJSON(&result),
autorest.ByClosing())
result.Response = autorest.Response{Response: resp}
@@ -124,12 +126,12 @@ func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (res
// Delete deletes a record set from a DNS zone. This operation cannot be undone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the type
-// of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS zone is
-// deleted). ifMatch is the etag of the record set. Omit this value to always delete the current record set. Specify
-// the last-seen etag value to prevent accidentally deleting any concurrent changes.
-func (client RecordSetsClient) Delete(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) {
- req, err := client.DeletePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch)
+// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the
+// type of DNS record in this record set. Record sets of type SOA cannot be deleted (they are deleted when the DNS
+// zone is deleted). ifMatch is the etag of the record set. Omit this value to always delete the current record
+// set. Specify the last-seen etag value to prevent accidentally deleting any concurrent changes.
+func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Delete", nil, "Failure preparing request")
return
@@ -151,7 +153,7 @@ func (client RecordSetsClient) Delete(resourceGroupName string, zoneName string,
}
// DeletePreparer prepares the Delete request.
-func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) {
+func (client RecordSetsClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recordType": autorest.Encode("path", recordType),
"relativeRecordSetName": relativeRecordSetName,
@@ -160,7 +162,7 @@ func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -174,13 +176,14 @@ func (client RecordSetsClient) DeletePreparer(resourceGroupName string, zoneName
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) DeleteSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// DeleteResponder handles the response to the Delete request. The method always
@@ -189,7 +192,7 @@ func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result auto
err = autorest.Respond(
resp,
client.ByInspecting(),
- azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusOK),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),
autorest.ByClosing())
result.Response = resp
return
@@ -198,10 +201,10 @@ func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result auto
// Get gets a record set.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the type
-// of DNS record in this record set.
-func (client RecordSetsClient) Get(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) {
- req, err := client.GetPreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType)
+// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the
+// type of DNS record in this record set.
+func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Get", nil, "Failure preparing request")
return
@@ -223,7 +226,7 @@ func (client RecordSetsClient) Get(resourceGroupName string, zoneName string, re
}
// GetPreparer prepares the Get request.
-func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) {
+func (client RecordSetsClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recordType": autorest.Encode("path", recordType),
"relativeRecordSetName": relativeRecordSetName,
@@ -232,7 +235,7 @@ func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName st
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -242,13 +245,14 @@ func (client RecordSetsClient) GetPreparer(resourceGroupName string, zoneName st
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) GetSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
@@ -271,8 +275,9 @@ func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordS
// recordsetnamesuffix is the suffix label of the record set name that has to be used to filter the record set
// enumerations. If this parameter is specified, Enumeration will return only records that end with
// .
-func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResult, err error) {
- req, err := client.ListByDNSZonePreparer(resourceGroupName, zoneName, top, recordsetnamesuffix)
+func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) {
+ result.fn = client.listByDNSZoneNextResults
+ req, err := client.ListByDNSZonePreparer(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing request")
return
@@ -280,12 +285,12 @@ func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName
resp, err := client.ListByDNSZoneSender(req)
if err != nil {
- result.Response = autorest.Response{Response: resp}
+ result.rslr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending request")
return
}
- result, err = client.ListByDNSZoneResponder(resp)
+ result.rslr, err = client.ListByDNSZoneResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to request")
}
@@ -294,14 +299,14 @@ func (client RecordSetsClient) ListByDNSZone(resourceGroupName string, zoneName
}
// ListByDNSZonePreparer prepares the ListByDNSZone request.
-func (client RecordSetsClient) ListByDNSZonePreparer(resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (*http.Request, error) {
+func (client RecordSetsClient) ListByDNSZonePreparer(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -317,13 +322,14 @@ func (client RecordSetsClient) ListByDNSZonePreparer(resourceGroupName string, z
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/recordsets", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByDNSZoneSender sends the ListByDNSZone request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) ListByDNSZoneSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// ListByDNSZoneResponder handles the response to the ListByDNSZone request. The method always
@@ -339,84 +345,43 @@ func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (resu
return
}
-// ListByDNSZoneNextResults retrieves the next set of results, if any.
-func (client RecordSetsClient) ListByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) {
- req, err := lastResults.RecordSetListResultPreparer()
+// listByDNSZoneNextResults retrieves the next set of results, if any.
+func (client RecordSetsClient) listByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) {
+ req, err := lastResults.recordSetListResultPreparer()
if err != nil {
- return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", nil, "Failure preparing next results request")
+ return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
-
resp, err := client.ListByDNSZoneSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
- return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure sending next results request")
+ return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure sending next results request")
}
-
result, err = client.ListByDNSZoneResponder(resp)
if err != nil {
- err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByDNSZone", resp, "Failure responding to next results request")
+ err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", resp, "Failure responding to next results request")
}
-
return
}
-// ListByDNSZoneComplete gets all elements from the list without paging.
-func (client RecordSetsClient) ListByDNSZoneComplete(resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string, cancel <-chan struct{}) (<-chan RecordSet, <-chan error) {
- resultChan := make(chan RecordSet)
- errChan := make(chan error, 1)
- go func() {
- defer func() {
- close(resultChan)
- close(errChan)
- }()
- list, err := client.ListByDNSZone(resourceGroupName, zoneName, top, recordsetnamesuffix)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- for list.NextLink != nil {
- list, err = client.ListByDNSZoneNextResults(list)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- }
- }()
- return resultChan, errChan
+// ListByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required.
+func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) {
+ result.page, err = client.ListByDNSZone(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix)
+ return
}
// ListByType lists the record sets of a specified type in a DNS zone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). recordType is the type of record sets to enumerate. top is the maximum number of record sets to return. If not
-// specified, returns up to 100 record sets. recordsetnamesuffix is the suffix label of the record set name that has to
-// be used to filter the record set enumerations. If this parameter is specified, Enumeration will return only records
-// that end with .
-func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResult, err error) {
- req, err := client.ListByTypePreparer(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix)
+// dot). recordType is the type of record sets to enumerate. top is the maximum number of record sets to return. If
+// not specified, returns up to 100 record sets. recordsetnamesuffix is the suffix label of the record set name
+// that has to be used to filter the record set enumerations. If this parameter is specified, Enumeration will
+// return only records that end with .
+func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) {
+ result.fn = client.listByTypeNextResults
+ req, err := client.ListByTypePreparer(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing request")
return
@@ -424,12 +389,12 @@ func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName str
resp, err := client.ListByTypeSender(req)
if err != nil {
- result.Response = autorest.Response{Response: resp}
+ result.rslr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending request")
return
}
- result, err = client.ListByTypeResponder(resp)
+ result.rslr, err = client.ListByTypeResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to request")
}
@@ -438,7 +403,7 @@ func (client RecordSetsClient) ListByType(resourceGroupName string, zoneName str
}
// ListByTypePreparer prepares the ListByType request.
-func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (*http.Request, error) {
+func (client RecordSetsClient) ListByTypePreparer(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recordType": autorest.Encode("path", recordType),
"resourceGroupName": autorest.Encode("path", resourceGroupName),
@@ -446,7 +411,7 @@ func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zone
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -462,13 +427,14 @@ func (client RecordSetsClient) ListByTypePreparer(resourceGroupName string, zone
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByTypeSender sends the ListByType request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) ListByTypeSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// ListByTypeResponder handles the response to the ListByType request. The method always
@@ -484,84 +450,42 @@ func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result
return
}
-// ListByTypeNextResults retrieves the next set of results, if any.
-func (client RecordSetsClient) ListByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) {
- req, err := lastResults.RecordSetListResultPreparer()
+// listByTypeNextResults retrieves the next set of results, if any.
+func (client RecordSetsClient) listByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) {
+ req, err := lastResults.recordSetListResultPreparer()
if err != nil {
- return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", nil, "Failure preparing next results request")
+ return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
-
resp, err := client.ListByTypeSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
- return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure sending next results request")
+ return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure sending next results request")
}
-
result, err = client.ListByTypeResponder(resp)
if err != nil {
- err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "ListByType", resp, "Failure responding to next results request")
+ err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", resp, "Failure responding to next results request")
}
-
return
}
-// ListByTypeComplete gets all elements from the list without paging.
-func (client RecordSetsClient) ListByTypeComplete(resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string, cancel <-chan struct{}) (<-chan RecordSet, <-chan error) {
- resultChan := make(chan RecordSet)
- errChan := make(chan error, 1)
- go func() {
- defer func() {
- close(resultChan)
- close(errChan)
- }()
- list, err := client.ListByType(resourceGroupName, zoneName, recordType, top, recordsetnamesuffix)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- for list.NextLink != nil {
- list, err = client.ListByTypeNextResults(list)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- }
- }()
- return resultChan, errChan
+// ListByTypeComplete enumerates all values, automatically crossing page boundaries as required.
+func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) {
+ result.page, err = client.ListByType(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix)
+ return
}
// Update updates a record set within a DNS zone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the type
-// of DNS record in this record set. parameters is parameters supplied to the Update operation. ifMatch is the etag of
-// the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag value to
-// prevent accidentally overwritting concurrent changes.
-func (client RecordSetsClient) Update(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) {
- req, err := client.UpdatePreparer(resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch)
+// dot). relativeRecordSetName is the name of the record set, relative to the name of the zone. recordType is the
+// type of DNS record in this record set. parameters is parameters supplied to the Update operation. ifMatch is the
+// etag of the record set. Omit this value to always overwrite the current record set. Specify the last-seen etag
+// value to prevent accidentally overwritting concurrent changes.
+func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) {
+ req, err := client.UpdatePreparer(ctx, resourceGroupName, zoneName, relativeRecordSetName, recordType, parameters, ifMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.RecordSetsClient", "Update", nil, "Failure preparing request")
return
@@ -583,7 +507,7 @@ func (client RecordSetsClient) Update(resourceGroupName string, zoneName string,
}
// UpdatePreparer prepares the Update request.
-func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) {
+func (client RecordSetsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"recordType": autorest.Encode("path", recordType),
"relativeRecordSetName": relativeRecordSetName,
@@ -592,13 +516,13 @@ func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
- autorest.AsJSON(),
+ autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPatch(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}/{recordType}/{relativeRecordSetName}", pathParameters),
@@ -608,13 +532,14 @@ func (client RecordSetsClient) UpdatePreparer(resourceGroupName string, zoneName
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// UpdateSender sends the Update request. The method will close the
// http.Response Body if it receives an error.
func (client RecordSetsClient) UpdateSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// UpdateResponder handles the response to the Update request. The method always
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/version.go
old mode 100755
new mode 100644
similarity index 87%
rename from vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go
rename to vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/version.go
index d5ade9afd..0556b6130
--- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/version.go
+++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/version.go
@@ -1,5 +1,7 @@
package dns
+import "github.com/Azure/azure-sdk-for-go/version"
+
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,10 +21,10 @@ package dns
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
- return "Azure-SDK-For-Go/v11.0.0-beta arm-dns/2016-04-01"
+ return "Azure-SDK-For-Go/" + version.Number + " dns/2017-09-01"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
- return "v11.0.0-beta"
+ return version.Number
}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go
old mode 100755
new mode 100644
similarity index 63%
rename from vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go
rename to vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go
index 33b230b03..04ac760d0
--- a/vendor/github.com/Azure/azure-sdk-for-go/arm/dns/zones.go
+++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go
@@ -18,6 +18,7 @@ package dns
// Changes may cause incorrect behavior and will be lost if the code is regenerated.
import (
+ "context"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
"net/http"
@@ -25,7 +26,7 @@ import (
// ZonesClient is the the DNS Management Client.
type ZonesClient struct {
- ManagementClient
+ BaseClient
}
// NewZonesClient creates an instance of the ZonesClient client.
@@ -41,12 +42,12 @@ func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClien
// CreateOrUpdate creates or updates a DNS zone. Does not modify DNS records within the zone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). parameters is parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of the DNS zone. Omit
-// this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally
-// overwritting any concurrent changes. ifNoneMatch is set to '*' to allow a new DNS zone to be created, but to prevent
-// updating an existing zone. Other values will be ignored.
-func (client ZonesClient) CreateOrUpdate(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) {
- req, err := client.CreateOrUpdatePreparer(resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch)
+// dot). parameters is parameters supplied to the CreateOrUpdate operation. ifMatch is the etag of the DNS zone.
+// Omit this value to always overwrite the current zone. Specify the last-seen etag value to prevent accidentally
+// overwritting any concurrent changes. ifNoneMatch is set to '*' to allow a new DNS zone to be created, but to
+// prevent updating an existing zone. Other values will be ignored.
+func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) {
+ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, zoneName, parameters, ifMatch, ifNoneMatch)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "CreateOrUpdate", nil, "Failure preparing request")
return
@@ -68,20 +69,20 @@ func (client ZonesClient) CreateOrUpdate(resourceGroupName string, zoneName stri
}
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
-func (client ZonesClient) CreateOrUpdatePreparer(resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) {
+func (client ZonesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
preparer := autorest.CreatePreparer(
- autorest.AsJSON(),
+ autorest.AsContentType("application/json; charset=utf-8"),
autorest.AsPut(),
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters),
@@ -95,13 +96,14 @@ func (client ZonesClient) CreateOrUpdatePreparer(resourceGroupName string, zoneN
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-None-Match", autorest.String(ifNoneMatch)))
}
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
// http.Response Body if it receives an error.
func (client ZonesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
@@ -118,56 +120,36 @@ func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Z
}
// Delete deletes a DNS zone. WARNING: All DNS records in the zone will also be deleted. This operation cannot be
-// undone. This method may poll for completion. Polling can be canceled by passing the cancel channel argument. The
-// channel will be used to cancel polling and any outstanding HTTP requests.
+// undone.
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
-// dot). ifMatch is the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen
-// etag value to prevent accidentally deleting any concurrent changes.
-func (client ZonesClient) Delete(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (<-chan ZoneDeleteResult, <-chan error) {
- resultChan := make(chan ZoneDeleteResult, 1)
- errChan := make(chan error, 1)
- go func() {
- var err error
- var result ZoneDeleteResult
- defer func() {
- if err != nil {
- errChan <- err
- }
- resultChan <- result
- close(resultChan)
- close(errChan)
- }()
- req, err := client.DeletePreparer(resourceGroupName, zoneName, ifMatch, cancel)
- if err != nil {
- err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request")
- return
- }
+// dot). ifMatch is the etag of the DNS zone. Omit this value to always delete the current zone. Specify the
+// last-seen etag value to prevent accidentally deleting any concurrent changes.
+func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) {
+ req, err := client.DeletePreparer(ctx, resourceGroupName, zoneName, ifMatch)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", nil, "Failure preparing request")
+ return
+ }
- resp, err := client.DeleteSender(req)
- if err != nil {
- result.Response = autorest.Response{Response: resp}
- err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure sending request")
- return
- }
+ result, err = client.DeleteSender(req)
+ if err != nil {
+ err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", result.Response(), "Failure sending request")
+ return
+ }
- result, err = client.DeleteResponder(resp)
- if err != nil {
- err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Delete", resp, "Failure responding to request")
- }
- }()
- return resultChan, errChan
+ return
}
// DeletePreparer prepares the Delete request.
-func (client ZonesClient) DeletePreparer(resourceGroupName string, zoneName string, ifMatch string, cancel <-chan struct{}) (*http.Request, error) {
+func (client ZonesClient) DeletePreparer(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -181,27 +163,33 @@ func (client ZonesClient) DeletePreparer(resourceGroupName string, zoneName stri
preparer = autorest.DecoratePreparer(preparer,
autorest.WithHeader("If-Match", autorest.String(ifMatch)))
}
- return preparer.Prepare(&http.Request{Cancel: cancel})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// DeleteSender sends the Delete request. The method will close the
// http.Response Body if it receives an error.
-func (client ZonesClient) DeleteSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client,
- req,
- azure.DoPollForAsynchronous(client.PollingDelay))
+func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFuture, err error) {
+ sender := autorest.DecorateSender(client, azure.DoRetryWithRegistration(client.Client))
+ future.Future = azure.NewFuture(req)
+ future.req = req
+ _, err = future.Done(sender)
+ if err != nil {
+ return
+ }
+ err = autorest.Respond(future.Response(),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent))
+ return
}
// DeleteResponder handles the response to the Delete request. The method always
// closes the http.Response Body.
-func (client ZonesClient) DeleteResponder(resp *http.Response) (result ZoneDeleteResult, err error) {
+func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
err = autorest.Respond(
resp,
client.ByInspecting(),
- azure.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
- autorest.ByUnmarshallingJSON(&result),
+ azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent),
autorest.ByClosing())
- result.Response = autorest.Response{Response: resp}
+ result.Response = resp
return
}
@@ -209,8 +197,8 @@ func (client ZonesClient) DeleteResponder(resp *http.Response) (result ZoneDelet
//
// resourceGroupName is the name of the resource group. zoneName is the name of the DNS zone (without a terminating
// dot).
-func (client ZonesClient) Get(resourceGroupName string, zoneName string) (result Zone, err error) {
- req, err := client.GetPreparer(resourceGroupName, zoneName)
+func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) {
+ req, err := client.GetPreparer(ctx, resourceGroupName, zoneName)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "Get", nil, "Failure preparing request")
return
@@ -232,14 +220,14 @@ func (client ZonesClient) Get(resourceGroupName string, zoneName string) (result
}
// GetPreparer prepares the Get request.
-func (client ZonesClient) GetPreparer(resourceGroupName string, zoneName string) (*http.Request, error) {
+func (client ZonesClient) GetPreparer(ctx context.Context, resourceGroupName string, zoneName string) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
"zoneName": autorest.Encode("path", zoneName),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -249,13 +237,14 @@ func (client ZonesClient) GetPreparer(resourceGroupName string, zoneName string)
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones/{zoneName}", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// GetSender sends the Get request. The method will close the
// http.Response Body if it receives an error.
func (client ZonesClient) GetSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// GetResponder handles the response to the Get request. The method always
@@ -274,8 +263,9 @@ func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err er
// List lists the DNS zones in all resource groups in a subscription.
//
// top is the maximum number of DNS zones to return. If not specified, returns up to 100 zones.
-func (client ZonesClient) List(top *int32) (result ZoneListResult, err error) {
- req, err := client.ListPreparer(top)
+func (client ZonesClient) List(ctx context.Context, top *int32) (result ZoneListResultPage, err error) {
+ result.fn = client.listNextResults
+ req, err := client.ListPreparer(ctx, top)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing request")
return
@@ -283,12 +273,12 @@ func (client ZonesClient) List(top *int32) (result ZoneListResult, err error) {
resp, err := client.ListSender(req)
if err != nil {
- result.Response = autorest.Response{Response: resp}
+ result.zlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending request")
return
}
- result, err = client.ListResponder(resp)
+ result.zlr, err = client.ListResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to request")
}
@@ -297,12 +287,12 @@ func (client ZonesClient) List(top *int32) (result ZoneListResult, err error) {
}
// ListPreparer prepares the List request.
-func (client ZonesClient) ListPreparer(top *int32) (*http.Request, error) {
+func (client ZonesClient) ListPreparer(ctx context.Context, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -315,13 +305,14 @@ func (client ZonesClient) ListPreparer(top *int32) (*http.Request, error) {
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/dnszones", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListSender sends the List request. The method will close the
// http.Response Body if it receives an error.
func (client ZonesClient) ListSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// ListResponder handles the response to the List request. The method always
@@ -337,81 +328,40 @@ func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListRes
return
}
-// ListNextResults retrieves the next set of results, if any.
-func (client ZonesClient) ListNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) {
- req, err := lastResults.ZoneListResultPreparer()
+// listNextResults retrieves the next set of results, if any.
+func (client ZonesClient) listNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) {
+ req, err := lastResults.zoneListResultPreparer()
if err != nil {
- return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", nil, "Failure preparing next results request")
+ return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
-
resp, err := client.ListSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
- return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure sending next results request")
+ return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure sending next results request")
}
-
result, err = client.ListResponder(resp)
if err != nil {
- err = autorest.NewErrorWithError(err, "dns.ZonesClient", "List", resp, "Failure responding to next results request")
+ err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", resp, "Failure responding to next results request")
}
-
return
}
-// ListComplete gets all elements from the list without paging.
-func (client ZonesClient) ListComplete(top *int32, cancel <-chan struct{}) (<-chan Zone, <-chan error) {
- resultChan := make(chan Zone)
- errChan := make(chan error, 1)
- go func() {
- defer func() {
- close(resultChan)
- close(errChan)
- }()
- list, err := client.List(top)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- for list.NextLink != nil {
- list, err = client.ListNextResults(list)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- }
- }()
- return resultChan, errChan
+// ListComplete enumerates all values, automatically crossing page boundaries as required.
+func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result ZoneListResultIterator, err error) {
+ result.page, err = client.List(ctx, top)
+ return
}
// ListByResourceGroup lists the DNS zones within a resource group.
//
// resourceGroupName is the name of the resource group. top is the maximum number of record sets to return. If not
// specified, returns up to 100 record sets.
-func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int32) (result ZoneListResult, err error) {
- req, err := client.ListByResourceGroupPreparer(resourceGroupName, top)
+func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) {
+ result.fn = client.listByResourceGroupNextResults
+ req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName, top)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing request")
return
@@ -419,12 +369,12 @@ func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
- result.Response = autorest.Response{Response: resp}
+ result.zlr.Response = autorest.Response{Response: resp}
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending request")
return
}
- result, err = client.ListByResourceGroupResponder(resp)
+ result.zlr, err = client.ListByResourceGroupResponder(resp)
if err != nil {
err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to request")
}
@@ -433,13 +383,13 @@ func (client ZonesClient) ListByResourceGroup(resourceGroupName string, top *int
}
// ListByResourceGroupPreparer prepares the ListByResourceGroup request.
-func (client ZonesClient) ListByResourceGroupPreparer(resourceGroupName string, top *int32) (*http.Request, error) {
+func (client ZonesClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string, top *int32) (*http.Request, error) {
pathParameters := map[string]interface{}{
"resourceGroupName": autorest.Encode("path", resourceGroupName),
"subscriptionId": autorest.Encode("path", client.SubscriptionID),
}
- const APIVersion = "2016-04-01"
+ const APIVersion = "2017-09-01"
queryParameters := map[string]interface{}{
"api-version": APIVersion,
}
@@ -452,13 +402,14 @@ func (client ZonesClient) ListByResourceGroupPreparer(resourceGroupName string,
autorest.WithBaseURL(client.BaseURI),
autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsZones", pathParameters),
autorest.WithQueryParameters(queryParameters))
- return preparer.Prepare(&http.Request{})
+ return preparer.Prepare((&http.Request{}).WithContext(ctx))
}
// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the
// http.Response Body if it receives an error.
func (client ZonesClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) {
- return autorest.SendWithSender(client, req)
+ return autorest.SendWithSender(client, req,
+ azure.DoRetryWithRegistration(client.Client))
}
// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always
@@ -474,71 +425,29 @@ func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (res
return
}
-// ListByResourceGroupNextResults retrieves the next set of results, if any.
-func (client ZonesClient) ListByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) {
- req, err := lastResults.ZoneListResultPreparer()
+// listByResourceGroupNextResults retrieves the next set of results, if any.
+func (client ZonesClient) listByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) {
+ req, err := lastResults.zoneListResultPreparer()
if err != nil {
- return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", nil, "Failure preparing next results request")
+ return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request")
}
if req == nil {
return
}
-
resp, err := client.ListByResourceGroupSender(req)
if err != nil {
result.Response = autorest.Response{Response: resp}
- return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure sending next results request")
+ return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure sending next results request")
}
-
result, err = client.ListByResourceGroupResponder(resp)
if err != nil {
- err = autorest.NewErrorWithError(err, "dns.ZonesClient", "ListByResourceGroup", resp, "Failure responding to next results request")
+ err = autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request")
}
-
return
}
-// ListByResourceGroupComplete gets all elements from the list without paging.
-func (client ZonesClient) ListByResourceGroupComplete(resourceGroupName string, top *int32, cancel <-chan struct{}) (<-chan Zone, <-chan error) {
- resultChan := make(chan Zone)
- errChan := make(chan error, 1)
- go func() {
- defer func() {
- close(resultChan)
- close(errChan)
- }()
- list, err := client.ListByResourceGroup(resourceGroupName, top)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- for list.NextLink != nil {
- list, err = client.ListByResourceGroupNextResults(list)
- if err != nil {
- errChan <- err
- return
- }
- if list.Value != nil {
- for _, item := range *list.Value {
- select {
- case <-cancel:
- return
- case resultChan <- item:
- // Intentionally left blank
- }
- }
- }
- }
- }()
- return resultChan, errChan
+// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required.
+func (client ZonesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultIterator, err error) {
+ result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top)
+ return
}
diff --git a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go
new file mode 100644
index 000000000..2cd4c1b1f
--- /dev/null
+++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go
@@ -0,0 +1,21 @@
+package version
+
+// Copyright (c) Microsoft and contributors. All rights reserved.
+//
+// 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.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is regenerated.
+
+// Number contains the semantic version of this SDK.
+const Number = "v15.0.1"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go
index 12375e0e4..f570d540a 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go
@@ -1,5 +1,19 @@
package adal
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"fmt"
"net/url"
@@ -18,8 +32,24 @@ type OAuthConfig struct {
DeviceCodeEndpoint url.URL
}
+// IsZero returns true if the OAuthConfig object is zero-initialized.
+func (oac OAuthConfig) IsZero() bool {
+ return oac == OAuthConfig{}
+}
+
+func validateStringParam(param, name string) error {
+ if len(param) == 0 {
+ return fmt.Errorf("parameter '" + name + "' cannot be empty")
+ }
+ return nil
+}
+
// NewOAuthConfig returns an OAuthConfig with tenant specific urls
func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) {
+ if err := validateStringParam(activeDirectoryEndpoint, "activeDirectoryEndpoint"); err != nil {
+ return nil, err
+ }
+ // it's legal for tenantID to be empty so don't validate it
const activeDirectoryEndpointTemplate = "%s/oauth2/%s?api-version=%s"
u, err := url.Parse(activeDirectoryEndpoint)
if err != nil {
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go
index 6c511f8c8..b38f4c245 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/adal/devicetoken.go
@@ -1,5 +1,19 @@
package adal
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
/*
This file is largely based on rjw57/oauth2device's code, with the follow differences:
* scope -> resource, and only allow a single one
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go b/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go
deleted file mode 100644
index e87911e83..000000000
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/msi.go
+++ /dev/null
@@ -1,6 +0,0 @@
-// +build !windows
-
-package adal
-
-// msiPath is the path to the MSI Extension settings file (to discover the endpoint)
-var msiPath = "/var/lib/waagent/ManagedIdentity-Settings"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go b/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go
deleted file mode 100644
index 80f800432..000000000
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/msi_windows.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build windows
-
-package adal
-
-import (
- "os"
- "strings"
-)
-
-// msiPath is the path to the MSI Extension settings file (to discover the endpoint)
-var msiPath = strings.Join([]string{os.Getenv("SystemDrive"), "WindowsAzure/Config/ManagedIdentity-Settings"}, "/")
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go
index 73711c667..9e15f2751 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/adal/persist.go
@@ -1,5 +1,19 @@
package adal
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"encoding/json"
"fmt"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
index 7928c971a..0e5ad14d3 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go
@@ -1,5 +1,19 @@
package adal
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"net/http"
)
diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go
index 2ac8c3c22..b61b3eb8e 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go
@@ -1,5 +1,19 @@
package adal
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"crypto/rand"
"crypto/rsa"
@@ -13,6 +27,7 @@ import (
"net/url"
"strconv"
"strings"
+ "sync"
"time"
"github.com/Azure/go-autorest/autorest/date"
@@ -28,11 +43,20 @@ const (
// OAuthGrantTypeClientCredentials is the "grant_type" identifier used in credential flows
OAuthGrantTypeClientCredentials = "client_credentials"
+ // OAuthGrantTypeUserPass is the "grant_type" identifier used in username and password auth flows
+ OAuthGrantTypeUserPass = "password"
+
// OAuthGrantTypeRefreshToken is the "grant_type" identifier used in refresh token flows
OAuthGrantTypeRefreshToken = "refresh_token"
+ // OAuthGrantTypeAuthorizationCode is the "grant_type" identifier used in authorization code flows
+ OAuthGrantTypeAuthorizationCode = "authorization_code"
+
// metadataHeader is the header required by MSI extension
metadataHeader = "Metadata"
+
+ // msiEndpoint is the well known endpoint for getting MSI authentications tokens
+ msiEndpoint = "http://169.254.169.254/metadata/identity/oauth2/token"
)
// OAuthTokenProvider is an interface which should be implemented by an access token retriever
@@ -40,6 +64,12 @@ type OAuthTokenProvider interface {
OAuthToken() string
}
+// TokenRefreshError is an interface used by errors returned during token refresh.
+type TokenRefreshError interface {
+ error
+ Response() *http.Response
+}
+
// Refresher is an interface for token refresh functionality
type Refresher interface {
Refresh() error
@@ -64,6 +94,11 @@ type Token struct {
Type string `json:"token_type"`
}
+// IsZero returns true if the token object is zero-initialized.
+func (t Token) IsZero() bool {
+ return t == Token{}
+}
+
// Expires returns the time.Time when the Token expires.
func (t Token) Expires() time.Time {
s, err := strconv.Atoi(t.ExpiresOn)
@@ -131,6 +166,34 @@ type ServicePrincipalCertificateSecret struct {
type ServicePrincipalMSISecret struct {
}
+// ServicePrincipalUsernamePasswordSecret implements ServicePrincipalSecret for username and password auth.
+type ServicePrincipalUsernamePasswordSecret struct {
+ Username string
+ Password string
+}
+
+// ServicePrincipalAuthorizationCodeSecret implements ServicePrincipalSecret for authorization code auth.
+type ServicePrincipalAuthorizationCodeSecret struct {
+ ClientSecret string
+ AuthorizationCode string
+ RedirectURI string
+}
+
+// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
+func (secret *ServicePrincipalAuthorizationCodeSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
+ v.Set("code", secret.AuthorizationCode)
+ v.Set("client_secret", secret.ClientSecret)
+ v.Set("redirect_uri", secret.RedirectURI)
+ return nil
+}
+
+// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
+func (secret *ServicePrincipalUsernamePasswordSecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
+ v.Set("username", secret.Username)
+ v.Set("password", secret.Password)
+ return nil
+}
+
// SetAuthenticationValues is a method of the interface ServicePrincipalSecret.
func (msiSecret *ServicePrincipalMSISecret) SetAuthenticationValues(spt *ServicePrincipalToken, v *url.Values) error {
return nil
@@ -183,27 +246,47 @@ func (secret *ServicePrincipalCertificateSecret) SetAuthenticationValues(spt *Se
// ServicePrincipalToken encapsulates a Token created for a Service Principal.
type ServicePrincipalToken struct {
- Token
-
+ token Token
secret ServicePrincipalSecret
oauthConfig OAuthConfig
clientID string
resource string
autoRefresh bool
+ refreshLock *sync.RWMutex
refreshWithin time.Duration
sender Sender
refreshCallbacks []TokenRefreshCallback
}
+func validateOAuthConfig(oac OAuthConfig) error {
+ if oac.IsZero() {
+ return fmt.Errorf("parameter 'oauthConfig' cannot be zero-initialized")
+ }
+ return nil
+}
+
// NewServicePrincipalTokenWithSecret create a ServicePrincipalToken using the supplied ServicePrincipalSecret implementation.
func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, resource string, secret ServicePrincipalSecret, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(id, "id"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
+ if secret == nil {
+ return nil, fmt.Errorf("parameter 'secret' cannot be nil")
+ }
spt := &ServicePrincipalToken{
oauthConfig: oauthConfig,
secret: secret,
clientID: id,
resource: resource,
autoRefresh: true,
+ refreshLock: &sync.RWMutex{},
refreshWithin: defaultRefresh,
sender: &http.Client{},
refreshCallbacks: callbacks,
@@ -213,6 +296,18 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso
// NewServicePrincipalTokenFromManualToken creates a ServicePrincipalToken using the supplied token
func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID string, resource string, token Token, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(clientID, "clientID"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
+ if token.IsZero() {
+ return nil, fmt.Errorf("parameter 'token' cannot be zero-initialized")
+ }
spt, err := NewServicePrincipalTokenWithSecret(
oauthConfig,
clientID,
@@ -223,7 +318,7 @@ func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID s
return nil, err
}
- spt.Token = token
+ spt.token = token
return spt, nil
}
@@ -231,6 +326,18 @@ func NewServicePrincipalTokenFromManualToken(oauthConfig OAuthConfig, clientID s
// NewServicePrincipalToken creates a ServicePrincipalToken from the supplied Service Principal
// credentials scoped to the named resource.
func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(clientID, "clientID"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(secret, "secret"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
return NewServicePrincipalTokenWithSecret(
oauthConfig,
clientID,
@@ -242,8 +349,23 @@ func NewServicePrincipalToken(oauthConfig OAuthConfig, clientID string, secret s
)
}
-// NewServicePrincipalTokenFromCertificate create a ServicePrincipalToken from the supplied pkcs12 bytes.
+// NewServicePrincipalTokenFromCertificate creates a ServicePrincipalToken from the supplied pkcs12 bytes.
func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID string, certificate *x509.Certificate, privateKey *rsa.PrivateKey, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(clientID, "clientID"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
+ if certificate == nil {
+ return nil, fmt.Errorf("parameter 'certificate' cannot be nil")
+ }
+ if privateKey == nil {
+ return nil, fmt.Errorf("parameter 'privateKey' cannot be nil")
+ }
return NewServicePrincipalTokenWithSecret(
oauthConfig,
clientID,
@@ -256,59 +378,163 @@ func NewServicePrincipalTokenFromCertificate(oauthConfig OAuthConfig, clientID s
)
}
-// GetMSIVMEndpoint gets the MSI endpoint on Virtual Machines.
-func GetMSIVMEndpoint() (string, error) {
- return getMSIVMEndpoint(msiPath)
+// NewServicePrincipalTokenFromUsernamePassword creates a ServicePrincipalToken from the username and password.
+func NewServicePrincipalTokenFromUsernamePassword(oauthConfig OAuthConfig, clientID string, username string, password string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(clientID, "clientID"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(username, "username"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(password, "password"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
+ return NewServicePrincipalTokenWithSecret(
+ oauthConfig,
+ clientID,
+ resource,
+ &ServicePrincipalUsernamePasswordSecret{
+ Username: username,
+ Password: password,
+ },
+ callbacks...,
+ )
}
-func getMSIVMEndpoint(path string) (string, error) {
- // Read MSI settings
- bytes, err := ioutil.ReadFile(path)
- if err != nil {
- return "", err
+// NewServicePrincipalTokenFromAuthorizationCode creates a ServicePrincipalToken from the
+func NewServicePrincipalTokenFromAuthorizationCode(oauthConfig OAuthConfig, clientID string, clientSecret string, authorizationCode string, redirectURI string, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+
+ if err := validateOAuthConfig(oauthConfig); err != nil {
+ return nil, err
}
- msiSettings := struct {
- URL string `json:"url"`
- }{}
- err = json.Unmarshal(bytes, &msiSettings)
- if err != nil {
- return "", err
+ if err := validateStringParam(clientID, "clientID"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(clientSecret, "clientSecret"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(authorizationCode, "authorizationCode"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(redirectURI, "redirectURI"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
}
- return msiSettings.URL, nil
+ return NewServicePrincipalTokenWithSecret(
+ oauthConfig,
+ clientID,
+ resource,
+ &ServicePrincipalAuthorizationCodeSecret{
+ ClientSecret: clientSecret,
+ AuthorizationCode: authorizationCode,
+ RedirectURI: redirectURI,
+ },
+ callbacks...,
+ )
+}
+
+// GetMSIVMEndpoint gets the MSI endpoint on Virtual Machines.
+func GetMSIVMEndpoint() (string, error) {
+ return msiEndpoint, nil
}
// NewServicePrincipalTokenFromMSI creates a ServicePrincipalToken via the MSI VM Extension.
+// It will use the system assigned identity when creating the token.
func NewServicePrincipalTokenFromMSI(msiEndpoint, resource string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ return newServicePrincipalTokenFromMSI(msiEndpoint, resource, nil, callbacks...)
+}
+
+// NewServicePrincipalTokenFromMSIWithUserAssignedID creates a ServicePrincipalToken via the MSI VM Extension.
+// It will use the specified user assigned identity when creating the token.
+func NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, resource string, userAssignedID string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ return newServicePrincipalTokenFromMSI(msiEndpoint, resource, &userAssignedID, callbacks...)
+}
+
+func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedID *string, callbacks ...TokenRefreshCallback) (*ServicePrincipalToken, error) {
+ if err := validateStringParam(msiEndpoint, "msiEndpoint"); err != nil {
+ return nil, err
+ }
+ if err := validateStringParam(resource, "resource"); err != nil {
+ return nil, err
+ }
+ if userAssignedID != nil {
+ if err := validateStringParam(*userAssignedID, "userAssignedID"); err != nil {
+ return nil, err
+ }
+ }
// We set the oauth config token endpoint to be MSI's endpoint
msiEndpointURL, err := url.Parse(msiEndpoint)
if err != nil {
return nil, err
}
- oauthConfig, err := NewOAuthConfig(msiEndpointURL.String(), "")
- if err != nil {
- return nil, err
+ v := url.Values{}
+ v.Set("resource", resource)
+ v.Set("api-version", "2018-02-01")
+ if userAssignedID != nil {
+ v.Set("client_id", *userAssignedID)
}
+ msiEndpointURL.RawQuery = v.Encode()
spt := &ServicePrincipalToken{
- oauthConfig: *oauthConfig,
+ oauthConfig: OAuthConfig{
+ TokenEndpoint: *msiEndpointURL,
+ },
secret: &ServicePrincipalMSISecret{},
resource: resource,
autoRefresh: true,
+ refreshLock: &sync.RWMutex{},
refreshWithin: defaultRefresh,
sender: &http.Client{},
refreshCallbacks: callbacks,
}
+ if userAssignedID != nil {
+ spt.clientID = *userAssignedID
+ }
+
return spt, nil
}
+// internal type that implements TokenRefreshError
+type tokenRefreshError struct {
+ message string
+ resp *http.Response
+}
+
+// Error implements the error interface which is part of the TokenRefreshError interface.
+func (tre tokenRefreshError) Error() string {
+ return tre.message
+}
+
+// Response implements the TokenRefreshError interface, it returns the raw HTTP response from the refresh operation.
+func (tre tokenRefreshError) Response() *http.Response {
+ return tre.resp
+}
+
+func newTokenRefreshError(message string, resp *http.Response) TokenRefreshError {
+ return tokenRefreshError{message: message, resp: resp}
+}
+
// EnsureFresh will refresh the token if it will expire within the refresh window (as set by
-// RefreshWithin) and autoRefresh flag is on.
+// RefreshWithin) and autoRefresh flag is on. This method is safe for concurrent use.
func (spt *ServicePrincipalToken) EnsureFresh() error {
- if spt.autoRefresh && spt.WillExpireIn(spt.refreshWithin) {
- return spt.Refresh()
+ if spt.autoRefresh && spt.token.WillExpireIn(spt.refreshWithin) {
+ // take the write lock then check to see if the token was already refreshed
+ spt.refreshLock.Lock()
+ defer spt.refreshLock.Unlock()
+ if spt.token.WillExpireIn(spt.refreshWithin) {
+ return spt.refreshInternal(spt.resource)
+ }
}
return nil
}
@@ -317,7 +543,7 @@ func (spt *ServicePrincipalToken) EnsureFresh() error {
func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error {
if spt.refreshCallbacks != nil {
for _, callback := range spt.refreshCallbacks {
- err := callback(spt.Token)
+ err := callback(spt.token)
if err != nil {
return fmt.Errorf("adal: TokenRefreshCallback handler failed. Error = '%v'", err)
}
@@ -327,43 +553,74 @@ func (spt *ServicePrincipalToken) InvokeRefreshCallbacks(token Token) error {
}
// Refresh obtains a fresh token for the Service Principal.
+// This method is not safe for concurrent use and should be syncrhonized.
func (spt *ServicePrincipalToken) Refresh() error {
+ spt.refreshLock.Lock()
+ defer spt.refreshLock.Unlock()
return spt.refreshInternal(spt.resource)
}
// RefreshExchange refreshes the token, but for a different resource.
+// This method is not safe for concurrent use and should be syncrhonized.
func (spt *ServicePrincipalToken) RefreshExchange(resource string) error {
+ spt.refreshLock.Lock()
+ defer spt.refreshLock.Unlock()
return spt.refreshInternal(resource)
}
-func (spt *ServicePrincipalToken) refreshInternal(resource string) error {
- v := url.Values{}
- v.Set("client_id", spt.clientID)
- v.Set("resource", resource)
-
- if spt.RefreshToken != "" {
- v.Set("grant_type", OAuthGrantTypeRefreshToken)
- v.Set("refresh_token", spt.RefreshToken)
- } else {
- v.Set("grant_type", OAuthGrantTypeClientCredentials)
- err := spt.secret.SetAuthenticationValues(spt, &v)
- if err != nil {
- return err
- }
+func (spt *ServicePrincipalToken) getGrantType() string {
+ switch spt.secret.(type) {
+ case *ServicePrincipalUsernamePasswordSecret:
+ return OAuthGrantTypeUserPass
+ case *ServicePrincipalAuthorizationCodeSecret:
+ return OAuthGrantTypeAuthorizationCode
+ default:
+ return OAuthGrantTypeClientCredentials
}
+}
- s := v.Encode()
- body := ioutil.NopCloser(strings.NewReader(s))
- req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), body)
+func isIMDS(u url.URL) bool {
+ imds, err := url.Parse(msiEndpoint)
+ if err != nil {
+ return false
+ }
+ return u.Host == imds.Host && u.Path == imds.Path
+}
+
+func (spt *ServicePrincipalToken) refreshInternal(resource string) error {
+ req, err := http.NewRequest(http.MethodPost, spt.oauthConfig.TokenEndpoint.String(), nil)
if err != nil {
return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err)
}
- req.ContentLength = int64(len(s))
- req.Header.Set(contentType, mimeTypeFormPost)
+ if !isIMDS(spt.oauthConfig.TokenEndpoint) {
+ v := url.Values{}
+ v.Set("client_id", spt.clientID)
+ v.Set("resource", resource)
+
+ if spt.token.RefreshToken != "" {
+ v.Set("grant_type", OAuthGrantTypeRefreshToken)
+ v.Set("refresh_token", spt.token.RefreshToken)
+ } else {
+ v.Set("grant_type", spt.getGrantType())
+ err := spt.secret.SetAuthenticationValues(spt, &v)
+ if err != nil {
+ return err
+ }
+ }
+
+ s := v.Encode()
+ body := ioutil.NopCloser(strings.NewReader(s))
+ req.ContentLength = int64(len(s))
+ req.Header.Set(contentType, mimeTypeFormPost)
+ req.Body = body
+ }
+
if _, ok := spt.secret.(*ServicePrincipalMSISecret); ok {
+ req.Method = http.MethodGet
req.Header.Set(metadataHeader, "true")
}
+
resp, err := spt.sender.Do(req)
if err != nil {
return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err)
@@ -374,9 +631,9 @@ func (spt *ServicePrincipalToken) refreshInternal(resource string) error {
if resp.StatusCode != http.StatusOK {
if err != nil {
- return fmt.Errorf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body", resp.StatusCode)
+ return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Failed reading response body", resp.StatusCode), resp)
}
- return fmt.Errorf("adal: Refresh request failed. Status Code = '%d'. Response body: %s", resp.StatusCode, string(rb))
+ return newTokenRefreshError(fmt.Sprintf("adal: Refresh request failed. Status Code = '%d'. Response body: %s", resp.StatusCode, string(rb)), resp)
}
if err != nil {
@@ -391,7 +648,7 @@ func (spt *ServicePrincipalToken) refreshInternal(resource string) error {
return fmt.Errorf("adal: Failed to unmarshal the service principal token during refresh. Error = '%v' JSON = '%s'", err, string(rb))
}
- spt.Token = token
+ spt.token = token
return spt.InvokeRefreshCallbacks(token)
}
@@ -411,3 +668,17 @@ func (spt *ServicePrincipalToken) SetRefreshWithin(d time.Duration) {
// SetSender sets the http.Client used when obtaining the Service Principal token. An
// undecorated http.Client is used by default.
func (spt *ServicePrincipalToken) SetSender(s Sender) { spt.sender = s }
+
+// OAuthToken implements the OAuthTokenProvider interface. It returns the current access token.
+func (spt *ServicePrincipalToken) OAuthToken() string {
+ spt.refreshLock.RLock()
+ defer spt.refreshLock.RUnlock()
+ return spt.token.OAuthToken()
+}
+
+// Token returns a copy of the current token.
+func (spt *ServicePrincipalToken) Token() Token {
+ spt.refreshLock.RLock()
+ defer spt.refreshLock.RUnlock()
+ return spt.token
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go
index 314ed7876..c51eac0a7 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/authorization.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"fmt"
"net/http"
@@ -10,9 +24,12 @@ import (
)
const (
- bearerChallengeHeader = "Www-Authenticate"
- bearer = "Bearer"
- tenantID = "tenantID"
+ bearerChallengeHeader = "Www-Authenticate"
+ bearer = "Bearer"
+ tenantID = "tenantID"
+ apiKeyAuthorizerHeader = "Ocp-Apim-Subscription-Key"
+ bingAPISdkHeader = "X-BingApis-SDK-Client"
+ golangBingAPISdkHeaderValue = "Go-SDK"
)
// Authorizer is the interface that provides a PrepareDecorator used to supply request
@@ -30,6 +47,53 @@ func (na NullAuthorizer) WithAuthorization() PrepareDecorator {
return WithNothing()
}
+// APIKeyAuthorizer implements API Key authorization.
+type APIKeyAuthorizer struct {
+ headers map[string]interface{}
+ queryParameters map[string]interface{}
+}
+
+// NewAPIKeyAuthorizerWithHeaders creates an ApiKeyAuthorizer with headers.
+func NewAPIKeyAuthorizerWithHeaders(headers map[string]interface{}) *APIKeyAuthorizer {
+ return NewAPIKeyAuthorizer(headers, nil)
+}
+
+// NewAPIKeyAuthorizerWithQueryParameters creates an ApiKeyAuthorizer with query parameters.
+func NewAPIKeyAuthorizerWithQueryParameters(queryParameters map[string]interface{}) *APIKeyAuthorizer {
+ return NewAPIKeyAuthorizer(nil, queryParameters)
+}
+
+// NewAPIKeyAuthorizer creates an ApiKeyAuthorizer with headers.
+func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[string]interface{}) *APIKeyAuthorizer {
+ return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters}
+}
+
+// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Paramaters
+func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator {
+ return func(p Preparer) Preparer {
+ return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters))
+ }
+}
+
+// CognitiveServicesAuthorizer implements authorization for Cognitive Services.
+type CognitiveServicesAuthorizer struct {
+ subscriptionKey string
+}
+
+// NewCognitiveServicesAuthorizer is
+func NewCognitiveServicesAuthorizer(subscriptionKey string) *CognitiveServicesAuthorizer {
+ return &CognitiveServicesAuthorizer{subscriptionKey: subscriptionKey}
+}
+
+// WithAuthorization is
+func (csa *CognitiveServicesAuthorizer) WithAuthorization() PrepareDecorator {
+ headers := make(map[string]interface{})
+ headers[apiKeyAuthorizerHeader] = csa.subscriptionKey
+ headers[bingAPISdkHeader] = golangBingAPISdkHeaderValue
+
+ return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization()
+}
+
// BearerAuthorizer implements the bearer authorization
type BearerAuthorizer struct {
tokenProvider adal.OAuthTokenProvider
@@ -40,10 +104,6 @@ func NewBearerAuthorizer(tp adal.OAuthTokenProvider) *BearerAuthorizer {
return &BearerAuthorizer{tokenProvider: tp}
}
-func (ba *BearerAuthorizer) withBearerAuthorization() PrepareDecorator {
- return WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken()))
-}
-
// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose
// value is "Bearer " followed by the token.
//
@@ -51,15 +111,23 @@ func (ba *BearerAuthorizer) withBearerAuthorization() PrepareDecorator {
func (ba *BearerAuthorizer) WithAuthorization() PrepareDecorator {
return func(p Preparer) Preparer {
return PreparerFunc(func(r *http.Request) (*http.Request, error) {
- refresher, ok := ba.tokenProvider.(adal.Refresher)
- if ok {
- err := refresher.EnsureFresh()
- if err != nil {
- return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", nil,
- "Failed to refresh the Token for request to %s", r.URL)
+ r, err := p.Prepare(r)
+ if err == nil {
+ refresher, ok := ba.tokenProvider.(adal.Refresher)
+ if ok {
+ err := refresher.EnsureFresh()
+ if err != nil {
+ var resp *http.Response
+ if tokError, ok := err.(adal.TokenRefreshError); ok {
+ resp = tokError.Response()
+ }
+ return r, NewErrorWithError(err, "azure.BearerAuthorizer", "WithAuthorization", resp,
+ "Failed to refresh the Token for request to %s", r.URL)
+ }
}
+ return Prepare(r, WithHeader(headerAuthorization, fmt.Sprintf("Bearer %s", ba.tokenProvider.OAuthToken())))
}
- return (ba.withBearerAuthorization()(p)).Prepare(r)
+ return r, err
})
}
}
@@ -89,25 +157,28 @@ func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbac
func (bacb *BearerAuthorizerCallback) WithAuthorization() PrepareDecorator {
return func(p Preparer) Preparer {
return PreparerFunc(func(r *http.Request) (*http.Request, error) {
- // make a copy of the request and remove the body as it's not
- // required and avoids us having to create a copy of it.
- rCopy := *r
- removeRequestBody(&rCopy)
+ r, err := p.Prepare(r)
+ if err == nil {
+ // make a copy of the request and remove the body as it's not
+ // required and avoids us having to create a copy of it.
+ rCopy := *r
+ removeRequestBody(&rCopy)
- resp, err := bacb.sender.Do(&rCopy)
- if err == nil && resp.StatusCode == 401 {
- defer resp.Body.Close()
- if hasBearerChallenge(resp) {
- bc, err := newBearerChallenge(resp)
- if err != nil {
- return r, err
- }
- if bacb.callback != nil {
- ba, err := bacb.callback(bc.values[tenantID], bc.values["resource"])
+ resp, err := bacb.sender.Do(&rCopy)
+ if err == nil && resp.StatusCode == 401 {
+ defer resp.Body.Close()
+ if hasBearerChallenge(resp) {
+ bc, err := newBearerChallenge(resp)
if err != nil {
return r, err
}
- return ba.WithAuthorization()(p).Prepare(r)
+ if bacb.callback != nil {
+ ba, err := bacb.callback(bc.values[tenantID], bc.values["resource"])
+ if err != nil {
+ return r, err
+ }
+ return Prepare(r, ba.WithAuthorization())
+ }
}
}
}
@@ -165,3 +236,22 @@ func newBearerChallenge(resp *http.Response) (bc bearerChallenge, err error) {
return bc, err
}
+
+// EventGridKeyAuthorizer implements authorization for event grid using key authentication.
+type EventGridKeyAuthorizer struct {
+ topicKey string
+}
+
+// NewEventGridKeyAuthorizer creates a new EventGridKeyAuthorizer
+// with the specified topic key.
+func NewEventGridKeyAuthorizer(topicKey string) EventGridKeyAuthorizer {
+ return EventGridKeyAuthorizer{topicKey: topicKey}
+}
+
+// WithAuthorization returns a PrepareDecorator that adds the aeg-sas-key authentication header.
+func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator {
+ headers := map[string]interface{}{
+ "aeg-sas-key": egta.topicKey,
+ }
+ return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization()
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/autorest.go b/vendor/github.com/Azure/go-autorest/autorest/autorest.go
index 51f1c4bbc..aafdf021f 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/autorest.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/autorest.go
@@ -57,7 +57,22 @@ generated clients, see the Client described below.
*/
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
+ "context"
"net/http"
"time"
)
@@ -73,6 +88,9 @@ const (
// ResponseHasStatusCode returns true if the status code in the HTTP Response is in the passed set
// and false otherwise.
func ResponseHasStatusCode(resp *http.Response, codes ...int) bool {
+ if resp == nil {
+ return false
+ }
return containsInt(codes, resp.StatusCode)
}
@@ -113,3 +131,20 @@ func NewPollingRequest(resp *http.Response, cancel <-chan struct{}) (*http.Reque
return req, nil
}
+
+// NewPollingRequestWithContext allocates and returns a new http.Request with the specified context to poll for the passed response.
+func NewPollingRequestWithContext(ctx context.Context, resp *http.Response) (*http.Request, error) {
+ location := GetLocation(resp)
+ if location == "" {
+ return nil, NewErrorWithResponse("autorest", "NewPollingRequestWithContext", resp, "Location header missing from response that requires polling")
+ }
+
+ req, err := Prepare((&http.Request{}).WithContext(ctx),
+ AsGet(),
+ WithBaseURL(location))
+ if err != nil {
+ return nil, NewErrorWithError(err, "autorest", "NewPollingRequestWithContext", nil, "Failure creating poll request to %s", location)
+ }
+
+ return req, nil
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go
index 332a8909d..a58e5ef3f 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go
@@ -1,7 +1,23 @@
package azure
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
+ "context"
+ "encoding/json"
"fmt"
"io/ioutil"
"net/http"
@@ -23,6 +39,184 @@ const (
operationSucceeded string = "Succeeded"
)
+var pollingCodes = [...]int{http.StatusNoContent, http.StatusAccepted, http.StatusCreated, http.StatusOK}
+
+// Future provides a mechanism to access the status and results of an asynchronous request.
+// Since futures are stateful they should be passed by value to avoid race conditions.
+type Future struct {
+ req *http.Request
+ resp *http.Response
+ ps pollingState
+}
+
+// NewFuture returns a new Future object initialized with the specified request.
+func NewFuture(req *http.Request) Future {
+ return Future{req: req}
+}
+
+// Response returns the last HTTP response or nil if there isn't one.
+func (f Future) Response() *http.Response {
+ return f.resp
+}
+
+// Status returns the last status message of the operation.
+func (f Future) Status() string {
+ if f.ps.State == "" {
+ return "Unknown"
+ }
+ return f.ps.State
+}
+
+// PollingMethod returns the method used to monitor the status of the asynchronous operation.
+func (f Future) PollingMethod() PollingMethodType {
+ return f.ps.PollingMethod
+}
+
+// Done queries the service to see if the operation has completed.
+func (f *Future) Done(sender autorest.Sender) (bool, error) {
+ // exit early if this future has terminated
+ if f.ps.hasTerminated() {
+ return true, f.errorInfo()
+ }
+ resp, err := sender.Do(f.req)
+ f.resp = resp
+ if err != nil {
+ return false, err
+ }
+
+ if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) {
+ // check response body for error content
+ if resp.Body != nil {
+ type respErr struct {
+ ServiceError ServiceError `json:"error"`
+ }
+ re := respErr{}
+
+ defer resp.Body.Close()
+ b, err := ioutil.ReadAll(resp.Body)
+ if err != nil {
+ return false, err
+ }
+ err = json.Unmarshal(b, &re)
+ if err != nil {
+ return false, err
+ }
+ return false, re.ServiceError
+ }
+
+ // try to return something meaningful
+ return false, ServiceError{
+ Code: fmt.Sprintf("%v", resp.StatusCode),
+ Message: resp.Status,
+ }
+ }
+
+ err = updatePollingState(resp, &f.ps)
+ if err != nil {
+ return false, err
+ }
+
+ if f.ps.hasTerminated() {
+ return true, f.errorInfo()
+ }
+
+ f.req, err = newPollingRequest(f.ps)
+ return false, err
+}
+
+// GetPollingDelay returns a duration the application should wait before checking
+// the status of the asynchronous request and true; this value is returned from
+// the service via the Retry-After response header. If the header wasn't returned
+// then the function returns the zero-value time.Duration and false.
+func (f Future) GetPollingDelay() (time.Duration, bool) {
+ if f.resp == nil {
+ return 0, false
+ }
+
+ retry := f.resp.Header.Get(autorest.HeaderRetryAfter)
+ if retry == "" {
+ return 0, false
+ }
+
+ d, err := time.ParseDuration(retry + "s")
+ if err != nil {
+ panic(err)
+ }
+
+ return d, true
+}
+
+// WaitForCompletion will return when one of the following conditions is met: the long
+// running operation has completed, the provided context is cancelled, or the client's
+// polling duration has been exceeded. It will retry failed polling attempts based on
+// the retry value defined in the client up to the maximum retry attempts.
+func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) error {
+ ctx, cancel := context.WithTimeout(ctx, client.PollingDuration)
+ defer cancel()
+
+ done, err := f.Done(client)
+ for attempts := 0; !done; done, err = f.Done(client) {
+ if attempts >= client.RetryAttempts {
+ return autorest.NewErrorWithError(err, "azure", "WaitForCompletion", f.resp, "the number of retries has been exceeded")
+ }
+ // we want delayAttempt to be zero in the non-error case so
+ // that DelayForBackoff doesn't perform exponential back-off
+ var delayAttempt int
+ var delay time.Duration
+ if err == nil {
+ // check for Retry-After delay, if not present use the client's polling delay
+ var ok bool
+ delay, ok = f.GetPollingDelay()
+ if !ok {
+ delay = client.PollingDelay
+ }
+ } else {
+ // there was an error polling for status so perform exponential
+ // back-off based on the number of attempts using the client's retry
+ // duration. update attempts after delayAttempt to avoid off-by-one.
+ delayAttempt = attempts
+ delay = client.RetryDuration
+ attempts++
+ }
+ // wait until the delay elapses or the context is cancelled
+ delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, ctx.Done())
+ if !delayElapsed {
+ return autorest.NewErrorWithError(ctx.Err(), "azure", "WaitForCompletion", f.resp, "context has been cancelled")
+ }
+ }
+ return err
+}
+
+// if the operation failed the polling state will contain
+// error information and implements the error interface
+func (f *Future) errorInfo() error {
+ if !f.ps.hasSucceeded() {
+ return f.ps
+ }
+ return nil
+}
+
+// MarshalJSON implements the json.Marshaler interface.
+func (f Future) MarshalJSON() ([]byte, error) {
+ return json.Marshal(&f.ps)
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface.
+func (f *Future) UnmarshalJSON(data []byte) error {
+ err := json.Unmarshal(data, &f.ps)
+ if err != nil {
+ return err
+ }
+ f.req, err = newPollingRequest(f.ps)
+ return err
+}
+
+// PollingURL returns the URL used for retrieving the status of the long-running operation.
+// For LROs that use the Location header the final URL value is used to retrieve the result.
+func (f Future) PollingURL() string {
+ return f.ps.URI
+}
+
// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure
// long-running operation. It will delay between requests for the duration specified in the
// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled by
@@ -34,8 +228,7 @@ func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator {
if err != nil {
return resp, err
}
- pollingCodes := []int{http.StatusAccepted, http.StatusCreated, http.StatusOK}
- if !autorest.ResponseHasStatusCode(resp, pollingCodes...) {
+ if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) {
return resp, nil
}
@@ -52,10 +245,11 @@ func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator {
break
}
- r, err = newPollingRequest(resp, ps)
+ r, err = newPollingRequest(ps)
if err != nil {
return resp, err
}
+ r = r.WithContext(resp.Request.Context())
delay = autorest.GetRetryAfter(resp, delay)
resp, err = autorest.SendWithSender(s, r,
@@ -72,20 +266,15 @@ func getAsyncOperation(resp *http.Response) string {
}
func hasSucceeded(state string) bool {
- return state == operationSucceeded
+ return strings.EqualFold(state, operationSucceeded)
}
func hasTerminated(state string) bool {
- switch state {
- case operationCanceled, operationFailed, operationSucceeded:
- return true
- default:
- return false
- }
+ return strings.EqualFold(state, operationCanceled) || strings.EqualFold(state, operationFailed) || strings.EqualFold(state, operationSucceeded)
}
func hasFailed(state string) bool {
- return state == operationFailed
+ return strings.EqualFold(state, operationFailed)
}
type provisioningTracker interface {
@@ -143,39 +332,50 @@ func (ps provisioningStatus) hasTerminated() bool {
}
func (ps provisioningStatus) hasProvisioningError() bool {
- return ps.ProvisioningError != ServiceError{}
+ // code and message are required fields so only check them
+ return len(ps.ProvisioningError.Code) > 0 ||
+ len(ps.ProvisioningError.Message) > 0
}
-type pollingResponseFormat string
+// PollingMethodType defines a type used for enumerating polling mechanisms.
+type PollingMethodType string
const (
- usesOperationResponse pollingResponseFormat = "OperationResponse"
- usesProvisioningStatus pollingResponseFormat = "ProvisioningStatus"
- formatIsUnknown pollingResponseFormat = ""
+ // PollingAsyncOperation indicates the polling method uses the Azure-AsyncOperation header.
+ PollingAsyncOperation PollingMethodType = "AsyncOperation"
+
+ // PollingLocation indicates the polling method uses the Location header.
+ PollingLocation PollingMethodType = "Location"
+
+ // PollingUnknown indicates an unknown polling method and is the default value.
+ PollingUnknown PollingMethodType = ""
)
type pollingState struct {
- responseFormat pollingResponseFormat
- uri string
- state string
- code string
- message string
+ PollingMethod PollingMethodType `json:"pollingMethod"`
+ URI string `json:"uri"`
+ State string `json:"state"`
+ ServiceError *ServiceError `json:"error,omitempty"`
}
func (ps pollingState) hasSucceeded() bool {
- return hasSucceeded(ps.state)
+ return hasSucceeded(ps.State)
}
func (ps pollingState) hasTerminated() bool {
- return hasTerminated(ps.state)
+ return hasTerminated(ps.State)
}
func (ps pollingState) hasFailed() bool {
- return hasFailed(ps.state)
+ return hasFailed(ps.State)
}
func (ps pollingState) Error() string {
- return fmt.Sprintf("Long running operation terminated with status '%s': Code=%q Message=%q", ps.state, ps.code, ps.message)
+ s := fmt.Sprintf("Long running operation terminated with status '%s'", ps.State)
+ if ps.ServiceError != nil {
+ s = fmt.Sprintf("%s: %+v", s, *ps.ServiceError)
+ }
+ return s
}
// updatePollingState maps the operation status -- retrieved from either a provisioningState
@@ -190,7 +390,7 @@ func updatePollingState(resp *http.Response, ps *pollingState) error {
// -- The first response will always be a provisioningStatus response; only the polling requests,
// depending on the header returned, may be something otherwise.
var pt provisioningTracker
- if ps.responseFormat == usesOperationResponse {
+ if ps.PollingMethod == PollingAsyncOperation {
pt = &operationResource{}
} else {
pt = &provisioningStatus{}
@@ -198,30 +398,30 @@ func updatePollingState(resp *http.Response, ps *pollingState) error {
// If this is the first request (that is, the polling response shape is unknown), determine how
// to poll and what to expect
- if ps.responseFormat == formatIsUnknown {
+ if ps.PollingMethod == PollingUnknown {
req := resp.Request
if req == nil {
return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Original HTTP request is missing")
}
// Prefer the Azure-AsyncOperation header
- ps.uri = getAsyncOperation(resp)
- if ps.uri != "" {
- ps.responseFormat = usesOperationResponse
+ ps.URI = getAsyncOperation(resp)
+ if ps.URI != "" {
+ ps.PollingMethod = PollingAsyncOperation
} else {
- ps.responseFormat = usesProvisioningStatus
+ ps.PollingMethod = PollingLocation
}
// Else, use the Location header
- if ps.uri == "" {
- ps.uri = autorest.GetLocation(resp)
+ if ps.URI == "" {
+ ps.URI = autorest.GetLocation(resp)
}
// Lastly, requests against an existing resource, use the last request URI
- if ps.uri == "" {
+ if ps.URI == "" {
m := strings.ToUpper(req.Method)
if m == http.MethodPatch || m == http.MethodPut || m == http.MethodGet {
- ps.uri = req.URL.String()
+ ps.URI = req.URL.String()
}
}
}
@@ -242,23 +442,23 @@ func updatePollingState(resp *http.Response, ps *pollingState) error {
// -- Unknown states are per-service inprogress states
// -- Otherwise, infer state from HTTP status code
if pt.hasTerminated() {
- ps.state = pt.state()
+ ps.State = pt.state()
} else if pt.state() != "" {
- ps.state = operationInProgress
+ ps.State = operationInProgress
} else {
switch resp.StatusCode {
case http.StatusAccepted:
- ps.state = operationInProgress
+ ps.State = operationInProgress
case http.StatusNoContent, http.StatusCreated, http.StatusOK:
- ps.state = operationSucceeded
+ ps.State = operationSucceeded
default:
- ps.state = operationFailed
+ ps.State = operationFailed
}
}
- if ps.state == operationInProgress && ps.uri == "" {
+ if strings.EqualFold(ps.State, operationInProgress) && ps.URI == "" {
return autorest.NewError("azure", "updatePollingState", "Azure Polling Error - Unable to obtain polling URI for %s %s", resp.Request.Method, resp.Request.URL)
}
@@ -267,36 +467,45 @@ func updatePollingState(resp *http.Response, ps *pollingState) error {
// -- Response
// -- Otherwise, Unknown
if ps.hasFailed() {
- if ps.responseFormat == usesOperationResponse {
- or := pt.(*operationResource)
- ps.code = or.OperationError.Code
- ps.message = or.OperationError.Message
+ if or, ok := pt.(*operationResource); ok {
+ ps.ServiceError = &or.OperationError
+ } else if p, ok := pt.(*provisioningStatus); ok && p.hasProvisioningError() {
+ ps.ServiceError = &p.ProvisioningError
} else {
- p := pt.(*provisioningStatus)
- if p.hasProvisioningError() {
- ps.code = p.ProvisioningError.Code
- ps.message = p.ProvisioningError.Message
- } else {
- ps.code = "Unknown"
- ps.message = "None"
+ ps.ServiceError = &ServiceError{
+ Code: "Unknown",
+ Message: "None",
}
}
}
return nil
}
-func newPollingRequest(resp *http.Response, ps pollingState) (*http.Request, error) {
- req := resp.Request
- if req == nil {
- return nil, autorest.NewError("azure", "newPollingRequest", "Azure Polling Error - Original HTTP request is missing")
- }
-
- reqPoll, err := autorest.Prepare(&http.Request{Cancel: req.Cancel},
+func newPollingRequest(ps pollingState) (*http.Request, error) {
+ reqPoll, err := autorest.Prepare(&http.Request{},
autorest.AsGet(),
- autorest.WithBaseURL(ps.uri))
+ autorest.WithBaseURL(ps.URI))
if err != nil {
- return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.uri)
+ return nil, autorest.NewErrorWithError(err, "azure", "newPollingRequest", nil, "Failure creating poll request to %s", ps.URI)
}
return reqPoll, nil
}
+
+// AsyncOpIncompleteError is the type that's returned from a future that has not completed.
+type AsyncOpIncompleteError struct {
+ // FutureType is the name of the type composed of a azure.Future.
+ FutureType string
+}
+
+// Error returns an error message including the originating type name of the error.
+func (e AsyncOpIncompleteError) Error() string {
+ return fmt.Sprintf("%s: asynchronous operation has not completed", e.FutureType)
+}
+
+// NewAsyncOpIncompleteError creates a new AsyncOpIncompleteError with the specified parameters.
+func NewAsyncOpIncompleteError(futureType string) AsyncOpIncompleteError {
+ return AsyncOpIncompleteError{
+ FutureType: futureType,
+ }
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
index 3f4d13421..18d029526 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/azure.go
@@ -1,16 +1,29 @@
-/*
-Package azure provides Azure-specific implementations used with AutoRest.
-
-See the included examples for more detail.
-*/
+// Package azure provides Azure-specific implementations used with AutoRest.
+// See the included examples for more detail.
package azure
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
+ "regexp"
"strconv"
+ "strings"
"github.com/Azure/go-autorest/autorest"
)
@@ -29,21 +42,88 @@ const (
)
// ServiceError encapsulates the error response from an Azure service.
+// It adhears to the OData v4 specification for error responses.
type ServiceError struct {
- Code string `json:"code"`
- Message string `json:"message"`
- Details *[]interface{} `json:"details"`
+ Code string `json:"code"`
+ Message string `json:"message"`
+ Target *string `json:"target"`
+ Details []map[string]interface{} `json:"details"`
+ InnerError map[string]interface{} `json:"innererror"`
}
func (se ServiceError) Error() string {
- if se.Details != nil {
- d, err := json.Marshal(*(se.Details))
- if err != nil {
- return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, *se.Details)
- }
- return fmt.Sprintf("Code=%q Message=%q Details=%v", se.Code, se.Message, string(d))
+ result := fmt.Sprintf("Code=%q Message=%q", se.Code, se.Message)
+
+ if se.Target != nil {
+ result += fmt.Sprintf(" Target=%q", *se.Target)
}
- return fmt.Sprintf("Code=%q Message=%q", se.Code, se.Message)
+
+ if se.Details != nil {
+ d, err := json.Marshal(se.Details)
+ if err != nil {
+ result += fmt.Sprintf(" Details=%v", se.Details)
+ }
+ result += fmt.Sprintf(" Details=%v", string(d))
+ }
+
+ if se.InnerError != nil {
+ d, err := json.Marshal(se.InnerError)
+ if err != nil {
+ result += fmt.Sprintf(" InnerError=%v", se.InnerError)
+ }
+ result += fmt.Sprintf(" InnerError=%v", string(d))
+ }
+
+ return result
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for the ServiceError type.
+func (se *ServiceError) UnmarshalJSON(b []byte) error {
+ // per the OData v4 spec the details field must be an array of JSON objects.
+ // unfortunately not all services adhear to the spec and just return a single
+ // object instead of an array with one object. so we have to perform some
+ // shenanigans to accommodate both cases.
+ // http://docs.oasis-open.org/odata/odata-json-format/v4.0/os/odata-json-format-v4.0-os.html#_Toc372793091
+
+ type serviceError1 struct {
+ Code string `json:"code"`
+ Message string `json:"message"`
+ Target *string `json:"target"`
+ Details []map[string]interface{} `json:"details"`
+ InnerError map[string]interface{} `json:"innererror"`
+ }
+
+ type serviceError2 struct {
+ Code string `json:"code"`
+ Message string `json:"message"`
+ Target *string `json:"target"`
+ Details map[string]interface{} `json:"details"`
+ InnerError map[string]interface{} `json:"innererror"`
+ }
+
+ se1 := serviceError1{}
+ err := json.Unmarshal(b, &se1)
+ if err == nil {
+ se.populate(se1.Code, se1.Message, se1.Target, se1.Details, se1.InnerError)
+ return nil
+ }
+
+ se2 := serviceError2{}
+ err = json.Unmarshal(b, &se2)
+ if err == nil {
+ se.populate(se2.Code, se2.Message, se2.Target, nil, se2.InnerError)
+ se.Details = append(se.Details, se2.Details)
+ return nil
+ }
+ return err
+}
+
+func (se *ServiceError) populate(code, message string, target *string, details []map[string]interface{}, inner map[string]interface{}) {
+ se.Code = code
+ se.Message = message
+ se.Target = target
+ se.Details = details
+ se.InnerError = inner
}
// RequestError describes an error response returned by Azure service.
@@ -69,6 +149,41 @@ func IsAzureError(e error) bool {
return ok
}
+// Resource contains details about an Azure resource.
+type Resource struct {
+ SubscriptionID string
+ ResourceGroup string
+ Provider string
+ ResourceType string
+ ResourceName string
+}
+
+// ParseResourceID parses a resource ID into a ResourceDetails struct.
+// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#return-value-4.
+func ParseResourceID(resourceID string) (Resource, error) {
+
+ const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)`
+ resourceIDPattern := regexp.MustCompile(resourceIDPatternText)
+ match := resourceIDPattern.FindStringSubmatch(resourceID)
+
+ if len(match) == 0 {
+ return Resource{}, fmt.Errorf("parsing failed for %s. Invalid resource Id format", resourceID)
+ }
+
+ v := strings.Split(match[5], "/")
+ resourceName := v[len(v)-1]
+
+ result := Resource{
+ SubscriptionID: match[1],
+ ResourceGroup: match[2],
+ Provider: match[3],
+ ResourceType: match[4],
+ ResourceName: resourceName,
+ }
+
+ return result, nil
+}
+
// NewErrorWithError creates a new Error conforming object from the
// passed packageType, method, statusCode of the given resp (UndefinedStatusCode
// if resp is nil), message, and original error. message is treated as a format
@@ -165,7 +280,13 @@ func WithErrorUnlessStatusCode(codes ...int) autorest.RespondDecorator {
if decodeErr != nil {
return fmt.Errorf("autorest/azure: error response cannot be parsed: %q error: %v", b.String(), decodeErr)
} else if e.ServiceError == nil {
- e.ServiceError = &ServiceError{Code: "Unknown", Message: "Unknown service error"}
+ // Check if error is unwrapped ServiceError
+ if err := json.Unmarshal(b.Bytes(), &e.ServiceError); err != nil || e.ServiceError.Message == "" {
+ e.ServiceError = &ServiceError{
+ Code: "Unknown",
+ Message: "Unknown service error",
+ }
+ }
}
e.RequestID = ExtractRequestID(resp)
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go
index 1cf55651f..7e41f7fd9 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go
@@ -1,10 +1,31 @@
package azure
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
+ "encoding/json"
"fmt"
+ "io/ioutil"
+ "os"
"strings"
)
+// EnvironmentFilepathName captures the name of the environment variable containing the path to the file
+// to be used while populating the Azure Environment.
+const EnvironmentFilepathName = "AZURE_ENVIRONMENT_FILEPATH"
+
var environments = map[string]Environment{
"AZURECHINACLOUD": ChinaCloud,
"AZUREGERMANCLOUD": GermanCloud,
@@ -23,6 +44,8 @@ type Environment struct {
GalleryEndpoint string `json:"galleryEndpoint"`
KeyVaultEndpoint string `json:"keyVaultEndpoint"`
GraphEndpoint string `json:"graphEndpoint"`
+ ServiceBusEndpoint string `json:"serviceBusEndpoint"`
+ BatchManagementEndpoint string `json:"batchManagementEndpoint"`
StorageEndpointSuffix string `json:"storageEndpointSuffix"`
SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"`
TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"`
@@ -31,6 +54,7 @@ type Environment struct {
ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"`
ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"`
ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"`
+ TokenAudience string `json:"tokenAudience"`
}
var (
@@ -45,14 +69,17 @@ var (
GalleryEndpoint: "https://gallery.azure.com/",
KeyVaultEndpoint: "https://vault.azure.net/",
GraphEndpoint: "https://graph.windows.net/",
+ ServiceBusEndpoint: "https://servicebus.windows.net/",
+ BatchManagementEndpoint: "https://batch.core.windows.net/",
StorageEndpointSuffix: "core.windows.net",
SQLDatabaseDNSSuffix: "database.windows.net",
TrafficManagerDNSSuffix: "trafficmanager.net",
KeyVaultDNSSuffix: "vault.azure.net",
- ServiceBusEndpointSuffix: "servicebus.azure.com",
+ ServiceBusEndpointSuffix: "servicebus.windows.net",
ServiceManagementVMDNSSuffix: "cloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.azure.com",
ContainerRegistryDNSSuffix: "azurecr.io",
+ TokenAudience: "https://management.azure.com/",
}
// USGovernmentCloud is the cloud environment for the US Government
@@ -62,10 +89,12 @@ var (
PublishSettingsURL: "https://manage.windowsazure.us/publishsettings/index",
ServiceManagementEndpoint: "https://management.core.usgovcloudapi.net/",
ResourceManagerEndpoint: "https://management.usgovcloudapi.net/",
- ActiveDirectoryEndpoint: "https://login.microsoftonline.com/",
+ ActiveDirectoryEndpoint: "https://login.microsoftonline.us/",
GalleryEndpoint: "https://gallery.usgovcloudapi.net/",
KeyVaultEndpoint: "https://vault.usgovcloudapi.net/",
- GraphEndpoint: "https://graph.usgovcloudapi.net/",
+ GraphEndpoint: "https://graph.windows.net/",
+ ServiceBusEndpoint: "https://servicebus.usgovcloudapi.net/",
+ BatchManagementEndpoint: "https://batch.core.usgovcloudapi.net/",
StorageEndpointSuffix: "core.usgovcloudapi.net",
SQLDatabaseDNSSuffix: "database.usgovcloudapi.net",
TrafficManagerDNSSuffix: "usgovtrafficmanager.net",
@@ -74,6 +103,7 @@ var (
ServiceManagementVMDNSSuffix: "usgovcloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us",
ContainerRegistryDNSSuffix: "azurecr.io",
+ TokenAudience: "https://management.usgovcloudapi.net/",
}
// ChinaCloud is the cloud environment operated in China
@@ -87,14 +117,17 @@ var (
GalleryEndpoint: "https://gallery.chinacloudapi.cn/",
KeyVaultEndpoint: "https://vault.azure.cn/",
GraphEndpoint: "https://graph.chinacloudapi.cn/",
+ ServiceBusEndpoint: "https://servicebus.chinacloudapi.cn/",
+ BatchManagementEndpoint: "https://batch.chinacloudapi.cn/",
StorageEndpointSuffix: "core.chinacloudapi.cn",
SQLDatabaseDNSSuffix: "database.chinacloudapi.cn",
TrafficManagerDNSSuffix: "trafficmanager.cn",
KeyVaultDNSSuffix: "vault.azure.cn",
- ServiceBusEndpointSuffix: "servicebus.chinacloudapi.net",
+ ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn",
ServiceManagementVMDNSSuffix: "chinacloudapp.cn",
ResourceManagerVMDNSSuffix: "cloudapp.azure.cn",
ContainerRegistryDNSSuffix: "azurecr.io",
+ TokenAudience: "https://management.chinacloudapi.cn/",
}
// GermanCloud is the cloud environment operated in Germany
@@ -108,6 +141,8 @@ var (
GalleryEndpoint: "https://gallery.cloudapi.de/",
KeyVaultEndpoint: "https://vault.microsoftazure.de/",
GraphEndpoint: "https://graph.cloudapi.de/",
+ ServiceBusEndpoint: "https://servicebus.cloudapi.de/",
+ BatchManagementEndpoint: "https://batch.cloudapi.de/",
StorageEndpointSuffix: "core.cloudapi.de",
SQLDatabaseDNSSuffix: "database.cloudapi.de",
TrafficManagerDNSSuffix: "azuretrafficmanager.de",
@@ -116,15 +151,41 @@ var (
ServiceManagementVMDNSSuffix: "azurecloudapp.de",
ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de",
ContainerRegistryDNSSuffix: "azurecr.io",
+ TokenAudience: "https://management.microsoftazure.de/",
}
)
-// EnvironmentFromName returns an Environment based on the common name specified
+// EnvironmentFromName returns an Environment based on the common name specified.
func EnvironmentFromName(name string) (Environment, error) {
+ // IMPORTANT
+ // As per @radhikagupta5:
+ // This is technical debt, fundamentally here because Kubernetes is not currently accepting
+ // contributions to the providers. Once that is an option, the provider should be updated to
+ // directly call `EnvironmentFromFile`. Until then, we rely on dispatching Azure Stack environment creation
+ // from this method based on the name that is provided to us.
+ if strings.EqualFold(name, "AZURESTACKCLOUD") {
+ return EnvironmentFromFile(os.Getenv(EnvironmentFilepathName))
+ }
+
name = strings.ToUpper(name)
env, ok := environments[name]
if !ok {
return env, fmt.Errorf("autorest/azure: There is no cloud environment matching the name %q", name)
}
+
return env, nil
}
+
+// EnvironmentFromFile loads an Environment from a configuration file available on disk.
+// This function is particularly useful in the Hybrid Cloud model, where one must define their own
+// endpoints.
+func EnvironmentFromFile(location string) (unmarshaled Environment, err error) {
+ fileContents, err := ioutil.ReadFile(location)
+ if err != nil {
+ return
+ }
+
+ err = json.Unmarshal(fileContents, &unmarshaled)
+
+ return
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go b/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go
new file mode 100644
index 000000000..507f9e95c
--- /dev/null
+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/metadata_environment.go
@@ -0,0 +1,245 @@
+package azure
+
+import (
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "strings"
+
+ "github.com/Azure/go-autorest/autorest"
+)
+
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
+type audience []string
+
+type authentication struct {
+ LoginEndpoint string `json:"loginEndpoint"`
+ Audiences audience `json:"audiences"`
+}
+
+type environmentMetadataInfo struct {
+ GalleryEndpoint string `json:"galleryEndpoint"`
+ GraphEndpoint string `json:"graphEndpoint"`
+ PortalEndpoint string `json:"portalEndpoint"`
+ Authentication authentication `json:"authentication"`
+}
+
+// EnvironmentProperty represent property names that clients can override
+type EnvironmentProperty string
+
+const (
+ // EnvironmentName ...
+ EnvironmentName EnvironmentProperty = "name"
+ // EnvironmentManagementPortalURL ..
+ EnvironmentManagementPortalURL EnvironmentProperty = "managementPortalURL"
+ // EnvironmentPublishSettingsURL ...
+ EnvironmentPublishSettingsURL EnvironmentProperty = "publishSettingsURL"
+ // EnvironmentServiceManagementEndpoint ...
+ EnvironmentServiceManagementEndpoint EnvironmentProperty = "serviceManagementEndpoint"
+ // EnvironmentResourceManagerEndpoint ...
+ EnvironmentResourceManagerEndpoint EnvironmentProperty = "resourceManagerEndpoint"
+ // EnvironmentActiveDirectoryEndpoint ...
+ EnvironmentActiveDirectoryEndpoint EnvironmentProperty = "activeDirectoryEndpoint"
+ // EnvironmentGalleryEndpoint ...
+ EnvironmentGalleryEndpoint EnvironmentProperty = "galleryEndpoint"
+ // EnvironmentKeyVaultEndpoint ...
+ EnvironmentKeyVaultEndpoint EnvironmentProperty = "keyVaultEndpoint"
+ // EnvironmentGraphEndpoint ...
+ EnvironmentGraphEndpoint EnvironmentProperty = "graphEndpoint"
+ // EnvironmentServiceBusEndpoint ...
+ EnvironmentServiceBusEndpoint EnvironmentProperty = "serviceBusEndpoint"
+ // EnvironmentBatchManagementEndpoint ...
+ EnvironmentBatchManagementEndpoint EnvironmentProperty = "batchManagementEndpoint"
+ // EnvironmentStorageEndpointSuffix ...
+ EnvironmentStorageEndpointSuffix EnvironmentProperty = "storageEndpointSuffix"
+ // EnvironmentSQLDatabaseDNSSuffix ...
+ EnvironmentSQLDatabaseDNSSuffix EnvironmentProperty = "sqlDatabaseDNSSuffix"
+ // EnvironmentTrafficManagerDNSSuffix ...
+ EnvironmentTrafficManagerDNSSuffix EnvironmentProperty = "trafficManagerDNSSuffix"
+ // EnvironmentKeyVaultDNSSuffix ...
+ EnvironmentKeyVaultDNSSuffix EnvironmentProperty = "keyVaultDNSSuffix"
+ // EnvironmentServiceBusEndpointSuffix ...
+ EnvironmentServiceBusEndpointSuffix EnvironmentProperty = "serviceBusEndpointSuffix"
+ // EnvironmentServiceManagementVMDNSSuffix ...
+ EnvironmentServiceManagementVMDNSSuffix EnvironmentProperty = "serviceManagementVMDNSSuffix"
+ // EnvironmentResourceManagerVMDNSSuffix ...
+ EnvironmentResourceManagerVMDNSSuffix EnvironmentProperty = "resourceManagerVMDNSSuffix"
+ // EnvironmentContainerRegistryDNSSuffix ...
+ EnvironmentContainerRegistryDNSSuffix EnvironmentProperty = "containerRegistryDNSSuffix"
+ // EnvironmentTokenAudience ...
+ EnvironmentTokenAudience EnvironmentProperty = "tokenAudience"
+)
+
+// OverrideProperty represents property name and value that clients can override
+type OverrideProperty struct {
+ Key EnvironmentProperty
+ Value string
+}
+
+// EnvironmentFromURL loads an Environment from a URL
+// This function is particularly useful in the Hybrid Cloud model, where one may define their own
+// endpoints.
+func EnvironmentFromURL(resourceManagerEndpoint string, properties ...OverrideProperty) (environment Environment, err error) {
+ var metadataEnvProperties environmentMetadataInfo
+
+ if resourceManagerEndpoint == "" {
+ return environment, fmt.Errorf("Metadata resource manager endpoint is empty")
+ }
+
+ if metadataEnvProperties, err = retrieveMetadataEnvironment(resourceManagerEndpoint); err != nil {
+ return environment, err
+ }
+
+ // Give priority to user's override values
+ overrideProperties(&environment, properties)
+
+ if environment.Name == "" {
+ environment.Name = "HybridEnvironment"
+ }
+ stampDNSSuffix := environment.StorageEndpointSuffix
+ if stampDNSSuffix == "" {
+ stampDNSSuffix = strings.TrimSuffix(strings.TrimPrefix(strings.Replace(resourceManagerEndpoint, strings.Split(resourceManagerEndpoint, ".")[0], "", 1), "."), "/")
+ environment.StorageEndpointSuffix = stampDNSSuffix
+ }
+ if environment.KeyVaultDNSSuffix == "" {
+ environment.KeyVaultDNSSuffix = fmt.Sprintf("%s.%s", "vault", stampDNSSuffix)
+ }
+ if environment.KeyVaultEndpoint == "" {
+ environment.KeyVaultEndpoint = fmt.Sprintf("%s%s", "https://", environment.KeyVaultDNSSuffix)
+ }
+ if environment.TokenAudience == "" {
+ environment.TokenAudience = metadataEnvProperties.Authentication.Audiences[0]
+ }
+ if environment.ActiveDirectoryEndpoint == "" {
+ environment.ActiveDirectoryEndpoint = metadataEnvProperties.Authentication.LoginEndpoint
+ }
+ if environment.ResourceManagerEndpoint == "" {
+ environment.ResourceManagerEndpoint = resourceManagerEndpoint
+ }
+ if environment.GalleryEndpoint == "" {
+ environment.GalleryEndpoint = metadataEnvProperties.GalleryEndpoint
+ }
+ if environment.GraphEndpoint == "" {
+ environment.GraphEndpoint = metadataEnvProperties.GraphEndpoint
+ }
+
+ return environment, nil
+}
+
+func overrideProperties(environment *Environment, properties []OverrideProperty) {
+ for _, property := range properties {
+ switch property.Key {
+ case EnvironmentName:
+ {
+ environment.Name = property.Value
+ }
+ case EnvironmentManagementPortalURL:
+ {
+ environment.ManagementPortalURL = property.Value
+ }
+ case EnvironmentPublishSettingsURL:
+ {
+ environment.PublishSettingsURL = property.Value
+ }
+ case EnvironmentServiceManagementEndpoint:
+ {
+ environment.ServiceManagementEndpoint = property.Value
+ }
+ case EnvironmentResourceManagerEndpoint:
+ {
+ environment.ResourceManagerEndpoint = property.Value
+ }
+ case EnvironmentActiveDirectoryEndpoint:
+ {
+ environment.ActiveDirectoryEndpoint = property.Value
+ }
+ case EnvironmentGalleryEndpoint:
+ {
+ environment.GalleryEndpoint = property.Value
+ }
+ case EnvironmentKeyVaultEndpoint:
+ {
+ environment.KeyVaultEndpoint = property.Value
+ }
+ case EnvironmentGraphEndpoint:
+ {
+ environment.GraphEndpoint = property.Value
+ }
+ case EnvironmentServiceBusEndpoint:
+ {
+ environment.ServiceBusEndpoint = property.Value
+ }
+ case EnvironmentBatchManagementEndpoint:
+ {
+ environment.BatchManagementEndpoint = property.Value
+ }
+ case EnvironmentStorageEndpointSuffix:
+ {
+ environment.StorageEndpointSuffix = property.Value
+ }
+ case EnvironmentSQLDatabaseDNSSuffix:
+ {
+ environment.SQLDatabaseDNSSuffix = property.Value
+ }
+ case EnvironmentTrafficManagerDNSSuffix:
+ {
+ environment.TrafficManagerDNSSuffix = property.Value
+ }
+ case EnvironmentKeyVaultDNSSuffix:
+ {
+ environment.KeyVaultDNSSuffix = property.Value
+ }
+ case EnvironmentServiceBusEndpointSuffix:
+ {
+ environment.ServiceBusEndpointSuffix = property.Value
+ }
+ case EnvironmentServiceManagementVMDNSSuffix:
+ {
+ environment.ServiceManagementVMDNSSuffix = property.Value
+ }
+ case EnvironmentResourceManagerVMDNSSuffix:
+ {
+ environment.ResourceManagerVMDNSSuffix = property.Value
+ }
+ case EnvironmentContainerRegistryDNSSuffix:
+ {
+ environment.ContainerRegistryDNSSuffix = property.Value
+ }
+ case EnvironmentTokenAudience:
+ {
+ environment.TokenAudience = property.Value
+ }
+ }
+ }
+}
+
+func retrieveMetadataEnvironment(endpoint string) (environment environmentMetadataInfo, err error) {
+ client := autorest.NewClientWithUserAgent("")
+ managementEndpoint := fmt.Sprintf("%s%s", strings.TrimSuffix(endpoint, "/"), "/metadata/endpoints?api-version=1.0")
+ req, _ := http.NewRequest("GET", managementEndpoint, nil)
+ response, err := client.Do(req)
+ if err != nil {
+ return environment, err
+ }
+ defer response.Body.Close()
+ jsonResponse, err := ioutil.ReadAll(response.Body)
+ if err != nil {
+ return environment, err
+ }
+ err = json.Unmarshal(jsonResponse, &environment)
+ return environment, err
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
new file mode 100644
index 000000000..65ad0afc8
--- /dev/null
+++ b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go
@@ -0,0 +1,200 @@
+// Copyright 2017 Microsoft Corporation
+//
+// 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 azure
+
+import (
+ "errors"
+ "fmt"
+ "net/http"
+ "net/url"
+ "strings"
+ "time"
+
+ "github.com/Azure/go-autorest/autorest"
+)
+
+// DoRetryWithRegistration tries to register the resource provider in case it is unregistered.
+// It also handles request retries
+func DoRetryWithRegistration(client autorest.Client) autorest.SendDecorator {
+ return func(s autorest.Sender) autorest.Sender {
+ return autorest.SenderFunc(func(r *http.Request) (resp *http.Response, err error) {
+ rr := autorest.NewRetriableRequest(r)
+ for currentAttempt := 0; currentAttempt < client.RetryAttempts; currentAttempt++ {
+ err = rr.Prepare()
+ if err != nil {
+ return resp, err
+ }
+
+ resp, err = autorest.SendWithSender(s, rr.Request(),
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
+ )
+ if err != nil {
+ return resp, err
+ }
+
+ if resp.StatusCode != http.StatusConflict || client.SkipResourceProviderRegistration {
+ return resp, err
+ }
+ var re RequestError
+ err = autorest.Respond(
+ resp,
+ autorest.ByUnmarshallingJSON(&re),
+ )
+ if err != nil {
+ return resp, err
+ }
+ err = re
+
+ if re.ServiceError != nil && re.ServiceError.Code == "MissingSubscriptionRegistration" {
+ regErr := register(client, r, re)
+ if regErr != nil {
+ return resp, fmt.Errorf("failed auto registering Resource Provider: %s. Original error: %s", regErr, err)
+ }
+ }
+ }
+ return resp, fmt.Errorf("failed request: %s", err)
+ })
+ }
+}
+
+func getProvider(re RequestError) (string, error) {
+ if re.ServiceError != nil && len(re.ServiceError.Details) > 0 {
+ return re.ServiceError.Details[0]["target"].(string), nil
+ }
+ return "", errors.New("provider was not found in the response")
+}
+
+func register(client autorest.Client, originalReq *http.Request, re RequestError) error {
+ subID := getSubscription(originalReq.URL.Path)
+ if subID == "" {
+ return errors.New("missing parameter subscriptionID to register resource provider")
+ }
+ providerName, err := getProvider(re)
+ if err != nil {
+ return fmt.Errorf("missing parameter provider to register resource provider: %s", err)
+ }
+ newURL := url.URL{
+ Scheme: originalReq.URL.Scheme,
+ Host: originalReq.URL.Host,
+ }
+
+ // taken from the resources SDK
+ // with almost identical code, this sections are easier to mantain
+ // It is also not a good idea to import the SDK here
+ // https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L252
+ pathParameters := map[string]interface{}{
+ "resourceProviderNamespace": autorest.Encode("path", providerName),
+ "subscriptionId": autorest.Encode("path", subID),
+ }
+
+ const APIVersion = "2016-09-01"
+ queryParameters := map[string]interface{}{
+ "api-version": APIVersion,
+ }
+
+ preparer := autorest.CreatePreparer(
+ autorest.AsPost(),
+ autorest.WithBaseURL(newURL.String()),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register", pathParameters),
+ autorest.WithQueryParameters(queryParameters),
+ )
+
+ req, err := preparer.Prepare(&http.Request{})
+ if err != nil {
+ return err
+ }
+ req = req.WithContext(originalReq.Context())
+
+ resp, err := autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
+ )
+ if err != nil {
+ return err
+ }
+
+ type Provider struct {
+ RegistrationState *string `json:"registrationState,omitempty"`
+ }
+ var provider Provider
+
+ err = autorest.Respond(
+ resp,
+ WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&provider),
+ autorest.ByClosing(),
+ )
+ if err != nil {
+ return err
+ }
+
+ // poll for registered provisioning state
+ now := time.Now()
+ for err == nil && time.Since(now) < client.PollingDuration {
+ // taken from the resources SDK
+ // https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45
+ preparer := autorest.CreatePreparer(
+ autorest.AsGet(),
+ autorest.WithBaseURL(newURL.String()),
+ autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}", pathParameters),
+ autorest.WithQueryParameters(queryParameters),
+ )
+ req, err = preparer.Prepare(&http.Request{})
+ if err != nil {
+ return err
+ }
+ req = req.WithContext(originalReq.Context())
+
+ resp, err := autorest.SendWithSender(client, req,
+ autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...),
+ )
+ if err != nil {
+ return err
+ }
+
+ err = autorest.Respond(
+ resp,
+ WithErrorUnlessStatusCode(http.StatusOK),
+ autorest.ByUnmarshallingJSON(&provider),
+ autorest.ByClosing(),
+ )
+ if err != nil {
+ return err
+ }
+
+ if provider.RegistrationState != nil &&
+ *provider.RegistrationState == "Registered" {
+ break
+ }
+
+ delayed := autorest.DelayWithRetryAfter(resp, originalReq.Context().Done())
+ if !delayed && !autorest.DelayForBackoff(client.PollingDelay, 0, originalReq.Context().Done()) {
+ return originalReq.Context().Err()
+ }
+ }
+ if !(time.Since(now) < client.PollingDuration) {
+ return errors.New("polling for resource provider registration has exceeded the polling duration")
+ }
+ return err
+}
+
+func getSubscription(path string) string {
+ parts := strings.Split(path, "/")
+ for i, v := range parts {
+ if v == "subscriptions" && (i+1) < len(parts) {
+ return parts[i+1]
+ }
+ }
+ return ""
+}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go
index 5f1e72fbe..4e92dcad0 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/client.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/client.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"fmt"
@@ -21,6 +35,9 @@ const (
// DefaultRetryAttempts is number of attempts for retry status codes (5xx).
DefaultRetryAttempts = 3
+
+ // DefaultRetryDuration is the duration to wait between retries.
+ DefaultRetryDuration = 30 * time.Second
)
var (
@@ -33,7 +50,8 @@ var (
Version(),
)
- statusCodesForRetry = []int{
+ // StatusCodesForRetry are a defined group of status code for which the client will retry
+ StatusCodesForRetry = []int{
http.StatusRequestTimeout, // 408
http.StatusTooManyRequests, // 429
http.StatusInternalServerError, // 500
@@ -148,6 +166,9 @@ type Client struct {
UserAgent string
Jar http.CookieJar
+
+ // Set to true to skip attempted registration of resource providers (false by default).
+ SkipResourceProviderRegistration bool
}
// NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed
@@ -157,9 +178,10 @@ func NewClientWithUserAgent(ua string) Client {
PollingDelay: DefaultPollingDelay,
PollingDuration: DefaultPollingDuration,
RetryAttempts: DefaultRetryAttempts,
- RetryDuration: 30 * time.Second,
+ RetryDuration: DefaultRetryDuration,
UserAgent: defaultUserAgent,
}
+ c.Sender = c.sender()
c.AddToUserAgent(ua)
return c
}
@@ -181,16 +203,22 @@ func (c Client) Do(r *http.Request) (*http.Response, error) {
r, _ = Prepare(r,
WithUserAgent(c.UserAgent))
}
+ // NOTE: c.WithInspection() must be last in the list so that it can inspect all preceding operations
r, err := Prepare(r,
- c.WithInspection(),
- c.WithAuthorization())
+ c.WithAuthorization(),
+ c.WithInspection())
if err != nil {
- return nil, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
+ var resp *http.Response
+ if detErr, ok := err.(DetailedError); ok {
+ // if the authorization failed (e.g. invalid credentials) there will
+ // be a response associated with the error, be sure to return it.
+ resp = detErr.Response
+ }
+ return resp, NewErrorWithError(err, "autorest/Client", "Do", nil, "Preparing request failed")
}
- resp, err := SendWithSender(c.sender(), r,
- DoRetryForStatusCodes(c.RetryAttempts, c.RetryDuration, statusCodesForRetry...))
- Respond(resp,
- c.ByInspecting())
+
+ resp, err := SendWithSender(c.sender(), r)
+ Respond(resp, c.ByInspecting())
return resp, err
}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/date.go b/vendor/github.com/Azure/go-autorest/autorest/date/date.go
index 80ca60e9b..c45710656 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/date/date.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/date/date.go
@@ -5,6 +5,20 @@ time.Time types. And both convert to time.Time through a ToTime method.
*/
package date
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"fmt"
"time"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/time.go b/vendor/github.com/Azure/go-autorest/autorest/date/time.go
index c1af62963..b453fad04 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/date/time.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/date/time.go
@@ -1,5 +1,19 @@
package date
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"regexp"
"time"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go
index 11995fb9f..48fb39ba9 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/date/timerfc1123.go
@@ -1,5 +1,19 @@
package date
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"errors"
"time"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go
index e085c77ee..7073959b2 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/date/unixtime.go
@@ -1,5 +1,19 @@
package date
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"encoding/binary"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go
index 207b1a240..12addf0eb 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/date/utility.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/date/utility.go
@@ -1,5 +1,19 @@
package date
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"strings"
"time"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/error.go b/vendor/github.com/Azure/go-autorest/autorest/error.go
index aaef2ac8e..f724f3332 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/error.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/error.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"fmt"
"net/http"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go
index afd114821..6d67bd733 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/preparer.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/preparer.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"encoding/json"
@@ -13,8 +27,9 @@ import (
)
const (
- mimeTypeJSON = "application/json"
- mimeTypeFormPost = "application/x-www-form-urlencoded"
+ mimeTypeJSON = "application/json"
+ mimeTypeOctetStream = "application/octet-stream"
+ mimeTypeFormPost = "application/x-www-form-urlencoded"
headerAuthorization = "Authorization"
headerContentType = "Content-Type"
@@ -98,6 +113,28 @@ func WithHeader(header string, value string) PrepareDecorator {
}
}
+// WithHeaders returns a PrepareDecorator that sets the specified HTTP headers of the http.Request to
+// the passed value. It canonicalizes the passed headers name (via http.CanonicalHeaderKey) before
+// adding them.
+func WithHeaders(headers map[string]interface{}) PrepareDecorator {
+ h := ensureValueStrings(headers)
+ return func(p Preparer) Preparer {
+ return PreparerFunc(func(r *http.Request) (*http.Request, error) {
+ r, err := p.Prepare(r)
+ if err == nil {
+ if r.Header == nil {
+ r.Header = make(http.Header)
+ }
+
+ for name, value := range h {
+ r.Header.Set(http.CanonicalHeaderKey(name), value)
+ }
+ }
+ return r, err
+ })
+ }
+}
+
// WithBearerAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose
// value is "Bearer " followed by the supplied token.
func WithBearerAuthorization(token string) PrepareDecorator {
@@ -128,6 +165,11 @@ func AsJSON() PrepareDecorator {
return AsContentType(mimeTypeJSON)
}
+// AsOctetStream returns a PrepareDecorator that adds the "application/octet-stream" Content-Type header.
+func AsOctetStream() PrepareDecorator {
+ return AsContentType(mimeTypeOctetStream)
+}
+
// WithMethod returns a PrepareDecorator that sets the HTTP method of the passed request. The
// decorator does not validate that the passed method string is a known HTTP method.
func WithMethod(method string) PrepareDecorator {
@@ -201,6 +243,11 @@ func WithFormData(v url.Values) PrepareDecorator {
r, err := p.Prepare(r)
if err == nil {
s := v.Encode()
+
+ if r.Header == nil {
+ r.Header = make(http.Header)
+ }
+ r.Header.Set(http.CanonicalHeaderKey(headerContentType), mimeTypeFormPost)
r.ContentLength = int64(len(s))
r.Body = ioutil.NopCloser(strings.NewReader(s))
}
@@ -416,11 +463,16 @@ func WithQueryParameters(queryParameters map[string]interface{}) PrepareDecorato
if r.URL == nil {
return r, NewError("autorest", "WithQueryParameters", "Invoked with a nil URL")
}
+
v := r.URL.Query()
for key, value := range parameters {
- v.Add(key, value)
+ d, err := url.QueryUnescape(value)
+ if err != nil {
+ return r, err
+ }
+ v.Add(key, d)
}
- r.URL.RawQuery = createQuery(v)
+ r.URL.RawQuery = v.Encode()
}
return r, err
})
diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go
index 87f71e585..a908a0adb 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/responder.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/responder.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"encoding/json"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go
index 0ab1eb300..fa11dbed7 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"io"
diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go
index e28eb2cbd..7143cc61b 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.7.go
@@ -1,17 +1,31 @@
// +build !go1.8
+// Copyright 2017 Microsoft Corporation
+//
+// 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 autorest
import (
"bytes"
+ "io/ioutil"
"net/http"
)
// RetriableRequest provides facilities for retrying an HTTP request.
type RetriableRequest struct {
- req *http.Request
- br *bytes.Reader
- reset bool
+ req *http.Request
+ br *bytes.Reader
}
// Prepare signals that the request is about to be sent.
@@ -19,21 +33,17 @@ func (rr *RetriableRequest) Prepare() (err error) {
// preserve the request body; this is to support retry logic as
// the underlying transport will always close the reqeust body
if rr.req.Body != nil {
- if rr.reset {
- if rr.br != nil {
- _, err = rr.br.Seek(0, 0 /*io.SeekStart*/)
- }
- rr.reset = false
- if err != nil {
- return err
- }
+ if rr.br != nil {
+ _, err = rr.br.Seek(0, 0 /*io.SeekStart*/)
+ rr.req.Body = ioutil.NopCloser(rr.br)
+ }
+ if err != nil {
+ return err
}
if rr.br == nil {
// fall back to making a copy (only do this once)
err = rr.prepareFromByteReader()
}
- // indicates that the request body needs to be reset
- rr.reset = true
}
return err
}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go
index 8c1d1aec8..ae15c6bf9 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/retriablerequest_1.8.go
@@ -1,19 +1,33 @@
// +build go1.8
+// Copyright 2017 Microsoft Corporation
+//
+// 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 autorest
import (
"bytes"
"io"
+ "io/ioutil"
"net/http"
)
// RetriableRequest provides facilities for retrying an HTTP request.
type RetriableRequest struct {
- req *http.Request
- rc io.ReadCloser
- br *bytes.Reader
- reset bool
+ req *http.Request
+ rc io.ReadCloser
+ br *bytes.Reader
}
// Prepare signals that the request is about to be sent.
@@ -21,16 +35,14 @@ func (rr *RetriableRequest) Prepare() (err error) {
// preserve the request body; this is to support retry logic as
// the underlying transport will always close the reqeust body
if rr.req.Body != nil {
- if rr.reset {
- if rr.rc != nil {
- rr.req.Body = rr.rc
- } else if rr.br != nil {
- _, err = rr.br.Seek(0, io.SeekStart)
- }
- rr.reset = false
- if err != nil {
- return err
- }
+ if rr.rc != nil {
+ rr.req.Body = rr.rc
+ } else if rr.br != nil {
+ _, err = rr.br.Seek(0, io.SeekStart)
+ rr.req.Body = ioutil.NopCloser(rr.br)
+ }
+ if err != nil {
+ return err
}
if rr.req.GetBody != nil {
// this will allow us to preserve the body without having to
@@ -43,8 +55,6 @@ func (rr *RetriableRequest) Prepare() (err error) {
// fall back to making a copy (only do this once)
err = rr.prepareFromByteReader()
}
- // indicates that the request body needs to be reset
- rr.reset = true
}
return err
}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go
index 94b029847..b4f762325 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/sender.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go
@@ -1,5 +1,19 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"fmt"
"log"
@@ -72,7 +86,7 @@ func SendWithSender(s Sender, r *http.Request, decorators ...SendDecorator) (*ht
func AfterDelay(d time.Duration) SendDecorator {
return func(s Sender) Sender {
return SenderFunc(func(r *http.Request) (*http.Response, error) {
- if !DelayForBackoff(d, 0, r.Cancel) {
+ if !DelayForBackoff(d, 0, r.Context().Done()) {
return nil, fmt.Errorf("autorest: AfterDelay canceled before full delay")
}
return s.Do(r)
@@ -151,7 +165,7 @@ func DoPollForStatusCodes(duration time.Duration, delay time.Duration, codes ...
resp, err = s.Do(r)
if err == nil && ResponseHasStatusCode(resp, codes...) {
- r, err = NewPollingRequest(resp, r.Cancel)
+ r, err = NewPollingRequestWithContext(r.Context(), resp)
for err == nil && ResponseHasStatusCode(resp, codes...) {
Respond(resp,
@@ -184,7 +198,9 @@ func DoRetryForAttempts(attempts int, backoff time.Duration) SendDecorator {
if err == nil {
return resp, err
}
- DelayForBackoff(backoff, attempt, r.Cancel)
+ if !DelayForBackoff(backoff, attempt, r.Context().Done()) {
+ return nil, r.Context().Err()
+ }
}
return resp, err
})
@@ -201,18 +217,25 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se
rr := NewRetriableRequest(r)
// Increment to add the first call (attempts denotes number of retries)
attempts++
- for attempt := 0; attempt < attempts; attempt++ {
+ for attempt := 0; attempt < attempts; {
err = rr.Prepare()
if err != nil {
return resp, err
}
resp, err = s.Do(rr.Request())
- if err != nil || !ResponseHasStatusCode(resp, codes...) {
+ // we want to retry if err is not nil (e.g. transient network failure). note that for failed authentication
+ // resp and err will both have a value, so in this case we don't want to retry as it will never succeed.
+ if err == nil && !ResponseHasStatusCode(resp, codes...) || IsTokenRefreshError(err) {
return resp, err
}
- delayed := DelayWithRetryAfter(resp, r.Cancel)
- if !delayed {
- DelayForBackoff(backoff, attempt, r.Cancel)
+ delayed := DelayWithRetryAfter(resp, r.Context().Done())
+ if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) {
+ return nil, r.Context().Err()
+ }
+ // don't count a 429 against the number of attempts
+ // so that we continue to retry until it succeeds
+ if resp == nil || resp.StatusCode != http.StatusTooManyRequests {
+ attempt++
}
}
return resp, err
@@ -223,6 +246,9 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se
// DelayWithRetryAfter invokes time.After for the duration specified in the "Retry-After" header in
// responses with status code 429
func DelayWithRetryAfter(resp *http.Response, cancel <-chan struct{}) bool {
+ if resp == nil {
+ return false
+ }
retryAfter, _ := strconv.Atoi(resp.Header.Get("Retry-After"))
if resp.StatusCode == http.StatusTooManyRequests && retryAfter > 0 {
select {
@@ -253,7 +279,9 @@ func DoRetryForDuration(d time.Duration, backoff time.Duration) SendDecorator {
if err == nil {
return resp, err
}
- DelayForBackoff(backoff, attempt, r.Cancel)
+ if !DelayForBackoff(backoff, attempt, r.Context().Done()) {
+ return nil, r.Context().Err()
+ }
}
return resp, err
})
diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go
index 7b180b866..fdda2ce1a 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go
@@ -3,6 +3,20 @@ Package to provides helpers to ease working with pointer values of marshalled st
*/
package to
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
// String returns a string value for the passed string pointer. It returns the empty string if the
// pointer is nil.
func String(s *string) string {
diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go
index 78067148b..afb3e4e16 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/utility.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go
@@ -1,15 +1,31 @@
package autorest
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
+
import (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"io"
+ "net/http"
"net/url"
"reflect"
- "sort"
"strings"
+
+ "github.com/Azure/go-autorest/autorest/adal"
)
// EncodedAs is a series of constants specifying various data encodings
@@ -123,13 +139,38 @@ func MapToValues(m map[string]interface{}) url.Values {
return v
}
-// String method converts interface v to string. If interface is a list, it
-// joins list elements using separator.
-func String(v interface{}, sep ...string) string {
- if len(sep) > 0 {
- return ensureValueString(strings.Join(v.([]string), sep[0]))
+// AsStringSlice method converts interface{} to []string. This expects a
+//that the parameter passed to be a slice or array of a type that has the underlying
+//type a string.
+func AsStringSlice(s interface{}) ([]string, error) {
+ v := reflect.ValueOf(s)
+ if v.Kind() != reflect.Slice && v.Kind() != reflect.Array {
+ return nil, NewError("autorest", "AsStringSlice", "the value's type is not an array.")
}
- return ensureValueString(v)
+ stringSlice := make([]string, 0, v.Len())
+
+ for i := 0; i < v.Len(); i++ {
+ stringSlice = append(stringSlice, v.Index(i).String())
+ }
+ return stringSlice, nil
+}
+
+// String method converts interface v to string. If interface is a list, it
+// joins list elements using the seperator. Note that only sep[0] will be used for
+// joining if any separator is specified.
+func String(v interface{}, sep ...string) string {
+ if len(sep) == 0 {
+ return ensureValueString(v)
+ }
+ stringSlice, ok := v.([]string)
+ if ok == false {
+ var err error
+ stringSlice, err = AsStringSlice(v)
+ if err != nil {
+ panic(fmt.Sprintf("autorest: Couldn't convert value to a string %s.", err))
+ }
+ }
+ return ensureValueString(strings.Join(stringSlice, sep[0]))
}
// Encode method encodes url path and query parameters.
@@ -153,26 +194,25 @@ func queryEscape(s string) string {
return url.QueryEscape(s)
}
-// This method is same as Encode() method of "net/url" go package,
-// except it does not encode the query parameters because they
-// already come encoded. It formats values map in query format (bar=foo&a=b).
-func createQuery(v url.Values) string {
- var buf bytes.Buffer
- keys := make([]string, 0, len(v))
- for k := range v {
- keys = append(keys, k)
- }
- sort.Strings(keys)
- for _, k := range keys {
- vs := v[k]
- prefix := url.QueryEscape(k) + "="
- for _, v := range vs {
- if buf.Len() > 0 {
- buf.WriteByte('&')
- }
- buf.WriteString(prefix)
- buf.WriteString(v)
- }
- }
- return buf.String()
+// ChangeToGet turns the specified http.Request into a GET (it assumes it wasn't).
+// This is mainly useful for long-running operations that use the Azure-AsyncOperation
+// header, so we change the initial PUT into a GET to retrieve the final result.
+func ChangeToGet(req *http.Request) *http.Request {
+ req.Method = "GET"
+ req.Body = nil
+ req.ContentLength = 0
+ req.Header.Del("Content-Length")
+ return req
+}
+
+// IsTokenRefreshError returns true if the specified error implements the TokenRefreshError
+// interface. If err is a DetailedError it will walk the chain of Original errors.
+func IsTokenRefreshError(err error) bool {
+ if _, ok := err.(adal.TokenRefreshError); ok {
+ return true
+ }
+ if de, ok := err.(DetailedError); ok {
+ return IsTokenRefreshError(de.Original)
+ }
+ return false
}
diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go
index a222e8efa..4ad7754ad 100644
--- a/vendor/github.com/Azure/go-autorest/autorest/version.go
+++ b/vendor/github.com/Azure/go-autorest/autorest/version.go
@@ -1,35 +1,20 @@
package autorest
-import (
- "bytes"
- "fmt"
- "strings"
- "sync"
-)
-
-const (
- major = 8
- minor = 0
- patch = 0
- tag = ""
-)
-
-var once sync.Once
-var version string
+// Copyright 2017 Microsoft Corporation
+//
+// 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.
// Version returns the semantic version (see http://semver.org).
func Version() string {
- once.Do(func() {
- semver := fmt.Sprintf("%d.%d.%d", major, minor, patch)
- verBuilder := bytes.NewBufferString(semver)
- if tag != "" && tag != "-" {
- updated := strings.TrimPrefix(tag, "-")
- _, err := verBuilder.WriteString("-" + updated)
- if err == nil {
- verBuilder = bytes.NewBufferString(semver)
- }
- }
- version = verBuilder.String()
- })
- return version
+ return "v10.5.0"
}
diff --git a/vendor/gopkg.in/square/go-jose.v1/LICENSE b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/LICENSE
similarity index 99%
rename from vendor/gopkg.in/square/go-jose.v1/LICENSE
rename to vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/LICENSE
index d64569567..8dada3eda 100644
--- a/vendor/gopkg.in/square/go-jose.v1/LICENSE
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/LICENSE
@@ -1,4 +1,3 @@
-
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@@ -179,7 +178,7 @@
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 "[]"
+ 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
@@ -187,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
- Copyright [yyyy] [name of copyright owner]
+ 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.
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/api.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/api.go
new file mode 100644
index 000000000..d20ce434e
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/api.go
@@ -0,0 +1,36 @@
+package client
+
+import (
+ "encoding/json"
+)
+
+// Resource is the "base" type for all API resources
+type Resource struct {
+ Complete chan bool `json:"-"`
+}
+
+// Init initializes the Complete channel, if it is necessary
+// need to create a resource specific Init(), make sure to
+// initialize the channel.
+func (resource *Resource) Init() {
+ resource.Complete = make(chan bool, 1)
+}
+
+// PostUnmarshalJSON is a default implementation of the
+// PostUnmarshalJSON hook that simply calls Init() and
+// sends true to the Complete channel. This is overridden
+// in many resources, in particular those that represent
+// collections, and have to initialize sub-resources also.
+func (resource *Resource) PostUnmarshalJSON() error {
+ resource.Init()
+ resource.Complete <- true
+ return nil
+}
+
+// GetJSON returns the raw (indented) JSON (as []bytes)
+func (resource *Resource) GetJSON() ([]byte, error) {
+ return json.MarshalIndent(resource, "", " ")
+}
+
+// JSONBody is a generic struct for temporary JSON unmarshalling.
+type JSONBody map[string]interface{}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/client.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/client.go
new file mode 100644
index 000000000..b02dba76a
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/client.go
@@ -0,0 +1,111 @@
+// Package client is a simple library for http.Client to sign Akamai OPEN Edgegrid API requests
+package client
+
+import (
+ "bytes"
+ "errors"
+ "io"
+ "io/ioutil"
+ "net/http"
+ "net/url"
+ "runtime"
+ "strings"
+
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1"
+)
+
+var (
+ libraryVersion = "0.6.0"
+ // UserAgent is the User-Agent value sent for all requests
+ UserAgent = "Akamai-Open-Edgegrid-golang/" + libraryVersion + " golang/" + strings.TrimPrefix(runtime.Version(), "go")
+ // Client is the *http.Client to use
+ Client = http.DefaultClient
+)
+
+// NewRequest creates an HTTP request that can be sent to Akamai APIs. A relative URL can be provided in path, which will be resolved to the
+// Host specified in Config. If body is specified, it will be sent as the request body.
+func NewRequest(config edgegrid.Config, method, path string, body io.Reader) (*http.Request, error) {
+ var (
+ baseURL *url.URL
+ err error
+ )
+
+ if strings.HasPrefix(config.Host, "https://") {
+ baseURL, err = url.Parse(config.Host)
+ } else {
+ baseURL, err = url.Parse("https://" + config.Host)
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ rel, err := url.Parse(strings.TrimPrefix(path, "/"))
+ if err != nil {
+ return nil, err
+ }
+
+ u := baseURL.ResolveReference(rel)
+
+ req, err := http.NewRequest(method, u.String(), body)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Add("User-Agent", UserAgent)
+
+ return req, nil
+}
+
+// NewJSONRequest creates an HTTP request that can be sent to the Akamai APIs with a JSON body
+// The JSON body is encoded and the Content-Type/Accept headers are set automatically.
+func NewJSONRequest(config edgegrid.Config, method, path string, body interface{}) (*http.Request, error) {
+ jsonBody, err := jsonhooks.Marshal(body)
+ if err != nil {
+ return nil, err
+ }
+
+ buf := bytes.NewReader(jsonBody)
+ req, err := NewRequest(config, method, path, buf)
+ if err != nil {
+ return nil, err
+ }
+
+ req.Header.Set("Content-Type", "application/json")
+ req.Header.Set("Accept", "application/json,*/*")
+
+ return req, nil
+}
+
+// Do performs a given HTTP Request, signed with the Akamai OPEN Edgegrid
+// Authorization header. An edgegrid.Response or an error is returned.
+func Do(config edgegrid.Config, req *http.Request) (*http.Response, error) {
+ Client.CheckRedirect = func(req *http.Request, via []*http.Request) error {
+ req = edgegrid.AddRequestHeader(config, req)
+ return nil
+ }
+
+ req = edgegrid.AddRequestHeader(config, req)
+ res, err := Client.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ return res, nil
+}
+
+// BodyJSON unmarshals the Response.Body into a given data structure
+func BodyJSON(r *http.Response, data interface{}) error {
+ if data == nil {
+ return errors.New("You must pass in an interface{}")
+ }
+
+ body, err := ioutil.ReadAll(r.Body)
+ if err != nil {
+ return err
+ }
+ err = jsonhooks.Unmarshal(body, data)
+
+ return err
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/errors.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/errors.go
new file mode 100644
index 000000000..c679963f4
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1/errors.go
@@ -0,0 +1,88 @@
+package client
+
+import (
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "strings"
+
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1"
+)
+
+// APIError exposes an Akamai OPEN Edgegrid Error
+type APIError struct {
+ error
+ Type string `json:"type"`
+ Title string `json:"title"`
+ Status int `json:"status"`
+ Detail string `json:"detail"`
+ Instance string `json:"instance"`
+ Method string `json:"method"`
+ ServerIP string `json:"serverIp"`
+ ClientIP string `json:"clientIp"`
+ RequestID string `json:"requestId"`
+ RequestTime string `json:"requestTime"`
+ Response *http.Response `json:"-"`
+ RawBody string `json:"-"`
+}
+
+func (error APIError) Error() string {
+ return strings.TrimSpace(fmt.Sprintf("API Error: %d %s %s More Info %s", error.Status, error.Title, error.Detail, error.Type))
+}
+
+// NewAPIError creates a new API error based on a Response,
+// or http.Response-like.
+func NewAPIError(response *http.Response) APIError {
+ // TODO: handle this error
+ body, _ := ioutil.ReadAll(response.Body)
+
+ return NewAPIErrorFromBody(response, body)
+}
+
+// NewAPIErrorFromBody creates a new API error, allowing you to pass in a body
+//
+// This function is intended to be used after the body has already been read for
+// other purposes.
+func NewAPIErrorFromBody(response *http.Response, body []byte) APIError {
+ error := APIError{}
+
+ if err := jsonhooks.Unmarshal(body, &error); err == nil {
+ error.Status = response.StatusCode
+ error.Title = response.Status
+ }
+
+ error.Response = response
+ error.RawBody = string(body)
+
+ return error
+}
+
+// IsInformational determines if a response was informational (1XX status)
+func IsInformational(r *http.Response) bool {
+ return r.StatusCode > 99 && r.StatusCode < 200
+}
+
+// IsSuccess determines if a response was successful (2XX status)
+func IsSuccess(r *http.Response) bool {
+ return r.StatusCode > 199 && r.StatusCode < 300
+}
+
+// IsRedirection determines if a response was a redirect (3XX status)
+func IsRedirection(r *http.Response) bool {
+ return r.StatusCode > 299 && r.StatusCode < 400
+}
+
+// IsClientError determines if a response was a client error (4XX status)
+func IsClientError(r *http.Response) bool {
+ return r.StatusCode > 399 && r.StatusCode < 500
+}
+
+// IsServerError determines if a response was a server error (5XX status)
+func IsServerError(r *http.Response) bool {
+ return r.StatusCode > 499 && r.StatusCode < 600
+}
+
+// IsError determines if the response was a client or server error (4XX or 5XX status)
+func IsError(r *http.Response) bool {
+ return r.StatusCode > 399 && r.StatusCode < 600
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/errors.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/errors.go
new file mode 100644
index 000000000..06eed5daa
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/errors.go
@@ -0,0 +1,125 @@
+package dns
+
+import (
+ "fmt"
+)
+
+type ConfigDNSError interface {
+ error
+ Network() bool
+ NotFound() bool
+ FailedToSave() bool
+ ValidationFailed() bool
+}
+
+func IsConfigDNSError(e error) bool {
+ _, ok := e.(ConfigDNSError)
+ return ok
+}
+
+type ZoneError struct {
+ zoneName string
+ httpErrorMessage string
+ apiErrorMessage string
+ err error
+}
+
+func (e *ZoneError) Network() bool {
+ if e.httpErrorMessage != "" {
+ return true
+ }
+ return false
+}
+
+func (e *ZoneError) NotFound() bool {
+ if e.err == nil && e.httpErrorMessage == "" && e.apiErrorMessage == "" {
+ return true
+ }
+ return false
+}
+
+func (e *ZoneError) FailedToSave() bool {
+ return false
+}
+
+func (e *ZoneError) ValidationFailed() bool {
+ if e.apiErrorMessage != "" {
+ return true
+ }
+ return false
+}
+
+func (e *ZoneError) Error() string {
+ if e.Network() {
+ return fmt.Sprintf("Zone \"%s\" network error: [%s]", e.zoneName, e.httpErrorMessage)
+ }
+
+ if e.NotFound() {
+ return fmt.Sprintf("Zone \"%s\" not found.", e.zoneName)
+ }
+
+ if e.FailedToSave() {
+ return fmt.Sprintf("Zone \"%s\" failed to save: [%s]", e.zoneName, e.err.Error())
+ }
+
+ if e.ValidationFailed() {
+ return fmt.Sprintf("Zone \"%s\" validation failed: [%s]", e.zoneName, e.apiErrorMessage)
+ }
+
+ if e.err != nil {
+ return e.err.Error()
+ }
+
+ return ""
+}
+
+type RecordError struct {
+ fieldName string
+ httpErrorMessage string
+ err error
+}
+
+func (e *RecordError) Network() bool {
+ if e.httpErrorMessage != "" {
+ return true
+ }
+ return false
+}
+
+func (e *RecordError) NotFound() bool {
+ return false
+}
+
+func (e *RecordError) FailedToSave() bool {
+ if e.fieldName == "" {
+ return true
+ }
+ return false
+}
+
+func (e *RecordError) ValidationFailed() bool {
+ if e.fieldName != "" {
+ return true
+ }
+ return false
+}
+
+func (e *RecordError) Error() string {
+ if e.Network() {
+ return fmt.Sprintf("Record network error: [%s]", e.httpErrorMessage)
+ }
+
+ if e.NotFound() {
+ return fmt.Sprintf("Record not found.")
+ }
+
+ if e.FailedToSave() {
+ return fmt.Sprintf("Record failed to save: [%s]", e.err.Error())
+ }
+
+ if e.ValidationFailed() {
+ return fmt.Sprintf("Record validation failed for field [%s]", e.fieldName)
+ }
+
+ return ""
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/record.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/record.go
new file mode 100644
index 000000000..1c2dcb48e
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/record.go
@@ -0,0 +1,1738 @@
+package dns
+
+import (
+ "strings"
+ "time"
+)
+
+// All record types (below) must implement the DNSRecord interface
+// This allows the record to be used dynamically in slices - see the Zone struct definition in zone.go
+//
+// The record types implemented and their fields are as defined here
+// https://developer.akamai.com/api/luna/config-dns/data.html
+type DNSRecord interface {
+ // Get the list of allowed fields for this type
+ GetAllowedFields() []string
+ // Set a field on the struct, which check for valid fields
+ SetField(name string, value interface{}) error
+ // Translate struct properties to a map
+ ToMap() map[string]interface{}
+}
+
+type ARecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewARecord() *ARecord {
+ return &ARecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *ARecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *ARecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *ARecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type AaaaRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewAaaaRecord() *AaaaRecord {
+ return &AaaaRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *AaaaRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *AaaaRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *AaaaRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type AfsdbRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+ Subtype int `json:"subtype,omitempty"`
+}
+
+func NewAfsdbRecord() *AfsdbRecord {
+ return &AfsdbRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ "subtype",
+ },
+ }
+}
+
+func (record *AfsdbRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *AfsdbRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ case "subtype":
+ v, ok := value.(int)
+ if ok {
+ record.Subtype = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *AfsdbRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ "subtype": record.Subtype,
+ }
+}
+
+type CnameRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewCnameRecord() *CnameRecord {
+ return &CnameRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *CnameRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *CnameRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *CnameRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type DnskeyRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Flags int `json:"flags,omitempty"`
+ Protocol int `json:"protocol,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ Key string `json:"key,omitempty"`
+}
+
+func NewDnskeyRecord() *DnskeyRecord {
+ return &DnskeyRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "flags",
+ "protocol",
+ "algorithm",
+ "key",
+ },
+ }
+}
+
+func (record *DnskeyRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *DnskeyRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "flags":
+ v, ok := value.(int)
+ if ok {
+ record.Flags = v
+ return nil
+ }
+ case "protocol":
+ v, ok := value.(int)
+ if ok {
+ record.Protocol = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "key":
+ v, ok := value.(string)
+ if ok {
+ record.Key = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *DnskeyRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "flags": record.Flags,
+ "protocol": record.Protocol,
+ "algorithm": record.Algorithm,
+ "key": record.Key,
+ }
+}
+
+type DsRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Keytag int `json:"keytag,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ DigestType int `json:"digest_type,omitempty"`
+ Digest string `json:"digest,omitempty"`
+}
+
+func NewDsRecord() *DsRecord {
+ return &DsRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "keytag",
+ "algorithm",
+ "digesttype",
+ "digest",
+ },
+ }
+}
+
+func (record *DsRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *DsRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "keytag":
+ v, ok := value.(int)
+ if ok {
+ record.Keytag = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "digesttype":
+ v, ok := value.(int)
+ if ok {
+ record.DigestType = v
+ return nil
+ }
+ case "digest":
+ v, ok := value.(string)
+ if ok {
+ record.Digest = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *DsRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "keytag": record.Keytag,
+ "algorithm": record.Algorithm,
+ "digesttype": record.DigestType,
+ "digest": record.DigestType,
+ }
+}
+
+type HinfoRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Hardware string `json:"hardware,omitempty"`
+ Software string `json:"software,omitempty"`
+}
+
+func NewHinfoRecord() *HinfoRecord {
+ return &HinfoRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "hardware",
+ "software",
+ },
+ }
+}
+
+func (record *HinfoRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *HinfoRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "hardware":
+ v, ok := value.(string)
+ if ok {
+ record.Hardware = v
+ return nil
+ }
+ case "software":
+ v, ok := value.(string)
+ if ok {
+ record.Software = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *HinfoRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "hardware": record.Hardware,
+ "software": record.Software,
+ }
+}
+
+type LocRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewLocRecord() *LocRecord {
+ return &LocRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *LocRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *LocRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *LocRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type MxRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+ Priority int `json:"priority,omitempty"`
+}
+
+func NewMxRecord() *MxRecord {
+ return &MxRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ "priority",
+ },
+ }
+}
+
+func (record *MxRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *MxRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ case "priority":
+ v, ok := value.(int)
+ if ok {
+ record.Priority = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *MxRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ "priority": record.Priority,
+ }
+}
+
+type NaptrRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Order uint16 `json:"order,omitempty"`
+ Preference uint16 `json:"preference,omitempty"`
+ Flags string `json:"flags,omitempty"`
+ Service string `json:"service,omitempty"`
+ Regexp string `json:"regexp,omitempty"`
+ Replacement string `json:"replacement,omitempty"`
+}
+
+func NewNaptrRecord() *NaptrRecord {
+ return &NaptrRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "order",
+ "preference",
+ "flags",
+ "service",
+ "regexp",
+ "replacement",
+ },
+ }
+}
+
+func (record *NaptrRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *NaptrRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "order":
+ v, ok := value.(uint16)
+ if ok {
+ record.Order = v
+ return nil
+ }
+ case "preference":
+ v, ok := value.(uint16)
+ if ok {
+ record.Preference = v
+ return nil
+ }
+ case "flags":
+ v, ok := value.(string)
+ if ok {
+ record.Flags = v
+ return nil
+ }
+ case "service":
+ v, ok := value.(string)
+ if ok {
+ record.Service = v
+ return nil
+ }
+ case "regexp":
+ v, ok := value.(string)
+ if ok {
+ record.Regexp = v
+ return nil
+ }
+ case "replacement":
+ v, ok := value.(string)
+ if ok {
+ record.Replacement = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *NaptrRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "order": record.Order,
+ "preference": record.Preference,
+ "flags": record.Flags,
+ "service": record.Service,
+ "regexp": record.Regexp,
+ "replacement": record.Replacement,
+ }
+}
+
+type NsRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewNsRecord() *NsRecord {
+ return &NsRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *NsRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *NsRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *NsRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type Nsec3Record struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ Flags int `json:"flags,omitempty"`
+ Iterations int `json:"iterations,omitempty"`
+ Salt string `json:"salt,omitempty"`
+ NextHashedOwnerName string `json:"next_hashed_owner_name,omitempty"`
+ TypeBitmaps string `json:"type_bitmaps,omitempty"`
+}
+
+func NewNsec3Record() *Nsec3Record {
+ return &Nsec3Record{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "algorithm",
+ "flags",
+ "iterations",
+ "salt",
+ "nexthashedownername",
+ "typebitmaps",
+ },
+ }
+}
+
+func (record *Nsec3Record) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *Nsec3Record) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "flags":
+ v, ok := value.(int)
+ if ok {
+ record.Flags = v
+ return nil
+ }
+ case "iterations":
+ v, ok := value.(int)
+ if ok {
+ record.Iterations = v
+ return nil
+ }
+ case "salt":
+ v, ok := value.(string)
+ if ok {
+ record.Salt = v
+ return nil
+ }
+ case "nexthashedownername":
+ v, ok := value.(string)
+ if ok {
+ record.NextHashedOwnerName = v
+ return nil
+ }
+ case "typebitmaps":
+ v, ok := value.(string)
+ if ok {
+ record.TypeBitmaps = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *Nsec3Record) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "algorithm": record.Algorithm,
+ "flags": record.Flags,
+ "iterations": record.Iterations,
+ "salt": record.Salt,
+ "nexthashedownername": record.NextHashedOwnerName,
+ "typebitmaps": record.TypeBitmaps,
+ }
+}
+
+type Nsec3paramRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ Flags int `json:"flags,omitempty"`
+ Iterations int `json:"iterations,omitempty"`
+ Salt string `json:"salt,omitempty"`
+}
+
+func NewNsec3paramRecord() *Nsec3paramRecord {
+ return &Nsec3paramRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "algorithm",
+ "flags",
+ "iterations",
+ "salt",
+ },
+ }
+}
+
+func (record *Nsec3paramRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *Nsec3paramRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "flags":
+ v, ok := value.(int)
+ if ok {
+ record.Flags = v
+ return nil
+ }
+ case "iterations":
+ v, ok := value.(int)
+ if ok {
+ record.Iterations = v
+ return nil
+ }
+ case "salt":
+ v, ok := value.(string)
+ if ok {
+ record.Salt = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *Nsec3paramRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "algorithm": record.Algorithm,
+ "flags": record.Flags,
+ "iterations": record.Iterations,
+ "salt": record.Salt,
+ }
+}
+
+type PtrRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewPtrRecord() *PtrRecord {
+ return &PtrRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *PtrRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *PtrRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *PtrRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type RpRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Mailbox string `json:"mailbox,omitempty"`
+ Txt string `json:"txt,omitempty"`
+}
+
+func NewRpRecord() *RpRecord {
+ return &RpRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "mailbox",
+ "txt",
+ },
+ }
+}
+
+func (record *RpRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *RpRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "mailbox":
+ v, ok := value.(string)
+ if ok {
+ record.Mailbox = v
+ return nil
+ }
+ case "txt":
+ v, ok := value.(string)
+ if ok {
+ record.Txt = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *RpRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "mailbox": record.Mailbox,
+ "txt": record.Txt,
+ }
+}
+
+type RrsigRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ TypeCovered string `json:"type_covered,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ OriginalTTL int `json:"original_ttl,omitempty"`
+ Expiration string `json:"expiration,omitempty"`
+ Inception string `json:"inception,omitempty"`
+ Keytag int `json:"keytag,omitempty"`
+ Signer string `json:"signer,omitempty"`
+ Signature string `json:"signature,omitempty"`
+ Labels int `json:"labels,omitempty"`
+}
+
+func NewRrsigRecord() *RrsigRecord {
+ return &RrsigRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "typecovered",
+ "algorithm",
+ "originalttl",
+ "expiration",
+ "inception",
+ "keytag",
+ "signer",
+ "signature",
+ "labels",
+ },
+ }
+}
+
+func (record *RrsigRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *RrsigRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "typecovered":
+ v, ok := value.(string)
+ if ok {
+ record.TypeCovered = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "originalttl":
+ v, ok := value.(int)
+ if ok {
+ record.OriginalTTL = v
+ return nil
+ }
+ case "expiration":
+ v, ok := value.(string)
+ if ok {
+ record.Expiration = v
+ return nil
+ }
+ case "inception":
+ v, ok := value.(string)
+ if ok {
+ record.Inception = v
+ return nil
+ }
+ case "keytag":
+ v, ok := value.(int)
+ if ok {
+ record.Keytag = v
+ return nil
+ }
+ case "signer":
+ v, ok := value.(string)
+ if ok {
+ record.Signer = v
+ return nil
+ }
+ case "signature":
+ v, ok := value.(string)
+ if ok {
+ record.Signature = v
+ return nil
+ }
+ case "labels":
+ v, ok := value.(int)
+ if ok {
+ record.Labels = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *RrsigRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "typecovered": record.TypeCovered,
+ "algorithm": record.Algorithm,
+ "originalttl": record.OriginalTTL,
+ "expiration": record.Expiration,
+ "inception": record.Inception,
+ "keytag": record.Keytag,
+ "signer": record.Signer,
+ "signature": record.Signature,
+ "labels": record.Labels,
+ }
+}
+
+type SoaRecord struct {
+ fieldMap []string `json:"-"`
+ TTL int `json:"ttl,omitempty"`
+ Originserver string `json:"originserver,omitempty"`
+ Contact string `json:"contact,omitempty"`
+ Serial uint `json:"serial,omitempty"`
+ Refresh int `json:"refresh,omitempty"`
+ Retry int `json:"retry,omitempty"`
+ Expire int `json:"expire,omitempty"`
+ Minimum uint `json:"minimum,omitempty"`
+}
+
+func NewSoaRecord() *SoaRecord {
+ r := &SoaRecord{
+ fieldMap: []string{
+ "ttl",
+ "originserver",
+ "contact",
+ "serial",
+ "refresh",
+ "retry",
+ "expire",
+ "minimum",
+ },
+ }
+ r.SetField("serial", int(time.Now().Unix()))
+ return r
+}
+
+func (record *SoaRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *SoaRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "originserver":
+ v, ok := value.(string)
+ if ok {
+ record.Originserver = v
+ return nil
+ }
+ case "contact":
+ v, ok := value.(string)
+ if ok {
+ record.Contact = v
+ return nil
+ }
+ case "serial":
+ v, ok := value.(uint)
+ if ok {
+ record.Serial = v
+ return nil
+ }
+ case "refresh":
+ v, ok := value.(int)
+ if ok {
+ record.Refresh = v
+ return nil
+ }
+ case "retry":
+ v, ok := value.(int)
+ if ok {
+ record.Retry = v
+ return nil
+ }
+ case "expire":
+ v, ok := value.(int)
+ if ok {
+ record.Expire = v
+ return nil
+ }
+ case "minimum":
+ v, ok := value.(uint)
+ if ok {
+ record.Minimum = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *SoaRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "ttl": record.TTL,
+ "originserver": record.Originserver,
+ "contact": record.Contact,
+ "serial": record.Serial,
+ "refresh": record.Refresh,
+ "retry": record.Retry,
+ "expire": record.Expire,
+ "minimum": record.Minimum,
+ }
+}
+
+type SpfRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewSpfRecord() *SpfRecord {
+ return &SpfRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *SpfRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *SpfRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *SpfRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+type SrvRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+ Priority int `json:"priority,omitempty"`
+ Weight uint16 `json:"weight,omitempty"`
+ Port uint16 `json:"port,omitempty"`
+}
+
+func NewSrvRecord() *SrvRecord {
+ return &SrvRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ "priority",
+ "weight",
+ "port",
+ },
+ }
+}
+
+func (record *SrvRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *SrvRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ case "priority":
+ v, ok := value.(int)
+ if ok {
+ record.Priority = v
+ return nil
+ }
+ case "weight":
+ v, ok := value.(uint16)
+ if ok {
+ record.Weight = v
+ return nil
+ }
+ case "port":
+ v, ok := value.(uint16)
+ if ok {
+ record.Port = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *SrvRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ "priority": record.Priority,
+ "weight": record.Weight,
+ "port": record.Port,
+ }
+}
+
+type SshfpRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Algorithm int `json:"algorithm,omitempty"`
+ FingerprintType int `json:"fingerprint_type,omitempty"`
+ Fingerprint string `json:"fingerprint,omitempty"`
+}
+
+func NewSshfpRecord() *SshfpRecord {
+ return &SshfpRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "algorithm",
+ "fingerprinttype",
+ "fingerprint",
+ },
+ }
+}
+
+func (record *SshfpRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *SshfpRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "algorithm":
+ v, ok := value.(int)
+ if ok {
+ record.Algorithm = v
+ return nil
+ }
+ case "fingerprinttype":
+ v, ok := value.(int)
+ if ok {
+ record.FingerprintType = v
+ return nil
+ }
+ case "fingerprint":
+ v, ok := value.(string)
+ if ok {
+ record.Fingerprint = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *SshfpRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "algorithm": record.Algorithm,
+ "fingerprinttype": record.FingerprintType,
+ "fingerprint": record.Fingerprint,
+ }
+}
+
+type TxtRecord struct {
+ fieldMap []string `json:"-"`
+ Name string `json:"name,omitempty"`
+ TTL int `json:"ttl,omitempty"`
+ Active bool `json:"active,omitempty"`
+ Target string `json:"target,omitempty"`
+}
+
+func NewTxtRecord() *TxtRecord {
+ return &TxtRecord{
+ fieldMap: []string{
+ "name",
+ "ttl",
+ "active",
+ "target",
+ },
+ }
+}
+
+func (record *TxtRecord) GetAllowedFields() []string {
+ return record.fieldMap
+}
+
+func (record *TxtRecord) SetField(name string, value interface{}) error {
+ if contains(record.fieldMap, name) {
+ switch name {
+ case "name":
+ v, ok := value.(string)
+ if ok {
+ record.Name = v
+ return nil
+ }
+ case "ttl":
+ v, ok := value.(int)
+ if ok {
+ record.TTL = v
+ return nil
+ }
+ case "active":
+ v, ok := value.(bool)
+ if ok {
+ record.Active = v
+ return nil
+ }
+ case "target":
+ v, ok := value.(string)
+ if ok {
+ record.Target = v
+ return nil
+ }
+ }
+ }
+ return &RecordError{fieldName: name}
+}
+
+func (record *TxtRecord) ToMap() map[string]interface{} {
+ return map[string]interface{}{
+ "name": record.Name,
+ "ttl": record.TTL,
+ "active": record.Active,
+ "target": record.Target,
+ }
+}
+
+func contains(fieldMap []string, field string) bool {
+ field = strings.ToLower(field)
+
+ for _, r := range fieldMap {
+ if r == field {
+ return true
+ }
+ }
+
+ return false
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/service.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/service.go
new file mode 100644
index 000000000..7f8ff80b6
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/service.go
@@ -0,0 +1,16 @@
+package dns
+
+import (
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
+)
+
+var (
+ // Config contains the Akamai OPEN Edgegrid API credentials
+ // for automatic signing of requests
+ Config edgegrid.Config
+)
+
+// Init sets the FastDNS edgegrid Config
+func Init(config edgegrid.Config) {
+ Config = config
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/zone.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/zone.go
new file mode 100644
index 000000000..355f81843
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1/zone.go
@@ -0,0 +1,1557 @@
+package dns
+
+import (
+ "errors"
+ "fmt"
+ "reflect"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/client-v1"
+)
+
+type name struct {
+ recordType string
+ name string
+}
+
+var (
+ cnameNames []name
+ nonCnameNames []name
+ zoneWriteLock sync.Mutex
+)
+
+// Zone represents a DNS zone
+type Zone struct {
+ Token string `json:"token"`
+ Zone struct {
+ Name string `json:"name,omitempty"`
+ A []*ARecord `json:"a,omitempty"`
+ Aaaa []*AaaaRecord `json:"aaaa,omitempty"`
+ Afsdb []*AfsdbRecord `json:"afsdb,omitempty"`
+ Cname []*CnameRecord `json:"cname,omitempty"`
+ Dnskey []*DnskeyRecord `json:"dnskey,omitempty"`
+ Ds []*DsRecord `json:"ds,omitempty"`
+ Hinfo []*HinfoRecord `json:"hinfo,omitempty"`
+ Loc []*LocRecord `json:"loc,omitempty"`
+ Mx []*MxRecord `json:"mx,omitempty"`
+ Naptr []*NaptrRecord `json:"naptr,omitempty"`
+ Ns []*NsRecord `json:"ns,omitempty"`
+ Nsec3 []*Nsec3Record `json:"nsec3,omitempty"`
+ Nsec3param []*Nsec3paramRecord `json:"nsec3param,omitempty"`
+ Ptr []*PtrRecord `json:"ptr,omitempty"`
+ Rp []*RpRecord `json:"rp,omitempty"`
+ Rrsig []*RrsigRecord `json:"rrsig,omitempty"`
+ Soa *SoaRecord `json:"soa,omitempty"`
+ Spf []*SpfRecord `json:"spf,omitempty"`
+ Srv []*SrvRecord `json:"srv,omitempty"`
+ Sshfp []*SshfpRecord `json:"sshfp,omitempty"`
+ Txt []*TxtRecord `json:"txt,omitempty"`
+ } `json:"zone"`
+}
+
+// NewZone creates a new Zone
+func NewZone(hostname string) *Zone {
+ zone := &Zone{Token: "new"}
+ zone.Zone.Soa = NewSoaRecord()
+ zone.Zone.Name = hostname
+ return zone
+}
+
+// GetZone retrieves a DNS Zone for a given hostname
+func GetZone(hostname string) (*Zone, error) {
+ zone := NewZone(hostname)
+ req, err := client.NewRequest(
+ Config,
+ "GET",
+ "/config-dns/v1/zones/"+hostname,
+ nil,
+ )
+ if err != nil {
+ return nil, err
+ }
+
+ res, err := client.Do(Config, req)
+ if err != nil {
+ return nil, err
+ }
+
+ if client.IsError(res) && res.StatusCode != 404 {
+ return nil, client.NewAPIError(res)
+ } else if res.StatusCode == 404 {
+ return nil, &ZoneError{zoneName: hostname}
+ } else {
+ err = client.BodyJSON(res, &zone)
+ if err != nil {
+ return nil, err
+ }
+
+ return zone, nil
+ }
+}
+
+// Save updates the Zone
+func (zone *Zone) Save() error {
+ // This lock will restrict the concurrency of API calls
+ // to 1 save request at a time. This is needed for the Soa.Serial value which
+ // is required to be incremented for every subsequent update to a zone
+ // so we have to save just one request at a time to ensure this is always
+ // incremented properly
+ zoneWriteLock.Lock()
+ defer zoneWriteLock.Unlock()
+
+ valid, f := zone.validateCnames()
+ if valid == false {
+ var msg string
+ for _, v := range f {
+ msg = msg + fmt.Sprintf("\n%s Record '%s' conflicts with CNAME", v.recordType, v.name)
+ }
+ return &ZoneError{
+ zoneName: zone.Zone.Name,
+ apiErrorMessage: "All CNAMEs must be unique in the zone" + msg,
+ }
+ }
+
+ req, err := client.NewJSONRequest(
+ Config,
+ "POST",
+ "/config-dns/v1/zones/"+zone.Zone.Name,
+ zone,
+ )
+ if err != nil {
+ return err
+ }
+
+ res, err := client.Do(Config, req)
+
+ // Network error
+ if err != nil {
+ return &ZoneError{
+ zoneName: zone.Zone.Name,
+ httpErrorMessage: err.Error(),
+ err: err,
+ }
+ }
+
+ // API error
+ if client.IsError(res) {
+ err := client.NewAPIError(res)
+ return &ZoneError{zoneName: zone.Zone.Name, apiErrorMessage: err.Detail, err: err}
+ }
+
+ for {
+ updatedZone, err := GetZone(zone.Zone.Name)
+ if err != nil {
+ return err
+ }
+
+ if updatedZone.Token != zone.Token {
+ *zone = *updatedZone
+ break
+ }
+ time.Sleep(time.Second)
+ }
+
+ return nil
+}
+
+func (zone *Zone) Delete() error {
+ // remove all the records except for SOA
+ // which is required and save the zone
+ zone.Zone.A = nil
+ zone.Zone.Aaaa = nil
+ zone.Zone.Afsdb = nil
+ zone.Zone.Cname = nil
+ zone.Zone.Dnskey = nil
+ zone.Zone.Ds = nil
+ zone.Zone.Hinfo = nil
+ zone.Zone.Loc = nil
+ zone.Zone.Mx = nil
+ zone.Zone.Naptr = nil
+ zone.Zone.Ns = nil
+ zone.Zone.Nsec3 = nil
+ zone.Zone.Nsec3param = nil
+ zone.Zone.Ptr = nil
+ zone.Zone.Rp = nil
+ zone.Zone.Rrsig = nil
+ zone.Zone.Spf = nil
+ zone.Zone.Srv = nil
+ zone.Zone.Sshfp = nil
+ zone.Zone.Txt = nil
+
+ return zone.Save()
+}
+
+func (zone *Zone) AddRecord(recordPtr interface{}) error {
+ switch recordPtr.(type) {
+ case *ARecord:
+ zone.addARecord(recordPtr.(*ARecord))
+ case *AaaaRecord:
+ zone.addAaaaRecord(recordPtr.(*AaaaRecord))
+ case *AfsdbRecord:
+ zone.addAfsdbRecord(recordPtr.(*AfsdbRecord))
+ case *CnameRecord:
+ zone.addCnameRecord(recordPtr.(*CnameRecord))
+ case *DnskeyRecord:
+ zone.addDnskeyRecord(recordPtr.(*DnskeyRecord))
+ case *DsRecord:
+ zone.addDsRecord(recordPtr.(*DsRecord))
+ case *HinfoRecord:
+ zone.addHinfoRecord(recordPtr.(*HinfoRecord))
+ case *LocRecord:
+ zone.addLocRecord(recordPtr.(*LocRecord))
+ case *MxRecord:
+ zone.addMxRecord(recordPtr.(*MxRecord))
+ case *NaptrRecord:
+ zone.addNaptrRecord(recordPtr.(*NaptrRecord))
+ case *NsRecord:
+ zone.addNsRecord(recordPtr.(*NsRecord))
+ case *Nsec3Record:
+ zone.addNsec3Record(recordPtr.(*Nsec3Record))
+ case *Nsec3paramRecord:
+ zone.addNsec3paramRecord(recordPtr.(*Nsec3paramRecord))
+ case *PtrRecord:
+ zone.addPtrRecord(recordPtr.(*PtrRecord))
+ case *RpRecord:
+ zone.addRpRecord(recordPtr.(*RpRecord))
+ case *RrsigRecord:
+ zone.addRrsigRecord(recordPtr.(*RrsigRecord))
+ case *SoaRecord:
+ zone.addSoaRecord(recordPtr.(*SoaRecord))
+ case *SpfRecord:
+ zone.addSpfRecord(recordPtr.(*SpfRecord))
+ case *SrvRecord:
+ zone.addSrvRecord(recordPtr.(*SrvRecord))
+ case *SshfpRecord:
+ zone.addSshfpRecord(recordPtr.(*SshfpRecord))
+ case *TxtRecord:
+ zone.addTxtRecord(recordPtr.(*TxtRecord))
+ }
+
+ return nil
+}
+
+func (zone *Zone) RemoveRecord(recordPtr interface{}) error {
+ switch recordPtr.(type) {
+ case *ARecord:
+ return zone.removeARecord(recordPtr.(*ARecord))
+ case *AaaaRecord:
+ return zone.removeAaaaRecord(recordPtr.(*AaaaRecord))
+ case *AfsdbRecord:
+ return zone.removeAfsdbRecord(recordPtr.(*AfsdbRecord))
+ case *CnameRecord:
+ return zone.removeCnameRecord(recordPtr.(*CnameRecord))
+ case *DnskeyRecord:
+ return zone.removeDnskeyRecord(recordPtr.(*DnskeyRecord))
+ case *DsRecord:
+ return zone.removeDsRecord(recordPtr.(*DsRecord))
+ case *HinfoRecord:
+ return zone.removeHinfoRecord(recordPtr.(*HinfoRecord))
+ case *LocRecord:
+ return zone.removeLocRecord(recordPtr.(*LocRecord))
+ case *MxRecord:
+ return zone.removeMxRecord(recordPtr.(*MxRecord))
+ case *NaptrRecord:
+ return zone.removeNaptrRecord(recordPtr.(*NaptrRecord))
+ case *NsRecord:
+ return zone.removeNsRecord(recordPtr.(*NsRecord))
+ case *Nsec3Record:
+ return zone.removeNsec3Record(recordPtr.(*Nsec3Record))
+ case *Nsec3paramRecord:
+ return zone.removeNsec3paramRecord(recordPtr.(*Nsec3paramRecord))
+ case *PtrRecord:
+ return zone.removePtrRecord(recordPtr.(*PtrRecord))
+ case *RpRecord:
+ return zone.removeRpRecord(recordPtr.(*RpRecord))
+ case *RrsigRecord:
+ return zone.removeRrsigRecord(recordPtr.(*RrsigRecord))
+ case *SoaRecord:
+ return zone.removeSoaRecord(recordPtr.(*SoaRecord))
+ case *SpfRecord:
+ return zone.removeSpfRecord(recordPtr.(*SpfRecord))
+ case *SrvRecord:
+ return zone.removeSrvRecord(recordPtr.(*SrvRecord))
+ case *SshfpRecord:
+ return zone.removeSshfpRecord(recordPtr.(*SshfpRecord))
+ case *TxtRecord:
+ return zone.removeTxtRecord(recordPtr.(*TxtRecord))
+ }
+
+ return nil
+}
+
+func (zone *Zone) addARecord(record *ARecord) {
+ zone.Zone.A = append(zone.Zone.A, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "A", name: record.Name})
+}
+
+func (zone *Zone) addAaaaRecord(record *AaaaRecord) {
+ zone.Zone.Aaaa = append(zone.Zone.Aaaa, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "AAAA", name: record.Name})
+}
+
+func (zone *Zone) addAfsdbRecord(record *AfsdbRecord) {
+ zone.Zone.Afsdb = append(zone.Zone.Afsdb, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "AFSDB", name: record.Name})
+}
+
+func (zone *Zone) addCnameRecord(record *CnameRecord) {
+ zone.Zone.Cname = append(zone.Zone.Cname, record)
+ cnameNames = append(cnameNames, name{recordType: "CNAME", name: record.Name})
+}
+
+func (zone *Zone) addDnskeyRecord(record *DnskeyRecord) {
+ zone.Zone.Dnskey = append(zone.Zone.Dnskey, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "DNSKEY", name: record.Name})
+}
+
+func (zone *Zone) addDsRecord(record *DsRecord) {
+ zone.Zone.Ds = append(zone.Zone.Ds, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "DS", name: record.Name})
+}
+
+func (zone *Zone) addHinfoRecord(record *HinfoRecord) {
+ zone.Zone.Hinfo = append(zone.Zone.Hinfo, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "HINFO", name: record.Name})
+}
+
+func (zone *Zone) addLocRecord(record *LocRecord) {
+ zone.Zone.Loc = append(zone.Zone.Loc, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "LOC", name: record.Name})
+}
+
+func (zone *Zone) addMxRecord(record *MxRecord) {
+ zone.Zone.Mx = append(zone.Zone.Mx, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "MX", name: record.Name})
+}
+
+func (zone *Zone) addNaptrRecord(record *NaptrRecord) {
+ zone.Zone.Naptr = append(zone.Zone.Naptr, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "NAPTR", name: record.Name})
+}
+
+func (zone *Zone) addNsRecord(record *NsRecord) {
+ zone.Zone.Ns = append(zone.Zone.Ns, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "NS", name: record.Name})
+}
+
+func (zone *Zone) addNsec3Record(record *Nsec3Record) {
+ zone.Zone.Nsec3 = append(zone.Zone.Nsec3, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "NSEC3", name: record.Name})
+}
+
+func (zone *Zone) addNsec3paramRecord(record *Nsec3paramRecord) {
+ zone.Zone.Nsec3param = append(zone.Zone.Nsec3param, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "NSEC3PARAM", name: record.Name})
+}
+
+func (zone *Zone) addPtrRecord(record *PtrRecord) {
+ zone.Zone.Ptr = append(zone.Zone.Ptr, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "PTR", name: record.Name})
+}
+
+func (zone *Zone) addRpRecord(record *RpRecord) {
+ zone.Zone.Rp = append(zone.Zone.Rp, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "RP", name: record.Name})
+}
+
+func (zone *Zone) addRrsigRecord(record *RrsigRecord) {
+ zone.Zone.Rrsig = append(zone.Zone.Rrsig, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "RRSIG", name: record.Name})
+}
+
+func (zone *Zone) addSoaRecord(record *SoaRecord) {
+ // Only one SOA records is allowed
+ zone.Zone.Soa = record
+}
+
+func (zone *Zone) addSpfRecord(record *SpfRecord) {
+ zone.Zone.Spf = append(zone.Zone.Spf, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "SPF", name: record.Name})
+}
+
+func (zone *Zone) addSrvRecord(record *SrvRecord) {
+ zone.Zone.Srv = append(zone.Zone.Srv, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "SRV", name: record.Name})
+}
+
+func (zone *Zone) addSshfpRecord(record *SshfpRecord) {
+ zone.Zone.Sshfp = append(zone.Zone.Sshfp, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "SSHFP", name: record.Name})
+}
+
+func (zone *Zone) addTxtRecord(record *TxtRecord) {
+ zone.Zone.Txt = append(zone.Zone.Txt, record)
+ nonCnameNames = append(nonCnameNames, name{recordType: "TXT", name: record.Name})
+}
+
+func (zone *Zone) removeARecord(record *ARecord) error {
+ for key, r := range zone.Zone.A {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.A[:key]
+ if len(zone.Zone.A) > key {
+ if len(zone.Zone.A) > key {
+ zone.Zone.A = append(records, zone.Zone.A[key+1:]...)
+ } else {
+ zone.Zone.A = records
+ }
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("A Record not found")
+}
+
+func (zone *Zone) removeAaaaRecord(record *AaaaRecord) error {
+ for key, r := range zone.Zone.Aaaa {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Aaaa[:key]
+ if len(zone.Zone.Aaaa) > key {
+ zone.Zone.Aaaa = append(records, zone.Zone.Aaaa[key+1:]...)
+ } else {
+ zone.Zone.Aaaa = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("AAAA Record not found")
+}
+
+func (zone *Zone) removeAfsdbRecord(record *AfsdbRecord) error {
+ for key, r := range zone.Zone.Afsdb {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Afsdb[:key]
+ if len(zone.Zone.Afsdb) > key {
+ zone.Zone.Afsdb = append(records, zone.Zone.Afsdb[key+1:]...)
+ } else {
+ zone.Zone.Afsdb = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Afsdb Record not found")
+}
+
+func (zone *Zone) removeCnameRecord(record *CnameRecord) error {
+ for key, r := range zone.Zone.Cname {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Cname[:key]
+ if len(zone.Zone.Cname) > key {
+ zone.Zone.Cname = append(records, zone.Zone.Cname[key+1:]...)
+ } else {
+ zone.Zone.Cname = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Cname Record not found")
+
+ zone.removeCnameName(record.Name)
+
+ return nil
+}
+
+func (zone *Zone) removeDnskeyRecord(record *DnskeyRecord) error {
+ for key, r := range zone.Zone.Dnskey {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Dnskey[:key]
+ if len(zone.Zone.Dnskey) > key {
+ zone.Zone.Dnskey = append(records, zone.Zone.Dnskey[key+1:]...)
+ } else {
+ zone.Zone.Dnskey = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Dnskey Record not found")
+}
+
+func (zone *Zone) removeDsRecord(record *DsRecord) error {
+ for key, r := range zone.Zone.Ds {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Ds[:key]
+ if len(zone.Zone.Ds) > key {
+ zone.Zone.Ds = append(records, zone.Zone.Ds[key+1:]...)
+ } else {
+ zone.Zone.Ds = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Ds Record not found")
+}
+
+func (zone *Zone) removeHinfoRecord(record *HinfoRecord) error {
+ for key, r := range zone.Zone.Hinfo {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Hinfo[:key]
+ if len(zone.Zone.Hinfo) > key {
+ zone.Zone.Hinfo = append(records, zone.Zone.Hinfo[key+1:]...)
+ } else {
+ zone.Zone.Hinfo = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Hinfo Record not found")
+}
+
+func (zone *Zone) removeLocRecord(record *LocRecord) error {
+ for key, r := range zone.Zone.Loc {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Loc[:key]
+ if len(zone.Zone.Loc) > key {
+ zone.Zone.Loc = append(records, zone.Zone.Loc[key+1:]...)
+ } else {
+ zone.Zone.Loc = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Loc Record not found")
+}
+
+func (zone *Zone) removeMxRecord(record *MxRecord) error {
+ for key, r := range zone.Zone.Mx {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Mx[:key]
+ if len(zone.Zone.Mx) > key {
+ zone.Zone.Mx = append(records, zone.Zone.Mx[key+1:]...)
+ } else {
+ zone.Zone.Mx = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Mx Record not found")
+}
+
+func (zone *Zone) removeNaptrRecord(record *NaptrRecord) error {
+ for key, r := range zone.Zone.Naptr {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Naptr[:key]
+ if len(zone.Zone.Naptr) > key {
+ zone.Zone.Naptr = append(records, zone.Zone.Naptr[key+1:]...)
+ } else {
+ zone.Zone.Naptr = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Naptr Record not found")
+}
+
+func (zone *Zone) removeNsRecord(record *NsRecord) error {
+ for key, r := range zone.Zone.Ns {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Ns[:key]
+ if len(zone.Zone.Ns) > key {
+ zone.Zone.Ns = append(records, zone.Zone.Ns[key+1:]...)
+ } else {
+ zone.Zone.Ns = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Ns Record not found")
+}
+
+func (zone *Zone) removeNsec3Record(record *Nsec3Record) error {
+ for key, r := range zone.Zone.Nsec3 {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Nsec3[:key]
+ if len(zone.Zone.Nsec3) > key {
+ zone.Zone.Nsec3 = append(records, zone.Zone.Nsec3[key+1:]...)
+ } else {
+ zone.Zone.Nsec3 = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Nsec3 Record not found")
+}
+
+func (zone *Zone) removeNsec3paramRecord(record *Nsec3paramRecord) error {
+ for key, r := range zone.Zone.Nsec3param {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Nsec3param[:key]
+ if len(zone.Zone.Nsec3param) > key {
+ zone.Zone.Nsec3param = append(records, zone.Zone.Nsec3param[key+1:]...)
+ } else {
+ zone.Zone.Nsec3param = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Nsec3param Record not found")
+}
+
+func (zone *Zone) removePtrRecord(record *PtrRecord) error {
+ for key, r := range zone.Zone.Ptr {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Ptr[:key]
+ if len(zone.Zone.Ptr) > key {
+ zone.Zone.Ptr = append(records, zone.Zone.Ptr[key+1:]...)
+ } else {
+ zone.Zone.Ptr = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Ptr Record not found")
+}
+
+func (zone *Zone) removeRpRecord(record *RpRecord) error {
+ for key, r := range zone.Zone.Rp {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Rp[:key]
+ if len(zone.Zone.Rp) > key {
+ zone.Zone.Rp = append(records, zone.Zone.Rp[key+1:]...)
+ } else {
+ zone.Zone.Rp = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Rp Record not found")
+}
+
+func (zone *Zone) removeRrsigRecord(record *RrsigRecord) error {
+ for key, r := range zone.Zone.Rrsig {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Rrsig[:key]
+ if len(zone.Zone.Rrsig) > key {
+ zone.Zone.Rrsig = append(records, zone.Zone.Rrsig[key+1:]...)
+ } else {
+ zone.Zone.Rrsig = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Rrsig Record not found")
+}
+
+func (zone *Zone) removeSoaRecord(record *SoaRecord) error {
+ if reflect.DeepEqual(zone.Zone.Soa, record) {
+ zone.Zone.Soa = nil
+
+ return nil
+ }
+
+ return errors.New("SOA Record does not match")
+}
+
+func (zone *Zone) removeSpfRecord(record *SpfRecord) error {
+ for key, r := range zone.Zone.Spf {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Spf[:key]
+ if len(zone.Zone.Spf) > key {
+ zone.Zone.Spf = append(records, zone.Zone.Spf[key+1:]...)
+ } else {
+ zone.Zone.Spf = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Spf Record not found")
+}
+
+func (zone *Zone) removeSrvRecord(record *SrvRecord) error {
+ for key, r := range zone.Zone.Srv {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Srv[:key]
+ if len(zone.Zone.Srv) > key {
+ zone.Zone.Srv = append(records, zone.Zone.Srv[key+1:]...)
+ } else {
+ zone.Zone.Srv = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Srv Record not found")
+}
+
+func (zone *Zone) removeSshfpRecord(record *SshfpRecord) error {
+ for key, r := range zone.Zone.Sshfp {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Sshfp[:key]
+ if len(zone.Zone.Sshfp) > key {
+ zone.Zone.Sshfp = append(records, zone.Zone.Sshfp[key+1:]...)
+ } else {
+ zone.Zone.Sshfp = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Sshfp Record not found")
+}
+
+func (zone *Zone) removeTxtRecord(record *TxtRecord) error {
+ for key, r := range zone.Zone.Txt {
+ if reflect.DeepEqual(r, record) {
+ records := zone.Zone.Txt[:key]
+ if len(zone.Zone.Txt) > key {
+ zone.Zone.Txt = append(records, zone.Zone.Txt[key+1:]...)
+ } else {
+ zone.Zone.Txt = records
+ }
+ zone.removeNonCnameName(record.Name)
+
+ return nil
+ }
+ }
+
+ return errors.New("Txt Record not found")
+}
+
+func (zone *Zone) PreMarshalJSON() error {
+ if zone.Zone.Soa.Serial > 0 {
+ zone.Zone.Soa.Serial = zone.Zone.Soa.Serial + 1
+ } else {
+ zone.Zone.Soa.Serial = uint(time.Now().Unix())
+ }
+ return nil
+}
+
+func (zone *Zone) validateCnames() (bool, []name) {
+ var valid bool = true
+ var failedRecords []name
+ for _, v := range cnameNames {
+ for _, vv := range nonCnameNames {
+ if v.name == vv.name {
+ valid = false
+ failedRecords = append(failedRecords, vv)
+ }
+ }
+ }
+ return valid, failedRecords
+}
+
+func (zone *Zone) removeCnameName(host string) {
+ for i, v := range cnameNames {
+ if v.name == host {
+ r := cnameNames[:i]
+ cnameNames = append(r, cnameNames[i+1:]...)
+ }
+ }
+}
+
+func (zone *Zone) removeNonCnameName(host string) {
+ for i, v := range nonCnameNames {
+ if v.name == host {
+ r := nonCnameNames[:i]
+ nonCnameNames = append(r, nonCnameNames[i+1:]...)
+ }
+ }
+}
+
+func (zone *Zone) FindRecords(recordType string, options map[string]interface{}) []DNSRecord {
+ switch strings.ToUpper(recordType) {
+ case "A":
+ return zone.findARecord(options)
+ case "AAAA":
+ return zone.findAaaaRecord(options)
+ case "AFSDB":
+ return zone.findAfsdbRecord(options)
+ case "CNAME":
+ return zone.findCnameRecord(options)
+ case "DNSKEY":
+ return zone.findDnskeyRecord(options)
+ case "DS":
+ return zone.findDsRecord(options)
+ case "HINFO":
+ return zone.findHinfoRecord(options)
+ case "LOC":
+ return zone.findLocRecord(options)
+ case "MX":
+ return zone.findMxRecord(options)
+ case "NAPTR":
+ return zone.findNaptrRecord(options)
+ case "NS":
+ return zone.findNsRecord(options)
+ case "NSEC3":
+ return zone.findNsec3Record(options)
+ case "NSEC3PARAM":
+ return zone.findNsec3paramRecord(options)
+ case "PTR":
+ return zone.findPtrRecord(options)
+ case "RP":
+ return zone.findRpRecord(options)
+ case "RRSIG":
+ return zone.findRrsigRecord(options)
+ case "SPF":
+ return zone.findSpfRecord(options)
+ case "SRV":
+ return zone.findSrvRecord(options)
+ case "SSHFP":
+ return zone.findSshfpRecord(options)
+ case "TXT":
+ return zone.findTxtRecord(options)
+ }
+
+ return make([]DNSRecord, 0)
+}
+
+func (zone *Zone) findARecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.A {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+
+ return found
+}
+
+func (zone *Zone) findAaaaRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Aaaa {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+
+ return found
+}
+
+func (zone *Zone) findAfsdbRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Afsdb {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if subtype, ok := options["subtype"]; ok && record.Subtype == subtype.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findCnameRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Cname {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findDnskeyRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Dnskey {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if flags, ok := options["flags"]; ok && record.Flags == flags.(int) {
+ matchCounter++
+ }
+
+ if protocol, ok := options["protocol"]; ok && record.Protocol == protocol.(int) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if key, ok := options["key"]; ok && record.Key == key.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findDsRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Ds {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if keytag, ok := options["keytag"]; ok && record.Keytag == keytag.(int) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if digesttype, ok := options["digesttype"]; ok && record.DigestType == digesttype.(int) {
+ matchCounter++
+ }
+
+ if digest, ok := options["digest"]; ok && record.Digest == digest.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findHinfoRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Hinfo {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if hardware, ok := options["hardware"]; ok && record.Hardware == hardware.(string) {
+ matchCounter++
+ }
+
+ if software, ok := options["software"]; ok && record.Software == software.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findLocRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Loc {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findMxRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Mx {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if priority, ok := options["priority"]; ok && record.Priority == priority.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findNaptrRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Naptr {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if order, ok := options["order"]; ok && record.Order == order.(uint16) {
+ matchCounter++
+ }
+
+ if preference, ok := options["preference"]; ok && record.Preference == preference.(uint16) {
+ matchCounter++
+ }
+
+ if flags, ok := options["flags"]; ok && record.Flags == flags.(string) {
+ matchCounter++
+ }
+
+ if service, ok := options["service"]; ok && record.Service == service.(string) {
+ matchCounter++
+ }
+
+ if regexp, ok := options["regexp"]; ok && record.Regexp == regexp.(string) {
+ matchCounter++
+ }
+
+ if replacement, ok := options["replacement"]; ok && record.Replacement == replacement.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findNsRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Ns {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findNsec3Record(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Nsec3 {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if flags, ok := options["flags"]; ok && record.Flags == flags.(int) {
+ matchCounter++
+ }
+
+ if iterations, ok := options["iterations"]; ok && record.Iterations == iterations.(int) {
+ matchCounter++
+ }
+
+ if salt, ok := options["salt"]; ok && record.Salt == salt.(string) {
+ matchCounter++
+ }
+
+ if nextHashedOwnerName, ok := options["nextHashedOwnerName"]; ok && record.NextHashedOwnerName == nextHashedOwnerName.(string) {
+ matchCounter++
+ }
+
+ if typeBitmaps, ok := options["typeBitmaps"]; ok && record.TypeBitmaps == typeBitmaps.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findNsec3paramRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Nsec3param {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if flags, ok := options["flags"]; ok && record.Flags == flags.(int) {
+ matchCounter++
+ }
+
+ if iterations, ok := options["iterations"]; ok && record.Iterations == iterations.(int) {
+ matchCounter++
+ }
+
+ if salt, ok := options["salt"]; ok && record.Salt == salt.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findPtrRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Ptr {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findRpRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Rp {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if mailbox, ok := options["mailbox"]; ok && record.Mailbox == mailbox.(string) {
+ matchCounter++
+ }
+
+ if txt, ok := options["txt"]; ok && record.Txt == txt.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findRrsigRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Rrsig {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if typeCovered, ok := options["typeCovered"]; ok && record.TypeCovered == typeCovered.(string) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if originalTTL, ok := options["originalTTL"]; ok && record.OriginalTTL == originalTTL.(int) {
+ matchCounter++
+ }
+
+ if expiration, ok := options["expiration"]; ok && record.Expiration == expiration.(string) {
+ matchCounter++
+ }
+
+ if inception, ok := options["inception"]; ok && record.Inception == inception.(string) {
+ matchCounter++
+ }
+
+ if keytag, ok := options["keytag"]; ok && record.Keytag == keytag.(int) {
+ matchCounter++
+ }
+
+ if signer, ok := options["signer"]; ok && record.Signer == signer.(string) {
+ matchCounter++
+ }
+
+ if signature, ok := options["signature"]; ok && record.Signature == signature.(string) {
+ matchCounter++
+ }
+
+ if labels, ok := options["labels"]; ok && record.Labels == labels.(int) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findSpfRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Spf {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findSrvRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Srv {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if priority, ok := options["priority"]; ok && record.Priority == priority.(int) {
+ matchCounter++
+ }
+
+ if weight, ok := options["weight"]; ok && record.Weight == weight.(uint16) {
+ matchCounter++
+ }
+
+ if port, ok := options["port"]; ok && record.Port == port.(uint16) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findSshfpRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Sshfp {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if algorithm, ok := options["algorithm"]; ok && record.Algorithm == algorithm.(int) {
+ matchCounter++
+ }
+
+ if fingerprintType, ok := options["fingerprintType"]; ok && record.FingerprintType == fingerprintType.(int) {
+ matchCounter++
+ }
+
+ if fingerprint, ok := options["fingerprint"]; ok && record.Fingerprint == fingerprint.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
+
+func (zone *Zone) findTxtRecord(options map[string]interface{}) []DNSRecord {
+ found := make([]DNSRecord, 0)
+ matchesNeeded := len(options)
+ for _, record := range zone.Zone.Txt {
+ matchCounter := 0
+ if name, ok := options["name"]; ok && record.Name == name.(string) {
+ matchCounter++
+ }
+
+ if active, ok := options["active"]; ok && record.Active == active.(bool) {
+ matchCounter++
+ }
+
+ if ttl, ok := options["ttl"]; ok && record.TTL == ttl.(int) {
+ matchCounter++
+ }
+
+ if target, ok := options["target"]; ok && record.Target == target.(string) {
+ matchCounter++
+ }
+
+ if matchCounter >= matchesNeeded {
+ found = append(found, record)
+ }
+ }
+ return found
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/config.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/config.go
new file mode 100644
index 000000000..b9f5411a5
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/config.go
@@ -0,0 +1,181 @@
+package edgegrid
+
+import (
+ "fmt"
+ "os"
+ "strconv"
+ "strings"
+
+ "github.com/go-ini/ini"
+ "gopkg.in/mattes/go-expand-tilde.v1"
+)
+
+// Config struct provides all the necessary fields to
+// create authorization header, debug is optional
+type Config struct {
+ Host string `ini:"host"`
+ ClientToken string `ini:"client_token"`
+ ClientSecret string `ini:"client_secret"`
+ AccessToken string `ini:"access_token"`
+ HeaderToSign []string `ini:"headers_to_sign"`
+ MaxBody int `ini:"max_body"`
+ Debug bool `ini:"debug"`
+}
+
+// Init initializes by first attempting to use ENV vars, with .edgerc as a fallback
+//
+// See: InitEnv()
+// See: InitEdgeRc()
+func Init(filepath string, section string) (Config, error) {
+ if section == "" {
+ section = defaultSection
+ } else {
+ section = strings.ToUpper(section)
+ }
+
+ _, exists := os.LookupEnv("AKAMAI_" + section + "_HOST")
+ if !exists && section == defaultSection {
+ _, exists := os.LookupEnv("AKAMAI_HOST")
+
+ if exists {
+ return InitEnv("")
+ }
+ }
+
+ if exists {
+ return InitEnv(section)
+ }
+
+ c, err := InitEdgeRc(filepath, strings.ToLower(section))
+
+ if err == nil {
+ return c, nil
+ }
+
+ if section != defaultSection {
+ _, ok := os.LookupEnv("AKAMAI_HOST")
+ if ok {
+ return InitEnv("")
+ }
+ }
+
+ return c, fmt.Errorf("Unable to create instance using environment or .edgerc file")
+}
+
+// InitEdgeRc initializes using a configuration file in standard INI format
+//
+// By default, it uses the .edgerc found in the users home directory, and the
+// "default" section.
+func InitEdgeRc(filepath string, section string) (Config, error) {
+ var (
+ c Config
+ requiredOptions = []string{"host", "client_token", "client_secret", "access_token"}
+ missing []string
+ )
+
+ // Check if filepath is empty
+ if filepath == "" {
+ filepath = "~/.edgerc"
+ }
+
+ // Check if section is empty
+ if section == "" {
+ section = "default"
+ }
+
+ // Tilde seems to be not working when passing ~/.edgerc as file
+ // Takes current user and use home dir instead
+
+ path, err := tilde.Expand(filepath)
+
+ if err != nil {
+ return c, fmt.Errorf(errorMap[ErrHomeDirNotFound], err)
+ }
+
+ edgerc, err := ini.Load(path)
+ if err != nil {
+ return c, fmt.Errorf(errorMap[ErrConfigFile], err)
+ }
+ err = edgerc.Section(section).MapTo(&c)
+ if err != nil {
+ return c, fmt.Errorf(errorMap[ErrConfigFileSection], err)
+ }
+ for _, opt := range requiredOptions {
+ if !(edgerc.Section(section).HasKey(opt)) {
+ missing = append(missing, opt)
+ }
+ }
+ if len(missing) > 0 {
+ return c, fmt.Errorf(errorMap[ErrConfigMissingOptions], missing)
+ }
+ if c.MaxBody == 0 {
+ c.MaxBody = 131072
+ }
+ return c, nil
+}
+
+// InitEnv initializes using the Environment (ENV)
+//
+// By default, it uses AKAMAI_HOST, AKAMAI_CLIENT_TOKEN, AKAMAI_CLIENT_SECRET,
+// AKAMAI_ACCESS_TOKEN, and AKAMAI_MAX_BODY variables.
+//
+// You can define multiple configurations by prefixing with the section name specified, e.g.
+// passing "ccu" will cause it to look for AKAMAI_CCU_HOST, etc.
+//
+// If AKAMAI_{SECTION} does not exist, it will fall back to just AKAMAI_.
+func InitEnv(section string) (Config, error) {
+ var (
+ c Config
+ requiredOptions = []string{"HOST", "CLIENT_TOKEN", "CLIENT_SECRET", "ACCESS_TOKEN"}
+ missing []string
+ prefix string
+ )
+
+ // Check if section is empty
+ if section == "" {
+ section = defaultSection
+ } else {
+ section = strings.ToUpper(section)
+ }
+
+ prefix = "AKAMAI_"
+ _, ok := os.LookupEnv("AKAMAI_" + section + "_HOST")
+ if ok {
+ prefix = "AKAMAI_" + section + "_"
+ }
+
+ for _, opt := range requiredOptions {
+ val, ok := os.LookupEnv(prefix + opt)
+ if !ok {
+ missing = append(missing, prefix+opt)
+ } else {
+ switch {
+ case opt == "HOST":
+ c.Host = val
+ case opt == "CLIENT_TOKEN":
+ c.ClientToken = val
+ case opt == "CLIENT_SECRET":
+ c.ClientSecret = val
+ case opt == "ACCESS_TOKEN":
+ c.AccessToken = val
+ }
+ }
+ }
+
+ if len(missing) > 0 {
+ return c, fmt.Errorf(errorMap[ErrMissingEnvVariables], missing)
+ }
+
+ c.MaxBody = 0
+
+ val, ok := os.LookupEnv(prefix + "MAX_BODY")
+ if i, err := strconv.Atoi(val); err == nil {
+ c.MaxBody = i
+ }
+
+ if !ok || c.MaxBody == 0 {
+ c.MaxBody = 131072
+ }
+
+ return c, nil
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/errors.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/errors.go
new file mode 100644
index 000000000..d5448aeae
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/errors.go
@@ -0,0 +1,22 @@
+package edgegrid
+
+// Error constants
+const (
+ ErrUUIDGenerateFailed = 500
+ ErrHomeDirNotFound = 501
+ ErrConfigFile = 502
+ ErrConfigFileSection = 503
+ ErrConfigMissingOptions = 504
+ ErrMissingEnvVariables = 505
+)
+
+var (
+ errorMap = map[int]string{
+ ErrUUIDGenerateFailed: "Generate UUID failed: %s",
+ ErrHomeDirNotFound: "Fatal could not find home dir from user: %s",
+ ErrConfigFile: "Fatal error edgegrid file: %s",
+ ErrConfigFileSection: "Could not map section: %s",
+ ErrConfigMissingOptions: "Fatal missing required options: %s",
+ ErrMissingEnvVariables: "Fatal missing required environment variables: %s",
+ }
+)
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/signer.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/signer.go
new file mode 100644
index 000000000..b43e4149e
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid/signer.go
@@ -0,0 +1,195 @@
+// Package edgegrid allows you to sign http.Request's using the Akamai OPEN Edgegrid Signing Scheme
+package edgegrid
+
+import (
+ "bytes"
+ "crypto/hmac"
+ "crypto/sha256"
+ "encoding/base64"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "sort"
+ "strings"
+ "time"
+ "unicode"
+
+ log "github.com/sirupsen/logrus"
+ "github.com/tuvistavie/securerandom"
+)
+
+const defaultSection = "DEFAULT"
+
+// AddRequestHeader sets the Authorization header to use Akamai Open API
+func AddRequestHeader(config Config, req *http.Request) *http.Request {
+ if config.Debug {
+ log.SetLevel(log.DebugLevel)
+ }
+ timestamp := makeEdgeTimeStamp()
+ nonce := createNonce()
+
+ if req.Header.Get("Content-Type") == "" {
+ req.Header.Set("Content-Type", "application/json")
+ }
+
+ req.Header.Set("Authorization", createAuthHeader(config, req, timestamp, nonce))
+ return req
+}
+
+// Must be assigned the UTC time when the request is signed.
+// Format of “yyyyMMddTHH:mm:ss+0000”
+func makeEdgeTimeStamp() string {
+ local := time.FixedZone("GMT", 0)
+ t := time.Now().In(local)
+ return fmt.Sprintf("%d%02d%02dT%02d:%02d:%02d+0000",
+ t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second())
+}
+
+// Must be assigned a nonce (number used once) for the request.
+// It is a random string used to detect replayed request messages.
+// A GUID is recommended.
+func createNonce() string {
+ uuid, err := securerandom.Uuid()
+ if err != nil {
+ log.Errorf(errorMap[ErrUUIDGenerateFailed], err)
+ return ""
+ }
+ return uuid
+}
+
+func stringMinifier(in string) (out string) {
+ white := false
+ for _, c := range in {
+ if unicode.IsSpace(c) {
+ if !white {
+ out = out + " "
+ }
+ white = true
+ } else {
+ out = out + string(c)
+ white = false
+ }
+ }
+ return
+}
+
+func concatPathQuery(path, query string) string {
+ if query == "" {
+ return path
+ }
+ return fmt.Sprintf("%s?%s", path, query)
+}
+
+// createSignature is the base64-encoding of the SHA–256 HMAC of the data to sign with the signing key.
+func createSignature(message string, secret string) string {
+ key := []byte(secret)
+ h := hmac.New(sha256.New, key)
+ h.Write([]byte(message))
+ return base64.StdEncoding.EncodeToString(h.Sum(nil))
+}
+
+func createHash(data string) string {
+ h := sha256.Sum256([]byte(data))
+ return base64.StdEncoding.EncodeToString(h[:])
+}
+
+func canonicalizeHeaders(config Config, req *http.Request) string {
+ var unsortedHeader []string
+ var sortedHeader []string
+ for k := range req.Header {
+ unsortedHeader = append(unsortedHeader, k)
+ }
+ sort.Strings(unsortedHeader)
+ for _, k := range unsortedHeader {
+ for _, sign := range config.HeaderToSign {
+ if sign == k {
+ v := strings.TrimSpace(req.Header.Get(k))
+ sortedHeader = append(sortedHeader, fmt.Sprintf("%s:%s", strings.ToLower(k), strings.ToLower(stringMinifier(v))))
+ }
+ }
+ }
+ return strings.Join(sortedHeader, "\t")
+
+}
+
+// signingKey is derived from the client secret.
+// The signing key is computed as the base64 encoding of the SHA–256 HMAC of the timestamp string
+// (the field value included in the HTTP authorization header described above) with the client secret as the key.
+func signingKey(config Config, timestamp string) string {
+ key := createSignature(timestamp, config.ClientSecret)
+ return key
+}
+
+// The content hash is the base64-encoded SHA–256 hash of the POST body.
+// For any other request methods, this field is empty. But the tac separator (\t) must be included.
+// The size of the POST body must be less than or equal to the value specified by the service.
+// Any request that does not meet this criteria SHOULD be rejected during the signing process,
+// as the request will be rejected by EdgeGrid.
+func createContentHash(config Config, req *http.Request) string {
+ var (
+ contentHash string
+ preparedBody string
+ bodyBytes []byte
+ )
+ if req.Body != nil {
+ bodyBytes, _ = ioutil.ReadAll(req.Body)
+ req.Body = ioutil.NopCloser(bytes.NewBuffer(bodyBytes))
+ preparedBody = string(bodyBytes)
+ }
+
+ log.Debugf("Body is %s", preparedBody)
+ if req.Method == "POST" && len(preparedBody) > 0 {
+ log.Debugf("Signing content: %s", preparedBody)
+ if len(preparedBody) > config.MaxBody {
+ log.Debugf("Data length %d is larger than maximum %d",
+ len(preparedBody), config.MaxBody)
+
+ preparedBody = preparedBody[0:config.MaxBody]
+ log.Debugf("Data truncated to %d for computing the hash", len(preparedBody))
+ }
+ contentHash = createHash(preparedBody)
+ }
+ log.Debugf("Content hash is '%s'", contentHash)
+ return contentHash
+}
+
+// The data to sign includes the information from the HTTP request that is relevant to ensuring that the request is authentic.
+// This data set comprised of the request data combined with the authorization header value (excluding the signature field,
+// but including the ; right before the signature field).
+func signingData(config Config, req *http.Request, authHeader string) string {
+
+ dataSign := []string{
+ req.Method,
+ req.URL.Scheme,
+ req.URL.Host,
+ concatPathQuery(req.URL.Path, req.URL.RawQuery),
+ canonicalizeHeaders(config, req),
+ createContentHash(config, req),
+ authHeader,
+ }
+ log.Debugf("Data to sign %s", strings.Join(dataSign, "\t"))
+ return strings.Join(dataSign, "\t")
+}
+
+func signingRequest(config Config, req *http.Request, authHeader string, timestamp string) string {
+ return createSignature(signingData(config, req, authHeader),
+ signingKey(config, timestamp))
+}
+
+// The Authorization header starts with the signing algorithm moniker (name of the algorithm) used to sign the request.
+// The moniker below identifies EdgeGrid V1, hash message authentication code, SHA–256 as the hash standard.
+// This moniker is then followed by a space and an ordered list of name value pairs with each field separated by a semicolon.
+func createAuthHeader(config Config, req *http.Request, timestamp string, nonce string) string {
+ authHeader := fmt.Sprintf("EG1-HMAC-SHA256 client_token=%s;access_token=%s;timestamp=%s;nonce=%s;",
+ config.ClientToken,
+ config.AccessToken,
+ timestamp,
+ nonce,
+ )
+ log.Debugf("Unsigned authorization header: '%s'", authHeader)
+
+ signedAuthHeader := fmt.Sprintf("%ssignature=%s", authHeader, signingRequest(config, req, authHeader, timestamp))
+
+ log.Debugf("Signed authorization header: '%s'", signedAuthHeader)
+ return signedAuthHeader
+}
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/errors.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/errors.go
new file mode 100644
index 000000000..594c04e41
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/errors.go
@@ -0,0 +1 @@
+package jsonhooks
diff --git a/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/jsonhooks.go b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/jsonhooks.go
new file mode 100644
index 000000000..83dccd5dd
--- /dev/null
+++ b/vendor/github.com/akamai/AkamaiOPEN-edgegrid-golang/jsonhooks-v1/jsonhooks.go
@@ -0,0 +1,69 @@
+// Package jsonhooks adds hooks that are automatically called before JSON marshaling (PreMarshalJSON) and
+// after JSON unmarshaling (PostUnmarshalJSON). It does not do so recursively.
+package jsonhooks
+
+import (
+ "encoding/json"
+ "reflect"
+)
+
+// Marshal wraps encoding/json.Marshal, calls v.PreMarshalJSON() if it exists
+func Marshal(v interface{}) ([]byte, error) {
+ if ImplementsPreJSONMarshaler(v) {
+ err := v.(PreJSONMarshaler).PreMarshalJSON()
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return json.Marshal(v)
+}
+
+// Unmarshal wraps encoding/json.Unmarshal, calls v.PostUnmarshalJSON() if it exists
+func Unmarshal(data []byte, v interface{}) error {
+ err := json.Unmarshal(data, v)
+ if err != nil {
+ return err
+ }
+
+ if ImplementsPostJSONUnmarshaler(v) {
+ err := v.(PostJSONUnmarshaler).PostUnmarshalJSON()
+ if err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+// PreJSONMarshaler infers support for the PreMarshalJSON pre-hook
+type PreJSONMarshaler interface {
+ PreMarshalJSON() error
+}
+
+// ImplementsPreJSONMarshaler checks for support for the PreMarshalJSON pre-hook
+func ImplementsPreJSONMarshaler(v interface{}) bool {
+ value := reflect.ValueOf(v)
+ if value.Kind() == reflect.Ptr && value.IsNil() {
+ return false
+ }
+
+ _, ok := value.Interface().(PreJSONMarshaler)
+ return ok
+}
+
+// PostJSONUnmarshaler infers support for the PostUnmarshalJSON post-hook
+type PostJSONUnmarshaler interface {
+ PostUnmarshalJSON() error
+}
+
+// ImplementsPostJSONUnmarshaler checks for support for the PostUnmarshalJSON post-hook
+func ImplementsPostJSONUnmarshaler(v interface{}) bool {
+ value := reflect.ValueOf(v)
+ if value.Kind() == reflect.Ptr && value.IsNil() {
+ return false
+ }
+
+ _, ok := value.Interface().(PostJSONUnmarshaler)
+ return ok
+}
diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go
new file mode 100644
index 000000000..9d3eb928d
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go
@@ -0,0 +1,15975 @@
+// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
+
+package lightsail
+
+import (
+ "time"
+
+ "github.com/aws/aws-sdk-go/aws"
+ "github.com/aws/aws-sdk-go/aws/awsutil"
+ "github.com/aws/aws-sdk-go/aws/request"
+)
+
+const opAllocateStaticIp = "AllocateStaticIp"
+
+// AllocateStaticIpRequest generates a "aws/request.Request" representing the
+// client's request for the AllocateStaticIp operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See AllocateStaticIp for more information on using the AllocateStaticIp
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the AllocateStaticIpRequest method.
+// req, resp := client.AllocateStaticIpRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AllocateStaticIp
+func (c *Lightsail) AllocateStaticIpRequest(input *AllocateStaticIpInput) (req *request.Request, output *AllocateStaticIpOutput) {
+ op := &request.Operation{
+ Name: opAllocateStaticIp,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &AllocateStaticIpInput{}
+ }
+
+ output = &AllocateStaticIpOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// AllocateStaticIp API operation for Amazon Lightsail.
+//
+// Allocates a static IP address.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation AllocateStaticIp for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AllocateStaticIp
+func (c *Lightsail) AllocateStaticIp(input *AllocateStaticIpInput) (*AllocateStaticIpOutput, error) {
+ req, out := c.AllocateStaticIpRequest(input)
+ return out, req.Send()
+}
+
+// AllocateStaticIpWithContext is the same as AllocateStaticIp with the addition of
+// the ability to pass a context and additional request options.
+//
+// See AllocateStaticIp for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) AllocateStaticIpWithContext(ctx aws.Context, input *AllocateStaticIpInput, opts ...request.Option) (*AllocateStaticIpOutput, error) {
+ req, out := c.AllocateStaticIpRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opAttachDisk = "AttachDisk"
+
+// AttachDiskRequest generates a "aws/request.Request" representing the
+// client's request for the AttachDisk operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See AttachDisk for more information on using the AttachDisk
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the AttachDiskRequest method.
+// req, resp := client.AttachDiskRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachDisk
+func (c *Lightsail) AttachDiskRequest(input *AttachDiskInput) (req *request.Request, output *AttachDiskOutput) {
+ op := &request.Operation{
+ Name: opAttachDisk,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &AttachDiskInput{}
+ }
+
+ output = &AttachDiskOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// AttachDisk API operation for Amazon Lightsail.
+//
+// Attaches a block storage disk to a running or stopped Lightsail instance
+// and exposes it to the instance with the specified disk name.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation AttachDisk for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachDisk
+func (c *Lightsail) AttachDisk(input *AttachDiskInput) (*AttachDiskOutput, error) {
+ req, out := c.AttachDiskRequest(input)
+ return out, req.Send()
+}
+
+// AttachDiskWithContext is the same as AttachDisk with the addition of
+// the ability to pass a context and additional request options.
+//
+// See AttachDisk for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) AttachDiskWithContext(ctx aws.Context, input *AttachDiskInput, opts ...request.Option) (*AttachDiskOutput, error) {
+ req, out := c.AttachDiskRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opAttachInstancesToLoadBalancer = "AttachInstancesToLoadBalancer"
+
+// AttachInstancesToLoadBalancerRequest generates a "aws/request.Request" representing the
+// client's request for the AttachInstancesToLoadBalancer operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See AttachInstancesToLoadBalancer for more information on using the AttachInstancesToLoadBalancer
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the AttachInstancesToLoadBalancerRequest method.
+// req, resp := client.AttachInstancesToLoadBalancerRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachInstancesToLoadBalancer
+func (c *Lightsail) AttachInstancesToLoadBalancerRequest(input *AttachInstancesToLoadBalancerInput) (req *request.Request, output *AttachInstancesToLoadBalancerOutput) {
+ op := &request.Operation{
+ Name: opAttachInstancesToLoadBalancer,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &AttachInstancesToLoadBalancerInput{}
+ }
+
+ output = &AttachInstancesToLoadBalancerOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// AttachInstancesToLoadBalancer API operation for Amazon Lightsail.
+//
+// Attaches one or more Lightsail instances to a load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation AttachInstancesToLoadBalancer for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachInstancesToLoadBalancer
+func (c *Lightsail) AttachInstancesToLoadBalancer(input *AttachInstancesToLoadBalancerInput) (*AttachInstancesToLoadBalancerOutput, error) {
+ req, out := c.AttachInstancesToLoadBalancerRequest(input)
+ return out, req.Send()
+}
+
+// AttachInstancesToLoadBalancerWithContext is the same as AttachInstancesToLoadBalancer with the addition of
+// the ability to pass a context and additional request options.
+//
+// See AttachInstancesToLoadBalancer for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) AttachInstancesToLoadBalancerWithContext(ctx aws.Context, input *AttachInstancesToLoadBalancerInput, opts ...request.Option) (*AttachInstancesToLoadBalancerOutput, error) {
+ req, out := c.AttachInstancesToLoadBalancerRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opAttachLoadBalancerTlsCertificate = "AttachLoadBalancerTlsCertificate"
+
+// AttachLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the
+// client's request for the AttachLoadBalancerTlsCertificate operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See AttachLoadBalancerTlsCertificate for more information on using the AttachLoadBalancerTlsCertificate
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the AttachLoadBalancerTlsCertificateRequest method.
+// req, resp := client.AttachLoadBalancerTlsCertificateRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachLoadBalancerTlsCertificate
+func (c *Lightsail) AttachLoadBalancerTlsCertificateRequest(input *AttachLoadBalancerTlsCertificateInput) (req *request.Request, output *AttachLoadBalancerTlsCertificateOutput) {
+ op := &request.Operation{
+ Name: opAttachLoadBalancerTlsCertificate,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &AttachLoadBalancerTlsCertificateInput{}
+ }
+
+ output = &AttachLoadBalancerTlsCertificateOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// AttachLoadBalancerTlsCertificate API operation for Amazon Lightsail.
+//
+// Attaches a Transport Layer Security (TLS) certificate to your load balancer.
+//
+// TLS is just an updated, more secure version of Secure Socket Layer (SSL).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation AttachLoadBalancerTlsCertificate for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachLoadBalancerTlsCertificate
+func (c *Lightsail) AttachLoadBalancerTlsCertificate(input *AttachLoadBalancerTlsCertificateInput) (*AttachLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.AttachLoadBalancerTlsCertificateRequest(input)
+ return out, req.Send()
+}
+
+// AttachLoadBalancerTlsCertificateWithContext is the same as AttachLoadBalancerTlsCertificate with the addition of
+// the ability to pass a context and additional request options.
+//
+// See AttachLoadBalancerTlsCertificate for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) AttachLoadBalancerTlsCertificateWithContext(ctx aws.Context, input *AttachLoadBalancerTlsCertificateInput, opts ...request.Option) (*AttachLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.AttachLoadBalancerTlsCertificateRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opAttachStaticIp = "AttachStaticIp"
+
+// AttachStaticIpRequest generates a "aws/request.Request" representing the
+// client's request for the AttachStaticIp operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See AttachStaticIp for more information on using the AttachStaticIp
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the AttachStaticIpRequest method.
+// req, resp := client.AttachStaticIpRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachStaticIp
+func (c *Lightsail) AttachStaticIpRequest(input *AttachStaticIpInput) (req *request.Request, output *AttachStaticIpOutput) {
+ op := &request.Operation{
+ Name: opAttachStaticIp,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &AttachStaticIpInput{}
+ }
+
+ output = &AttachStaticIpOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// AttachStaticIp API operation for Amazon Lightsail.
+//
+// Attaches a static IP address to a specific Amazon Lightsail instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation AttachStaticIp for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/AttachStaticIp
+func (c *Lightsail) AttachStaticIp(input *AttachStaticIpInput) (*AttachStaticIpOutput, error) {
+ req, out := c.AttachStaticIpRequest(input)
+ return out, req.Send()
+}
+
+// AttachStaticIpWithContext is the same as AttachStaticIp with the addition of
+// the ability to pass a context and additional request options.
+//
+// See AttachStaticIp for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) AttachStaticIpWithContext(ctx aws.Context, input *AttachStaticIpInput, opts ...request.Option) (*AttachStaticIpOutput, error) {
+ req, out := c.AttachStaticIpRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCloseInstancePublicPorts = "CloseInstancePublicPorts"
+
+// CloseInstancePublicPortsRequest generates a "aws/request.Request" representing the
+// client's request for the CloseInstancePublicPorts operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CloseInstancePublicPorts for more information on using the CloseInstancePublicPorts
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CloseInstancePublicPortsRequest method.
+// req, resp := client.CloseInstancePublicPortsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CloseInstancePublicPorts
+func (c *Lightsail) CloseInstancePublicPortsRequest(input *CloseInstancePublicPortsInput) (req *request.Request, output *CloseInstancePublicPortsOutput) {
+ op := &request.Operation{
+ Name: opCloseInstancePublicPorts,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CloseInstancePublicPortsInput{}
+ }
+
+ output = &CloseInstancePublicPortsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CloseInstancePublicPorts API operation for Amazon Lightsail.
+//
+// Closes the public ports on a specific Amazon Lightsail instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CloseInstancePublicPorts for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CloseInstancePublicPorts
+func (c *Lightsail) CloseInstancePublicPorts(input *CloseInstancePublicPortsInput) (*CloseInstancePublicPortsOutput, error) {
+ req, out := c.CloseInstancePublicPortsRequest(input)
+ return out, req.Send()
+}
+
+// CloseInstancePublicPortsWithContext is the same as CloseInstancePublicPorts with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CloseInstancePublicPorts for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CloseInstancePublicPortsWithContext(ctx aws.Context, input *CloseInstancePublicPortsInput, opts ...request.Option) (*CloseInstancePublicPortsOutput, error) {
+ req, out := c.CloseInstancePublicPortsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateDisk = "CreateDisk"
+
+// CreateDiskRequest generates a "aws/request.Request" representing the
+// client's request for the CreateDisk operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateDisk for more information on using the CreateDisk
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateDiskRequest method.
+// req, resp := client.CreateDiskRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDisk
+func (c *Lightsail) CreateDiskRequest(input *CreateDiskInput) (req *request.Request, output *CreateDiskOutput) {
+ op := &request.Operation{
+ Name: opCreateDisk,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateDiskInput{}
+ }
+
+ output = &CreateDiskOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateDisk API operation for Amazon Lightsail.
+//
+// Creates a block storage disk that can be attached to a Lightsail instance
+// in the same Availability Zone (e.g., us-east-2a). The disk is created in
+// the regional endpoint that you send the HTTP request to. For more information,
+// see Regions and Availability Zones in Lightsail (https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateDisk for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDisk
+func (c *Lightsail) CreateDisk(input *CreateDiskInput) (*CreateDiskOutput, error) {
+ req, out := c.CreateDiskRequest(input)
+ return out, req.Send()
+}
+
+// CreateDiskWithContext is the same as CreateDisk with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateDisk for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateDiskWithContext(ctx aws.Context, input *CreateDiskInput, opts ...request.Option) (*CreateDiskOutput, error) {
+ req, out := c.CreateDiskRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateDiskFromSnapshot = "CreateDiskFromSnapshot"
+
+// CreateDiskFromSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the CreateDiskFromSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateDiskFromSnapshot for more information on using the CreateDiskFromSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateDiskFromSnapshotRequest method.
+// req, resp := client.CreateDiskFromSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDiskFromSnapshot
+func (c *Lightsail) CreateDiskFromSnapshotRequest(input *CreateDiskFromSnapshotInput) (req *request.Request, output *CreateDiskFromSnapshotOutput) {
+ op := &request.Operation{
+ Name: opCreateDiskFromSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateDiskFromSnapshotInput{}
+ }
+
+ output = &CreateDiskFromSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateDiskFromSnapshot API operation for Amazon Lightsail.
+//
+// Creates a block storage disk from a disk snapshot that can be attached to
+// a Lightsail instance in the same Availability Zone (e.g., us-east-2a). The
+// disk is created in the regional endpoint that you send the HTTP request to.
+// For more information, see Regions and Availability Zones in Lightsail (https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateDiskFromSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDiskFromSnapshot
+func (c *Lightsail) CreateDiskFromSnapshot(input *CreateDiskFromSnapshotInput) (*CreateDiskFromSnapshotOutput, error) {
+ req, out := c.CreateDiskFromSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// CreateDiskFromSnapshotWithContext is the same as CreateDiskFromSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateDiskFromSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateDiskFromSnapshotWithContext(ctx aws.Context, input *CreateDiskFromSnapshotInput, opts ...request.Option) (*CreateDiskFromSnapshotOutput, error) {
+ req, out := c.CreateDiskFromSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateDiskSnapshot = "CreateDiskSnapshot"
+
+// CreateDiskSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the CreateDiskSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateDiskSnapshot for more information on using the CreateDiskSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateDiskSnapshotRequest method.
+// req, resp := client.CreateDiskSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDiskSnapshot
+func (c *Lightsail) CreateDiskSnapshotRequest(input *CreateDiskSnapshotInput) (req *request.Request, output *CreateDiskSnapshotOutput) {
+ op := &request.Operation{
+ Name: opCreateDiskSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateDiskSnapshotInput{}
+ }
+
+ output = &CreateDiskSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateDiskSnapshot API operation for Amazon Lightsail.
+//
+// Creates a snapshot of a block storage disk. You can use snapshots for backups,
+// to make copies of disks, and to save data before shutting down a Lightsail
+// instance.
+//
+// You can take a snapshot of an attached disk that is in use; however, snapshots
+// only capture data that has been written to your disk at the time the snapshot
+// command is issued. This may exclude any data that has been cached by any
+// applications or the operating system. If you can pause any file systems on
+// the disk long enough to take a snapshot, your snapshot should be complete.
+// Nevertheless, if you cannot pause all file writes to the disk, you should
+// unmount the disk from within the Lightsail instance, issue the create disk
+// snapshot command, and then remount the disk to ensure a consistent and complete
+// snapshot. You may remount and use your disk while the snapshot status is
+// pending.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateDiskSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDiskSnapshot
+func (c *Lightsail) CreateDiskSnapshot(input *CreateDiskSnapshotInput) (*CreateDiskSnapshotOutput, error) {
+ req, out := c.CreateDiskSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// CreateDiskSnapshotWithContext is the same as CreateDiskSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateDiskSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateDiskSnapshotWithContext(ctx aws.Context, input *CreateDiskSnapshotInput, opts ...request.Option) (*CreateDiskSnapshotOutput, error) {
+ req, out := c.CreateDiskSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateDomain = "CreateDomain"
+
+// CreateDomainRequest generates a "aws/request.Request" representing the
+// client's request for the CreateDomain operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateDomain for more information on using the CreateDomain
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateDomainRequest method.
+// req, resp := client.CreateDomainRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomain
+func (c *Lightsail) CreateDomainRequest(input *CreateDomainInput) (req *request.Request, output *CreateDomainOutput) {
+ op := &request.Operation{
+ Name: opCreateDomain,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateDomainInput{}
+ }
+
+ output = &CreateDomainOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateDomain API operation for Amazon Lightsail.
+//
+// Creates a domain resource for the specified domain (e.g., example.com).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateDomain for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomain
+func (c *Lightsail) CreateDomain(input *CreateDomainInput) (*CreateDomainOutput, error) {
+ req, out := c.CreateDomainRequest(input)
+ return out, req.Send()
+}
+
+// CreateDomainWithContext is the same as CreateDomain with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateDomain for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateDomainWithContext(ctx aws.Context, input *CreateDomainInput, opts ...request.Option) (*CreateDomainOutput, error) {
+ req, out := c.CreateDomainRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateDomainEntry = "CreateDomainEntry"
+
+// CreateDomainEntryRequest generates a "aws/request.Request" representing the
+// client's request for the CreateDomainEntry operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateDomainEntry for more information on using the CreateDomainEntry
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateDomainEntryRequest method.
+// req, resp := client.CreateDomainEntryRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomainEntry
+func (c *Lightsail) CreateDomainEntryRequest(input *CreateDomainEntryInput) (req *request.Request, output *CreateDomainEntryOutput) {
+ op := &request.Operation{
+ Name: opCreateDomainEntry,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateDomainEntryInput{}
+ }
+
+ output = &CreateDomainEntryOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateDomainEntry API operation for Amazon Lightsail.
+//
+// Creates one of the following entry records associated with the domain: A
+// record, CNAME record, TXT record, or MX record.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateDomainEntry for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateDomainEntry
+func (c *Lightsail) CreateDomainEntry(input *CreateDomainEntryInput) (*CreateDomainEntryOutput, error) {
+ req, out := c.CreateDomainEntryRequest(input)
+ return out, req.Send()
+}
+
+// CreateDomainEntryWithContext is the same as CreateDomainEntry with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateDomainEntry for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateDomainEntryWithContext(ctx aws.Context, input *CreateDomainEntryInput, opts ...request.Option) (*CreateDomainEntryOutput, error) {
+ req, out := c.CreateDomainEntryRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateInstanceSnapshot = "CreateInstanceSnapshot"
+
+// CreateInstanceSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the CreateInstanceSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateInstanceSnapshot for more information on using the CreateInstanceSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateInstanceSnapshotRequest method.
+// req, resp := client.CreateInstanceSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstanceSnapshot
+func (c *Lightsail) CreateInstanceSnapshotRequest(input *CreateInstanceSnapshotInput) (req *request.Request, output *CreateInstanceSnapshotOutput) {
+ op := &request.Operation{
+ Name: opCreateInstanceSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateInstanceSnapshotInput{}
+ }
+
+ output = &CreateInstanceSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateInstanceSnapshot API operation for Amazon Lightsail.
+//
+// Creates a snapshot of a specific virtual private server, or instance. You
+// can use a snapshot to create a new instance that is based on that snapshot.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateInstanceSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstanceSnapshot
+func (c *Lightsail) CreateInstanceSnapshot(input *CreateInstanceSnapshotInput) (*CreateInstanceSnapshotOutput, error) {
+ req, out := c.CreateInstanceSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// CreateInstanceSnapshotWithContext is the same as CreateInstanceSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateInstanceSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateInstanceSnapshotWithContext(ctx aws.Context, input *CreateInstanceSnapshotInput, opts ...request.Option) (*CreateInstanceSnapshotOutput, error) {
+ req, out := c.CreateInstanceSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateInstances = "CreateInstances"
+
+// CreateInstancesRequest generates a "aws/request.Request" representing the
+// client's request for the CreateInstances operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateInstances for more information on using the CreateInstances
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateInstancesRequest method.
+// req, resp := client.CreateInstancesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstances
+func (c *Lightsail) CreateInstancesRequest(input *CreateInstancesInput) (req *request.Request, output *CreateInstancesOutput) {
+ op := &request.Operation{
+ Name: opCreateInstances,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateInstancesInput{}
+ }
+
+ output = &CreateInstancesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateInstances API operation for Amazon Lightsail.
+//
+// Creates one or more Amazon Lightsail virtual private servers, or instances.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateInstances for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstances
+func (c *Lightsail) CreateInstances(input *CreateInstancesInput) (*CreateInstancesOutput, error) {
+ req, out := c.CreateInstancesRequest(input)
+ return out, req.Send()
+}
+
+// CreateInstancesWithContext is the same as CreateInstances with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateInstances for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateInstancesWithContext(ctx aws.Context, input *CreateInstancesInput, opts ...request.Option) (*CreateInstancesOutput, error) {
+ req, out := c.CreateInstancesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateInstancesFromSnapshot = "CreateInstancesFromSnapshot"
+
+// CreateInstancesFromSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the CreateInstancesFromSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateInstancesFromSnapshot for more information on using the CreateInstancesFromSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateInstancesFromSnapshotRequest method.
+// req, resp := client.CreateInstancesFromSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstancesFromSnapshot
+func (c *Lightsail) CreateInstancesFromSnapshotRequest(input *CreateInstancesFromSnapshotInput) (req *request.Request, output *CreateInstancesFromSnapshotOutput) {
+ op := &request.Operation{
+ Name: opCreateInstancesFromSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateInstancesFromSnapshotInput{}
+ }
+
+ output = &CreateInstancesFromSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateInstancesFromSnapshot API operation for Amazon Lightsail.
+//
+// Uses a specific snapshot as a blueprint for creating one or more new instances
+// that are based on that identical configuration.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateInstancesFromSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateInstancesFromSnapshot
+func (c *Lightsail) CreateInstancesFromSnapshot(input *CreateInstancesFromSnapshotInput) (*CreateInstancesFromSnapshotOutput, error) {
+ req, out := c.CreateInstancesFromSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// CreateInstancesFromSnapshotWithContext is the same as CreateInstancesFromSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateInstancesFromSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateInstancesFromSnapshotWithContext(ctx aws.Context, input *CreateInstancesFromSnapshotInput, opts ...request.Option) (*CreateInstancesFromSnapshotOutput, error) {
+ req, out := c.CreateInstancesFromSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateKeyPair = "CreateKeyPair"
+
+// CreateKeyPairRequest generates a "aws/request.Request" representing the
+// client's request for the CreateKeyPair operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateKeyPair for more information on using the CreateKeyPair
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateKeyPairRequest method.
+// req, resp := client.CreateKeyPairRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateKeyPair
+func (c *Lightsail) CreateKeyPairRequest(input *CreateKeyPairInput) (req *request.Request, output *CreateKeyPairOutput) {
+ op := &request.Operation{
+ Name: opCreateKeyPair,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateKeyPairInput{}
+ }
+
+ output = &CreateKeyPairOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateKeyPair API operation for Amazon Lightsail.
+//
+// Creates sn SSH key pair.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateKeyPair for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateKeyPair
+func (c *Lightsail) CreateKeyPair(input *CreateKeyPairInput) (*CreateKeyPairOutput, error) {
+ req, out := c.CreateKeyPairRequest(input)
+ return out, req.Send()
+}
+
+// CreateKeyPairWithContext is the same as CreateKeyPair with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateKeyPair for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateKeyPairWithContext(ctx aws.Context, input *CreateKeyPairInput, opts ...request.Option) (*CreateKeyPairOutput, error) {
+ req, out := c.CreateKeyPairRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateLoadBalancer = "CreateLoadBalancer"
+
+// CreateLoadBalancerRequest generates a "aws/request.Request" representing the
+// client's request for the CreateLoadBalancer operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateLoadBalancer for more information on using the CreateLoadBalancer
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateLoadBalancerRequest method.
+// req, resp := client.CreateLoadBalancerRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateLoadBalancer
+func (c *Lightsail) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (req *request.Request, output *CreateLoadBalancerOutput) {
+ op := &request.Operation{
+ Name: opCreateLoadBalancer,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateLoadBalancerInput{}
+ }
+
+ output = &CreateLoadBalancerOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateLoadBalancer API operation for Amazon Lightsail.
+//
+// Creates a Lightsail load balancer.
+//
+// When you create a load balancer, you can specify certificates and port settings.
+// You can create up to 5 load balancers per AWS Region in your account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateLoadBalancer for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateLoadBalancer
+func (c *Lightsail) CreateLoadBalancer(input *CreateLoadBalancerInput) (*CreateLoadBalancerOutput, error) {
+ req, out := c.CreateLoadBalancerRequest(input)
+ return out, req.Send()
+}
+
+// CreateLoadBalancerWithContext is the same as CreateLoadBalancer with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateLoadBalancer for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateLoadBalancerWithContext(ctx aws.Context, input *CreateLoadBalancerInput, opts ...request.Option) (*CreateLoadBalancerOutput, error) {
+ req, out := c.CreateLoadBalancerRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opCreateLoadBalancerTlsCertificate = "CreateLoadBalancerTlsCertificate"
+
+// CreateLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the
+// client's request for the CreateLoadBalancerTlsCertificate operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See CreateLoadBalancerTlsCertificate for more information on using the CreateLoadBalancerTlsCertificate
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the CreateLoadBalancerTlsCertificateRequest method.
+// req, resp := client.CreateLoadBalancerTlsCertificateRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateLoadBalancerTlsCertificate
+func (c *Lightsail) CreateLoadBalancerTlsCertificateRequest(input *CreateLoadBalancerTlsCertificateInput) (req *request.Request, output *CreateLoadBalancerTlsCertificateOutput) {
+ op := &request.Operation{
+ Name: opCreateLoadBalancerTlsCertificate,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &CreateLoadBalancerTlsCertificateInput{}
+ }
+
+ output = &CreateLoadBalancerTlsCertificateOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// CreateLoadBalancerTlsCertificate API operation for Amazon Lightsail.
+//
+// Creates a Lightsail load balancer TLS certificate.
+//
+// TLS is just an updated, more secure version of Secure Socket Layer (SSL).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation CreateLoadBalancerTlsCertificate for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateLoadBalancerTlsCertificate
+func (c *Lightsail) CreateLoadBalancerTlsCertificate(input *CreateLoadBalancerTlsCertificateInput) (*CreateLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.CreateLoadBalancerTlsCertificateRequest(input)
+ return out, req.Send()
+}
+
+// CreateLoadBalancerTlsCertificateWithContext is the same as CreateLoadBalancerTlsCertificate with the addition of
+// the ability to pass a context and additional request options.
+//
+// See CreateLoadBalancerTlsCertificate for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) CreateLoadBalancerTlsCertificateWithContext(ctx aws.Context, input *CreateLoadBalancerTlsCertificateInput, opts ...request.Option) (*CreateLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.CreateLoadBalancerTlsCertificateRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteDisk = "DeleteDisk"
+
+// DeleteDiskRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteDisk operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteDisk for more information on using the DeleteDisk
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteDiskRequest method.
+// req, resp := client.DeleteDiskRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDisk
+func (c *Lightsail) DeleteDiskRequest(input *DeleteDiskInput) (req *request.Request, output *DeleteDiskOutput) {
+ op := &request.Operation{
+ Name: opDeleteDisk,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteDiskInput{}
+ }
+
+ output = &DeleteDiskOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteDisk API operation for Amazon Lightsail.
+//
+// Deletes the specified block storage disk. The disk must be in the available
+// state (not attached to a Lightsail instance).
+//
+// The disk may remain in the deleting state for several minutes.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteDisk for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDisk
+func (c *Lightsail) DeleteDisk(input *DeleteDiskInput) (*DeleteDiskOutput, error) {
+ req, out := c.DeleteDiskRequest(input)
+ return out, req.Send()
+}
+
+// DeleteDiskWithContext is the same as DeleteDisk with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteDisk for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteDiskWithContext(ctx aws.Context, input *DeleteDiskInput, opts ...request.Option) (*DeleteDiskOutput, error) {
+ req, out := c.DeleteDiskRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteDiskSnapshot = "DeleteDiskSnapshot"
+
+// DeleteDiskSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteDiskSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteDiskSnapshot for more information on using the DeleteDiskSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteDiskSnapshotRequest method.
+// req, resp := client.DeleteDiskSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDiskSnapshot
+func (c *Lightsail) DeleteDiskSnapshotRequest(input *DeleteDiskSnapshotInput) (req *request.Request, output *DeleteDiskSnapshotOutput) {
+ op := &request.Operation{
+ Name: opDeleteDiskSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteDiskSnapshotInput{}
+ }
+
+ output = &DeleteDiskSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteDiskSnapshot API operation for Amazon Lightsail.
+//
+// Deletes the specified disk snapshot.
+//
+// When you make periodic snapshots of a disk, the snapshots are incremental,
+// and only the blocks on the device that have changed since your last snapshot
+// are saved in the new snapshot. When you delete a snapshot, only the data
+// not needed for any other snapshot is removed. So regardless of which prior
+// snapshots have been deleted, all active snapshots will have access to all
+// the information needed to restore the disk.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteDiskSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDiskSnapshot
+func (c *Lightsail) DeleteDiskSnapshot(input *DeleteDiskSnapshotInput) (*DeleteDiskSnapshotOutput, error) {
+ req, out := c.DeleteDiskSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// DeleteDiskSnapshotWithContext is the same as DeleteDiskSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteDiskSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteDiskSnapshotWithContext(ctx aws.Context, input *DeleteDiskSnapshotInput, opts ...request.Option) (*DeleteDiskSnapshotOutput, error) {
+ req, out := c.DeleteDiskSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteDomain = "DeleteDomain"
+
+// DeleteDomainRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteDomain operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteDomain for more information on using the DeleteDomain
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteDomainRequest method.
+// req, resp := client.DeleteDomainRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomain
+func (c *Lightsail) DeleteDomainRequest(input *DeleteDomainInput) (req *request.Request, output *DeleteDomainOutput) {
+ op := &request.Operation{
+ Name: opDeleteDomain,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteDomainInput{}
+ }
+
+ output = &DeleteDomainOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteDomain API operation for Amazon Lightsail.
+//
+// Deletes the specified domain recordset and all of its domain records.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteDomain for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomain
+func (c *Lightsail) DeleteDomain(input *DeleteDomainInput) (*DeleteDomainOutput, error) {
+ req, out := c.DeleteDomainRequest(input)
+ return out, req.Send()
+}
+
+// DeleteDomainWithContext is the same as DeleteDomain with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteDomain for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteDomainWithContext(ctx aws.Context, input *DeleteDomainInput, opts ...request.Option) (*DeleteDomainOutput, error) {
+ req, out := c.DeleteDomainRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteDomainEntry = "DeleteDomainEntry"
+
+// DeleteDomainEntryRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteDomainEntry operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteDomainEntry for more information on using the DeleteDomainEntry
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteDomainEntryRequest method.
+// req, resp := client.DeleteDomainEntryRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomainEntry
+func (c *Lightsail) DeleteDomainEntryRequest(input *DeleteDomainEntryInput) (req *request.Request, output *DeleteDomainEntryOutput) {
+ op := &request.Operation{
+ Name: opDeleteDomainEntry,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteDomainEntryInput{}
+ }
+
+ output = &DeleteDomainEntryOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteDomainEntry API operation for Amazon Lightsail.
+//
+// Deletes a specific domain entry.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteDomainEntry for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteDomainEntry
+func (c *Lightsail) DeleteDomainEntry(input *DeleteDomainEntryInput) (*DeleteDomainEntryOutput, error) {
+ req, out := c.DeleteDomainEntryRequest(input)
+ return out, req.Send()
+}
+
+// DeleteDomainEntryWithContext is the same as DeleteDomainEntry with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteDomainEntry for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteDomainEntryWithContext(ctx aws.Context, input *DeleteDomainEntryInput, opts ...request.Option) (*DeleteDomainEntryOutput, error) {
+ req, out := c.DeleteDomainEntryRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteInstance = "DeleteInstance"
+
+// DeleteInstanceRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteInstance operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteInstance for more information on using the DeleteInstance
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteInstanceRequest method.
+// req, resp := client.DeleteInstanceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstance
+func (c *Lightsail) DeleteInstanceRequest(input *DeleteInstanceInput) (req *request.Request, output *DeleteInstanceOutput) {
+ op := &request.Operation{
+ Name: opDeleteInstance,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteInstanceInput{}
+ }
+
+ output = &DeleteInstanceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteInstance API operation for Amazon Lightsail.
+//
+// Deletes a specific Amazon Lightsail virtual private server, or instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteInstance for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstance
+func (c *Lightsail) DeleteInstance(input *DeleteInstanceInput) (*DeleteInstanceOutput, error) {
+ req, out := c.DeleteInstanceRequest(input)
+ return out, req.Send()
+}
+
+// DeleteInstanceWithContext is the same as DeleteInstance with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteInstance for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteInstanceWithContext(ctx aws.Context, input *DeleteInstanceInput, opts ...request.Option) (*DeleteInstanceOutput, error) {
+ req, out := c.DeleteInstanceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteInstanceSnapshot = "DeleteInstanceSnapshot"
+
+// DeleteInstanceSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteInstanceSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteInstanceSnapshot for more information on using the DeleteInstanceSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteInstanceSnapshotRequest method.
+// req, resp := client.DeleteInstanceSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstanceSnapshot
+func (c *Lightsail) DeleteInstanceSnapshotRequest(input *DeleteInstanceSnapshotInput) (req *request.Request, output *DeleteInstanceSnapshotOutput) {
+ op := &request.Operation{
+ Name: opDeleteInstanceSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteInstanceSnapshotInput{}
+ }
+
+ output = &DeleteInstanceSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteInstanceSnapshot API operation for Amazon Lightsail.
+//
+// Deletes a specific snapshot of a virtual private server (or instance).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteInstanceSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteInstanceSnapshot
+func (c *Lightsail) DeleteInstanceSnapshot(input *DeleteInstanceSnapshotInput) (*DeleteInstanceSnapshotOutput, error) {
+ req, out := c.DeleteInstanceSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// DeleteInstanceSnapshotWithContext is the same as DeleteInstanceSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteInstanceSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteInstanceSnapshotWithContext(ctx aws.Context, input *DeleteInstanceSnapshotInput, opts ...request.Option) (*DeleteInstanceSnapshotOutput, error) {
+ req, out := c.DeleteInstanceSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteKeyPair = "DeleteKeyPair"
+
+// DeleteKeyPairRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteKeyPair operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteKeyPair for more information on using the DeleteKeyPair
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteKeyPairRequest method.
+// req, resp := client.DeleteKeyPairRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteKeyPair
+func (c *Lightsail) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *request.Request, output *DeleteKeyPairOutput) {
+ op := &request.Operation{
+ Name: opDeleteKeyPair,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteKeyPairInput{}
+ }
+
+ output = &DeleteKeyPairOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteKeyPair API operation for Amazon Lightsail.
+//
+// Deletes a specific SSH key pair.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteKeyPair for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteKeyPair
+func (c *Lightsail) DeleteKeyPair(input *DeleteKeyPairInput) (*DeleteKeyPairOutput, error) {
+ req, out := c.DeleteKeyPairRequest(input)
+ return out, req.Send()
+}
+
+// DeleteKeyPairWithContext is the same as DeleteKeyPair with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteKeyPair for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteKeyPairWithContext(ctx aws.Context, input *DeleteKeyPairInput, opts ...request.Option) (*DeleteKeyPairOutput, error) {
+ req, out := c.DeleteKeyPairRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteLoadBalancer = "DeleteLoadBalancer"
+
+// DeleteLoadBalancerRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteLoadBalancer operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteLoadBalancer for more information on using the DeleteLoadBalancer
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteLoadBalancerRequest method.
+// req, resp := client.DeleteLoadBalancerRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteLoadBalancer
+func (c *Lightsail) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (req *request.Request, output *DeleteLoadBalancerOutput) {
+ op := &request.Operation{
+ Name: opDeleteLoadBalancer,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteLoadBalancerInput{}
+ }
+
+ output = &DeleteLoadBalancerOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteLoadBalancer API operation for Amazon Lightsail.
+//
+// Deletes a Lightsail load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteLoadBalancer for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteLoadBalancer
+func (c *Lightsail) DeleteLoadBalancer(input *DeleteLoadBalancerInput) (*DeleteLoadBalancerOutput, error) {
+ req, out := c.DeleteLoadBalancerRequest(input)
+ return out, req.Send()
+}
+
+// DeleteLoadBalancerWithContext is the same as DeleteLoadBalancer with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteLoadBalancer for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteLoadBalancerWithContext(ctx aws.Context, input *DeleteLoadBalancerInput, opts ...request.Option) (*DeleteLoadBalancerOutput, error) {
+ req, out := c.DeleteLoadBalancerRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDeleteLoadBalancerTlsCertificate = "DeleteLoadBalancerTlsCertificate"
+
+// DeleteLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the
+// client's request for the DeleteLoadBalancerTlsCertificate operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DeleteLoadBalancerTlsCertificate for more information on using the DeleteLoadBalancerTlsCertificate
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DeleteLoadBalancerTlsCertificateRequest method.
+// req, resp := client.DeleteLoadBalancerTlsCertificateRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteLoadBalancerTlsCertificate
+func (c *Lightsail) DeleteLoadBalancerTlsCertificateRequest(input *DeleteLoadBalancerTlsCertificateInput) (req *request.Request, output *DeleteLoadBalancerTlsCertificateOutput) {
+ op := &request.Operation{
+ Name: opDeleteLoadBalancerTlsCertificate,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DeleteLoadBalancerTlsCertificateInput{}
+ }
+
+ output = &DeleteLoadBalancerTlsCertificateOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DeleteLoadBalancerTlsCertificate API operation for Amazon Lightsail.
+//
+// Deletes a TLS/SSL certificate associated with a Lightsail load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DeleteLoadBalancerTlsCertificate for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteLoadBalancerTlsCertificate
+func (c *Lightsail) DeleteLoadBalancerTlsCertificate(input *DeleteLoadBalancerTlsCertificateInput) (*DeleteLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.DeleteLoadBalancerTlsCertificateRequest(input)
+ return out, req.Send()
+}
+
+// DeleteLoadBalancerTlsCertificateWithContext is the same as DeleteLoadBalancerTlsCertificate with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DeleteLoadBalancerTlsCertificate for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DeleteLoadBalancerTlsCertificateWithContext(ctx aws.Context, input *DeleteLoadBalancerTlsCertificateInput, opts ...request.Option) (*DeleteLoadBalancerTlsCertificateOutput, error) {
+ req, out := c.DeleteLoadBalancerTlsCertificateRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDetachDisk = "DetachDisk"
+
+// DetachDiskRequest generates a "aws/request.Request" representing the
+// client's request for the DetachDisk operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DetachDisk for more information on using the DetachDisk
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DetachDiskRequest method.
+// req, resp := client.DetachDiskRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachDisk
+func (c *Lightsail) DetachDiskRequest(input *DetachDiskInput) (req *request.Request, output *DetachDiskOutput) {
+ op := &request.Operation{
+ Name: opDetachDisk,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DetachDiskInput{}
+ }
+
+ output = &DetachDiskOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DetachDisk API operation for Amazon Lightsail.
+//
+// Detaches a stopped block storage disk from a Lightsail instance. Make sure
+// to unmount any file systems on the device within your operating system before
+// stopping the instance and detaching the disk.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DetachDisk for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachDisk
+func (c *Lightsail) DetachDisk(input *DetachDiskInput) (*DetachDiskOutput, error) {
+ req, out := c.DetachDiskRequest(input)
+ return out, req.Send()
+}
+
+// DetachDiskWithContext is the same as DetachDisk with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DetachDisk for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DetachDiskWithContext(ctx aws.Context, input *DetachDiskInput, opts ...request.Option) (*DetachDiskOutput, error) {
+ req, out := c.DetachDiskRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDetachInstancesFromLoadBalancer = "DetachInstancesFromLoadBalancer"
+
+// DetachInstancesFromLoadBalancerRequest generates a "aws/request.Request" representing the
+// client's request for the DetachInstancesFromLoadBalancer operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DetachInstancesFromLoadBalancer for more information on using the DetachInstancesFromLoadBalancer
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DetachInstancesFromLoadBalancerRequest method.
+// req, resp := client.DetachInstancesFromLoadBalancerRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachInstancesFromLoadBalancer
+func (c *Lightsail) DetachInstancesFromLoadBalancerRequest(input *DetachInstancesFromLoadBalancerInput) (req *request.Request, output *DetachInstancesFromLoadBalancerOutput) {
+ op := &request.Operation{
+ Name: opDetachInstancesFromLoadBalancer,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DetachInstancesFromLoadBalancerInput{}
+ }
+
+ output = &DetachInstancesFromLoadBalancerOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DetachInstancesFromLoadBalancer API operation for Amazon Lightsail.
+//
+// Detaches the specified instances from a Lightsail load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DetachInstancesFromLoadBalancer for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachInstancesFromLoadBalancer
+func (c *Lightsail) DetachInstancesFromLoadBalancer(input *DetachInstancesFromLoadBalancerInput) (*DetachInstancesFromLoadBalancerOutput, error) {
+ req, out := c.DetachInstancesFromLoadBalancerRequest(input)
+ return out, req.Send()
+}
+
+// DetachInstancesFromLoadBalancerWithContext is the same as DetachInstancesFromLoadBalancer with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DetachInstancesFromLoadBalancer for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DetachInstancesFromLoadBalancerWithContext(ctx aws.Context, input *DetachInstancesFromLoadBalancerInput, opts ...request.Option) (*DetachInstancesFromLoadBalancerOutput, error) {
+ req, out := c.DetachInstancesFromLoadBalancerRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDetachStaticIp = "DetachStaticIp"
+
+// DetachStaticIpRequest generates a "aws/request.Request" representing the
+// client's request for the DetachStaticIp operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DetachStaticIp for more information on using the DetachStaticIp
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DetachStaticIpRequest method.
+// req, resp := client.DetachStaticIpRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachStaticIp
+func (c *Lightsail) DetachStaticIpRequest(input *DetachStaticIpInput) (req *request.Request, output *DetachStaticIpOutput) {
+ op := &request.Operation{
+ Name: opDetachStaticIp,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DetachStaticIpInput{}
+ }
+
+ output = &DetachStaticIpOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DetachStaticIp API operation for Amazon Lightsail.
+//
+// Detaches a static IP from the Amazon Lightsail instance to which it is attached.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DetachStaticIp for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DetachStaticIp
+func (c *Lightsail) DetachStaticIp(input *DetachStaticIpInput) (*DetachStaticIpOutput, error) {
+ req, out := c.DetachStaticIpRequest(input)
+ return out, req.Send()
+}
+
+// DetachStaticIpWithContext is the same as DetachStaticIp with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DetachStaticIp for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DetachStaticIpWithContext(ctx aws.Context, input *DetachStaticIpInput, opts ...request.Option) (*DetachStaticIpOutput, error) {
+ req, out := c.DetachStaticIpRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opDownloadDefaultKeyPair = "DownloadDefaultKeyPair"
+
+// DownloadDefaultKeyPairRequest generates a "aws/request.Request" representing the
+// client's request for the DownloadDefaultKeyPair operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See DownloadDefaultKeyPair for more information on using the DownloadDefaultKeyPair
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the DownloadDefaultKeyPairRequest method.
+// req, resp := client.DownloadDefaultKeyPairRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DownloadDefaultKeyPair
+func (c *Lightsail) DownloadDefaultKeyPairRequest(input *DownloadDefaultKeyPairInput) (req *request.Request, output *DownloadDefaultKeyPairOutput) {
+ op := &request.Operation{
+ Name: opDownloadDefaultKeyPair,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &DownloadDefaultKeyPairInput{}
+ }
+
+ output = &DownloadDefaultKeyPairOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// DownloadDefaultKeyPair API operation for Amazon Lightsail.
+//
+// Downloads the default SSH key pair from the user's account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation DownloadDefaultKeyPair for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DownloadDefaultKeyPair
+func (c *Lightsail) DownloadDefaultKeyPair(input *DownloadDefaultKeyPairInput) (*DownloadDefaultKeyPairOutput, error) {
+ req, out := c.DownloadDefaultKeyPairRequest(input)
+ return out, req.Send()
+}
+
+// DownloadDefaultKeyPairWithContext is the same as DownloadDefaultKeyPair with the addition of
+// the ability to pass a context and additional request options.
+//
+// See DownloadDefaultKeyPair for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) DownloadDefaultKeyPairWithContext(ctx aws.Context, input *DownloadDefaultKeyPairInput, opts ...request.Option) (*DownloadDefaultKeyPairOutput, error) {
+ req, out := c.DownloadDefaultKeyPairRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetActiveNames = "GetActiveNames"
+
+// GetActiveNamesRequest generates a "aws/request.Request" representing the
+// client's request for the GetActiveNames operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetActiveNames for more information on using the GetActiveNames
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetActiveNamesRequest method.
+// req, resp := client.GetActiveNamesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetActiveNames
+func (c *Lightsail) GetActiveNamesRequest(input *GetActiveNamesInput) (req *request.Request, output *GetActiveNamesOutput) {
+ op := &request.Operation{
+ Name: opGetActiveNames,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetActiveNamesInput{}
+ }
+
+ output = &GetActiveNamesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetActiveNames API operation for Amazon Lightsail.
+//
+// Returns the names of all active (not deleted) resources.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetActiveNames for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetActiveNames
+func (c *Lightsail) GetActiveNames(input *GetActiveNamesInput) (*GetActiveNamesOutput, error) {
+ req, out := c.GetActiveNamesRequest(input)
+ return out, req.Send()
+}
+
+// GetActiveNamesWithContext is the same as GetActiveNames with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetActiveNames for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetActiveNamesWithContext(ctx aws.Context, input *GetActiveNamesInput, opts ...request.Option) (*GetActiveNamesOutput, error) {
+ req, out := c.GetActiveNamesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetBlueprints = "GetBlueprints"
+
+// GetBlueprintsRequest generates a "aws/request.Request" representing the
+// client's request for the GetBlueprints operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetBlueprints for more information on using the GetBlueprints
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetBlueprintsRequest method.
+// req, resp := client.GetBlueprintsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBlueprints
+func (c *Lightsail) GetBlueprintsRequest(input *GetBlueprintsInput) (req *request.Request, output *GetBlueprintsOutput) {
+ op := &request.Operation{
+ Name: opGetBlueprints,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetBlueprintsInput{}
+ }
+
+ output = &GetBlueprintsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetBlueprints API operation for Amazon Lightsail.
+//
+// Returns the list of available instance images, or blueprints. You can use
+// a blueprint to create a new virtual private server already running a specific
+// operating system, as well as a preinstalled app or development stack. The
+// software each instance is running depends on the blueprint image you choose.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetBlueprints for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBlueprints
+func (c *Lightsail) GetBlueprints(input *GetBlueprintsInput) (*GetBlueprintsOutput, error) {
+ req, out := c.GetBlueprintsRequest(input)
+ return out, req.Send()
+}
+
+// GetBlueprintsWithContext is the same as GetBlueprints with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetBlueprints for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetBlueprintsWithContext(ctx aws.Context, input *GetBlueprintsInput, opts ...request.Option) (*GetBlueprintsOutput, error) {
+ req, out := c.GetBlueprintsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetBundles = "GetBundles"
+
+// GetBundlesRequest generates a "aws/request.Request" representing the
+// client's request for the GetBundles operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetBundles for more information on using the GetBundles
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetBundlesRequest method.
+// req, resp := client.GetBundlesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBundles
+func (c *Lightsail) GetBundlesRequest(input *GetBundlesInput) (req *request.Request, output *GetBundlesOutput) {
+ op := &request.Operation{
+ Name: opGetBundles,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetBundlesInput{}
+ }
+
+ output = &GetBundlesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetBundles API operation for Amazon Lightsail.
+//
+// Returns the list of bundles that are available for purchase. A bundle describes
+// the specs for your virtual private server (or instance).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetBundles for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetBundles
+func (c *Lightsail) GetBundles(input *GetBundlesInput) (*GetBundlesOutput, error) {
+ req, out := c.GetBundlesRequest(input)
+ return out, req.Send()
+}
+
+// GetBundlesWithContext is the same as GetBundles with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetBundles for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetBundlesWithContext(ctx aws.Context, input *GetBundlesInput, opts ...request.Option) (*GetBundlesOutput, error) {
+ req, out := c.GetBundlesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDisk = "GetDisk"
+
+// GetDiskRequest generates a "aws/request.Request" representing the
+// client's request for the GetDisk operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDisk for more information on using the GetDisk
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDiskRequest method.
+// req, resp := client.GetDiskRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDisk
+func (c *Lightsail) GetDiskRequest(input *GetDiskInput) (req *request.Request, output *GetDiskOutput) {
+ op := &request.Operation{
+ Name: opGetDisk,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDiskInput{}
+ }
+
+ output = &GetDiskOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDisk API operation for Amazon Lightsail.
+//
+// Returns information about a specific block storage disk.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDisk for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDisk
+func (c *Lightsail) GetDisk(input *GetDiskInput) (*GetDiskOutput, error) {
+ req, out := c.GetDiskRequest(input)
+ return out, req.Send()
+}
+
+// GetDiskWithContext is the same as GetDisk with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDisk for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDiskWithContext(ctx aws.Context, input *GetDiskInput, opts ...request.Option) (*GetDiskOutput, error) {
+ req, out := c.GetDiskRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDiskSnapshot = "GetDiskSnapshot"
+
+// GetDiskSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the GetDiskSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDiskSnapshot for more information on using the GetDiskSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDiskSnapshotRequest method.
+// req, resp := client.GetDiskSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDiskSnapshot
+func (c *Lightsail) GetDiskSnapshotRequest(input *GetDiskSnapshotInput) (req *request.Request, output *GetDiskSnapshotOutput) {
+ op := &request.Operation{
+ Name: opGetDiskSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDiskSnapshotInput{}
+ }
+
+ output = &GetDiskSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDiskSnapshot API operation for Amazon Lightsail.
+//
+// Returns information about a specific block storage disk snapshot.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDiskSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDiskSnapshot
+func (c *Lightsail) GetDiskSnapshot(input *GetDiskSnapshotInput) (*GetDiskSnapshotOutput, error) {
+ req, out := c.GetDiskSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// GetDiskSnapshotWithContext is the same as GetDiskSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDiskSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDiskSnapshotWithContext(ctx aws.Context, input *GetDiskSnapshotInput, opts ...request.Option) (*GetDiskSnapshotOutput, error) {
+ req, out := c.GetDiskSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDiskSnapshots = "GetDiskSnapshots"
+
+// GetDiskSnapshotsRequest generates a "aws/request.Request" representing the
+// client's request for the GetDiskSnapshots operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDiskSnapshots for more information on using the GetDiskSnapshots
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDiskSnapshotsRequest method.
+// req, resp := client.GetDiskSnapshotsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDiskSnapshots
+func (c *Lightsail) GetDiskSnapshotsRequest(input *GetDiskSnapshotsInput) (req *request.Request, output *GetDiskSnapshotsOutput) {
+ op := &request.Operation{
+ Name: opGetDiskSnapshots,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDiskSnapshotsInput{}
+ }
+
+ output = &GetDiskSnapshotsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDiskSnapshots API operation for Amazon Lightsail.
+//
+// Returns information about all block storage disk snapshots in your AWS account
+// and region.
+//
+// If you are describing a long list of disk snapshots, you can paginate the
+// output to make the list more manageable. You can use the pageToken and nextPageToken
+// values to retrieve the next items in the list.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDiskSnapshots for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDiskSnapshots
+func (c *Lightsail) GetDiskSnapshots(input *GetDiskSnapshotsInput) (*GetDiskSnapshotsOutput, error) {
+ req, out := c.GetDiskSnapshotsRequest(input)
+ return out, req.Send()
+}
+
+// GetDiskSnapshotsWithContext is the same as GetDiskSnapshots with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDiskSnapshots for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDiskSnapshotsWithContext(ctx aws.Context, input *GetDiskSnapshotsInput, opts ...request.Option) (*GetDiskSnapshotsOutput, error) {
+ req, out := c.GetDiskSnapshotsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDisks = "GetDisks"
+
+// GetDisksRequest generates a "aws/request.Request" representing the
+// client's request for the GetDisks operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDisks for more information on using the GetDisks
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDisksRequest method.
+// req, resp := client.GetDisksRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDisks
+func (c *Lightsail) GetDisksRequest(input *GetDisksInput) (req *request.Request, output *GetDisksOutput) {
+ op := &request.Operation{
+ Name: opGetDisks,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDisksInput{}
+ }
+
+ output = &GetDisksOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDisks API operation for Amazon Lightsail.
+//
+// Returns information about all block storage disks in your AWS account and
+// region.
+//
+// If you are describing a long list of disks, you can paginate the output to
+// make the list more manageable. You can use the pageToken and nextPageToken
+// values to retrieve the next items in the list.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDisks for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDisks
+func (c *Lightsail) GetDisks(input *GetDisksInput) (*GetDisksOutput, error) {
+ req, out := c.GetDisksRequest(input)
+ return out, req.Send()
+}
+
+// GetDisksWithContext is the same as GetDisks with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDisks for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDisksWithContext(ctx aws.Context, input *GetDisksInput, opts ...request.Option) (*GetDisksOutput, error) {
+ req, out := c.GetDisksRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDomain = "GetDomain"
+
+// GetDomainRequest generates a "aws/request.Request" representing the
+// client's request for the GetDomain operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDomain for more information on using the GetDomain
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDomainRequest method.
+// req, resp := client.GetDomainRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomain
+func (c *Lightsail) GetDomainRequest(input *GetDomainInput) (req *request.Request, output *GetDomainOutput) {
+ op := &request.Operation{
+ Name: opGetDomain,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDomainInput{}
+ }
+
+ output = &GetDomainOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDomain API operation for Amazon Lightsail.
+//
+// Returns information about a specific domain recordset.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDomain for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomain
+func (c *Lightsail) GetDomain(input *GetDomainInput) (*GetDomainOutput, error) {
+ req, out := c.GetDomainRequest(input)
+ return out, req.Send()
+}
+
+// GetDomainWithContext is the same as GetDomain with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDomain for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDomainWithContext(ctx aws.Context, input *GetDomainInput, opts ...request.Option) (*GetDomainOutput, error) {
+ req, out := c.GetDomainRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetDomains = "GetDomains"
+
+// GetDomainsRequest generates a "aws/request.Request" representing the
+// client's request for the GetDomains operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetDomains for more information on using the GetDomains
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetDomainsRequest method.
+// req, resp := client.GetDomainsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomains
+func (c *Lightsail) GetDomainsRequest(input *GetDomainsInput) (req *request.Request, output *GetDomainsOutput) {
+ op := &request.Operation{
+ Name: opGetDomains,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetDomainsInput{}
+ }
+
+ output = &GetDomainsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetDomains API operation for Amazon Lightsail.
+//
+// Returns a list of all domains in the user's account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetDomains for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetDomains
+func (c *Lightsail) GetDomains(input *GetDomainsInput) (*GetDomainsOutput, error) {
+ req, out := c.GetDomainsRequest(input)
+ return out, req.Send()
+}
+
+// GetDomainsWithContext is the same as GetDomains with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetDomains for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetDomainsWithContext(ctx aws.Context, input *GetDomainsInput, opts ...request.Option) (*GetDomainsOutput, error) {
+ req, out := c.GetDomainsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstance = "GetInstance"
+
+// GetInstanceRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstance operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstance for more information on using the GetInstance
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceRequest method.
+// req, resp := client.GetInstanceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstance
+func (c *Lightsail) GetInstanceRequest(input *GetInstanceInput) (req *request.Request, output *GetInstanceOutput) {
+ op := &request.Operation{
+ Name: opGetInstance,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceInput{}
+ }
+
+ output = &GetInstanceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstance API operation for Amazon Lightsail.
+//
+// Returns information about a specific Amazon Lightsail instance, which is
+// a virtual private server.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstance for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstance
+func (c *Lightsail) GetInstance(input *GetInstanceInput) (*GetInstanceOutput, error) {
+ req, out := c.GetInstanceRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceWithContext is the same as GetInstance with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstance for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceWithContext(ctx aws.Context, input *GetInstanceInput, opts ...request.Option) (*GetInstanceOutput, error) {
+ req, out := c.GetInstanceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstanceAccessDetails = "GetInstanceAccessDetails"
+
+// GetInstanceAccessDetailsRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstanceAccessDetails operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstanceAccessDetails for more information on using the GetInstanceAccessDetails
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceAccessDetailsRequest method.
+// req, resp := client.GetInstanceAccessDetailsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceAccessDetails
+func (c *Lightsail) GetInstanceAccessDetailsRequest(input *GetInstanceAccessDetailsInput) (req *request.Request, output *GetInstanceAccessDetailsOutput) {
+ op := &request.Operation{
+ Name: opGetInstanceAccessDetails,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceAccessDetailsInput{}
+ }
+
+ output = &GetInstanceAccessDetailsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstanceAccessDetails API operation for Amazon Lightsail.
+//
+// Returns temporary SSH keys you can use to connect to a specific virtual private
+// server, or instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstanceAccessDetails for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceAccessDetails
+func (c *Lightsail) GetInstanceAccessDetails(input *GetInstanceAccessDetailsInput) (*GetInstanceAccessDetailsOutput, error) {
+ req, out := c.GetInstanceAccessDetailsRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceAccessDetailsWithContext is the same as GetInstanceAccessDetails with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstanceAccessDetails for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceAccessDetailsWithContext(ctx aws.Context, input *GetInstanceAccessDetailsInput, opts ...request.Option) (*GetInstanceAccessDetailsOutput, error) {
+ req, out := c.GetInstanceAccessDetailsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstanceMetricData = "GetInstanceMetricData"
+
+// GetInstanceMetricDataRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstanceMetricData operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstanceMetricData for more information on using the GetInstanceMetricData
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceMetricDataRequest method.
+// req, resp := client.GetInstanceMetricDataRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceMetricData
+func (c *Lightsail) GetInstanceMetricDataRequest(input *GetInstanceMetricDataInput) (req *request.Request, output *GetInstanceMetricDataOutput) {
+ op := &request.Operation{
+ Name: opGetInstanceMetricData,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceMetricDataInput{}
+ }
+
+ output = &GetInstanceMetricDataOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstanceMetricData API operation for Amazon Lightsail.
+//
+// Returns the data points for the specified Amazon Lightsail instance metric,
+// given an instance name.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstanceMetricData for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceMetricData
+func (c *Lightsail) GetInstanceMetricData(input *GetInstanceMetricDataInput) (*GetInstanceMetricDataOutput, error) {
+ req, out := c.GetInstanceMetricDataRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceMetricDataWithContext is the same as GetInstanceMetricData with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstanceMetricData for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceMetricDataWithContext(ctx aws.Context, input *GetInstanceMetricDataInput, opts ...request.Option) (*GetInstanceMetricDataOutput, error) {
+ req, out := c.GetInstanceMetricDataRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstancePortStates = "GetInstancePortStates"
+
+// GetInstancePortStatesRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstancePortStates operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstancePortStates for more information on using the GetInstancePortStates
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstancePortStatesRequest method.
+// req, resp := client.GetInstancePortStatesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstancePortStates
+func (c *Lightsail) GetInstancePortStatesRequest(input *GetInstancePortStatesInput) (req *request.Request, output *GetInstancePortStatesOutput) {
+ op := &request.Operation{
+ Name: opGetInstancePortStates,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstancePortStatesInput{}
+ }
+
+ output = &GetInstancePortStatesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstancePortStates API operation for Amazon Lightsail.
+//
+// Returns the port states for a specific virtual private server, or instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstancePortStates for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstancePortStates
+func (c *Lightsail) GetInstancePortStates(input *GetInstancePortStatesInput) (*GetInstancePortStatesOutput, error) {
+ req, out := c.GetInstancePortStatesRequest(input)
+ return out, req.Send()
+}
+
+// GetInstancePortStatesWithContext is the same as GetInstancePortStates with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstancePortStates for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstancePortStatesWithContext(ctx aws.Context, input *GetInstancePortStatesInput, opts ...request.Option) (*GetInstancePortStatesOutput, error) {
+ req, out := c.GetInstancePortStatesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstanceSnapshot = "GetInstanceSnapshot"
+
+// GetInstanceSnapshotRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstanceSnapshot operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstanceSnapshot for more information on using the GetInstanceSnapshot
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceSnapshotRequest method.
+// req, resp := client.GetInstanceSnapshotRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshot
+func (c *Lightsail) GetInstanceSnapshotRequest(input *GetInstanceSnapshotInput) (req *request.Request, output *GetInstanceSnapshotOutput) {
+ op := &request.Operation{
+ Name: opGetInstanceSnapshot,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceSnapshotInput{}
+ }
+
+ output = &GetInstanceSnapshotOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstanceSnapshot API operation for Amazon Lightsail.
+//
+// Returns information about a specific instance snapshot.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstanceSnapshot for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshot
+func (c *Lightsail) GetInstanceSnapshot(input *GetInstanceSnapshotInput) (*GetInstanceSnapshotOutput, error) {
+ req, out := c.GetInstanceSnapshotRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceSnapshotWithContext is the same as GetInstanceSnapshot with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstanceSnapshot for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceSnapshotWithContext(ctx aws.Context, input *GetInstanceSnapshotInput, opts ...request.Option) (*GetInstanceSnapshotOutput, error) {
+ req, out := c.GetInstanceSnapshotRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstanceSnapshots = "GetInstanceSnapshots"
+
+// GetInstanceSnapshotsRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstanceSnapshots operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstanceSnapshots for more information on using the GetInstanceSnapshots
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceSnapshotsRequest method.
+// req, resp := client.GetInstanceSnapshotsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshots
+func (c *Lightsail) GetInstanceSnapshotsRequest(input *GetInstanceSnapshotsInput) (req *request.Request, output *GetInstanceSnapshotsOutput) {
+ op := &request.Operation{
+ Name: opGetInstanceSnapshots,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceSnapshotsInput{}
+ }
+
+ output = &GetInstanceSnapshotsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstanceSnapshots API operation for Amazon Lightsail.
+//
+// Returns all instance snapshots for the user's account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstanceSnapshots for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceSnapshots
+func (c *Lightsail) GetInstanceSnapshots(input *GetInstanceSnapshotsInput) (*GetInstanceSnapshotsOutput, error) {
+ req, out := c.GetInstanceSnapshotsRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceSnapshotsWithContext is the same as GetInstanceSnapshots with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstanceSnapshots for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceSnapshotsWithContext(ctx aws.Context, input *GetInstanceSnapshotsInput, opts ...request.Option) (*GetInstanceSnapshotsOutput, error) {
+ req, out := c.GetInstanceSnapshotsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstanceState = "GetInstanceState"
+
+// GetInstanceStateRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstanceState operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstanceState for more information on using the GetInstanceState
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstanceStateRequest method.
+// req, resp := client.GetInstanceStateRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceState
+func (c *Lightsail) GetInstanceStateRequest(input *GetInstanceStateInput) (req *request.Request, output *GetInstanceStateOutput) {
+ op := &request.Operation{
+ Name: opGetInstanceState,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstanceStateInput{}
+ }
+
+ output = &GetInstanceStateOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstanceState API operation for Amazon Lightsail.
+//
+// Returns the state of a specific instance. Works on one instance at a time.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstanceState for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstanceState
+func (c *Lightsail) GetInstanceState(input *GetInstanceStateInput) (*GetInstanceStateOutput, error) {
+ req, out := c.GetInstanceStateRequest(input)
+ return out, req.Send()
+}
+
+// GetInstanceStateWithContext is the same as GetInstanceState with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstanceState for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstanceStateWithContext(ctx aws.Context, input *GetInstanceStateInput, opts ...request.Option) (*GetInstanceStateOutput, error) {
+ req, out := c.GetInstanceStateRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetInstances = "GetInstances"
+
+// GetInstancesRequest generates a "aws/request.Request" representing the
+// client's request for the GetInstances operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetInstances for more information on using the GetInstances
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetInstancesRequest method.
+// req, resp := client.GetInstancesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstances
+func (c *Lightsail) GetInstancesRequest(input *GetInstancesInput) (req *request.Request, output *GetInstancesOutput) {
+ op := &request.Operation{
+ Name: opGetInstances,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetInstancesInput{}
+ }
+
+ output = &GetInstancesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetInstances API operation for Amazon Lightsail.
+//
+// Returns information about all Amazon Lightsail virtual private servers, or
+// instances.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetInstances for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetInstances
+func (c *Lightsail) GetInstances(input *GetInstancesInput) (*GetInstancesOutput, error) {
+ req, out := c.GetInstancesRequest(input)
+ return out, req.Send()
+}
+
+// GetInstancesWithContext is the same as GetInstances with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetInstances for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetInstancesWithContext(ctx aws.Context, input *GetInstancesInput, opts ...request.Option) (*GetInstancesOutput, error) {
+ req, out := c.GetInstancesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetKeyPair = "GetKeyPair"
+
+// GetKeyPairRequest generates a "aws/request.Request" representing the
+// client's request for the GetKeyPair operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetKeyPair for more information on using the GetKeyPair
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetKeyPairRequest method.
+// req, resp := client.GetKeyPairRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPair
+func (c *Lightsail) GetKeyPairRequest(input *GetKeyPairInput) (req *request.Request, output *GetKeyPairOutput) {
+ op := &request.Operation{
+ Name: opGetKeyPair,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetKeyPairInput{}
+ }
+
+ output = &GetKeyPairOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetKeyPair API operation for Amazon Lightsail.
+//
+// Returns information about a specific key pair.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetKeyPair for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPair
+func (c *Lightsail) GetKeyPair(input *GetKeyPairInput) (*GetKeyPairOutput, error) {
+ req, out := c.GetKeyPairRequest(input)
+ return out, req.Send()
+}
+
+// GetKeyPairWithContext is the same as GetKeyPair with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetKeyPair for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetKeyPairWithContext(ctx aws.Context, input *GetKeyPairInput, opts ...request.Option) (*GetKeyPairOutput, error) {
+ req, out := c.GetKeyPairRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetKeyPairs = "GetKeyPairs"
+
+// GetKeyPairsRequest generates a "aws/request.Request" representing the
+// client's request for the GetKeyPairs operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetKeyPairs for more information on using the GetKeyPairs
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetKeyPairsRequest method.
+// req, resp := client.GetKeyPairsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPairs
+func (c *Lightsail) GetKeyPairsRequest(input *GetKeyPairsInput) (req *request.Request, output *GetKeyPairsOutput) {
+ op := &request.Operation{
+ Name: opGetKeyPairs,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetKeyPairsInput{}
+ }
+
+ output = &GetKeyPairsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetKeyPairs API operation for Amazon Lightsail.
+//
+// Returns information about all key pairs in the user's account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetKeyPairs for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetKeyPairs
+func (c *Lightsail) GetKeyPairs(input *GetKeyPairsInput) (*GetKeyPairsOutput, error) {
+ req, out := c.GetKeyPairsRequest(input)
+ return out, req.Send()
+}
+
+// GetKeyPairsWithContext is the same as GetKeyPairs with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetKeyPairs for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetKeyPairsWithContext(ctx aws.Context, input *GetKeyPairsInput, opts ...request.Option) (*GetKeyPairsOutput, error) {
+ req, out := c.GetKeyPairsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetLoadBalancer = "GetLoadBalancer"
+
+// GetLoadBalancerRequest generates a "aws/request.Request" representing the
+// client's request for the GetLoadBalancer operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetLoadBalancer for more information on using the GetLoadBalancer
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetLoadBalancerRequest method.
+// req, resp := client.GetLoadBalancerRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancer
+func (c *Lightsail) GetLoadBalancerRequest(input *GetLoadBalancerInput) (req *request.Request, output *GetLoadBalancerOutput) {
+ op := &request.Operation{
+ Name: opGetLoadBalancer,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetLoadBalancerInput{}
+ }
+
+ output = &GetLoadBalancerOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetLoadBalancer API operation for Amazon Lightsail.
+//
+// Returns information about the specified Lightsail load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetLoadBalancer for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancer
+func (c *Lightsail) GetLoadBalancer(input *GetLoadBalancerInput) (*GetLoadBalancerOutput, error) {
+ req, out := c.GetLoadBalancerRequest(input)
+ return out, req.Send()
+}
+
+// GetLoadBalancerWithContext is the same as GetLoadBalancer with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetLoadBalancer for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetLoadBalancerWithContext(ctx aws.Context, input *GetLoadBalancerInput, opts ...request.Option) (*GetLoadBalancerOutput, error) {
+ req, out := c.GetLoadBalancerRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetLoadBalancerMetricData = "GetLoadBalancerMetricData"
+
+// GetLoadBalancerMetricDataRequest generates a "aws/request.Request" representing the
+// client's request for the GetLoadBalancerMetricData operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetLoadBalancerMetricData for more information on using the GetLoadBalancerMetricData
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetLoadBalancerMetricDataRequest method.
+// req, resp := client.GetLoadBalancerMetricDataRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancerMetricData
+func (c *Lightsail) GetLoadBalancerMetricDataRequest(input *GetLoadBalancerMetricDataInput) (req *request.Request, output *GetLoadBalancerMetricDataOutput) {
+ op := &request.Operation{
+ Name: opGetLoadBalancerMetricData,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetLoadBalancerMetricDataInput{}
+ }
+
+ output = &GetLoadBalancerMetricDataOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetLoadBalancerMetricData API operation for Amazon Lightsail.
+//
+// Returns information about health metrics for your Lightsail load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetLoadBalancerMetricData for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancerMetricData
+func (c *Lightsail) GetLoadBalancerMetricData(input *GetLoadBalancerMetricDataInput) (*GetLoadBalancerMetricDataOutput, error) {
+ req, out := c.GetLoadBalancerMetricDataRequest(input)
+ return out, req.Send()
+}
+
+// GetLoadBalancerMetricDataWithContext is the same as GetLoadBalancerMetricData with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetLoadBalancerMetricData for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetLoadBalancerMetricDataWithContext(ctx aws.Context, input *GetLoadBalancerMetricDataInput, opts ...request.Option) (*GetLoadBalancerMetricDataOutput, error) {
+ req, out := c.GetLoadBalancerMetricDataRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetLoadBalancerTlsCertificates = "GetLoadBalancerTlsCertificates"
+
+// GetLoadBalancerTlsCertificatesRequest generates a "aws/request.Request" representing the
+// client's request for the GetLoadBalancerTlsCertificates operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetLoadBalancerTlsCertificates for more information on using the GetLoadBalancerTlsCertificates
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetLoadBalancerTlsCertificatesRequest method.
+// req, resp := client.GetLoadBalancerTlsCertificatesRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancerTlsCertificates
+func (c *Lightsail) GetLoadBalancerTlsCertificatesRequest(input *GetLoadBalancerTlsCertificatesInput) (req *request.Request, output *GetLoadBalancerTlsCertificatesOutput) {
+ op := &request.Operation{
+ Name: opGetLoadBalancerTlsCertificates,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetLoadBalancerTlsCertificatesInput{}
+ }
+
+ output = &GetLoadBalancerTlsCertificatesOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetLoadBalancerTlsCertificates API operation for Amazon Lightsail.
+//
+// Returns information about the TLS certificates that are associated with the
+// specified Lightsail load balancer.
+//
+// TLS is just an updated, more secure version of Secure Socket Layer (SSL).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetLoadBalancerTlsCertificates for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancerTlsCertificates
+func (c *Lightsail) GetLoadBalancerTlsCertificates(input *GetLoadBalancerTlsCertificatesInput) (*GetLoadBalancerTlsCertificatesOutput, error) {
+ req, out := c.GetLoadBalancerTlsCertificatesRequest(input)
+ return out, req.Send()
+}
+
+// GetLoadBalancerTlsCertificatesWithContext is the same as GetLoadBalancerTlsCertificates with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetLoadBalancerTlsCertificates for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetLoadBalancerTlsCertificatesWithContext(ctx aws.Context, input *GetLoadBalancerTlsCertificatesInput, opts ...request.Option) (*GetLoadBalancerTlsCertificatesOutput, error) {
+ req, out := c.GetLoadBalancerTlsCertificatesRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetLoadBalancers = "GetLoadBalancers"
+
+// GetLoadBalancersRequest generates a "aws/request.Request" representing the
+// client's request for the GetLoadBalancers operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetLoadBalancers for more information on using the GetLoadBalancers
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetLoadBalancersRequest method.
+// req, resp := client.GetLoadBalancersRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancers
+func (c *Lightsail) GetLoadBalancersRequest(input *GetLoadBalancersInput) (req *request.Request, output *GetLoadBalancersOutput) {
+ op := &request.Operation{
+ Name: opGetLoadBalancers,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetLoadBalancersInput{}
+ }
+
+ output = &GetLoadBalancersOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetLoadBalancers API operation for Amazon Lightsail.
+//
+// Returns information about all load balancers in an account.
+//
+// If you are describing a long list of load balancers, you can paginate the
+// output to make the list more manageable. You can use the pageToken and nextPageToken
+// values to retrieve the next items in the list.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetLoadBalancers for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetLoadBalancers
+func (c *Lightsail) GetLoadBalancers(input *GetLoadBalancersInput) (*GetLoadBalancersOutput, error) {
+ req, out := c.GetLoadBalancersRequest(input)
+ return out, req.Send()
+}
+
+// GetLoadBalancersWithContext is the same as GetLoadBalancers with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetLoadBalancers for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetLoadBalancersWithContext(ctx aws.Context, input *GetLoadBalancersInput, opts ...request.Option) (*GetLoadBalancersOutput, error) {
+ req, out := c.GetLoadBalancersRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetOperation = "GetOperation"
+
+// GetOperationRequest generates a "aws/request.Request" representing the
+// client's request for the GetOperation operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetOperation for more information on using the GetOperation
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetOperationRequest method.
+// req, resp := client.GetOperationRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperation
+func (c *Lightsail) GetOperationRequest(input *GetOperationInput) (req *request.Request, output *GetOperationOutput) {
+ op := &request.Operation{
+ Name: opGetOperation,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetOperationInput{}
+ }
+
+ output = &GetOperationOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetOperation API operation for Amazon Lightsail.
+//
+// Returns information about a specific operation. Operations include events
+// such as when you create an instance, allocate a static IP, attach a static
+// IP, and so on.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetOperation for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperation
+func (c *Lightsail) GetOperation(input *GetOperationInput) (*GetOperationOutput, error) {
+ req, out := c.GetOperationRequest(input)
+ return out, req.Send()
+}
+
+// GetOperationWithContext is the same as GetOperation with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetOperation for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetOperationWithContext(ctx aws.Context, input *GetOperationInput, opts ...request.Option) (*GetOperationOutput, error) {
+ req, out := c.GetOperationRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetOperations = "GetOperations"
+
+// GetOperationsRequest generates a "aws/request.Request" representing the
+// client's request for the GetOperations operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetOperations for more information on using the GetOperations
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetOperationsRequest method.
+// req, resp := client.GetOperationsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperations
+func (c *Lightsail) GetOperationsRequest(input *GetOperationsInput) (req *request.Request, output *GetOperationsOutput) {
+ op := &request.Operation{
+ Name: opGetOperations,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetOperationsInput{}
+ }
+
+ output = &GetOperationsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetOperations API operation for Amazon Lightsail.
+//
+// Returns information about all operations.
+//
+// Results are returned from oldest to newest, up to a maximum of 200. Results
+// can be paged by making each subsequent call to GetOperations use the maximum
+// (last) statusChangedAt value from the previous request.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetOperations for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperations
+func (c *Lightsail) GetOperations(input *GetOperationsInput) (*GetOperationsOutput, error) {
+ req, out := c.GetOperationsRequest(input)
+ return out, req.Send()
+}
+
+// GetOperationsWithContext is the same as GetOperations with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetOperations for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetOperationsWithContext(ctx aws.Context, input *GetOperationsInput, opts ...request.Option) (*GetOperationsOutput, error) {
+ req, out := c.GetOperationsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetOperationsForResource = "GetOperationsForResource"
+
+// GetOperationsForResourceRequest generates a "aws/request.Request" representing the
+// client's request for the GetOperationsForResource operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetOperationsForResource for more information on using the GetOperationsForResource
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetOperationsForResourceRequest method.
+// req, resp := client.GetOperationsForResourceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperationsForResource
+func (c *Lightsail) GetOperationsForResourceRequest(input *GetOperationsForResourceInput) (req *request.Request, output *GetOperationsForResourceOutput) {
+ op := &request.Operation{
+ Name: opGetOperationsForResource,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetOperationsForResourceInput{}
+ }
+
+ output = &GetOperationsForResourceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetOperationsForResource API operation for Amazon Lightsail.
+//
+// Gets operations for a specific resource (e.g., an instance or a static IP).
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetOperationsForResource for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetOperationsForResource
+func (c *Lightsail) GetOperationsForResource(input *GetOperationsForResourceInput) (*GetOperationsForResourceOutput, error) {
+ req, out := c.GetOperationsForResourceRequest(input)
+ return out, req.Send()
+}
+
+// GetOperationsForResourceWithContext is the same as GetOperationsForResource with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetOperationsForResource for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetOperationsForResourceWithContext(ctx aws.Context, input *GetOperationsForResourceInput, opts ...request.Option) (*GetOperationsForResourceOutput, error) {
+ req, out := c.GetOperationsForResourceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetRegions = "GetRegions"
+
+// GetRegionsRequest generates a "aws/request.Request" representing the
+// client's request for the GetRegions operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetRegions for more information on using the GetRegions
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetRegionsRequest method.
+// req, resp := client.GetRegionsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRegions
+func (c *Lightsail) GetRegionsRequest(input *GetRegionsInput) (req *request.Request, output *GetRegionsOutput) {
+ op := &request.Operation{
+ Name: opGetRegions,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetRegionsInput{}
+ }
+
+ output = &GetRegionsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetRegions API operation for Amazon Lightsail.
+//
+// Returns a list of all valid regions for Amazon Lightsail. Use the include
+// availability zones parameter to also return the availability zones in a region.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetRegions for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRegions
+func (c *Lightsail) GetRegions(input *GetRegionsInput) (*GetRegionsOutput, error) {
+ req, out := c.GetRegionsRequest(input)
+ return out, req.Send()
+}
+
+// GetRegionsWithContext is the same as GetRegions with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetRegions for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetRegionsWithContext(ctx aws.Context, input *GetRegionsInput, opts ...request.Option) (*GetRegionsOutput, error) {
+ req, out := c.GetRegionsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetStaticIp = "GetStaticIp"
+
+// GetStaticIpRequest generates a "aws/request.Request" representing the
+// client's request for the GetStaticIp operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetStaticIp for more information on using the GetStaticIp
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetStaticIpRequest method.
+// req, resp := client.GetStaticIpRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIp
+func (c *Lightsail) GetStaticIpRequest(input *GetStaticIpInput) (req *request.Request, output *GetStaticIpOutput) {
+ op := &request.Operation{
+ Name: opGetStaticIp,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetStaticIpInput{}
+ }
+
+ output = &GetStaticIpOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetStaticIp API operation for Amazon Lightsail.
+//
+// Returns information about a specific static IP.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetStaticIp for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIp
+func (c *Lightsail) GetStaticIp(input *GetStaticIpInput) (*GetStaticIpOutput, error) {
+ req, out := c.GetStaticIpRequest(input)
+ return out, req.Send()
+}
+
+// GetStaticIpWithContext is the same as GetStaticIp with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetStaticIp for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetStaticIpWithContext(ctx aws.Context, input *GetStaticIpInput, opts ...request.Option) (*GetStaticIpOutput, error) {
+ req, out := c.GetStaticIpRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opGetStaticIps = "GetStaticIps"
+
+// GetStaticIpsRequest generates a "aws/request.Request" representing the
+// client's request for the GetStaticIps operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See GetStaticIps for more information on using the GetStaticIps
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the GetStaticIpsRequest method.
+// req, resp := client.GetStaticIpsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIps
+func (c *Lightsail) GetStaticIpsRequest(input *GetStaticIpsInput) (req *request.Request, output *GetStaticIpsOutput) {
+ op := &request.Operation{
+ Name: opGetStaticIps,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &GetStaticIpsInput{}
+ }
+
+ output = &GetStaticIpsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// GetStaticIps API operation for Amazon Lightsail.
+//
+// Returns information about all static IPs in the user's account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation GetStaticIps for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetStaticIps
+func (c *Lightsail) GetStaticIps(input *GetStaticIpsInput) (*GetStaticIpsOutput, error) {
+ req, out := c.GetStaticIpsRequest(input)
+ return out, req.Send()
+}
+
+// GetStaticIpsWithContext is the same as GetStaticIps with the addition of
+// the ability to pass a context and additional request options.
+//
+// See GetStaticIps for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) GetStaticIpsWithContext(ctx aws.Context, input *GetStaticIpsInput, opts ...request.Option) (*GetStaticIpsOutput, error) {
+ req, out := c.GetStaticIpsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opImportKeyPair = "ImportKeyPair"
+
+// ImportKeyPairRequest generates a "aws/request.Request" representing the
+// client's request for the ImportKeyPair operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See ImportKeyPair for more information on using the ImportKeyPair
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the ImportKeyPairRequest method.
+// req, resp := client.ImportKeyPairRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ImportKeyPair
+func (c *Lightsail) ImportKeyPairRequest(input *ImportKeyPairInput) (req *request.Request, output *ImportKeyPairOutput) {
+ op := &request.Operation{
+ Name: opImportKeyPair,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &ImportKeyPairInput{}
+ }
+
+ output = &ImportKeyPairOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// ImportKeyPair API operation for Amazon Lightsail.
+//
+// Imports a public SSH key from a specific key pair.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation ImportKeyPair for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ImportKeyPair
+func (c *Lightsail) ImportKeyPair(input *ImportKeyPairInput) (*ImportKeyPairOutput, error) {
+ req, out := c.ImportKeyPairRequest(input)
+ return out, req.Send()
+}
+
+// ImportKeyPairWithContext is the same as ImportKeyPair with the addition of
+// the ability to pass a context and additional request options.
+//
+// See ImportKeyPair for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) ImportKeyPairWithContext(ctx aws.Context, input *ImportKeyPairInput, opts ...request.Option) (*ImportKeyPairOutput, error) {
+ req, out := c.ImportKeyPairRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opIsVpcPeered = "IsVpcPeered"
+
+// IsVpcPeeredRequest generates a "aws/request.Request" representing the
+// client's request for the IsVpcPeered operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See IsVpcPeered for more information on using the IsVpcPeered
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the IsVpcPeeredRequest method.
+// req, resp := client.IsVpcPeeredRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/IsVpcPeered
+func (c *Lightsail) IsVpcPeeredRequest(input *IsVpcPeeredInput) (req *request.Request, output *IsVpcPeeredOutput) {
+ op := &request.Operation{
+ Name: opIsVpcPeered,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &IsVpcPeeredInput{}
+ }
+
+ output = &IsVpcPeeredOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// IsVpcPeered API operation for Amazon Lightsail.
+//
+// Returns a Boolean value indicating whether your Lightsail VPC is peered.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation IsVpcPeered for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/IsVpcPeered
+func (c *Lightsail) IsVpcPeered(input *IsVpcPeeredInput) (*IsVpcPeeredOutput, error) {
+ req, out := c.IsVpcPeeredRequest(input)
+ return out, req.Send()
+}
+
+// IsVpcPeeredWithContext is the same as IsVpcPeered with the addition of
+// the ability to pass a context and additional request options.
+//
+// See IsVpcPeered for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) IsVpcPeeredWithContext(ctx aws.Context, input *IsVpcPeeredInput, opts ...request.Option) (*IsVpcPeeredOutput, error) {
+ req, out := c.IsVpcPeeredRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opOpenInstancePublicPorts = "OpenInstancePublicPorts"
+
+// OpenInstancePublicPortsRequest generates a "aws/request.Request" representing the
+// client's request for the OpenInstancePublicPorts operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See OpenInstancePublicPorts for more information on using the OpenInstancePublicPorts
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the OpenInstancePublicPortsRequest method.
+// req, resp := client.OpenInstancePublicPortsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/OpenInstancePublicPorts
+func (c *Lightsail) OpenInstancePublicPortsRequest(input *OpenInstancePublicPortsInput) (req *request.Request, output *OpenInstancePublicPortsOutput) {
+ op := &request.Operation{
+ Name: opOpenInstancePublicPorts,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &OpenInstancePublicPortsInput{}
+ }
+
+ output = &OpenInstancePublicPortsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// OpenInstancePublicPorts API operation for Amazon Lightsail.
+//
+// Adds public ports to an Amazon Lightsail instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation OpenInstancePublicPorts for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/OpenInstancePublicPorts
+func (c *Lightsail) OpenInstancePublicPorts(input *OpenInstancePublicPortsInput) (*OpenInstancePublicPortsOutput, error) {
+ req, out := c.OpenInstancePublicPortsRequest(input)
+ return out, req.Send()
+}
+
+// OpenInstancePublicPortsWithContext is the same as OpenInstancePublicPorts with the addition of
+// the ability to pass a context and additional request options.
+//
+// See OpenInstancePublicPorts for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) OpenInstancePublicPortsWithContext(ctx aws.Context, input *OpenInstancePublicPortsInput, opts ...request.Option) (*OpenInstancePublicPortsOutput, error) {
+ req, out := c.OpenInstancePublicPortsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opPeerVpc = "PeerVpc"
+
+// PeerVpcRequest generates a "aws/request.Request" representing the
+// client's request for the PeerVpc operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See PeerVpc for more information on using the PeerVpc
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the PeerVpcRequest method.
+// req, resp := client.PeerVpcRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PeerVpc
+func (c *Lightsail) PeerVpcRequest(input *PeerVpcInput) (req *request.Request, output *PeerVpcOutput) {
+ op := &request.Operation{
+ Name: opPeerVpc,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &PeerVpcInput{}
+ }
+
+ output = &PeerVpcOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// PeerVpc API operation for Amazon Lightsail.
+//
+// Tries to peer the Lightsail VPC with the user's default VPC.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation PeerVpc for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PeerVpc
+func (c *Lightsail) PeerVpc(input *PeerVpcInput) (*PeerVpcOutput, error) {
+ req, out := c.PeerVpcRequest(input)
+ return out, req.Send()
+}
+
+// PeerVpcWithContext is the same as PeerVpc with the addition of
+// the ability to pass a context and additional request options.
+//
+// See PeerVpc for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) PeerVpcWithContext(ctx aws.Context, input *PeerVpcInput, opts ...request.Option) (*PeerVpcOutput, error) {
+ req, out := c.PeerVpcRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opPutInstancePublicPorts = "PutInstancePublicPorts"
+
+// PutInstancePublicPortsRequest generates a "aws/request.Request" representing the
+// client's request for the PutInstancePublicPorts operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See PutInstancePublicPorts for more information on using the PutInstancePublicPorts
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the PutInstancePublicPortsRequest method.
+// req, resp := client.PutInstancePublicPortsRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPorts
+func (c *Lightsail) PutInstancePublicPortsRequest(input *PutInstancePublicPortsInput) (req *request.Request, output *PutInstancePublicPortsOutput) {
+ op := &request.Operation{
+ Name: opPutInstancePublicPorts,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &PutInstancePublicPortsInput{}
+ }
+
+ output = &PutInstancePublicPortsOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// PutInstancePublicPorts API operation for Amazon Lightsail.
+//
+// Sets the specified open ports for an Amazon Lightsail instance, and closes
+// all ports for every protocol not included in the current request.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation PutInstancePublicPorts for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPorts
+func (c *Lightsail) PutInstancePublicPorts(input *PutInstancePublicPortsInput) (*PutInstancePublicPortsOutput, error) {
+ req, out := c.PutInstancePublicPortsRequest(input)
+ return out, req.Send()
+}
+
+// PutInstancePublicPortsWithContext is the same as PutInstancePublicPorts with the addition of
+// the ability to pass a context and additional request options.
+//
+// See PutInstancePublicPorts for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) PutInstancePublicPortsWithContext(ctx aws.Context, input *PutInstancePublicPortsInput, opts ...request.Option) (*PutInstancePublicPortsOutput, error) {
+ req, out := c.PutInstancePublicPortsRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opRebootInstance = "RebootInstance"
+
+// RebootInstanceRequest generates a "aws/request.Request" representing the
+// client's request for the RebootInstance operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See RebootInstance for more information on using the RebootInstance
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the RebootInstanceRequest method.
+// req, resp := client.RebootInstanceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootInstance
+func (c *Lightsail) RebootInstanceRequest(input *RebootInstanceInput) (req *request.Request, output *RebootInstanceOutput) {
+ op := &request.Operation{
+ Name: opRebootInstance,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &RebootInstanceInput{}
+ }
+
+ output = &RebootInstanceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// RebootInstance API operation for Amazon Lightsail.
+//
+// Restarts a specific instance. When your Amazon Lightsail instance is finished
+// rebooting, Lightsail assigns a new public IP address. To use the same IP
+// address after restarting, create a static IP address and attach it to the
+// instance.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation RebootInstance for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootInstance
+func (c *Lightsail) RebootInstance(input *RebootInstanceInput) (*RebootInstanceOutput, error) {
+ req, out := c.RebootInstanceRequest(input)
+ return out, req.Send()
+}
+
+// RebootInstanceWithContext is the same as RebootInstance with the addition of
+// the ability to pass a context and additional request options.
+//
+// See RebootInstance for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) RebootInstanceWithContext(ctx aws.Context, input *RebootInstanceInput, opts ...request.Option) (*RebootInstanceOutput, error) {
+ req, out := c.RebootInstanceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opReleaseStaticIp = "ReleaseStaticIp"
+
+// ReleaseStaticIpRequest generates a "aws/request.Request" representing the
+// client's request for the ReleaseStaticIp operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See ReleaseStaticIp for more information on using the ReleaseStaticIp
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the ReleaseStaticIpRequest method.
+// req, resp := client.ReleaseStaticIpRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ReleaseStaticIp
+func (c *Lightsail) ReleaseStaticIpRequest(input *ReleaseStaticIpInput) (req *request.Request, output *ReleaseStaticIpOutput) {
+ op := &request.Operation{
+ Name: opReleaseStaticIp,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &ReleaseStaticIpInput{}
+ }
+
+ output = &ReleaseStaticIpOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// ReleaseStaticIp API operation for Amazon Lightsail.
+//
+// Deletes a specific static IP from your account.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation ReleaseStaticIp for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ReleaseStaticIp
+func (c *Lightsail) ReleaseStaticIp(input *ReleaseStaticIpInput) (*ReleaseStaticIpOutput, error) {
+ req, out := c.ReleaseStaticIpRequest(input)
+ return out, req.Send()
+}
+
+// ReleaseStaticIpWithContext is the same as ReleaseStaticIp with the addition of
+// the ability to pass a context and additional request options.
+//
+// See ReleaseStaticIp for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) ReleaseStaticIpWithContext(ctx aws.Context, input *ReleaseStaticIpInput, opts ...request.Option) (*ReleaseStaticIpOutput, error) {
+ req, out := c.ReleaseStaticIpRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opStartInstance = "StartInstance"
+
+// StartInstanceRequest generates a "aws/request.Request" representing the
+// client's request for the StartInstance operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See StartInstance for more information on using the StartInstance
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the StartInstanceRequest method.
+// req, resp := client.StartInstanceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StartInstance
+func (c *Lightsail) StartInstanceRequest(input *StartInstanceInput) (req *request.Request, output *StartInstanceOutput) {
+ op := &request.Operation{
+ Name: opStartInstance,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &StartInstanceInput{}
+ }
+
+ output = &StartInstanceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// StartInstance API operation for Amazon Lightsail.
+//
+// Starts a specific Amazon Lightsail instance from a stopped state. To restart
+// an instance, use the reboot instance operation.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation StartInstance for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StartInstance
+func (c *Lightsail) StartInstance(input *StartInstanceInput) (*StartInstanceOutput, error) {
+ req, out := c.StartInstanceRequest(input)
+ return out, req.Send()
+}
+
+// StartInstanceWithContext is the same as StartInstance with the addition of
+// the ability to pass a context and additional request options.
+//
+// See StartInstance for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) StartInstanceWithContext(ctx aws.Context, input *StartInstanceInput, opts ...request.Option) (*StartInstanceOutput, error) {
+ req, out := c.StartInstanceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opStopInstance = "StopInstance"
+
+// StopInstanceRequest generates a "aws/request.Request" representing the
+// client's request for the StopInstance operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See StopInstance for more information on using the StopInstance
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the StopInstanceRequest method.
+// req, resp := client.StopInstanceRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StopInstance
+func (c *Lightsail) StopInstanceRequest(input *StopInstanceInput) (req *request.Request, output *StopInstanceOutput) {
+ op := &request.Operation{
+ Name: opStopInstance,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &StopInstanceInput{}
+ }
+
+ output = &StopInstanceOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// StopInstance API operation for Amazon Lightsail.
+//
+// Stops a specific Amazon Lightsail instance that is currently running.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation StopInstance for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StopInstance
+func (c *Lightsail) StopInstance(input *StopInstanceInput) (*StopInstanceOutput, error) {
+ req, out := c.StopInstanceRequest(input)
+ return out, req.Send()
+}
+
+// StopInstanceWithContext is the same as StopInstance with the addition of
+// the ability to pass a context and additional request options.
+//
+// See StopInstance for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) StopInstanceWithContext(ctx aws.Context, input *StopInstanceInput, opts ...request.Option) (*StopInstanceOutput, error) {
+ req, out := c.StopInstanceRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opUnpeerVpc = "UnpeerVpc"
+
+// UnpeerVpcRequest generates a "aws/request.Request" representing the
+// client's request for the UnpeerVpc operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See UnpeerVpc for more information on using the UnpeerVpc
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the UnpeerVpcRequest method.
+// req, resp := client.UnpeerVpcRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UnpeerVpc
+func (c *Lightsail) UnpeerVpcRequest(input *UnpeerVpcInput) (req *request.Request, output *UnpeerVpcOutput) {
+ op := &request.Operation{
+ Name: opUnpeerVpc,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &UnpeerVpcInput{}
+ }
+
+ output = &UnpeerVpcOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// UnpeerVpc API operation for Amazon Lightsail.
+//
+// Attempts to unpeer the Lightsail VPC from the user's default VPC.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation UnpeerVpc for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UnpeerVpc
+func (c *Lightsail) UnpeerVpc(input *UnpeerVpcInput) (*UnpeerVpcOutput, error) {
+ req, out := c.UnpeerVpcRequest(input)
+ return out, req.Send()
+}
+
+// UnpeerVpcWithContext is the same as UnpeerVpc with the addition of
+// the ability to pass a context and additional request options.
+//
+// See UnpeerVpc for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) UnpeerVpcWithContext(ctx aws.Context, input *UnpeerVpcInput, opts ...request.Option) (*UnpeerVpcOutput, error) {
+ req, out := c.UnpeerVpcRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opUpdateDomainEntry = "UpdateDomainEntry"
+
+// UpdateDomainEntryRequest generates a "aws/request.Request" representing the
+// client's request for the UpdateDomainEntry operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See UpdateDomainEntry for more information on using the UpdateDomainEntry
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the UpdateDomainEntryRequest method.
+// req, resp := client.UpdateDomainEntryRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateDomainEntry
+func (c *Lightsail) UpdateDomainEntryRequest(input *UpdateDomainEntryInput) (req *request.Request, output *UpdateDomainEntryOutput) {
+ op := &request.Operation{
+ Name: opUpdateDomainEntry,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &UpdateDomainEntryInput{}
+ }
+
+ output = &UpdateDomainEntryOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// UpdateDomainEntry API operation for Amazon Lightsail.
+//
+// Updates a domain recordset after it is created.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation UpdateDomainEntry for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateDomainEntry
+func (c *Lightsail) UpdateDomainEntry(input *UpdateDomainEntryInput) (*UpdateDomainEntryOutput, error) {
+ req, out := c.UpdateDomainEntryRequest(input)
+ return out, req.Send()
+}
+
+// UpdateDomainEntryWithContext is the same as UpdateDomainEntry with the addition of
+// the ability to pass a context and additional request options.
+//
+// See UpdateDomainEntry for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) UpdateDomainEntryWithContext(ctx aws.Context, input *UpdateDomainEntryInput, opts ...request.Option) (*UpdateDomainEntryOutput, error) {
+ req, out := c.UpdateDomainEntryRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+const opUpdateLoadBalancerAttribute = "UpdateLoadBalancerAttribute"
+
+// UpdateLoadBalancerAttributeRequest generates a "aws/request.Request" representing the
+// client's request for the UpdateLoadBalancerAttribute operation. The "output" return
+// value will be populated with the request's response once the request complets
+// successfuly.
+//
+// Use "Send" method on the returned Request to send the API call to the service.
+// the "output" return value is not valid until after Send returns without error.
+//
+// See UpdateLoadBalancerAttribute for more information on using the UpdateLoadBalancerAttribute
+// API call, and error handling.
+//
+// This method is useful when you want to inject custom logic or configuration
+// into the SDK's request lifecycle. Such as custom headers, or retry logic.
+//
+//
+// // Example sending a request using the UpdateLoadBalancerAttributeRequest method.
+// req, resp := client.UpdateLoadBalancerAttributeRequest(params)
+//
+// err := req.Send()
+// if err == nil { // resp is now filled
+// fmt.Println(resp)
+// }
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateLoadBalancerAttribute
+func (c *Lightsail) UpdateLoadBalancerAttributeRequest(input *UpdateLoadBalancerAttributeInput) (req *request.Request, output *UpdateLoadBalancerAttributeOutput) {
+ op := &request.Operation{
+ Name: opUpdateLoadBalancerAttribute,
+ HTTPMethod: "POST",
+ HTTPPath: "/",
+ }
+
+ if input == nil {
+ input = &UpdateLoadBalancerAttributeInput{}
+ }
+
+ output = &UpdateLoadBalancerAttributeOutput{}
+ req = c.newRequest(op, input, output)
+ return
+}
+
+// UpdateLoadBalancerAttribute API operation for Amazon Lightsail.
+//
+// Updates the specified attribute for a load balancer.
+//
+// Returns awserr.Error for service API and SDK errors. Use runtime type assertions
+// with awserr.Error's Code and Message methods to get detailed information about
+// the error.
+//
+// See the AWS API reference guide for Amazon Lightsail's
+// API operation UpdateLoadBalancerAttribute for usage and error information.
+//
+// Returned Error Codes:
+// * ErrCodeServiceException "ServiceException"
+// A general service exception.
+//
+// * ErrCodeInvalidInputException "InvalidInputException"
+// Lightsail throws this exception when user input does not conform to the validation
+// rules of an input field.
+//
+// Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+// Please set your Region configuration to us-east-1 to create, view, or edit
+// these resources.
+//
+// * ErrCodeNotFoundException "NotFoundException"
+// Lightsail throws this exception when it cannot find a resource.
+//
+// * ErrCodeOperationFailureException "OperationFailureException"
+// Lightsail throws this exception when an operation fails to execute.
+//
+// * ErrCodeAccessDeniedException "AccessDeniedException"
+// Lightsail throws this exception when the user cannot be authenticated or
+// uses invalid credentials to access a resource.
+//
+// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException"
+// Lightsail throws this exception when an account is still in the setup in
+// progress state.
+//
+// * ErrCodeUnauthenticatedException "UnauthenticatedException"
+// Lightsail throws this exception when the user has not been authenticated.
+//
+// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateLoadBalancerAttribute
+func (c *Lightsail) UpdateLoadBalancerAttribute(input *UpdateLoadBalancerAttributeInput) (*UpdateLoadBalancerAttributeOutput, error) {
+ req, out := c.UpdateLoadBalancerAttributeRequest(input)
+ return out, req.Send()
+}
+
+// UpdateLoadBalancerAttributeWithContext is the same as UpdateLoadBalancerAttribute with the addition of
+// the ability to pass a context and additional request options.
+//
+// See UpdateLoadBalancerAttribute for details on how to use this API operation.
+//
+// The context must be non-nil and will be used for request cancellation. If
+// the context is nil a panic will occur. In the future the SDK may create
+// sub-contexts for http.Requests. See https://golang.org/pkg/context/
+// for more information on using Contexts.
+func (c *Lightsail) UpdateLoadBalancerAttributeWithContext(ctx aws.Context, input *UpdateLoadBalancerAttributeInput, opts ...request.Option) (*UpdateLoadBalancerAttributeOutput, error) {
+ req, out := c.UpdateLoadBalancerAttributeRequest(input)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return out, req.Send()
+}
+
+type AllocateStaticIpInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the static IP address.
+ //
+ // StaticIpName is a required field
+ StaticIpName *string `locationName:"staticIpName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s AllocateStaticIpInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AllocateStaticIpInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *AllocateStaticIpInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "AllocateStaticIpInput"}
+ if s.StaticIpName == nil {
+ invalidParams.Add(request.NewErrParamRequired("StaticIpName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetStaticIpName sets the StaticIpName field's value.
+func (s *AllocateStaticIpInput) SetStaticIpName(v string) *AllocateStaticIpInput {
+ s.StaticIpName = &v
+ return s
+}
+
+type AllocateStaticIpOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the static IP address
+ // you allocated.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s AllocateStaticIpOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AllocateStaticIpOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *AllocateStaticIpOutput) SetOperations(v []*Operation) *AllocateStaticIpOutput {
+ s.Operations = v
+ return s
+}
+
+type AttachDiskInput struct {
+ _ struct{} `type:"structure"`
+
+ // The unique Lightsail disk name (e.g., my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+
+ // The disk path to expose to the instance (e.g., /dev/xvdf).
+ //
+ // DiskPath is a required field
+ DiskPath *string `locationName:"diskPath" type:"string" required:"true"`
+
+ // The name of the Lightsail instance where you want to utilize the storage
+ // disk.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s AttachDiskInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachDiskInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *AttachDiskInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "AttachDiskInput"}
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+ if s.DiskPath == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskPath"))
+ }
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *AttachDiskInput) SetDiskName(v string) *AttachDiskInput {
+ s.DiskName = &v
+ return s
+}
+
+// SetDiskPath sets the DiskPath field's value.
+func (s *AttachDiskInput) SetDiskPath(v string) *AttachDiskInput {
+ s.DiskPath = &v
+ return s
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *AttachDiskInput) SetInstanceName(v string) *AttachDiskInput {
+ s.InstanceName = &v
+ return s
+}
+
+type AttachDiskOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s AttachDiskOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachDiskOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *AttachDiskOutput) SetOperations(v []*Operation) *AttachDiskOutput {
+ s.Operations = v
+ return s
+}
+
+type AttachInstancesToLoadBalancerInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of strings representing the instance name(s) you want to attach
+ // to your load balancer.
+ //
+ // InstanceNames is a required field
+ InstanceNames []*string `locationName:"instanceNames" type:"list" required:"true"`
+
+ // The name of the load balancer.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s AttachInstancesToLoadBalancerInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachInstancesToLoadBalancerInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *AttachInstancesToLoadBalancerInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "AttachInstancesToLoadBalancerInput"}
+ if s.InstanceNames == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceNames"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceNames sets the InstanceNames field's value.
+func (s *AttachInstancesToLoadBalancerInput) SetInstanceNames(v []*string) *AttachInstancesToLoadBalancerInput {
+ s.InstanceNames = v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *AttachInstancesToLoadBalancerInput) SetLoadBalancerName(v string) *AttachInstancesToLoadBalancerInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type AttachInstancesToLoadBalancerOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object representing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s AttachInstancesToLoadBalancerOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachInstancesToLoadBalancerOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *AttachInstancesToLoadBalancerOutput) SetOperations(v []*Operation) *AttachInstancesToLoadBalancerOutput {
+ s.Operations = v
+ return s
+}
+
+type AttachLoadBalancerTlsCertificateInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of your TLS/SSL certificate.
+ //
+ // CertificateName is a required field
+ CertificateName *string `locationName:"certificateName" type:"string" required:"true"`
+
+ // The name of the load balancer to which you want to associate the TLS/SSL
+ // certificate.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s AttachLoadBalancerTlsCertificateInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachLoadBalancerTlsCertificateInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *AttachLoadBalancerTlsCertificateInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "AttachLoadBalancerTlsCertificateInput"}
+ if s.CertificateName == nil {
+ invalidParams.Add(request.NewErrParamRequired("CertificateName"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetCertificateName sets the CertificateName field's value.
+func (s *AttachLoadBalancerTlsCertificateInput) SetCertificateName(v string) *AttachLoadBalancerTlsCertificateInput {
+ s.CertificateName = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *AttachLoadBalancerTlsCertificateInput) SetLoadBalancerName(v string) *AttachLoadBalancerTlsCertificateInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type AttachLoadBalancerTlsCertificateOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object representing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s AttachLoadBalancerTlsCertificateOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachLoadBalancerTlsCertificateOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *AttachLoadBalancerTlsCertificateOutput) SetOperations(v []*Operation) *AttachLoadBalancerTlsCertificateOutput {
+ s.Operations = v
+ return s
+}
+
+type AttachStaticIpInput struct {
+ _ struct{} `type:"structure"`
+
+ // The instance name to which you want to attach the static IP address.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // The name of the static IP.
+ //
+ // StaticIpName is a required field
+ StaticIpName *string `locationName:"staticIpName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s AttachStaticIpInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachStaticIpInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *AttachStaticIpInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "AttachStaticIpInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.StaticIpName == nil {
+ invalidParams.Add(request.NewErrParamRequired("StaticIpName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *AttachStaticIpInput) SetInstanceName(v string) *AttachStaticIpInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetStaticIpName sets the StaticIpName field's value.
+func (s *AttachStaticIpInput) SetStaticIpName(v string) *AttachStaticIpInput {
+ s.StaticIpName = &v
+ return s
+}
+
+type AttachStaticIpOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about your API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s AttachStaticIpOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AttachStaticIpOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *AttachStaticIpOutput) SetOperations(v []*Operation) *AttachStaticIpOutput {
+ s.Operations = v
+ return s
+}
+
+// Describes an Availability Zone.
+type AvailabilityZone struct {
+ _ struct{} `type:"structure"`
+
+ // The state of the Availability Zone.
+ State *string `locationName:"state" type:"string"`
+
+ // The name of the Availability Zone. The format is us-east-2a (case-sensitive).
+ ZoneName *string `locationName:"zoneName" type:"string"`
+}
+
+// String returns the string representation
+func (s AvailabilityZone) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s AvailabilityZone) GoString() string {
+ return s.String()
+}
+
+// SetState sets the State field's value.
+func (s *AvailabilityZone) SetState(v string) *AvailabilityZone {
+ s.State = &v
+ return s
+}
+
+// SetZoneName sets the ZoneName field's value.
+func (s *AvailabilityZone) SetZoneName(v string) *AvailabilityZone {
+ s.ZoneName = &v
+ return s
+}
+
+// Describes a blueprint (a virtual private server image).
+type Blueprint struct {
+ _ struct{} `type:"structure"`
+
+ // The ID for the virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0).
+ BlueprintId *string `locationName:"blueprintId" type:"string"`
+
+ // The description of the blueprint.
+ Description *string `locationName:"description" type:"string"`
+
+ // The group name of the blueprint (e.g., amazon-linux).
+ Group *string `locationName:"group" type:"string"`
+
+ // A Boolean value indicating whether the blueprint is active. When you update
+ // your blueprints, you will inactivate old blueprints and keep the most recent
+ // versions active.
+ IsActive *bool `locationName:"isActive" type:"boolean"`
+
+ // The end-user license agreement URL for the image or blueprint.
+ LicenseUrl *string `locationName:"licenseUrl" type:"string"`
+
+ // The minimum bundle power required to run this blueprint. For example, you
+ // need a bundle with a power value of 500 or more to create an instance that
+ // uses a blueprint with a minimum power value of 500. 0 indicates that the
+ // blueprint runs on all instance sizes.
+ MinPower *int64 `locationName:"minPower" type:"integer"`
+
+ // The friendly name of the blueprint (e.g., Amazon Linux).
+ Name *string `locationName:"name" type:"string"`
+
+ // The operating system platform (either Linux/Unix-based or Windows Server-based)
+ // of the blueprint.
+ Platform *string `locationName:"platform" type:"string" enum:"InstancePlatform"`
+
+ // The product URL to learn more about the image or blueprint.
+ ProductUrl *string `locationName:"productUrl" type:"string"`
+
+ // The type of the blueprint (e.g., os or app).
+ Type *string `locationName:"type" type:"string" enum:"BlueprintType"`
+
+ // The version number of the operating system, application, or stack (e.g.,
+ // 2016.03.0).
+ Version *string `locationName:"version" type:"string"`
+
+ // The version code.
+ VersionCode *string `locationName:"versionCode" type:"string"`
+}
+
+// String returns the string representation
+func (s Blueprint) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Blueprint) GoString() string {
+ return s.String()
+}
+
+// SetBlueprintId sets the BlueprintId field's value.
+func (s *Blueprint) SetBlueprintId(v string) *Blueprint {
+ s.BlueprintId = &v
+ return s
+}
+
+// SetDescription sets the Description field's value.
+func (s *Blueprint) SetDescription(v string) *Blueprint {
+ s.Description = &v
+ return s
+}
+
+// SetGroup sets the Group field's value.
+func (s *Blueprint) SetGroup(v string) *Blueprint {
+ s.Group = &v
+ return s
+}
+
+// SetIsActive sets the IsActive field's value.
+func (s *Blueprint) SetIsActive(v bool) *Blueprint {
+ s.IsActive = &v
+ return s
+}
+
+// SetLicenseUrl sets the LicenseUrl field's value.
+func (s *Blueprint) SetLicenseUrl(v string) *Blueprint {
+ s.LicenseUrl = &v
+ return s
+}
+
+// SetMinPower sets the MinPower field's value.
+func (s *Blueprint) SetMinPower(v int64) *Blueprint {
+ s.MinPower = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Blueprint) SetName(v string) *Blueprint {
+ s.Name = &v
+ return s
+}
+
+// SetPlatform sets the Platform field's value.
+func (s *Blueprint) SetPlatform(v string) *Blueprint {
+ s.Platform = &v
+ return s
+}
+
+// SetProductUrl sets the ProductUrl field's value.
+func (s *Blueprint) SetProductUrl(v string) *Blueprint {
+ s.ProductUrl = &v
+ return s
+}
+
+// SetType sets the Type field's value.
+func (s *Blueprint) SetType(v string) *Blueprint {
+ s.Type = &v
+ return s
+}
+
+// SetVersion sets the Version field's value.
+func (s *Blueprint) SetVersion(v string) *Blueprint {
+ s.Version = &v
+ return s
+}
+
+// SetVersionCode sets the VersionCode field's value.
+func (s *Blueprint) SetVersionCode(v string) *Blueprint {
+ s.VersionCode = &v
+ return s
+}
+
+// Describes a bundle, which is a set of specs describing your virtual private
+// server (or instance).
+type Bundle struct {
+ _ struct{} `type:"structure"`
+
+ // The bundle ID (e.g., micro_1_0).
+ BundleId *string `locationName:"bundleId" type:"string"`
+
+ // The number of vCPUs included in the bundle (e.g., 2).
+ CpuCount *int64 `locationName:"cpuCount" type:"integer"`
+
+ // The size of the SSD (e.g., 30).
+ DiskSizeInGb *int64 `locationName:"diskSizeInGb" type:"integer"`
+
+ // The Amazon EC2 instance type (e.g., t2.micro).
+ InstanceType *string `locationName:"instanceType" type:"string"`
+
+ // A Boolean value indicating whether the bundle is active.
+ IsActive *bool `locationName:"isActive" type:"boolean"`
+
+ // A friendly name for the bundle (e.g., Micro).
+ Name *string `locationName:"name" type:"string"`
+
+ // A numeric value that represents the power of the bundle (e.g., 500). You
+ // can use the bundle's power value in conjunction with a blueprint's minimum
+ // power value to determine whether the blueprint will run on the bundle. For
+ // example, you need a bundle with a power value of 500 or more to create an
+ // instance that uses a blueprint with a minimum power value of 500.
+ Power *int64 `locationName:"power" type:"integer"`
+
+ // The price in US dollars (e.g., 5.0).
+ Price *float64 `locationName:"price" type:"float"`
+
+ // The amount of RAM in GB (e.g., 2.0).
+ RamSizeInGb *float64 `locationName:"ramSizeInGb" type:"float"`
+
+ // The operating system platform (Linux/Unix-based or Windows Server-based)
+ // that the bundle supports. You can only launch a WINDOWS bundle on a blueprint
+ // that supports the WINDOWS platform. LINUX_UNIX blueprints require a LINUX_UNIX
+ // bundle.
+ SupportedPlatforms []*string `locationName:"supportedPlatforms" type:"list"`
+
+ // The data transfer rate per month in GB (e.g., 2000).
+ TransferPerMonthInGb *int64 `locationName:"transferPerMonthInGb" type:"integer"`
+}
+
+// String returns the string representation
+func (s Bundle) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Bundle) GoString() string {
+ return s.String()
+}
+
+// SetBundleId sets the BundleId field's value.
+func (s *Bundle) SetBundleId(v string) *Bundle {
+ s.BundleId = &v
+ return s
+}
+
+// SetCpuCount sets the CpuCount field's value.
+func (s *Bundle) SetCpuCount(v int64) *Bundle {
+ s.CpuCount = &v
+ return s
+}
+
+// SetDiskSizeInGb sets the DiskSizeInGb field's value.
+func (s *Bundle) SetDiskSizeInGb(v int64) *Bundle {
+ s.DiskSizeInGb = &v
+ return s
+}
+
+// SetInstanceType sets the InstanceType field's value.
+func (s *Bundle) SetInstanceType(v string) *Bundle {
+ s.InstanceType = &v
+ return s
+}
+
+// SetIsActive sets the IsActive field's value.
+func (s *Bundle) SetIsActive(v bool) *Bundle {
+ s.IsActive = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Bundle) SetName(v string) *Bundle {
+ s.Name = &v
+ return s
+}
+
+// SetPower sets the Power field's value.
+func (s *Bundle) SetPower(v int64) *Bundle {
+ s.Power = &v
+ return s
+}
+
+// SetPrice sets the Price field's value.
+func (s *Bundle) SetPrice(v float64) *Bundle {
+ s.Price = &v
+ return s
+}
+
+// SetRamSizeInGb sets the RamSizeInGb field's value.
+func (s *Bundle) SetRamSizeInGb(v float64) *Bundle {
+ s.RamSizeInGb = &v
+ return s
+}
+
+// SetSupportedPlatforms sets the SupportedPlatforms field's value.
+func (s *Bundle) SetSupportedPlatforms(v []*string) *Bundle {
+ s.SupportedPlatforms = v
+ return s
+}
+
+// SetTransferPerMonthInGb sets the TransferPerMonthInGb field's value.
+func (s *Bundle) SetTransferPerMonthInGb(v int64) *Bundle {
+ s.TransferPerMonthInGb = &v
+ return s
+}
+
+type CloseInstancePublicPortsInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance on which you're attempting to close the public ports.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // Information about the public port you are trying to close.
+ //
+ // PortInfo is a required field
+ PortInfo *PortInfo `locationName:"portInfo" type:"structure" required:"true"`
+}
+
+// String returns the string representation
+func (s CloseInstancePublicPortsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CloseInstancePublicPortsInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CloseInstancePublicPortsInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CloseInstancePublicPortsInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.PortInfo == nil {
+ invalidParams.Add(request.NewErrParamRequired("PortInfo"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *CloseInstancePublicPortsInput) SetInstanceName(v string) *CloseInstancePublicPortsInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetPortInfo sets the PortInfo field's value.
+func (s *CloseInstancePublicPortsInput) SetPortInfo(v *PortInfo) *CloseInstancePublicPortsInput {
+ s.PortInfo = v
+ return s
+}
+
+type CloseInstancePublicPortsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs that contains information about the operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s CloseInstancePublicPortsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CloseInstancePublicPortsOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *CloseInstancePublicPortsOutput) SetOperation(v *Operation) *CloseInstancePublicPortsOutput {
+ s.Operation = v
+ return s
+}
+
+type CreateDiskFromSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The Availability Zone where you want to create the disk (e.g., us-east-2a).
+ // Choose the same Availability Zone as the Lightsail instance where you want
+ // to create the disk.
+ //
+ // Use the GetRegions operation to list the Availability Zones where Lightsail
+ // is currently available.
+ //
+ // AvailabilityZone is a required field
+ AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"`
+
+ // The unique Lightsail disk name (e.g., my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+
+ // The name of the disk snapshot (e.g., my-snapshot) from which to create the
+ // new storage disk.
+ //
+ // DiskSnapshotName is a required field
+ DiskSnapshotName *string `locationName:"diskSnapshotName" type:"string" required:"true"`
+
+ // The size of the disk in GB (e.g., 32).
+ //
+ // SizeInGb is a required field
+ SizeInGb *int64 `locationName:"sizeInGb" type:"integer" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateDiskFromSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskFromSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateDiskFromSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateDiskFromSnapshotInput"}
+ if s.AvailabilityZone == nil {
+ invalidParams.Add(request.NewErrParamRequired("AvailabilityZone"))
+ }
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+ if s.DiskSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskSnapshotName"))
+ }
+ if s.SizeInGb == nil {
+ invalidParams.Add(request.NewErrParamRequired("SizeInGb"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetAvailabilityZone sets the AvailabilityZone field's value.
+func (s *CreateDiskFromSnapshotInput) SetAvailabilityZone(v string) *CreateDiskFromSnapshotInput {
+ s.AvailabilityZone = &v
+ return s
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *CreateDiskFromSnapshotInput) SetDiskName(v string) *CreateDiskFromSnapshotInput {
+ s.DiskName = &v
+ return s
+}
+
+// SetDiskSnapshotName sets the DiskSnapshotName field's value.
+func (s *CreateDiskFromSnapshotInput) SetDiskSnapshotName(v string) *CreateDiskFromSnapshotInput {
+ s.DiskSnapshotName = &v
+ return s
+}
+
+// SetSizeInGb sets the SizeInGb field's value.
+func (s *CreateDiskFromSnapshotInput) SetSizeInGb(v int64) *CreateDiskFromSnapshotInput {
+ s.SizeInGb = &v
+ return s
+}
+
+type CreateDiskFromSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateDiskFromSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskFromSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateDiskFromSnapshotOutput) SetOperations(v []*Operation) *CreateDiskFromSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateDiskInput struct {
+ _ struct{} `type:"structure"`
+
+ // The Availability Zone where you want to create the disk (e.g., us-east-2a).
+ // Choose the same Availability Zone as the Lightsail instance where you want
+ // to create the disk.
+ //
+ // Use the GetRegions operation to list the Availability Zones where Lightsail
+ // is currently available.
+ //
+ // AvailabilityZone is a required field
+ AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"`
+
+ // The unique Lightsail disk name (e.g., my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+
+ // The size of the disk in GB (e.g., 32).
+ //
+ // SizeInGb is a required field
+ SizeInGb *int64 `locationName:"sizeInGb" type:"integer" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateDiskInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateDiskInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateDiskInput"}
+ if s.AvailabilityZone == nil {
+ invalidParams.Add(request.NewErrParamRequired("AvailabilityZone"))
+ }
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+ if s.SizeInGb == nil {
+ invalidParams.Add(request.NewErrParamRequired("SizeInGb"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetAvailabilityZone sets the AvailabilityZone field's value.
+func (s *CreateDiskInput) SetAvailabilityZone(v string) *CreateDiskInput {
+ s.AvailabilityZone = &v
+ return s
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *CreateDiskInput) SetDiskName(v string) *CreateDiskInput {
+ s.DiskName = &v
+ return s
+}
+
+// SetSizeInGb sets the SizeInGb field's value.
+func (s *CreateDiskInput) SetSizeInGb(v int64) *CreateDiskInput {
+ s.SizeInGb = &v
+ return s
+}
+
+type CreateDiskOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateDiskOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateDiskOutput) SetOperations(v []*Operation) *CreateDiskOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateDiskSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The unique name of the source disk (e.g., my-source-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+
+ // The name of the destination disk snapshot (e.g., my-disk-snapshot) based
+ // on the source disk.
+ //
+ // DiskSnapshotName is a required field
+ DiskSnapshotName *string `locationName:"diskSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateDiskSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateDiskSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateDiskSnapshotInput"}
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+ if s.DiskSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *CreateDiskSnapshotInput) SetDiskName(v string) *CreateDiskSnapshotInput {
+ s.DiskName = &v
+ return s
+}
+
+// SetDiskSnapshotName sets the DiskSnapshotName field's value.
+func (s *CreateDiskSnapshotInput) SetDiskSnapshotName(v string) *CreateDiskSnapshotInput {
+ s.DiskSnapshotName = &v
+ return s
+}
+
+type CreateDiskSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateDiskSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDiskSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateDiskSnapshotOutput) SetOperations(v []*Operation) *CreateDiskSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateDomainEntryInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the domain entry
+ // request.
+ //
+ // DomainEntry is a required field
+ DomainEntry *DomainEntry `locationName:"domainEntry" type:"structure" required:"true"`
+
+ // The domain name (e.g., example.com) for which you want to create the domain
+ // entry.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateDomainEntryInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDomainEntryInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateDomainEntryInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateDomainEntryInput"}
+ if s.DomainEntry == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainEntry"))
+ }
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainEntry sets the DomainEntry field's value.
+func (s *CreateDomainEntryInput) SetDomainEntry(v *DomainEntry) *CreateDomainEntryInput {
+ s.DomainEntry = v
+ return s
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *CreateDomainEntryInput) SetDomainName(v string) *CreateDomainEntryInput {
+ s.DomainName = &v
+ return s
+}
+
+type CreateDomainEntryOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s CreateDomainEntryOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDomainEntryOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *CreateDomainEntryOutput) SetOperation(v *Operation) *CreateDomainEntryOutput {
+ s.Operation = v
+ return s
+}
+
+type CreateDomainInput struct {
+ _ struct{} `type:"structure"`
+
+ // The domain name to manage (e.g., example.com).
+ //
+ // You cannot register a new domain name using Lightsail. You must register
+ // a domain name using Amazon Route 53 or another domain name registrar. If
+ // you have already registered your domain, you can enter its name in this parameter
+ // to manage the DNS records for that domain.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateDomainInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDomainInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateDomainInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateDomainInput"}
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *CreateDomainInput) SetDomainName(v string) *CreateDomainInput {
+ s.DomainName = &v
+ return s
+}
+
+type CreateDomainOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the domain resource
+ // you created.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s CreateDomainOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateDomainOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *CreateDomainOutput) SetOperation(v *Operation) *CreateDomainOutput {
+ s.Operation = v
+ return s
+}
+
+type CreateInstanceSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The Lightsail instance on which to base your snapshot.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // The name for your new snapshot.
+ //
+ // InstanceSnapshotName is a required field
+ InstanceSnapshotName *string `locationName:"instanceSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateInstanceSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstanceSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateInstanceSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateInstanceSnapshotInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.InstanceSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *CreateInstanceSnapshotInput) SetInstanceName(v string) *CreateInstanceSnapshotInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetInstanceSnapshotName sets the InstanceSnapshotName field's value.
+func (s *CreateInstanceSnapshotInput) SetInstanceSnapshotName(v string) *CreateInstanceSnapshotInput {
+ s.InstanceSnapshotName = &v
+ return s
+}
+
+type CreateInstanceSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // create instances snapshot request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateInstanceSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstanceSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateInstanceSnapshotOutput) SetOperations(v []*Operation) *CreateInstanceSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateInstancesFromSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about one or more disk mappings.
+ AttachedDiskMapping map[string][]*DiskMap `locationName:"attachedDiskMapping" type:"map"`
+
+ // The Availability Zone where you want to create your instances. Use the following
+ // formatting: us-east-2a (case sensitive). You can get a list of availability
+ // zones by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html)
+ // operation. Be sure to add the include availability zones parameter to your
+ // request.
+ //
+ // AvailabilityZone is a required field
+ AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"`
+
+ // The bundle of specification information for your virtual private server (or
+ // instance), including the pricing plan (e.g., micro_1_0).
+ //
+ // BundleId is a required field
+ BundleId *string `locationName:"bundleId" type:"string" required:"true"`
+
+ // The names for your new instances.
+ //
+ // InstanceNames is a required field
+ InstanceNames []*string `locationName:"instanceNames" type:"list" required:"true"`
+
+ // The name of the instance snapshot on which you are basing your new instances.
+ // Use the get instance snapshots operation to return information about your
+ // existing snapshots.
+ //
+ // InstanceSnapshotName is a required field
+ InstanceSnapshotName *string `locationName:"instanceSnapshotName" type:"string" required:"true"`
+
+ // The name for your key pair.
+ KeyPairName *string `locationName:"keyPairName" type:"string"`
+
+ // You can create a launch script that configures a server with additional user
+ // data. For example, apt-get -y update.
+ //
+ // Depending on the machine image you choose, the command to get software on
+ // your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu
+ // use apt-get, and FreeBSD uses pkg. For a complete list, see the Dev Guide
+ // (http://lightsail.aws.amazon.com/ls/docs/getting-started/articles/pre-installed-apps).
+ UserData *string `locationName:"userData" type:"string"`
+}
+
+// String returns the string representation
+func (s CreateInstancesFromSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstancesFromSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateInstancesFromSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateInstancesFromSnapshotInput"}
+ if s.AvailabilityZone == nil {
+ invalidParams.Add(request.NewErrParamRequired("AvailabilityZone"))
+ }
+ if s.BundleId == nil {
+ invalidParams.Add(request.NewErrParamRequired("BundleId"))
+ }
+ if s.InstanceNames == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceNames"))
+ }
+ if s.InstanceSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetAttachedDiskMapping sets the AttachedDiskMapping field's value.
+func (s *CreateInstancesFromSnapshotInput) SetAttachedDiskMapping(v map[string][]*DiskMap) *CreateInstancesFromSnapshotInput {
+ s.AttachedDiskMapping = v
+ return s
+}
+
+// SetAvailabilityZone sets the AvailabilityZone field's value.
+func (s *CreateInstancesFromSnapshotInput) SetAvailabilityZone(v string) *CreateInstancesFromSnapshotInput {
+ s.AvailabilityZone = &v
+ return s
+}
+
+// SetBundleId sets the BundleId field's value.
+func (s *CreateInstancesFromSnapshotInput) SetBundleId(v string) *CreateInstancesFromSnapshotInput {
+ s.BundleId = &v
+ return s
+}
+
+// SetInstanceNames sets the InstanceNames field's value.
+func (s *CreateInstancesFromSnapshotInput) SetInstanceNames(v []*string) *CreateInstancesFromSnapshotInput {
+ s.InstanceNames = v
+ return s
+}
+
+// SetInstanceSnapshotName sets the InstanceSnapshotName field's value.
+func (s *CreateInstancesFromSnapshotInput) SetInstanceSnapshotName(v string) *CreateInstancesFromSnapshotInput {
+ s.InstanceSnapshotName = &v
+ return s
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *CreateInstancesFromSnapshotInput) SetKeyPairName(v string) *CreateInstancesFromSnapshotInput {
+ s.KeyPairName = &v
+ return s
+}
+
+// SetUserData sets the UserData field's value.
+func (s *CreateInstancesFromSnapshotInput) SetUserData(v string) *CreateInstancesFromSnapshotInput {
+ s.UserData = &v
+ return s
+}
+
+type CreateInstancesFromSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // create instances from snapshot request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateInstancesFromSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstancesFromSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateInstancesFromSnapshotOutput) SetOperations(v []*Operation) *CreateInstancesFromSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateInstancesInput struct {
+ _ struct{} `type:"structure"`
+
+ // The Availability Zone in which to create your instance. Use the following
+ // format: us-east-2a (case sensitive). You can get a list of availability zones
+ // by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html)
+ // operation. Be sure to add the include availability zones parameter to your
+ // request.
+ //
+ // AvailabilityZone is a required field
+ AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"`
+
+ // The ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0).
+ // Use the get blueprints operation to return a list of available images (or
+ // blueprints).
+ //
+ // BlueprintId is a required field
+ BlueprintId *string `locationName:"blueprintId" type:"string" required:"true"`
+
+ // The bundle of specification information for your virtual private server (or
+ // instance), including the pricing plan (e.g., micro_1_0).
+ //
+ // BundleId is a required field
+ BundleId *string `locationName:"bundleId" type:"string" required:"true"`
+
+ // (Deprecated) The name for your custom image.
+ //
+ // In releases prior to June 12, 2017, this parameter was ignored by the API.
+ // It is now deprecated.
+ CustomImageName *string `locationName:"customImageName" deprecated:"true" type:"string"`
+
+ // The names to use for your new Lightsail instances. Separate multiple values
+ // using quotation marks and commas, for example: ["MyFirstInstance","MySecondInstance"]
+ //
+ // InstanceNames is a required field
+ InstanceNames []*string `locationName:"instanceNames" type:"list" required:"true"`
+
+ // The name of your key pair.
+ KeyPairName *string `locationName:"keyPairName" type:"string"`
+
+ // A launch script you can create that configures a server with additional user
+ // data. For example, you might want to run apt-get -y update.
+ //
+ // Depending on the machine image you choose, the command to get software on
+ // your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu
+ // use apt-get, and FreeBSD uses pkg. For a complete list, see the Dev Guide
+ // (https://lightsail.aws.amazon.com/ls/docs/getting-started/article/compare-options-choose-lightsail-instance-image).
+ UserData *string `locationName:"userData" type:"string"`
+}
+
+// String returns the string representation
+func (s CreateInstancesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstancesInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateInstancesInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateInstancesInput"}
+ if s.AvailabilityZone == nil {
+ invalidParams.Add(request.NewErrParamRequired("AvailabilityZone"))
+ }
+ if s.BlueprintId == nil {
+ invalidParams.Add(request.NewErrParamRequired("BlueprintId"))
+ }
+ if s.BundleId == nil {
+ invalidParams.Add(request.NewErrParamRequired("BundleId"))
+ }
+ if s.InstanceNames == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceNames"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetAvailabilityZone sets the AvailabilityZone field's value.
+func (s *CreateInstancesInput) SetAvailabilityZone(v string) *CreateInstancesInput {
+ s.AvailabilityZone = &v
+ return s
+}
+
+// SetBlueprintId sets the BlueprintId field's value.
+func (s *CreateInstancesInput) SetBlueprintId(v string) *CreateInstancesInput {
+ s.BlueprintId = &v
+ return s
+}
+
+// SetBundleId sets the BundleId field's value.
+func (s *CreateInstancesInput) SetBundleId(v string) *CreateInstancesInput {
+ s.BundleId = &v
+ return s
+}
+
+// SetCustomImageName sets the CustomImageName field's value.
+func (s *CreateInstancesInput) SetCustomImageName(v string) *CreateInstancesInput {
+ s.CustomImageName = &v
+ return s
+}
+
+// SetInstanceNames sets the InstanceNames field's value.
+func (s *CreateInstancesInput) SetInstanceNames(v []*string) *CreateInstancesInput {
+ s.InstanceNames = v
+ return s
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *CreateInstancesInput) SetKeyPairName(v string) *CreateInstancesInput {
+ s.KeyPairName = &v
+ return s
+}
+
+// SetUserData sets the UserData field's value.
+func (s *CreateInstancesInput) SetUserData(v string) *CreateInstancesInput {
+ s.UserData = &v
+ return s
+}
+
+type CreateInstancesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // create instances request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateInstancesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateInstancesOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateInstancesOutput) SetOperations(v []*Operation) *CreateInstancesOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateKeyPairInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name for your new key pair.
+ //
+ // KeyPairName is a required field
+ KeyPairName *string `locationName:"keyPairName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateKeyPairInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateKeyPairInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateKeyPairInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateKeyPairInput"}
+ if s.KeyPairName == nil {
+ invalidParams.Add(request.NewErrParamRequired("KeyPairName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *CreateKeyPairInput) SetKeyPairName(v string) *CreateKeyPairInput {
+ s.KeyPairName = &v
+ return s
+}
+
+type CreateKeyPairOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the new key pair
+ // you just created.
+ KeyPair *KeyPair `locationName:"keyPair" type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // create key pair request.
+ Operation *Operation `locationName:"operation" type:"structure"`
+
+ // A base64-encoded RSA private key.
+ PrivateKeyBase64 *string `locationName:"privateKeyBase64" type:"string"`
+
+ // A base64-encoded public key of the ssh-rsa type.
+ PublicKeyBase64 *string `locationName:"publicKeyBase64" type:"string"`
+}
+
+// String returns the string representation
+func (s CreateKeyPairOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateKeyPairOutput) GoString() string {
+ return s.String()
+}
+
+// SetKeyPair sets the KeyPair field's value.
+func (s *CreateKeyPairOutput) SetKeyPair(v *KeyPair) *CreateKeyPairOutput {
+ s.KeyPair = v
+ return s
+}
+
+// SetOperation sets the Operation field's value.
+func (s *CreateKeyPairOutput) SetOperation(v *Operation) *CreateKeyPairOutput {
+ s.Operation = v
+ return s
+}
+
+// SetPrivateKeyBase64 sets the PrivateKeyBase64 field's value.
+func (s *CreateKeyPairOutput) SetPrivateKeyBase64(v string) *CreateKeyPairOutput {
+ s.PrivateKeyBase64 = &v
+ return s
+}
+
+// SetPublicKeyBase64 sets the PublicKeyBase64 field's value.
+func (s *CreateKeyPairOutput) SetPublicKeyBase64(v string) *CreateKeyPairOutput {
+ s.PublicKeyBase64 = &v
+ return s
+}
+
+type CreateLoadBalancerInput struct {
+ _ struct{} `type:"structure"`
+
+ // The alternative domain names to use with your TLS/SSL certificate (e.g.,
+ // www.example.com, www.ejemplo.com, ejemplo.com).
+ CertificateAlternativeNames []*string `locationName:"certificateAlternativeNames" type:"list"`
+
+ // The domain name with which your certificate is associated (e.g., example.com).
+ //
+ // If you specify certificateDomainName, then certificateName is required (and
+ // vice-versa).
+ CertificateDomainName *string `locationName:"certificateDomainName" type:"string"`
+
+ // The name of the TLS/SSL certificate.
+ //
+ // If you specify certificateName, then certificateDomainName is required (and
+ // vice-versa).
+ CertificateName *string `locationName:"certificateName" type:"string"`
+
+ // The path you provided to perform the load balancer health check. If you didn't
+ // specify a health check path, Lightsail uses the root path of your website
+ // (e.g., "/").
+ HealthCheckPath *string `locationName:"healthCheckPath" type:"string"`
+
+ // The instance port where you're creating your load balancer.
+ //
+ // InstancePort is a required field
+ InstancePort *int64 `locationName:"instancePort" type:"integer" required:"true"`
+
+ // The name of your load balancer.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateLoadBalancerInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateLoadBalancerInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateLoadBalancerInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerInput"}
+ if s.InstancePort == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstancePort"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetCertificateAlternativeNames sets the CertificateAlternativeNames field's value.
+func (s *CreateLoadBalancerInput) SetCertificateAlternativeNames(v []*string) *CreateLoadBalancerInput {
+ s.CertificateAlternativeNames = v
+ return s
+}
+
+// SetCertificateDomainName sets the CertificateDomainName field's value.
+func (s *CreateLoadBalancerInput) SetCertificateDomainName(v string) *CreateLoadBalancerInput {
+ s.CertificateDomainName = &v
+ return s
+}
+
+// SetCertificateName sets the CertificateName field's value.
+func (s *CreateLoadBalancerInput) SetCertificateName(v string) *CreateLoadBalancerInput {
+ s.CertificateName = &v
+ return s
+}
+
+// SetHealthCheckPath sets the HealthCheckPath field's value.
+func (s *CreateLoadBalancerInput) SetHealthCheckPath(v string) *CreateLoadBalancerInput {
+ s.HealthCheckPath = &v
+ return s
+}
+
+// SetInstancePort sets the InstancePort field's value.
+func (s *CreateLoadBalancerInput) SetInstancePort(v int64) *CreateLoadBalancerInput {
+ s.InstancePort = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *CreateLoadBalancerInput) SetLoadBalancerName(v string) *CreateLoadBalancerInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type CreateLoadBalancerOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateLoadBalancerOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateLoadBalancerOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateLoadBalancerOutput) SetOperations(v []*Operation) *CreateLoadBalancerOutput {
+ s.Operations = v
+ return s
+}
+
+type CreateLoadBalancerTlsCertificateInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of strings listing alternative domain names for your TLS/SSL certificate.
+ CertificateAlternativeNames []*string `locationName:"certificateAlternativeNames" type:"list"`
+
+ // The domain name (e.g., example.com) for your TLS/SSL certificate.
+ //
+ // CertificateDomainName is a required field
+ CertificateDomainName *string `locationName:"certificateDomainName" type:"string" required:"true"`
+
+ // The TLS/SSL certificate name.
+ //
+ // CertificateName is a required field
+ CertificateName *string `locationName:"certificateName" type:"string" required:"true"`
+
+ // The load balancer name where you want to create the TLS/SSL certificate.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s CreateLoadBalancerTlsCertificateInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateLoadBalancerTlsCertificateInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *CreateLoadBalancerTlsCertificateInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "CreateLoadBalancerTlsCertificateInput"}
+ if s.CertificateDomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("CertificateDomainName"))
+ }
+ if s.CertificateName == nil {
+ invalidParams.Add(request.NewErrParamRequired("CertificateName"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetCertificateAlternativeNames sets the CertificateAlternativeNames field's value.
+func (s *CreateLoadBalancerTlsCertificateInput) SetCertificateAlternativeNames(v []*string) *CreateLoadBalancerTlsCertificateInput {
+ s.CertificateAlternativeNames = v
+ return s
+}
+
+// SetCertificateDomainName sets the CertificateDomainName field's value.
+func (s *CreateLoadBalancerTlsCertificateInput) SetCertificateDomainName(v string) *CreateLoadBalancerTlsCertificateInput {
+ s.CertificateDomainName = &v
+ return s
+}
+
+// SetCertificateName sets the CertificateName field's value.
+func (s *CreateLoadBalancerTlsCertificateInput) SetCertificateName(v string) *CreateLoadBalancerTlsCertificateInput {
+ s.CertificateName = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *CreateLoadBalancerTlsCertificateInput) SetLoadBalancerName(v string) *CreateLoadBalancerTlsCertificateInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type CreateLoadBalancerTlsCertificateOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s CreateLoadBalancerTlsCertificateOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s CreateLoadBalancerTlsCertificateOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *CreateLoadBalancerTlsCertificateOutput) SetOperations(v []*Operation) *CreateLoadBalancerTlsCertificateOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteDiskInput struct {
+ _ struct{} `type:"structure"`
+
+ // The unique name of the disk you want to delete (e.g., my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteDiskInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDiskInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteDiskInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteDiskInput"}
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *DeleteDiskInput) SetDiskName(v string) *DeleteDiskInput {
+ s.DiskName = &v
+ return s
+}
+
+type DeleteDiskOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteDiskOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDiskOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteDiskOutput) SetOperations(v []*Operation) *DeleteDiskOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteDiskSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the disk snapshot you want to delete (e.g., my-disk-snapshot).
+ //
+ // DiskSnapshotName is a required field
+ DiskSnapshotName *string `locationName:"diskSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteDiskSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDiskSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteDiskSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteDiskSnapshotInput"}
+ if s.DiskSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskSnapshotName sets the DiskSnapshotName field's value.
+func (s *DeleteDiskSnapshotInput) SetDiskSnapshotName(v string) *DeleteDiskSnapshotInput {
+ s.DiskSnapshotName = &v
+ return s
+}
+
+type DeleteDiskSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteDiskSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDiskSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteDiskSnapshotOutput) SetOperations(v []*Operation) *DeleteDiskSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteDomainEntryInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about your domain entries.
+ //
+ // DomainEntry is a required field
+ DomainEntry *DomainEntry `locationName:"domainEntry" type:"structure" required:"true"`
+
+ // The name of the domain entry to delete.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteDomainEntryInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDomainEntryInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteDomainEntryInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteDomainEntryInput"}
+ if s.DomainEntry == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainEntry"))
+ }
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainEntry sets the DomainEntry field's value.
+func (s *DeleteDomainEntryInput) SetDomainEntry(v *DomainEntry) *DeleteDomainEntryInput {
+ s.DomainEntry = v
+ return s
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *DeleteDomainEntryInput) SetDomainName(v string) *DeleteDomainEntryInput {
+ s.DomainName = &v
+ return s
+}
+
+type DeleteDomainEntryOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // delete domain entry request.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s DeleteDomainEntryOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDomainEntryOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *DeleteDomainEntryOutput) SetOperation(v *Operation) *DeleteDomainEntryOutput {
+ s.Operation = v
+ return s
+}
+
+type DeleteDomainInput struct {
+ _ struct{} `type:"structure"`
+
+ // The specific domain name to delete.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteDomainInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDomainInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteDomainInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteDomainInput"}
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *DeleteDomainInput) SetDomainName(v string) *DeleteDomainInput {
+ s.DomainName = &v
+ return s
+}
+
+type DeleteDomainOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // delete domain request.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s DeleteDomainOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteDomainOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *DeleteDomainOutput) SetOperation(v *Operation) *DeleteDomainOutput {
+ s.Operation = v
+ return s
+}
+
+type DeleteInstanceInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance to delete.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteInstanceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteInstanceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteInstanceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteInstanceInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *DeleteInstanceInput) SetInstanceName(v string) *DeleteInstanceInput {
+ s.InstanceName = &v
+ return s
+}
+
+type DeleteInstanceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // delete instance request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteInstanceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteInstanceOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteInstanceOutput) SetOperations(v []*Operation) *DeleteInstanceOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteInstanceSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the snapshot to delete.
+ //
+ // InstanceSnapshotName is a required field
+ InstanceSnapshotName *string `locationName:"instanceSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteInstanceSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteInstanceSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteInstanceSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteInstanceSnapshotInput"}
+ if s.InstanceSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceSnapshotName sets the InstanceSnapshotName field's value.
+func (s *DeleteInstanceSnapshotInput) SetInstanceSnapshotName(v string) *DeleteInstanceSnapshotInput {
+ s.InstanceSnapshotName = &v
+ return s
+}
+
+type DeleteInstanceSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // delete instance snapshot request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteInstanceSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteInstanceSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteInstanceSnapshotOutput) SetOperations(v []*Operation) *DeleteInstanceSnapshotOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteKeyPairInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the key pair to delete.
+ //
+ // KeyPairName is a required field
+ KeyPairName *string `locationName:"keyPairName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteKeyPairInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteKeyPairInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteKeyPairInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteKeyPairInput"}
+ if s.KeyPairName == nil {
+ invalidParams.Add(request.NewErrParamRequired("KeyPairName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *DeleteKeyPairInput) SetKeyPairName(v string) *DeleteKeyPairInput {
+ s.KeyPairName = &v
+ return s
+}
+
+type DeleteKeyPairOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // delete key pair request.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s DeleteKeyPairOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteKeyPairOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *DeleteKeyPairOutput) SetOperation(v *Operation) *DeleteKeyPairOutput {
+ s.Operation = v
+ return s
+}
+
+type DeleteLoadBalancerInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the load balancer you want to delete.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteLoadBalancerInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteLoadBalancerInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteLoadBalancerInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerInput"}
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *DeleteLoadBalancerInput) SetLoadBalancerName(v string) *DeleteLoadBalancerInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type DeleteLoadBalancerOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteLoadBalancerOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteLoadBalancerOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteLoadBalancerOutput) SetOperations(v []*Operation) *DeleteLoadBalancerOutput {
+ s.Operations = v
+ return s
+}
+
+type DeleteLoadBalancerTlsCertificateInput struct {
+ _ struct{} `type:"structure"`
+
+ // The TLS/SSL certificate name.
+ //
+ // CertificateName is a required field
+ CertificateName *string `locationName:"certificateName" type:"string" required:"true"`
+
+ // When true, forces the deletion of a TLS/SSL certificate.
+ Force *bool `locationName:"force" type:"boolean"`
+
+ // The load balancer name.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DeleteLoadBalancerTlsCertificateInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteLoadBalancerTlsCertificateInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DeleteLoadBalancerTlsCertificateInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DeleteLoadBalancerTlsCertificateInput"}
+ if s.CertificateName == nil {
+ invalidParams.Add(request.NewErrParamRequired("CertificateName"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetCertificateName sets the CertificateName field's value.
+func (s *DeleteLoadBalancerTlsCertificateInput) SetCertificateName(v string) *DeleteLoadBalancerTlsCertificateInput {
+ s.CertificateName = &v
+ return s
+}
+
+// SetForce sets the Force field's value.
+func (s *DeleteLoadBalancerTlsCertificateInput) SetForce(v bool) *DeleteLoadBalancerTlsCertificateInput {
+ s.Force = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *DeleteLoadBalancerTlsCertificateInput) SetLoadBalancerName(v string) *DeleteLoadBalancerTlsCertificateInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type DeleteLoadBalancerTlsCertificateOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DeleteLoadBalancerTlsCertificateOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DeleteLoadBalancerTlsCertificateOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DeleteLoadBalancerTlsCertificateOutput) SetOperations(v []*Operation) *DeleteLoadBalancerTlsCertificateOutput {
+ s.Operations = v
+ return s
+}
+
+type DetachDiskInput struct {
+ _ struct{} `type:"structure"`
+
+ // The unique name of the disk you want to detach from your instance (e.g.,
+ // my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DetachDiskInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachDiskInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DetachDiskInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DetachDiskInput"}
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *DetachDiskInput) SetDiskName(v string) *DetachDiskInput {
+ s.DiskName = &v
+ return s
+}
+
+type DetachDiskOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DetachDiskOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachDiskOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DetachDiskOutput) SetOperations(v []*Operation) *DetachDiskOutput {
+ s.Operations = v
+ return s
+}
+
+type DetachInstancesFromLoadBalancerInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of strings containing the names of the instances you want to detach
+ // from the load balancer.
+ //
+ // InstanceNames is a required field
+ InstanceNames []*string `locationName:"instanceNames" type:"list" required:"true"`
+
+ // The name of the Lightsail load balancer.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DetachInstancesFromLoadBalancerInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachInstancesFromLoadBalancerInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DetachInstancesFromLoadBalancerInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DetachInstancesFromLoadBalancerInput"}
+ if s.InstanceNames == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceNames"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceNames sets the InstanceNames field's value.
+func (s *DetachInstancesFromLoadBalancerInput) SetInstanceNames(v []*string) *DetachInstancesFromLoadBalancerInput {
+ s.InstanceNames = v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *DetachInstancesFromLoadBalancerInput) SetLoadBalancerName(v string) *DetachInstancesFromLoadBalancerInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type DetachInstancesFromLoadBalancerOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DetachInstancesFromLoadBalancerOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachInstancesFromLoadBalancerOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DetachInstancesFromLoadBalancerOutput) SetOperations(v []*Operation) *DetachInstancesFromLoadBalancerOutput {
+ s.Operations = v
+ return s
+}
+
+type DetachStaticIpInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the static IP to detach from the instance.
+ //
+ // StaticIpName is a required field
+ StaticIpName *string `locationName:"staticIpName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s DetachStaticIpInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachStaticIpInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *DetachStaticIpInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "DetachStaticIpInput"}
+ if s.StaticIpName == nil {
+ invalidParams.Add(request.NewErrParamRequired("StaticIpName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetStaticIpName sets the StaticIpName field's value.
+func (s *DetachStaticIpInput) SetStaticIpName(v string) *DetachStaticIpInput {
+ s.StaticIpName = &v
+ return s
+}
+
+type DetachStaticIpOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // detach static IP request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s DetachStaticIpOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DetachStaticIpOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *DetachStaticIpOutput) SetOperations(v []*Operation) *DetachStaticIpOutput {
+ s.Operations = v
+ return s
+}
+
+// Describes a system disk or an block storage disk.
+type Disk struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the disk.
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The resources to which the disk is attached.
+ AttachedTo *string `locationName:"attachedTo" type:"string"`
+
+ // (Deprecated) The attachment state of the disk.
+ //
+ // In releases prior to November 14, 2017, this parameter returned attached
+ // for system disks in the API response. It is now deprecated, but still included
+ // in the response. Use isAttached instead.
+ AttachmentState *string `locationName:"attachmentState" deprecated:"true" type:"string"`
+
+ // The date when the disk was created.
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // (Deprecated) The number of GB in use by the disk.
+ //
+ // In releases prior to November 14, 2017, this parameter was not included in
+ // the API response. It is now deprecated.
+ GbInUse *int64 `locationName:"gbInUse" deprecated:"true" type:"integer"`
+
+ // The input/output operations per second (IOPS) of the disk.
+ Iops *int64 `locationName:"iops" type:"integer"`
+
+ // A Boolean value indicating whether the disk is attached.
+ IsAttached *bool `locationName:"isAttached" type:"boolean"`
+
+ // A Boolean value indicating whether this disk is a system disk (has an operating
+ // system loaded on it).
+ IsSystemDisk *bool `locationName:"isSystemDisk" type:"boolean"`
+
+ // The AWS Region and Availability Zone where the disk is located.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The unique name of the disk.
+ Name *string `locationName:"name" type:"string"`
+
+ // The disk path.
+ Path *string `locationName:"path" type:"string"`
+
+ // The Lightsail resource type (e.g., Disk).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The size of the disk in GB.
+ SizeInGb *int64 `locationName:"sizeInGb" type:"integer"`
+
+ // Describes the status of the disk.
+ State *string `locationName:"state" type:"string" enum:"DiskState"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s Disk) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Disk) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *Disk) SetArn(v string) *Disk {
+ s.Arn = &v
+ return s
+}
+
+// SetAttachedTo sets the AttachedTo field's value.
+func (s *Disk) SetAttachedTo(v string) *Disk {
+ s.AttachedTo = &v
+ return s
+}
+
+// SetAttachmentState sets the AttachmentState field's value.
+func (s *Disk) SetAttachmentState(v string) *Disk {
+ s.AttachmentState = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *Disk) SetCreatedAt(v time.Time) *Disk {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetGbInUse sets the GbInUse field's value.
+func (s *Disk) SetGbInUse(v int64) *Disk {
+ s.GbInUse = &v
+ return s
+}
+
+// SetIops sets the Iops field's value.
+func (s *Disk) SetIops(v int64) *Disk {
+ s.Iops = &v
+ return s
+}
+
+// SetIsAttached sets the IsAttached field's value.
+func (s *Disk) SetIsAttached(v bool) *Disk {
+ s.IsAttached = &v
+ return s
+}
+
+// SetIsSystemDisk sets the IsSystemDisk field's value.
+func (s *Disk) SetIsSystemDisk(v bool) *Disk {
+ s.IsSystemDisk = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *Disk) SetLocation(v *ResourceLocation) *Disk {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Disk) SetName(v string) *Disk {
+ s.Name = &v
+ return s
+}
+
+// SetPath sets the Path field's value.
+func (s *Disk) SetPath(v string) *Disk {
+ s.Path = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *Disk) SetResourceType(v string) *Disk {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSizeInGb sets the SizeInGb field's value.
+func (s *Disk) SetSizeInGb(v int64) *Disk {
+ s.SizeInGb = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *Disk) SetState(v string) *Disk {
+ s.State = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *Disk) SetSupportCode(v string) *Disk {
+ s.SupportCode = &v
+ return s
+}
+
+// Describes a block storage disk mapping.
+type DiskMap struct {
+ _ struct{} `type:"structure"`
+
+ // The new disk name (e.g., my-new-disk).
+ NewDiskName *string `locationName:"newDiskName" type:"string"`
+
+ // The original disk path exposed to the instance (for example, /dev/sdh).
+ OriginalDiskPath *string `locationName:"originalDiskPath" type:"string"`
+}
+
+// String returns the string representation
+func (s DiskMap) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DiskMap) GoString() string {
+ return s.String()
+}
+
+// SetNewDiskName sets the NewDiskName field's value.
+func (s *DiskMap) SetNewDiskName(v string) *DiskMap {
+ s.NewDiskName = &v
+ return s
+}
+
+// SetOriginalDiskPath sets the OriginalDiskPath field's value.
+func (s *DiskMap) SetOriginalDiskPath(v string) *DiskMap {
+ s.OriginalDiskPath = &v
+ return s
+}
+
+// Describes a block storage disk snapshot.
+type DiskSnapshot struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the disk snapshot.
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The date when the disk snapshot was created.
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The Amazon Resource Name (ARN) of the source disk from which you are creating
+ // the disk snapshot.
+ FromDiskArn *string `locationName:"fromDiskArn" type:"string"`
+
+ // The unique name of the source disk from which you are creating the disk snapshot.
+ FromDiskName *string `locationName:"fromDiskName" type:"string"`
+
+ // The AWS Region and Availability Zone where the disk snapshot was created.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the disk snapshot (e.g., my-disk-snapshot).
+ Name *string `locationName:"name" type:"string"`
+
+ // The progress of the disk snapshot operation.
+ Progress *string `locationName:"progress" type:"string"`
+
+ // The Lightsail resource type (e.g., DiskSnapshot).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The size of the disk in GB.
+ SizeInGb *int64 `locationName:"sizeInGb" type:"integer"`
+
+ // The status of the disk snapshot operation.
+ State *string `locationName:"state" type:"string" enum:"DiskSnapshotState"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s DiskSnapshot) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DiskSnapshot) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *DiskSnapshot) SetArn(v string) *DiskSnapshot {
+ s.Arn = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *DiskSnapshot) SetCreatedAt(v time.Time) *DiskSnapshot {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetFromDiskArn sets the FromDiskArn field's value.
+func (s *DiskSnapshot) SetFromDiskArn(v string) *DiskSnapshot {
+ s.FromDiskArn = &v
+ return s
+}
+
+// SetFromDiskName sets the FromDiskName field's value.
+func (s *DiskSnapshot) SetFromDiskName(v string) *DiskSnapshot {
+ s.FromDiskName = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *DiskSnapshot) SetLocation(v *ResourceLocation) *DiskSnapshot {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *DiskSnapshot) SetName(v string) *DiskSnapshot {
+ s.Name = &v
+ return s
+}
+
+// SetProgress sets the Progress field's value.
+func (s *DiskSnapshot) SetProgress(v string) *DiskSnapshot {
+ s.Progress = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *DiskSnapshot) SetResourceType(v string) *DiskSnapshot {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSizeInGb sets the SizeInGb field's value.
+func (s *DiskSnapshot) SetSizeInGb(v int64) *DiskSnapshot {
+ s.SizeInGb = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *DiskSnapshot) SetState(v string) *DiskSnapshot {
+ s.State = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *DiskSnapshot) SetSupportCode(v string) *DiskSnapshot {
+ s.SupportCode = &v
+ return s
+}
+
+// Describes a domain where you are storing recordsets in Lightsail.
+type Domain struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the domain recordset (e.g., arn:aws:lightsail:global:123456789101:Domain/824cede0-abc7-4f84-8dbc-12345EXAMPLE).
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The date when the domain recordset was created.
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // An array of key-value pairs containing information about the domain entries.
+ DomainEntries []*DomainEntry `locationName:"domainEntries" type:"list"`
+
+ // The AWS Region and Availability Zones where the domain recordset was created.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the domain.
+ Name *string `locationName:"name" type:"string"`
+
+ // The resource type.
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s Domain) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Domain) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *Domain) SetArn(v string) *Domain {
+ s.Arn = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *Domain) SetCreatedAt(v time.Time) *Domain {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetDomainEntries sets the DomainEntries field's value.
+func (s *Domain) SetDomainEntries(v []*DomainEntry) *Domain {
+ s.DomainEntries = v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *Domain) SetLocation(v *ResourceLocation) *Domain {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Domain) SetName(v string) *Domain {
+ s.Name = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *Domain) SetResourceType(v string) *Domain {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *Domain) SetSupportCode(v string) *Domain {
+ s.SupportCode = &v
+ return s
+}
+
+// Describes a domain recordset entry.
+type DomainEntry struct {
+ _ struct{} `type:"structure"`
+
+ // The ID of the domain recordset entry.
+ Id *string `locationName:"id" type:"string"`
+
+ // When true, specifies whether the domain entry is an alias used by the Lightsail
+ // load balancer.
+ IsAlias *bool `locationName:"isAlias" type:"boolean"`
+
+ // The name of the domain.
+ Name *string `locationName:"name" type:"string"`
+
+ // (Deprecated) The options for the domain entry.
+ //
+ // In releases prior to November 29, 2017, this parameter was not included in
+ // the API response. It is now deprecated.
+ Options map[string]*string `locationName:"options" deprecated:"true" type:"map"`
+
+ // The target AWS name server (e.g., ns-111.awsdns-22.com.).
+ Target *string `locationName:"target" type:"string"`
+
+ // The type of domain entry (e.g., SOA or NS).
+ Type *string `locationName:"type" type:"string"`
+}
+
+// String returns the string representation
+func (s DomainEntry) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DomainEntry) GoString() string {
+ return s.String()
+}
+
+// SetId sets the Id field's value.
+func (s *DomainEntry) SetId(v string) *DomainEntry {
+ s.Id = &v
+ return s
+}
+
+// SetIsAlias sets the IsAlias field's value.
+func (s *DomainEntry) SetIsAlias(v bool) *DomainEntry {
+ s.IsAlias = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *DomainEntry) SetName(v string) *DomainEntry {
+ s.Name = &v
+ return s
+}
+
+// SetOptions sets the Options field's value.
+func (s *DomainEntry) SetOptions(v map[string]*string) *DomainEntry {
+ s.Options = v
+ return s
+}
+
+// SetTarget sets the Target field's value.
+func (s *DomainEntry) SetTarget(v string) *DomainEntry {
+ s.Target = &v
+ return s
+}
+
+// SetType sets the Type field's value.
+func (s *DomainEntry) SetType(v string) *DomainEntry {
+ s.Type = &v
+ return s
+}
+
+type DownloadDefaultKeyPairInput struct {
+ _ struct{} `type:"structure"`
+}
+
+// String returns the string representation
+func (s DownloadDefaultKeyPairInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DownloadDefaultKeyPairInput) GoString() string {
+ return s.String()
+}
+
+type DownloadDefaultKeyPairOutput struct {
+ _ struct{} `type:"structure"`
+
+ // A base64-encoded RSA private key.
+ PrivateKeyBase64 *string `locationName:"privateKeyBase64" type:"string"`
+
+ // A base64-encoded public key of the ssh-rsa type.
+ PublicKeyBase64 *string `locationName:"publicKeyBase64" type:"string"`
+}
+
+// String returns the string representation
+func (s DownloadDefaultKeyPairOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s DownloadDefaultKeyPairOutput) GoString() string {
+ return s.String()
+}
+
+// SetPrivateKeyBase64 sets the PrivateKeyBase64 field's value.
+func (s *DownloadDefaultKeyPairOutput) SetPrivateKeyBase64(v string) *DownloadDefaultKeyPairOutput {
+ s.PrivateKeyBase64 = &v
+ return s
+}
+
+// SetPublicKeyBase64 sets the PublicKeyBase64 field's value.
+func (s *DownloadDefaultKeyPairOutput) SetPublicKeyBase64(v string) *DownloadDefaultKeyPairOutput {
+ s.PublicKeyBase64 = &v
+ return s
+}
+
+type GetActiveNamesInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for paginating results from your get active names request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetActiveNamesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetActiveNamesInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetActiveNamesInput) SetPageToken(v string) *GetActiveNamesInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetActiveNamesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // The list of active names returned by the get active names request.
+ ActiveNames []*string `locationName:"activeNames" type:"list"`
+
+ // A token used for advancing to the next page of results from your get active
+ // names request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetActiveNamesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetActiveNamesOutput) GoString() string {
+ return s.String()
+}
+
+// SetActiveNames sets the ActiveNames field's value.
+func (s *GetActiveNamesOutput) SetActiveNames(v []*string) *GetActiveNamesOutput {
+ s.ActiveNames = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetActiveNamesOutput) SetNextPageToken(v string) *GetActiveNamesOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetBlueprintsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A Boolean value indicating whether to include inactive results in your request.
+ IncludeInactive *bool `locationName:"includeInactive" type:"boolean"`
+
+ // A token used for advancing to the next page of results from your get blueprints
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetBlueprintsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetBlueprintsInput) GoString() string {
+ return s.String()
+}
+
+// SetIncludeInactive sets the IncludeInactive field's value.
+func (s *GetBlueprintsInput) SetIncludeInactive(v bool) *GetBlueprintsInput {
+ s.IncludeInactive = &v
+ return s
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetBlueprintsInput) SetPageToken(v string) *GetBlueprintsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetBlueprintsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs that contains information about the available
+ // blueprints.
+ Blueprints []*Blueprint `locationName:"blueprints" type:"list"`
+
+ // A token used for advancing to the next page of results from your get blueprints
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetBlueprintsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetBlueprintsOutput) GoString() string {
+ return s.String()
+}
+
+// SetBlueprints sets the Blueprints field's value.
+func (s *GetBlueprintsOutput) SetBlueprints(v []*Blueprint) *GetBlueprintsOutput {
+ s.Blueprints = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetBlueprintsOutput) SetNextPageToken(v string) *GetBlueprintsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetBundlesInput struct {
+ _ struct{} `type:"structure"`
+
+ // A Boolean value that indicates whether to include inactive bundle results
+ // in your request.
+ IncludeInactive *bool `locationName:"includeInactive" type:"boolean"`
+
+ // A token used for advancing to the next page of results from your get bundles
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetBundlesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetBundlesInput) GoString() string {
+ return s.String()
+}
+
+// SetIncludeInactive sets the IncludeInactive field's value.
+func (s *GetBundlesInput) SetIncludeInactive(v bool) *GetBundlesInput {
+ s.IncludeInactive = &v
+ return s
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetBundlesInput) SetPageToken(v string) *GetBundlesInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetBundlesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs that contains information about the available
+ // bundles.
+ Bundles []*Bundle `locationName:"bundles" type:"list"`
+
+ // A token used for advancing to the next page of results from your get active
+ // names request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetBundlesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetBundlesOutput) GoString() string {
+ return s.String()
+}
+
+// SetBundles sets the Bundles field's value.
+func (s *GetBundlesOutput) SetBundles(v []*Bundle) *GetBundlesOutput {
+ s.Bundles = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetBundlesOutput) SetNextPageToken(v string) *GetBundlesOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetDiskInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the disk (e.g., my-disk).
+ //
+ // DiskName is a required field
+ DiskName *string `locationName:"diskName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetDiskInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetDiskInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetDiskInput"}
+ if s.DiskName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskName sets the DiskName field's value.
+func (s *GetDiskInput) SetDiskName(v string) *GetDiskInput {
+ s.DiskName = &v
+ return s
+}
+
+type GetDiskOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about the disk.
+ Disk *Disk `locationName:"disk" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetDiskOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskOutput) GoString() string {
+ return s.String()
+}
+
+// SetDisk sets the Disk field's value.
+func (s *GetDiskOutput) SetDisk(v *Disk) *GetDiskOutput {
+ s.Disk = v
+ return s
+}
+
+type GetDiskSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the disk snapshot (e.g., my-disk-snapshot).
+ //
+ // DiskSnapshotName is a required field
+ DiskSnapshotName *string `locationName:"diskSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetDiskSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetDiskSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetDiskSnapshotInput"}
+ if s.DiskSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DiskSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDiskSnapshotName sets the DiskSnapshotName field's value.
+func (s *GetDiskSnapshotInput) SetDiskSnapshotName(v string) *GetDiskSnapshotInput {
+ s.DiskSnapshotName = &v
+ return s
+}
+
+type GetDiskSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about the disk snapshot.
+ DiskSnapshot *DiskSnapshot `locationName:"diskSnapshot" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetDiskSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetDiskSnapshot sets the DiskSnapshot field's value.
+func (s *GetDiskSnapshotOutput) SetDiskSnapshot(v *DiskSnapshot) *GetDiskSnapshotOutput {
+ s.DiskSnapshot = v
+ return s
+}
+
+type GetDiskSnapshotsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your GetDiskSnapshots
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDiskSnapshotsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskSnapshotsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetDiskSnapshotsInput) SetPageToken(v string) *GetDiskSnapshotsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetDiskSnapshotsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of objects containing information about all block storage disk snapshots.
+ DiskSnapshots []*DiskSnapshot `locationName:"diskSnapshots" type:"list"`
+
+ // A token used for advancing to the next page of results from your GetDiskSnapshots
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDiskSnapshotsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDiskSnapshotsOutput) GoString() string {
+ return s.String()
+}
+
+// SetDiskSnapshots sets the DiskSnapshots field's value.
+func (s *GetDiskSnapshotsOutput) SetDiskSnapshots(v []*DiskSnapshot) *GetDiskSnapshotsOutput {
+ s.DiskSnapshots = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetDiskSnapshotsOutput) SetNextPageToken(v string) *GetDiskSnapshotsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetDisksInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your GetDisks
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDisksInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDisksInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetDisksInput) SetPageToken(v string) *GetDisksInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetDisksOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of objects containing information about all block storage disks.
+ Disks []*Disk `locationName:"disks" type:"list"`
+
+ // A token used for advancing to the next page of results from your GetDisks
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDisksOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDisksOutput) GoString() string {
+ return s.String()
+}
+
+// SetDisks sets the Disks field's value.
+func (s *GetDisksOutput) SetDisks(v []*Disk) *GetDisksOutput {
+ s.Disks = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetDisksOutput) SetNextPageToken(v string) *GetDisksOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetDomainInput struct {
+ _ struct{} `type:"structure"`
+
+ // The domain name for which your want to return information about.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetDomainInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDomainInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetDomainInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetDomainInput"}
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *GetDomainInput) SetDomainName(v string) *GetDomainInput {
+ s.DomainName = &v
+ return s
+}
+
+type GetDomainOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about your get domain
+ // request.
+ Domain *Domain `locationName:"domain" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetDomainOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDomainOutput) GoString() string {
+ return s.String()
+}
+
+// SetDomain sets the Domain field's value.
+func (s *GetDomainOutput) SetDomain(v *Domain) *GetDomainOutput {
+ s.Domain = v
+ return s
+}
+
+type GetDomainsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get domains
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDomainsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDomainsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetDomainsInput) SetPageToken(v string) *GetDomainsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetDomainsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about each of the domain
+ // entries in the user's account.
+ Domains []*Domain `locationName:"domains" type:"list"`
+
+ // A token used for advancing to the next page of results from your get active
+ // names request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetDomainsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetDomainsOutput) GoString() string {
+ return s.String()
+}
+
+// SetDomains sets the Domains field's value.
+func (s *GetDomainsOutput) SetDomains(v []*Domain) *GetDomainsOutput {
+ s.Domains = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetDomainsOutput) SetNextPageToken(v string) *GetDomainsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetInstanceAccessDetailsInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance to access.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // The protocol to use to connect to your instance. Defaults to ssh.
+ Protocol *string `locationName:"protocol" type:"string" enum:"InstanceAccessProtocol"`
+}
+
+// String returns the string representation
+func (s GetInstanceAccessDetailsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceAccessDetailsInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstanceAccessDetailsInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstanceAccessDetailsInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *GetInstanceAccessDetailsInput) SetInstanceName(v string) *GetInstanceAccessDetailsInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *GetInstanceAccessDetailsInput) SetProtocol(v string) *GetInstanceAccessDetailsInput {
+ s.Protocol = &v
+ return s
+}
+
+type GetInstanceAccessDetailsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about a get instance access
+ // request.
+ AccessDetails *InstanceAccessDetails `locationName:"accessDetails" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetInstanceAccessDetailsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceAccessDetailsOutput) GoString() string {
+ return s.String()
+}
+
+// SetAccessDetails sets the AccessDetails field's value.
+func (s *GetInstanceAccessDetailsOutput) SetAccessDetails(v *InstanceAccessDetails) *GetInstanceAccessDetailsOutput {
+ s.AccessDetails = v
+ return s
+}
+
+type GetInstanceInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetInstanceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstanceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstanceInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *GetInstanceInput) SetInstanceName(v string) *GetInstanceInput {
+ s.InstanceName = &v
+ return s
+}
+
+type GetInstanceMetricDataInput struct {
+ _ struct{} `type:"structure"`
+
+ // The end time of the time period.
+ //
+ // EndTime is a required field
+ EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"unix" required:"true"`
+
+ // The name of the instance for which you want to get metrics data.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // The metric name to get data about.
+ //
+ // MetricName is a required field
+ MetricName *string `locationName:"metricName" type:"string" required:"true" enum:"InstanceMetricName"`
+
+ // The time period for which you are requesting data.
+ //
+ // Period is a required field
+ Period *int64 `locationName:"period" min:"60" type:"integer" required:"true"`
+
+ // The start time of the time period.
+ //
+ // StartTime is a required field
+ StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"unix" required:"true"`
+
+ // The instance statistics.
+ //
+ // Statistics is a required field
+ Statistics []*string `locationName:"statistics" type:"list" required:"true"`
+
+ // The unit. The list of valid values is below.
+ //
+ // Unit is a required field
+ Unit *string `locationName:"unit" type:"string" required:"true" enum:"MetricUnit"`
+}
+
+// String returns the string representation
+func (s GetInstanceMetricDataInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceMetricDataInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstanceMetricDataInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstanceMetricDataInput"}
+ if s.EndTime == nil {
+ invalidParams.Add(request.NewErrParamRequired("EndTime"))
+ }
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.MetricName == nil {
+ invalidParams.Add(request.NewErrParamRequired("MetricName"))
+ }
+ if s.Period == nil {
+ invalidParams.Add(request.NewErrParamRequired("Period"))
+ }
+ if s.Period != nil && *s.Period < 60 {
+ invalidParams.Add(request.NewErrParamMinValue("Period", 60))
+ }
+ if s.StartTime == nil {
+ invalidParams.Add(request.NewErrParamRequired("StartTime"))
+ }
+ if s.Statistics == nil {
+ invalidParams.Add(request.NewErrParamRequired("Statistics"))
+ }
+ if s.Unit == nil {
+ invalidParams.Add(request.NewErrParamRequired("Unit"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetEndTime sets the EndTime field's value.
+func (s *GetInstanceMetricDataInput) SetEndTime(v time.Time) *GetInstanceMetricDataInput {
+ s.EndTime = &v
+ return s
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *GetInstanceMetricDataInput) SetInstanceName(v string) *GetInstanceMetricDataInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetMetricName sets the MetricName field's value.
+func (s *GetInstanceMetricDataInput) SetMetricName(v string) *GetInstanceMetricDataInput {
+ s.MetricName = &v
+ return s
+}
+
+// SetPeriod sets the Period field's value.
+func (s *GetInstanceMetricDataInput) SetPeriod(v int64) *GetInstanceMetricDataInput {
+ s.Period = &v
+ return s
+}
+
+// SetStartTime sets the StartTime field's value.
+func (s *GetInstanceMetricDataInput) SetStartTime(v time.Time) *GetInstanceMetricDataInput {
+ s.StartTime = &v
+ return s
+}
+
+// SetStatistics sets the Statistics field's value.
+func (s *GetInstanceMetricDataInput) SetStatistics(v []*string) *GetInstanceMetricDataInput {
+ s.Statistics = v
+ return s
+}
+
+// SetUnit sets the Unit field's value.
+func (s *GetInstanceMetricDataInput) SetUnit(v string) *GetInstanceMetricDataInput {
+ s.Unit = &v
+ return s
+}
+
+type GetInstanceMetricDataOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get instance metric data request.
+ MetricData []*MetricDatapoint `locationName:"metricData" type:"list"`
+
+ // The metric name to return data for.
+ MetricName *string `locationName:"metricName" type:"string" enum:"InstanceMetricName"`
+}
+
+// String returns the string representation
+func (s GetInstanceMetricDataOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceMetricDataOutput) GoString() string {
+ return s.String()
+}
+
+// SetMetricData sets the MetricData field's value.
+func (s *GetInstanceMetricDataOutput) SetMetricData(v []*MetricDatapoint) *GetInstanceMetricDataOutput {
+ s.MetricData = v
+ return s
+}
+
+// SetMetricName sets the MetricName field's value.
+func (s *GetInstanceMetricDataOutput) SetMetricName(v string) *GetInstanceMetricDataOutput {
+ s.MetricName = &v
+ return s
+}
+
+type GetInstanceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the specified instance.
+ Instance *Instance `locationName:"instance" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetInstanceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceOutput) GoString() string {
+ return s.String()
+}
+
+// SetInstance sets the Instance field's value.
+func (s *GetInstanceOutput) SetInstance(v *Instance) *GetInstanceOutput {
+ s.Instance = v
+ return s
+}
+
+type GetInstancePortStatesInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetInstancePortStatesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstancePortStatesInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstancePortStatesInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstancePortStatesInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *GetInstancePortStatesInput) SetInstanceName(v string) *GetInstancePortStatesInput {
+ s.InstanceName = &v
+ return s
+}
+
+type GetInstancePortStatesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // Information about the port states resulting from your request.
+ PortStates []*InstancePortState `locationName:"portStates" type:"list"`
+}
+
+// String returns the string representation
+func (s GetInstancePortStatesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstancePortStatesOutput) GoString() string {
+ return s.String()
+}
+
+// SetPortStates sets the PortStates field's value.
+func (s *GetInstancePortStatesOutput) SetPortStates(v []*InstancePortState) *GetInstancePortStatesOutput {
+ s.PortStates = v
+ return s
+}
+
+type GetInstanceSnapshotInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the snapshot for which you are requesting information.
+ //
+ // InstanceSnapshotName is a required field
+ InstanceSnapshotName *string `locationName:"instanceSnapshotName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetInstanceSnapshotInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceSnapshotInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstanceSnapshotInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstanceSnapshotInput"}
+ if s.InstanceSnapshotName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceSnapshotName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceSnapshotName sets the InstanceSnapshotName field's value.
+func (s *GetInstanceSnapshotInput) SetInstanceSnapshotName(v string) *GetInstanceSnapshotInput {
+ s.InstanceSnapshotName = &v
+ return s
+}
+
+type GetInstanceSnapshotOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get instance snapshot request.
+ InstanceSnapshot *InstanceSnapshot `locationName:"instanceSnapshot" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetInstanceSnapshotOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceSnapshotOutput) GoString() string {
+ return s.String()
+}
+
+// SetInstanceSnapshot sets the InstanceSnapshot field's value.
+func (s *GetInstanceSnapshotOutput) SetInstanceSnapshot(v *InstanceSnapshot) *GetInstanceSnapshotOutput {
+ s.InstanceSnapshot = v
+ return s
+}
+
+type GetInstanceSnapshotsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get instance
+ // snapshots request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetInstanceSnapshotsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceSnapshotsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetInstanceSnapshotsInput) SetPageToken(v string) *GetInstanceSnapshotsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetInstanceSnapshotsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get instance snapshots request.
+ InstanceSnapshots []*InstanceSnapshot `locationName:"instanceSnapshots" type:"list"`
+
+ // A token used for advancing to the next page of results from your get instance
+ // snapshots request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetInstanceSnapshotsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceSnapshotsOutput) GoString() string {
+ return s.String()
+}
+
+// SetInstanceSnapshots sets the InstanceSnapshots field's value.
+func (s *GetInstanceSnapshotsOutput) SetInstanceSnapshots(v []*InstanceSnapshot) *GetInstanceSnapshotsOutput {
+ s.InstanceSnapshots = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetInstanceSnapshotsOutput) SetNextPageToken(v string) *GetInstanceSnapshotsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetInstanceStateInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance to get state information about.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetInstanceStateInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceStateInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetInstanceStateInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetInstanceStateInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *GetInstanceStateInput) SetInstanceName(v string) *GetInstanceStateInput {
+ s.InstanceName = &v
+ return s
+}
+
+type GetInstanceStateOutput struct {
+ _ struct{} `type:"structure"`
+
+ // The state of the instance.
+ State *InstanceState `locationName:"state" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetInstanceStateOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstanceStateOutput) GoString() string {
+ return s.String()
+}
+
+// SetState sets the State field's value.
+func (s *GetInstanceStateOutput) SetState(v *InstanceState) *GetInstanceStateOutput {
+ s.State = v
+ return s
+}
+
+type GetInstancesInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get instances
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetInstancesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstancesInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetInstancesInput) SetPageToken(v string) *GetInstancesInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetInstancesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about your instances.
+ Instances []*Instance `locationName:"instances" type:"list"`
+
+ // A token used for advancing to the next page of results from your get instances
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetInstancesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetInstancesOutput) GoString() string {
+ return s.String()
+}
+
+// SetInstances sets the Instances field's value.
+func (s *GetInstancesOutput) SetInstances(v []*Instance) *GetInstancesOutput {
+ s.Instances = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetInstancesOutput) SetNextPageToken(v string) *GetInstancesOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetKeyPairInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the key pair for which you are requesting information.
+ //
+ // KeyPairName is a required field
+ KeyPairName *string `locationName:"keyPairName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetKeyPairInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetKeyPairInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetKeyPairInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetKeyPairInput"}
+ if s.KeyPairName == nil {
+ invalidParams.Add(request.NewErrParamRequired("KeyPairName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *GetKeyPairInput) SetKeyPairName(v string) *GetKeyPairInput {
+ s.KeyPairName = &v
+ return s
+}
+
+type GetKeyPairOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the key pair.
+ KeyPair *KeyPair `locationName:"keyPair" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetKeyPairOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetKeyPairOutput) GoString() string {
+ return s.String()
+}
+
+// SetKeyPair sets the KeyPair field's value.
+func (s *GetKeyPairOutput) SetKeyPair(v *KeyPair) *GetKeyPairOutput {
+ s.KeyPair = v
+ return s
+}
+
+type GetKeyPairsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get key
+ // pairs request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetKeyPairsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetKeyPairsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetKeyPairsInput) SetPageToken(v string) *GetKeyPairsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetKeyPairsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the key pairs.
+ KeyPairs []*KeyPair `locationName:"keyPairs" type:"list"`
+
+ // A token used for advancing to the next page of results from your get key
+ // pairs request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetKeyPairsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetKeyPairsOutput) GoString() string {
+ return s.String()
+}
+
+// SetKeyPairs sets the KeyPairs field's value.
+func (s *GetKeyPairsOutput) SetKeyPairs(v []*KeyPair) *GetKeyPairsOutput {
+ s.KeyPairs = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetKeyPairsOutput) SetNextPageToken(v string) *GetKeyPairsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetLoadBalancerInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the load balancer.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetLoadBalancerInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetLoadBalancerInput"}
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *GetLoadBalancerInput) SetLoadBalancerName(v string) *GetLoadBalancerInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type GetLoadBalancerMetricDataInput struct {
+ _ struct{} `type:"structure"`
+
+ // The end time of the period.
+ //
+ // EndTime is a required field
+ EndTime *time.Time `locationName:"endTime" type:"timestamp" timestampFormat:"unix" required:"true"`
+
+ // The name of the load balancer.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+
+ // The metric about which you want to return information. Valid values are listed
+ // below, along with the most useful statistics to include in your request.
+ //
+ // * ClientTLSNegotiationErrorCount - The number of TLS connections initiated
+ // by the client that did not establish a session with the load balancer.
+ // Possible causes include a mismatch of ciphers or protocols.
+ //
+ // Statistics: The most useful statistic is Sum.
+ //
+ // * HealthyHostCount - The number of target instances that are considered
+ // healthy.
+ //
+ // Statistics: The most useful statistic are Average, Minimum, and Maximum.
+ //
+ // * UnhealthyHostCount - The number of target instances that are considered
+ // unhealthy.
+ //
+ // Statistics: The most useful statistic are Average, Minimum, and Maximum.
+ //
+ // * HTTPCode_LB_4XX_Count - The number of HTTP 4XX client error codes that
+ // originate from the load balancer. Client errors are generated when requests
+ // are malformed or incomplete. These requests have not been received by
+ // the target instance. This count does not include any response codes generated
+ // by the target instances.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // * HTTPCode_LB_5XX_Count - The number of HTTP 5XX server error codes that
+ // originate from the load balancer. This count does not include any response
+ // codes generated by the target instances.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1. Note that Minimum, Maximum, and Average all
+ // return 1.
+ //
+ // * HTTPCode_Instance_2XX_Count - The number of HTTP response codes generated
+ // by the target instances. This does not include any response codes generated
+ // by the load balancer.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // * HTTPCode_Instance_3XX_Count - The number of HTTP response codes generated
+ // by the target instances. This does not include any response codes generated
+ // by the load balancer.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // * HTTPCode_Instance_4XX_Count - The number of HTTP response codes generated
+ // by the target instances. This does not include any response codes generated
+ // by the load balancer.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // * HTTPCode_Instance_5XX_Count - The number of HTTP response codes generated
+ // by the target instances. This does not include any response codes generated
+ // by the load balancer.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // * InstanceResponseTime - The time elapsed, in seconds, after the request
+ // leaves the load balancer until a response from the target instance is
+ // received.
+ //
+ // Statistics: The most useful statistic is Average.
+ //
+ // * RejectedConnectionCount - The number of connections that were rejected
+ // because the load balancer had reached its maximum number of connections.
+ //
+ // Statistics: The most useful statistic is Sum.
+ //
+ // * RequestCount - The number of requests processed over IPv4. This count
+ // includes only the requests with a response generated by a target instance
+ // of the load balancer.
+ //
+ // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum,
+ // and Average all return 1.
+ //
+ // MetricName is a required field
+ MetricName *string `locationName:"metricName" type:"string" required:"true" enum:"LoadBalancerMetricName"`
+
+ // The time period duration for your health data request.
+ //
+ // Period is a required field
+ Period *int64 `locationName:"period" min:"60" type:"integer" required:"true"`
+
+ // The start time of the period.
+ //
+ // StartTime is a required field
+ StartTime *time.Time `locationName:"startTime" type:"timestamp" timestampFormat:"unix" required:"true"`
+
+ // An array of statistics that you want to request metrics for. Valid values
+ // are listed below.
+ //
+ // Statistics is a required field
+ Statistics []*string `locationName:"statistics" type:"list" required:"true"`
+
+ // The unit for the time period request. Valid values are listed below.
+ //
+ // Unit is a required field
+ Unit *string `locationName:"unit" type:"string" required:"true" enum:"MetricUnit"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerMetricDataInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerMetricDataInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetLoadBalancerMetricDataInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetLoadBalancerMetricDataInput"}
+ if s.EndTime == nil {
+ invalidParams.Add(request.NewErrParamRequired("EndTime"))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+ if s.MetricName == nil {
+ invalidParams.Add(request.NewErrParamRequired("MetricName"))
+ }
+ if s.Period == nil {
+ invalidParams.Add(request.NewErrParamRequired("Period"))
+ }
+ if s.Period != nil && *s.Period < 60 {
+ invalidParams.Add(request.NewErrParamMinValue("Period", 60))
+ }
+ if s.StartTime == nil {
+ invalidParams.Add(request.NewErrParamRequired("StartTime"))
+ }
+ if s.Statistics == nil {
+ invalidParams.Add(request.NewErrParamRequired("Statistics"))
+ }
+ if s.Unit == nil {
+ invalidParams.Add(request.NewErrParamRequired("Unit"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetEndTime sets the EndTime field's value.
+func (s *GetLoadBalancerMetricDataInput) SetEndTime(v time.Time) *GetLoadBalancerMetricDataInput {
+ s.EndTime = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *GetLoadBalancerMetricDataInput) SetLoadBalancerName(v string) *GetLoadBalancerMetricDataInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+// SetMetricName sets the MetricName field's value.
+func (s *GetLoadBalancerMetricDataInput) SetMetricName(v string) *GetLoadBalancerMetricDataInput {
+ s.MetricName = &v
+ return s
+}
+
+// SetPeriod sets the Period field's value.
+func (s *GetLoadBalancerMetricDataInput) SetPeriod(v int64) *GetLoadBalancerMetricDataInput {
+ s.Period = &v
+ return s
+}
+
+// SetStartTime sets the StartTime field's value.
+func (s *GetLoadBalancerMetricDataInput) SetStartTime(v time.Time) *GetLoadBalancerMetricDataInput {
+ s.StartTime = &v
+ return s
+}
+
+// SetStatistics sets the Statistics field's value.
+func (s *GetLoadBalancerMetricDataInput) SetStatistics(v []*string) *GetLoadBalancerMetricDataInput {
+ s.Statistics = v
+ return s
+}
+
+// SetUnit sets the Unit field's value.
+func (s *GetLoadBalancerMetricDataInput) SetUnit(v string) *GetLoadBalancerMetricDataInput {
+ s.Unit = &v
+ return s
+}
+
+type GetLoadBalancerMetricDataOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of metric datapoint objects.
+ MetricData []*MetricDatapoint `locationName:"metricData" type:"list"`
+
+ // The metric about which you are receiving information. Valid values are listed
+ // below.
+ MetricName *string `locationName:"metricName" type:"string" enum:"LoadBalancerMetricName"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerMetricDataOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerMetricDataOutput) GoString() string {
+ return s.String()
+}
+
+// SetMetricData sets the MetricData field's value.
+func (s *GetLoadBalancerMetricDataOutput) SetMetricData(v []*MetricDatapoint) *GetLoadBalancerMetricDataOutput {
+ s.MetricData = v
+ return s
+}
+
+// SetMetricName sets the MetricName field's value.
+func (s *GetLoadBalancerMetricDataOutput) SetMetricName(v string) *GetLoadBalancerMetricDataOutput {
+ s.MetricName = &v
+ return s
+}
+
+type GetLoadBalancerOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object containing information about your load balancer.
+ LoadBalancer *LoadBalancer `locationName:"loadBalancer" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerOutput) GoString() string {
+ return s.String()
+}
+
+// SetLoadBalancer sets the LoadBalancer field's value.
+func (s *GetLoadBalancerOutput) SetLoadBalancer(v *LoadBalancer) *GetLoadBalancerOutput {
+ s.LoadBalancer = v
+ return s
+}
+
+type GetLoadBalancerTlsCertificatesInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the load balancer where you stored your TLS/SSL certificate.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerTlsCertificatesInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerTlsCertificatesInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetLoadBalancerTlsCertificatesInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetLoadBalancerTlsCertificatesInput"}
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *GetLoadBalancerTlsCertificatesInput) SetLoadBalancerName(v string) *GetLoadBalancerTlsCertificatesInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type GetLoadBalancerTlsCertificatesOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of LoadBalancerTlsCertificate objects describing your TLS/SSL certificates.
+ TlsCertificates []*LoadBalancerTlsCertificate `locationName:"tlsCertificates" type:"list"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancerTlsCertificatesOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancerTlsCertificatesOutput) GoString() string {
+ return s.String()
+}
+
+// SetTlsCertificates sets the TlsCertificates field's value.
+func (s *GetLoadBalancerTlsCertificatesOutput) SetTlsCertificates(v []*LoadBalancerTlsCertificate) *GetLoadBalancerTlsCertificatesOutput {
+ s.TlsCertificates = v
+ return s
+}
+
+type GetLoadBalancersInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for paginating the results from your GetLoadBalancers request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancersInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancersInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetLoadBalancersInput) SetPageToken(v string) *GetLoadBalancersInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetLoadBalancersOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of LoadBalancer objects describing your load balancers.
+ LoadBalancers []*LoadBalancer `locationName:"loadBalancers" type:"list"`
+
+ // A token used for advancing to the next page of results from your GetLoadBalancers
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetLoadBalancersOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetLoadBalancersOutput) GoString() string {
+ return s.String()
+}
+
+// SetLoadBalancers sets the LoadBalancers field's value.
+func (s *GetLoadBalancersOutput) SetLoadBalancers(v []*LoadBalancer) *GetLoadBalancersOutput {
+ s.LoadBalancers = v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetLoadBalancersOutput) SetNextPageToken(v string) *GetLoadBalancersOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+type GetOperationInput struct {
+ _ struct{} `type:"structure"`
+
+ // A GUID used to identify the operation.
+ //
+ // OperationId is a required field
+ OperationId *string `locationName:"operationId" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetOperationInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetOperationInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetOperationInput"}
+ if s.OperationId == nil {
+ invalidParams.Add(request.NewErrParamRequired("OperationId"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetOperationId sets the OperationId field's value.
+func (s *GetOperationInput) SetOperationId(v string) *GetOperationInput {
+ s.OperationId = &v
+ return s
+}
+
+type GetOperationOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get operation request.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetOperationOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *GetOperationOutput) SetOperation(v *Operation) *GetOperationOutput {
+ s.Operation = v
+ return s
+}
+
+type GetOperationsForResourceInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get operations
+ // for resource request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+
+ // The name of the resource for which you are requesting information.
+ //
+ // ResourceName is a required field
+ ResourceName *string `locationName:"resourceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetOperationsForResourceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationsForResourceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetOperationsForResourceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetOperationsForResourceInput"}
+ if s.ResourceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("ResourceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetOperationsForResourceInput) SetPageToken(v string) *GetOperationsForResourceInput {
+ s.PageToken = &v
+ return s
+}
+
+// SetResourceName sets the ResourceName field's value.
+func (s *GetOperationsForResourceInput) SetResourceName(v string) *GetOperationsForResourceInput {
+ s.ResourceName = &v
+ return s
+}
+
+type GetOperationsForResourceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // (Deprecated) Returns the number of pages of results that remain.
+ //
+ // In releases prior to June 12, 2017, this parameter returned null by the API.
+ // It is now deprecated, and the API returns the nextPageToken parameter instead.
+ NextPageCount *string `locationName:"nextPageCount" deprecated:"true" type:"string"`
+
+ // An identifier that was returned from the previous call to this operation,
+ // which can be used to return the next set of items in the list.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get operations for resource request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s GetOperationsForResourceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationsForResourceOutput) GoString() string {
+ return s.String()
+}
+
+// SetNextPageCount sets the NextPageCount field's value.
+func (s *GetOperationsForResourceOutput) SetNextPageCount(v string) *GetOperationsForResourceOutput {
+ s.NextPageCount = &v
+ return s
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetOperationsForResourceOutput) SetNextPageToken(v string) *GetOperationsForResourceOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+// SetOperations sets the Operations field's value.
+func (s *GetOperationsForResourceOutput) SetOperations(v []*Operation) *GetOperationsForResourceOutput {
+ s.Operations = v
+ return s
+}
+
+type GetOperationsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get operations
+ // request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetOperationsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetOperationsInput) SetPageToken(v string) *GetOperationsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetOperationsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get operations
+ // request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+
+ // An array of key-value pairs containing information about the results of your
+ // get operations request.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s GetOperationsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetOperationsOutput) GoString() string {
+ return s.String()
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetOperationsOutput) SetNextPageToken(v string) *GetOperationsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+// SetOperations sets the Operations field's value.
+func (s *GetOperationsOutput) SetOperations(v []*Operation) *GetOperationsOutput {
+ s.Operations = v
+ return s
+}
+
+type GetRegionsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A Boolean value indicating whether to also include Availability Zones in
+ // your get regions request. Availability Zones are indicated with a letter:
+ // e.g., us-east-2a.
+ IncludeAvailabilityZones *bool `locationName:"includeAvailabilityZones" type:"boolean"`
+}
+
+// String returns the string representation
+func (s GetRegionsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetRegionsInput) GoString() string {
+ return s.String()
+}
+
+// SetIncludeAvailabilityZones sets the IncludeAvailabilityZones field's value.
+func (s *GetRegionsInput) SetIncludeAvailabilityZones(v bool) *GetRegionsInput {
+ s.IncludeAvailabilityZones = &v
+ return s
+}
+
+type GetRegionsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about your get regions
+ // request.
+ Regions []*Region `locationName:"regions" type:"list"`
+}
+
+// String returns the string representation
+func (s GetRegionsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetRegionsOutput) GoString() string {
+ return s.String()
+}
+
+// SetRegions sets the Regions field's value.
+func (s *GetRegionsOutput) SetRegions(v []*Region) *GetRegionsOutput {
+ s.Regions = v
+ return s
+}
+
+type GetStaticIpInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the static IP in Lightsail.
+ //
+ // StaticIpName is a required field
+ StaticIpName *string `locationName:"staticIpName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s GetStaticIpInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetStaticIpInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *GetStaticIpInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "GetStaticIpInput"}
+ if s.StaticIpName == nil {
+ invalidParams.Add(request.NewErrParamRequired("StaticIpName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetStaticIpName sets the StaticIpName field's value.
+func (s *GetStaticIpInput) SetStaticIpName(v string) *GetStaticIpInput {
+ s.StaticIpName = &v
+ return s
+}
+
+type GetStaticIpOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the requested static
+ // IP.
+ StaticIp *StaticIp `locationName:"staticIp" type:"structure"`
+}
+
+// String returns the string representation
+func (s GetStaticIpOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetStaticIpOutput) GoString() string {
+ return s.String()
+}
+
+// SetStaticIp sets the StaticIp field's value.
+func (s *GetStaticIpOutput) SetStaticIp(v *StaticIp) *GetStaticIpOutput {
+ s.StaticIp = v
+ return s
+}
+
+type GetStaticIpsInput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get static
+ // IPs request.
+ PageToken *string `locationName:"pageToken" type:"string"`
+}
+
+// String returns the string representation
+func (s GetStaticIpsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetStaticIpsInput) GoString() string {
+ return s.String()
+}
+
+// SetPageToken sets the PageToken field's value.
+func (s *GetStaticIpsInput) SetPageToken(v string) *GetStaticIpsInput {
+ s.PageToken = &v
+ return s
+}
+
+type GetStaticIpsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // A token used for advancing to the next page of results from your get static
+ // IPs request.
+ NextPageToken *string `locationName:"nextPageToken" type:"string"`
+
+ // An array of key-value pairs containing information about your get static
+ // IPs request.
+ StaticIps []*StaticIp `locationName:"staticIps" type:"list"`
+}
+
+// String returns the string representation
+func (s GetStaticIpsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s GetStaticIpsOutput) GoString() string {
+ return s.String()
+}
+
+// SetNextPageToken sets the NextPageToken field's value.
+func (s *GetStaticIpsOutput) SetNextPageToken(v string) *GetStaticIpsOutput {
+ s.NextPageToken = &v
+ return s
+}
+
+// SetStaticIps sets the StaticIps field's value.
+func (s *GetStaticIpsOutput) SetStaticIps(v []*StaticIp) *GetStaticIpsOutput {
+ s.StaticIps = v
+ return s
+}
+
+type ImportKeyPairInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the key pair for which you want to import the public key.
+ //
+ // KeyPairName is a required field
+ KeyPairName *string `locationName:"keyPairName" type:"string" required:"true"`
+
+ // A base64-encoded public key of the ssh-rsa type.
+ //
+ // PublicKeyBase64 is a required field
+ PublicKeyBase64 *string `locationName:"publicKeyBase64" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s ImportKeyPairInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s ImportKeyPairInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *ImportKeyPairInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "ImportKeyPairInput"}
+ if s.KeyPairName == nil {
+ invalidParams.Add(request.NewErrParamRequired("KeyPairName"))
+ }
+ if s.PublicKeyBase64 == nil {
+ invalidParams.Add(request.NewErrParamRequired("PublicKeyBase64"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *ImportKeyPairInput) SetKeyPairName(v string) *ImportKeyPairInput {
+ s.KeyPairName = &v
+ return s
+}
+
+// SetPublicKeyBase64 sets the PublicKeyBase64 field's value.
+func (s *ImportKeyPairInput) SetPublicKeyBase64(v string) *ImportKeyPairInput {
+ s.PublicKeyBase64 = &v
+ return s
+}
+
+type ImportKeyPairOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s ImportKeyPairOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s ImportKeyPairOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *ImportKeyPairOutput) SetOperation(v *Operation) *ImportKeyPairOutput {
+ s.Operation = v
+ return s
+}
+
+// Describes an instance (a virtual private server).
+type Instance struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the instance (e.g., arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE).
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The blueprint ID (e.g., os_amlinux_2016_03).
+ BlueprintId *string `locationName:"blueprintId" type:"string"`
+
+ // The friendly name of the blueprint (e.g., Amazon Linux).
+ BlueprintName *string `locationName:"blueprintName" type:"string"`
+
+ // The bundle for the instance (e.g., micro_1_0).
+ BundleId *string `locationName:"bundleId" type:"string"`
+
+ // The timestamp when the instance was created (e.g., 1479734909.17).
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The size of the vCPU and the amount of RAM for the instance.
+ Hardware *InstanceHardware `locationName:"hardware" type:"structure"`
+
+ // The IPv6 address of the instance.
+ Ipv6Address *string `locationName:"ipv6Address" type:"string"`
+
+ // A Boolean value indicating whether this instance has a static IP assigned
+ // to it.
+ IsStaticIp *bool `locationName:"isStaticIp" type:"boolean"`
+
+ // The region name and availability zone where the instance is located.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name the user gave the instance (e.g., Amazon_Linux-1GB-Ohio-1).
+ Name *string `locationName:"name" type:"string"`
+
+ // Information about the public ports and monthly data transfer rates for the
+ // instance.
+ Networking *InstanceNetworking `locationName:"networking" type:"structure"`
+
+ // The private IP address of the instance.
+ PrivateIpAddress *string `locationName:"privateIpAddress" type:"string"`
+
+ // The public IP address of the instance.
+ PublicIpAddress *string `locationName:"publicIpAddress" type:"string"`
+
+ // The type of resource (usually Instance).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The name of the SSH key being used to connect to the instance (e.g., LightsailDefaultKeyPair).
+ SshKeyName *string `locationName:"sshKeyName" type:"string"`
+
+ // The status code and the state (e.g., running) for the instance.
+ State *InstanceState `locationName:"state" type:"structure"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+
+ // The user name for connecting to the instance (e.g., ec2-user).
+ Username *string `locationName:"username" type:"string"`
+}
+
+// String returns the string representation
+func (s Instance) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Instance) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *Instance) SetArn(v string) *Instance {
+ s.Arn = &v
+ return s
+}
+
+// SetBlueprintId sets the BlueprintId field's value.
+func (s *Instance) SetBlueprintId(v string) *Instance {
+ s.BlueprintId = &v
+ return s
+}
+
+// SetBlueprintName sets the BlueprintName field's value.
+func (s *Instance) SetBlueprintName(v string) *Instance {
+ s.BlueprintName = &v
+ return s
+}
+
+// SetBundleId sets the BundleId field's value.
+func (s *Instance) SetBundleId(v string) *Instance {
+ s.BundleId = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *Instance) SetCreatedAt(v time.Time) *Instance {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetHardware sets the Hardware field's value.
+func (s *Instance) SetHardware(v *InstanceHardware) *Instance {
+ s.Hardware = v
+ return s
+}
+
+// SetIpv6Address sets the Ipv6Address field's value.
+func (s *Instance) SetIpv6Address(v string) *Instance {
+ s.Ipv6Address = &v
+ return s
+}
+
+// SetIsStaticIp sets the IsStaticIp field's value.
+func (s *Instance) SetIsStaticIp(v bool) *Instance {
+ s.IsStaticIp = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *Instance) SetLocation(v *ResourceLocation) *Instance {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Instance) SetName(v string) *Instance {
+ s.Name = &v
+ return s
+}
+
+// SetNetworking sets the Networking field's value.
+func (s *Instance) SetNetworking(v *InstanceNetworking) *Instance {
+ s.Networking = v
+ return s
+}
+
+// SetPrivateIpAddress sets the PrivateIpAddress field's value.
+func (s *Instance) SetPrivateIpAddress(v string) *Instance {
+ s.PrivateIpAddress = &v
+ return s
+}
+
+// SetPublicIpAddress sets the PublicIpAddress field's value.
+func (s *Instance) SetPublicIpAddress(v string) *Instance {
+ s.PublicIpAddress = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *Instance) SetResourceType(v string) *Instance {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSshKeyName sets the SshKeyName field's value.
+func (s *Instance) SetSshKeyName(v string) *Instance {
+ s.SshKeyName = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *Instance) SetState(v *InstanceState) *Instance {
+ s.State = v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *Instance) SetSupportCode(v string) *Instance {
+ s.SupportCode = &v
+ return s
+}
+
+// SetUsername sets the Username field's value.
+func (s *Instance) SetUsername(v string) *Instance {
+ s.Username = &v
+ return s
+}
+
+// The parameters for gaining temporary access to one of your Amazon Lightsail
+// instances.
+type InstanceAccessDetails struct {
+ _ struct{} `type:"structure"`
+
+ // For SSH access, the public key to use when accessing your instance For OpenSSH
+ // clients (e.g., command line SSH), you should save this value to tempkey-cert.pub.
+ CertKey *string `locationName:"certKey" type:"string"`
+
+ // For SSH access, the date on which the temporary keys expire.
+ ExpiresAt *time.Time `locationName:"expiresAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The name of this Amazon Lightsail instance.
+ InstanceName *string `locationName:"instanceName" type:"string"`
+
+ // The public IP address of the Amazon Lightsail instance.
+ IpAddress *string `locationName:"ipAddress" type:"string"`
+
+ // For RDP access, the password for your Amazon Lightsail instance. Password
+ // will be an empty string if the password for your new instance is not ready
+ // yet. When you create an instance, it can take up to 15 minutes for the instance
+ // to be ready.
+ //
+ // If you create an instance using any key pair other than the default (LightsailDefaultKeyPair),
+ // password will always be an empty string.
+ //
+ // If you change the Administrator password on the instance, Lightsail will
+ // continue to return the original password value. When accessing the instance
+ // using RDP, you need to manually enter the Administrator password after changing
+ // it from the default.
+ Password *string `locationName:"password" type:"string"`
+
+ // For a Windows Server-based instance, an object with the data you can use
+ // to retrieve your password. This is only needed if password is empty and the
+ // instance is not new (and therefore the password is not ready yet). When you
+ // create an instance, it can take up to 15 minutes for the instance to be ready.
+ PasswordData *PasswordData `locationName:"passwordData" type:"structure"`
+
+ // For SSH access, the temporary private key. For OpenSSH clients (e.g., command
+ // line SSH), you should save this value to tempkey).
+ PrivateKey *string `locationName:"privateKey" type:"string"`
+
+ // The protocol for these Amazon Lightsail instance access details.
+ Protocol *string `locationName:"protocol" type:"string" enum:"InstanceAccessProtocol"`
+
+ // The user name to use when logging in to the Amazon Lightsail instance.
+ Username *string `locationName:"username" type:"string"`
+}
+
+// String returns the string representation
+func (s InstanceAccessDetails) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceAccessDetails) GoString() string {
+ return s.String()
+}
+
+// SetCertKey sets the CertKey field's value.
+func (s *InstanceAccessDetails) SetCertKey(v string) *InstanceAccessDetails {
+ s.CertKey = &v
+ return s
+}
+
+// SetExpiresAt sets the ExpiresAt field's value.
+func (s *InstanceAccessDetails) SetExpiresAt(v time.Time) *InstanceAccessDetails {
+ s.ExpiresAt = &v
+ return s
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *InstanceAccessDetails) SetInstanceName(v string) *InstanceAccessDetails {
+ s.InstanceName = &v
+ return s
+}
+
+// SetIpAddress sets the IpAddress field's value.
+func (s *InstanceAccessDetails) SetIpAddress(v string) *InstanceAccessDetails {
+ s.IpAddress = &v
+ return s
+}
+
+// SetPassword sets the Password field's value.
+func (s *InstanceAccessDetails) SetPassword(v string) *InstanceAccessDetails {
+ s.Password = &v
+ return s
+}
+
+// SetPasswordData sets the PasswordData field's value.
+func (s *InstanceAccessDetails) SetPasswordData(v *PasswordData) *InstanceAccessDetails {
+ s.PasswordData = v
+ return s
+}
+
+// SetPrivateKey sets the PrivateKey field's value.
+func (s *InstanceAccessDetails) SetPrivateKey(v string) *InstanceAccessDetails {
+ s.PrivateKey = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *InstanceAccessDetails) SetProtocol(v string) *InstanceAccessDetails {
+ s.Protocol = &v
+ return s
+}
+
+// SetUsername sets the Username field's value.
+func (s *InstanceAccessDetails) SetUsername(v string) *InstanceAccessDetails {
+ s.Username = &v
+ return s
+}
+
+// Describes the hardware for the instance.
+type InstanceHardware struct {
+ _ struct{} `type:"structure"`
+
+ // The number of vCPUs the instance has.
+ CpuCount *int64 `locationName:"cpuCount" type:"integer"`
+
+ // The disks attached to the instance.
+ Disks []*Disk `locationName:"disks" type:"list"`
+
+ // The amount of RAM in GB on the instance (e.g., 1.0).
+ RamSizeInGb *float64 `locationName:"ramSizeInGb" type:"float"`
+}
+
+// String returns the string representation
+func (s InstanceHardware) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceHardware) GoString() string {
+ return s.String()
+}
+
+// SetCpuCount sets the CpuCount field's value.
+func (s *InstanceHardware) SetCpuCount(v int64) *InstanceHardware {
+ s.CpuCount = &v
+ return s
+}
+
+// SetDisks sets the Disks field's value.
+func (s *InstanceHardware) SetDisks(v []*Disk) *InstanceHardware {
+ s.Disks = v
+ return s
+}
+
+// SetRamSizeInGb sets the RamSizeInGb field's value.
+func (s *InstanceHardware) SetRamSizeInGb(v float64) *InstanceHardware {
+ s.RamSizeInGb = &v
+ return s
+}
+
+// Describes information about the health of the instance.
+type InstanceHealthSummary struct {
+ _ struct{} `type:"structure"`
+
+ // Describes the overall instance health. Valid values are below.
+ InstanceHealth *string `locationName:"instanceHealth" type:"string" enum:"InstanceHealthState"`
+
+ // More information about the instance health. Valid values are below.
+ InstanceHealthReason *string `locationName:"instanceHealthReason" type:"string" enum:"InstanceHealthReason"`
+
+ // The name of the Lightsail instance for which you are requesting health check
+ // data.
+ InstanceName *string `locationName:"instanceName" type:"string"`
+}
+
+// String returns the string representation
+func (s InstanceHealthSummary) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceHealthSummary) GoString() string {
+ return s.String()
+}
+
+// SetInstanceHealth sets the InstanceHealth field's value.
+func (s *InstanceHealthSummary) SetInstanceHealth(v string) *InstanceHealthSummary {
+ s.InstanceHealth = &v
+ return s
+}
+
+// SetInstanceHealthReason sets the InstanceHealthReason field's value.
+func (s *InstanceHealthSummary) SetInstanceHealthReason(v string) *InstanceHealthSummary {
+ s.InstanceHealthReason = &v
+ return s
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *InstanceHealthSummary) SetInstanceName(v string) *InstanceHealthSummary {
+ s.InstanceName = &v
+ return s
+}
+
+// Describes monthly data transfer rates and port information for an instance.
+type InstanceNetworking struct {
+ _ struct{} `type:"structure"`
+
+ // The amount of data in GB allocated for monthly data transfers.
+ MonthlyTransfer *MonthlyTransfer `locationName:"monthlyTransfer" type:"structure"`
+
+ // An array of key-value pairs containing information about the ports on the
+ // instance.
+ Ports []*InstancePortInfo `locationName:"ports" type:"list"`
+}
+
+// String returns the string representation
+func (s InstanceNetworking) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceNetworking) GoString() string {
+ return s.String()
+}
+
+// SetMonthlyTransfer sets the MonthlyTransfer field's value.
+func (s *InstanceNetworking) SetMonthlyTransfer(v *MonthlyTransfer) *InstanceNetworking {
+ s.MonthlyTransfer = v
+ return s
+}
+
+// SetPorts sets the Ports field's value.
+func (s *InstanceNetworking) SetPorts(v []*InstancePortInfo) *InstanceNetworking {
+ s.Ports = v
+ return s
+}
+
+// Describes information about the instance ports.
+type InstancePortInfo struct {
+ _ struct{} `type:"structure"`
+
+ // The access direction (inbound or outbound).
+ AccessDirection *string `locationName:"accessDirection" type:"string" enum:"AccessDirection"`
+
+ // The location from which access is allowed (e.g., Anywhere (0.0.0.0/0)).
+ AccessFrom *string `locationName:"accessFrom" type:"string"`
+
+ // The type of access (Public or Private).
+ AccessType *string `locationName:"accessType" type:"string" enum:"PortAccessType"`
+
+ // The common name.
+ CommonName *string `locationName:"commonName" type:"string"`
+
+ // The first port in the range.
+ FromPort *int64 `locationName:"fromPort" type:"integer"`
+
+ // The protocol being used. Can be one of the following.
+ //
+ // * tcp - Transmission Control Protocol (TCP) provides reliable, ordered,
+ // and error-checked delivery of streamed data between applications running
+ // on hosts communicating by an IP network. If you have an application that
+ // doesn't require reliable data stream service, use UDP instead.
+ //
+ // * all - All transport layer protocol types. For more general information,
+ // see Transport layer (https://en.wikipedia.org/wiki/Transport_layer) on
+ // Wikipedia.
+ //
+ // * udp - With User Datagram Protocol (UDP), computer applications can send
+ // messages (or datagrams) to other hosts on an Internet Protocol (IP) network.
+ // Prior communications are not required to set up transmission channels
+ // or data paths. Applications that don't require reliable data stream service
+ // can use UDP, which provides a connectionless datagram service that emphasizes
+ // reduced latency over reliability. If you do require reliable data stream
+ // service, use TCP instead.
+ Protocol *string `locationName:"protocol" type:"string" enum:"NetworkProtocol"`
+
+ // The last port in the range.
+ ToPort *int64 `locationName:"toPort" type:"integer"`
+}
+
+// String returns the string representation
+func (s InstancePortInfo) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstancePortInfo) GoString() string {
+ return s.String()
+}
+
+// SetAccessDirection sets the AccessDirection field's value.
+func (s *InstancePortInfo) SetAccessDirection(v string) *InstancePortInfo {
+ s.AccessDirection = &v
+ return s
+}
+
+// SetAccessFrom sets the AccessFrom field's value.
+func (s *InstancePortInfo) SetAccessFrom(v string) *InstancePortInfo {
+ s.AccessFrom = &v
+ return s
+}
+
+// SetAccessType sets the AccessType field's value.
+func (s *InstancePortInfo) SetAccessType(v string) *InstancePortInfo {
+ s.AccessType = &v
+ return s
+}
+
+// SetCommonName sets the CommonName field's value.
+func (s *InstancePortInfo) SetCommonName(v string) *InstancePortInfo {
+ s.CommonName = &v
+ return s
+}
+
+// SetFromPort sets the FromPort field's value.
+func (s *InstancePortInfo) SetFromPort(v int64) *InstancePortInfo {
+ s.FromPort = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *InstancePortInfo) SetProtocol(v string) *InstancePortInfo {
+ s.Protocol = &v
+ return s
+}
+
+// SetToPort sets the ToPort field's value.
+func (s *InstancePortInfo) SetToPort(v int64) *InstancePortInfo {
+ s.ToPort = &v
+ return s
+}
+
+// Describes the port state.
+type InstancePortState struct {
+ _ struct{} `type:"structure"`
+
+ // The first port in the range.
+ FromPort *int64 `locationName:"fromPort" type:"integer"`
+
+ // The protocol being used. Can be one of the following.
+ //
+ // * tcp - Transmission Control Protocol (TCP) provides reliable, ordered,
+ // and error-checked delivery of streamed data between applications running
+ // on hosts communicating by an IP network. If you have an application that
+ // doesn't require reliable data stream service, use UDP instead.
+ //
+ // * all - All transport layer protocol types. For more general information,
+ // see Transport layer (https://en.wikipedia.org/wiki/Transport_layer) on
+ // Wikipedia.
+ //
+ // * udp - With User Datagram Protocol (UDP), computer applications can send
+ // messages (or datagrams) to other hosts on an Internet Protocol (IP) network.
+ // Prior communications are not required to set up transmission channels
+ // or data paths. Applications that don't require reliable data stream service
+ // can use UDP, which provides a connectionless datagram service that emphasizes
+ // reduced latency over reliability. If you do require reliable data stream
+ // service, use TCP instead.
+ Protocol *string `locationName:"protocol" type:"string" enum:"NetworkProtocol"`
+
+ // Specifies whether the instance port is open or closed.
+ State *string `locationName:"state" type:"string" enum:"PortState"`
+
+ // The last port in the range.
+ ToPort *int64 `locationName:"toPort" type:"integer"`
+}
+
+// String returns the string representation
+func (s InstancePortState) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstancePortState) GoString() string {
+ return s.String()
+}
+
+// SetFromPort sets the FromPort field's value.
+func (s *InstancePortState) SetFromPort(v int64) *InstancePortState {
+ s.FromPort = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *InstancePortState) SetProtocol(v string) *InstancePortState {
+ s.Protocol = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *InstancePortState) SetState(v string) *InstancePortState {
+ s.State = &v
+ return s
+}
+
+// SetToPort sets the ToPort field's value.
+func (s *InstancePortState) SetToPort(v int64) *InstancePortState {
+ s.ToPort = &v
+ return s
+}
+
+// Describes the snapshot of the virtual private server, or instance.
+type InstanceSnapshot struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the snapshot (e.g., arn:aws:lightsail:us-east-2:123456789101:InstanceSnapshot/d23b5706-3322-4d83-81e5-12345EXAMPLE).
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The timestamp when the snapshot was created (e.g., 1479907467.024).
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // An array of disk objects containing information about all block storage disks.
+ FromAttachedDisks []*Disk `locationName:"fromAttachedDisks" type:"list"`
+
+ // The blueprint ID from which you created the snapshot (e.g., os_debian_8_3).
+ // A blueprint is a virtual private server (or instance) image used to create
+ // instances quickly.
+ FromBlueprintId *string `locationName:"fromBlueprintId" type:"string"`
+
+ // The bundle ID from which you created the snapshot (e.g., micro_1_0).
+ FromBundleId *string `locationName:"fromBundleId" type:"string"`
+
+ // The Amazon Resource Name (ARN) of the instance from which the snapshot was
+ // created (e.g., arn:aws:lightsail:us-east-2:123456789101:Instance/64b8404c-ccb1-430b-8daf-12345EXAMPLE).
+ FromInstanceArn *string `locationName:"fromInstanceArn" type:"string"`
+
+ // The instance from which the snapshot was created.
+ FromInstanceName *string `locationName:"fromInstanceName" type:"string"`
+
+ // The region name and availability zone where you created the snapshot.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the snapshot.
+ Name *string `locationName:"name" type:"string"`
+
+ // The progress of the snapshot.
+ Progress *string `locationName:"progress" type:"string"`
+
+ // The type of resource (usually InstanceSnapshot).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The size in GB of the SSD.
+ SizeInGb *int64 `locationName:"sizeInGb" type:"integer"`
+
+ // The state the snapshot is in.
+ State *string `locationName:"state" type:"string" enum:"InstanceSnapshotState"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s InstanceSnapshot) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceSnapshot) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *InstanceSnapshot) SetArn(v string) *InstanceSnapshot {
+ s.Arn = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *InstanceSnapshot) SetCreatedAt(v time.Time) *InstanceSnapshot {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetFromAttachedDisks sets the FromAttachedDisks field's value.
+func (s *InstanceSnapshot) SetFromAttachedDisks(v []*Disk) *InstanceSnapshot {
+ s.FromAttachedDisks = v
+ return s
+}
+
+// SetFromBlueprintId sets the FromBlueprintId field's value.
+func (s *InstanceSnapshot) SetFromBlueprintId(v string) *InstanceSnapshot {
+ s.FromBlueprintId = &v
+ return s
+}
+
+// SetFromBundleId sets the FromBundleId field's value.
+func (s *InstanceSnapshot) SetFromBundleId(v string) *InstanceSnapshot {
+ s.FromBundleId = &v
+ return s
+}
+
+// SetFromInstanceArn sets the FromInstanceArn field's value.
+func (s *InstanceSnapshot) SetFromInstanceArn(v string) *InstanceSnapshot {
+ s.FromInstanceArn = &v
+ return s
+}
+
+// SetFromInstanceName sets the FromInstanceName field's value.
+func (s *InstanceSnapshot) SetFromInstanceName(v string) *InstanceSnapshot {
+ s.FromInstanceName = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *InstanceSnapshot) SetLocation(v *ResourceLocation) *InstanceSnapshot {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *InstanceSnapshot) SetName(v string) *InstanceSnapshot {
+ s.Name = &v
+ return s
+}
+
+// SetProgress sets the Progress field's value.
+func (s *InstanceSnapshot) SetProgress(v string) *InstanceSnapshot {
+ s.Progress = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *InstanceSnapshot) SetResourceType(v string) *InstanceSnapshot {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSizeInGb sets the SizeInGb field's value.
+func (s *InstanceSnapshot) SetSizeInGb(v int64) *InstanceSnapshot {
+ s.SizeInGb = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *InstanceSnapshot) SetState(v string) *InstanceSnapshot {
+ s.State = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *InstanceSnapshot) SetSupportCode(v string) *InstanceSnapshot {
+ s.SupportCode = &v
+ return s
+}
+
+// Describes the virtual private server (or instance) status.
+type InstanceState struct {
+ _ struct{} `type:"structure"`
+
+ // The status code for the instance.
+ Code *int64 `locationName:"code" type:"integer"`
+
+ // The state of the instance (e.g., running or pending).
+ Name *string `locationName:"name" type:"string"`
+}
+
+// String returns the string representation
+func (s InstanceState) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s InstanceState) GoString() string {
+ return s.String()
+}
+
+// SetCode sets the Code field's value.
+func (s *InstanceState) SetCode(v int64) *InstanceState {
+ s.Code = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *InstanceState) SetName(v string) *InstanceState {
+ s.Name = &v
+ return s
+}
+
+type IsVpcPeeredInput struct {
+ _ struct{} `type:"structure"`
+}
+
+// String returns the string representation
+func (s IsVpcPeeredInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s IsVpcPeeredInput) GoString() string {
+ return s.String()
+}
+
+type IsVpcPeeredOutput struct {
+ _ struct{} `type:"structure"`
+
+ // Returns true if the Lightsail VPC is peered; otherwise, false.
+ IsPeered *bool `locationName:"isPeered" type:"boolean"`
+}
+
+// String returns the string representation
+func (s IsVpcPeeredOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s IsVpcPeeredOutput) GoString() string {
+ return s.String()
+}
+
+// SetIsPeered sets the IsPeered field's value.
+func (s *IsVpcPeeredOutput) SetIsPeered(v bool) *IsVpcPeeredOutput {
+ s.IsPeered = &v
+ return s
+}
+
+// Describes the SSH key pair.
+type KeyPair struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the key pair (e.g., arn:aws:lightsail:us-east-2:123456789101:KeyPair/05859e3d-331d-48ba-9034-12345EXAMPLE).
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The timestamp when the key pair was created (e.g., 1479816991.349).
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The RSA fingerprint of the key pair.
+ Fingerprint *string `locationName:"fingerprint" type:"string"`
+
+ // The region name and Availability Zone where the key pair was created.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The friendly name of the SSH key pair.
+ Name *string `locationName:"name" type:"string"`
+
+ // The resource type (usually KeyPair).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s KeyPair) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s KeyPair) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *KeyPair) SetArn(v string) *KeyPair {
+ s.Arn = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *KeyPair) SetCreatedAt(v time.Time) *KeyPair {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetFingerprint sets the Fingerprint field's value.
+func (s *KeyPair) SetFingerprint(v string) *KeyPair {
+ s.Fingerprint = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *KeyPair) SetLocation(v *ResourceLocation) *KeyPair {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *KeyPair) SetName(v string) *KeyPair {
+ s.Name = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *KeyPair) SetResourceType(v string) *KeyPair {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *KeyPair) SetSupportCode(v string) *KeyPair {
+ s.SupportCode = &v
+ return s
+}
+
+// Describes the Lightsail load balancer.
+type LoadBalancer struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the load balancer.
+ Arn *string `locationName:"arn" type:"string"`
+
+ // A string to string map of the configuration options for your load balancer.
+ // Valid values are listed below.
+ ConfigurationOptions map[string]*string `locationName:"configurationOptions" type:"map"`
+
+ // The date when your load balancer was created.
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The DNS name of your Lightsail load balancer.
+ DnsName *string `locationName:"dnsName" type:"string"`
+
+ // The path you specified to perform your health checks. If no path is specified,
+ // the load balancer tries to make a request to the default (root) page.
+ HealthCheckPath *string `locationName:"healthCheckPath" type:"string"`
+
+ // An array of InstanceHealthSummary objects describing the health of the load
+ // balancer.
+ InstanceHealthSummary []*InstanceHealthSummary `locationName:"instanceHealthSummary" type:"list"`
+
+ // The instance port where the load balancer is listening.
+ InstancePort *int64 `locationName:"instancePort" type:"integer"`
+
+ // The AWS Region and Availability Zone where your load balancer was created
+ // (e.g., us-east-2a).
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the load balancer (e.g., my-load-balancer).
+ Name *string `locationName:"name" type:"string"`
+
+ // The protocol you have enabled for your load balancer. Valid values are below.
+ Protocol *string `locationName:"protocol" type:"string" enum:"LoadBalancerProtocol"`
+
+ // An array of public port settings for your load balancer.
+ PublicPorts []*int64 `locationName:"publicPorts" type:"list"`
+
+ // The resource type (e.g., LoadBalancer.
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The status of your load balancer. Valid values are below.
+ State *string `locationName:"state" type:"string" enum:"LoadBalancerState"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about your Lightsail load balancer. This code enables our support
+ // team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+
+ // An array of LoadBalancerTlsCertificateSummary objects that provide additional
+ // information about the TLS/SSL certificates.
+ TlsCertificateSummaries []*LoadBalancerTlsCertificateSummary `locationName:"tlsCertificateSummaries" type:"list"`
+}
+
+// String returns the string representation
+func (s LoadBalancer) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancer) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *LoadBalancer) SetArn(v string) *LoadBalancer {
+ s.Arn = &v
+ return s
+}
+
+// SetConfigurationOptions sets the ConfigurationOptions field's value.
+func (s *LoadBalancer) SetConfigurationOptions(v map[string]*string) *LoadBalancer {
+ s.ConfigurationOptions = v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *LoadBalancer) SetCreatedAt(v time.Time) *LoadBalancer {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetDnsName sets the DnsName field's value.
+func (s *LoadBalancer) SetDnsName(v string) *LoadBalancer {
+ s.DnsName = &v
+ return s
+}
+
+// SetHealthCheckPath sets the HealthCheckPath field's value.
+func (s *LoadBalancer) SetHealthCheckPath(v string) *LoadBalancer {
+ s.HealthCheckPath = &v
+ return s
+}
+
+// SetInstanceHealthSummary sets the InstanceHealthSummary field's value.
+func (s *LoadBalancer) SetInstanceHealthSummary(v []*InstanceHealthSummary) *LoadBalancer {
+ s.InstanceHealthSummary = v
+ return s
+}
+
+// SetInstancePort sets the InstancePort field's value.
+func (s *LoadBalancer) SetInstancePort(v int64) *LoadBalancer {
+ s.InstancePort = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *LoadBalancer) SetLocation(v *ResourceLocation) *LoadBalancer {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *LoadBalancer) SetName(v string) *LoadBalancer {
+ s.Name = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *LoadBalancer) SetProtocol(v string) *LoadBalancer {
+ s.Protocol = &v
+ return s
+}
+
+// SetPublicPorts sets the PublicPorts field's value.
+func (s *LoadBalancer) SetPublicPorts(v []*int64) *LoadBalancer {
+ s.PublicPorts = v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *LoadBalancer) SetResourceType(v string) *LoadBalancer {
+ s.ResourceType = &v
+ return s
+}
+
+// SetState sets the State field's value.
+func (s *LoadBalancer) SetState(v string) *LoadBalancer {
+ s.State = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *LoadBalancer) SetSupportCode(v string) *LoadBalancer {
+ s.SupportCode = &v
+ return s
+}
+
+// SetTlsCertificateSummaries sets the TlsCertificateSummaries field's value.
+func (s *LoadBalancer) SetTlsCertificateSummaries(v []*LoadBalancerTlsCertificateSummary) *LoadBalancer {
+ s.TlsCertificateSummaries = v
+ return s
+}
+
+// Describes a load balancer TLS/SSL certificate.
+//
+// TLS is just an updated, more secure version of Secure Socket Layer (SSL).
+type LoadBalancerTlsCertificate struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the TLS/SSL certificate.
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The time when you created your TLS/SSL certificate.
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The domain name for your TLS/SSL certificate.
+ DomainName *string `locationName:"domainName" type:"string"`
+
+ // An array of LoadBalancerTlsCertificateDomainValidationRecord objects describing
+ // the records.
+ DomainValidationRecords []*LoadBalancerTlsCertificateDomainValidationRecord `locationName:"domainValidationRecords" type:"list"`
+
+ // The reason for the TLS/SSL certificate validation failure.
+ FailureReason *string `locationName:"failureReason" type:"string" enum:"LoadBalancerTlsCertificateFailureReason"`
+
+ // When true, the TLS/SSL certificate is attached to the Lightsail load balancer.
+ IsAttached *bool `locationName:"isAttached" type:"boolean"`
+
+ // The time when the TLS/SSL certificate was issued.
+ IssuedAt *time.Time `locationName:"issuedAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The issuer of the certificate.
+ Issuer *string `locationName:"issuer" type:"string"`
+
+ // The algorithm that was used to generate the key pair (the public and private
+ // key).
+ KeyAlgorithm *string `locationName:"keyAlgorithm" type:"string"`
+
+ // The load balancer name where your TLS/SSL certificate is attached.
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string"`
+
+ // The AWS Region and Availability Zone where you created your certificate.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the TLS/SSL certificate (e.g., my-certificate).
+ Name *string `locationName:"name" type:"string"`
+
+ // The timestamp when the TLS/SSL certificate expires.
+ NotAfter *time.Time `locationName:"notAfter" type:"timestamp" timestampFormat:"unix"`
+
+ // The timestamp when the TLS/SSL certificate is first valid.
+ NotBefore *time.Time `locationName:"notBefore" type:"timestamp" timestampFormat:"unix"`
+
+ // An object containing information about the status of Lightsail's managed
+ // renewal for the certificate.
+ RenewalSummary *LoadBalancerTlsCertificateRenewalSummary `locationName:"renewalSummary" type:"structure"`
+
+ // The resource type (e.g., LoadBalancerTlsCertificate.
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The reason the certificate was revoked. Valid values are below.
+ RevocationReason *string `locationName:"revocationReason" type:"string" enum:"LoadBalancerTlsCertificateRevocationReason"`
+
+ // The timestamp when the TLS/SSL certificate was revoked.
+ RevokedAt *time.Time `locationName:"revokedAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The serial number of the certificate.
+ Serial *string `locationName:"serial" type:"string"`
+
+ // The algorithm that was used to sign the certificate.
+ SignatureAlgorithm *string `locationName:"signatureAlgorithm" type:"string"`
+
+ // The status of the TLS/SSL certificate. Valid values are below.
+ Status *string `locationName:"status" type:"string" enum:"LoadBalancerTlsCertificateStatus"`
+
+ // The name of the entity that is associated with the public key contained in
+ // the certificate.
+ Subject *string `locationName:"subject" type:"string"`
+
+ // One or more domain names (subject alternative names) included in the certificate.
+ // This list contains the domain names that are bound to the public key that
+ // is contained in the certificate. The subject alternative names include the
+ // canonical domain name (CN) of the certificate and additional domain names
+ // that can be used to connect to the website.
+ SubjectAlternativeNames []*string `locationName:"subjectAlternativeNames" type:"list"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about your Lightsail load balancer or TLS/SSL certificate. This
+ // code enables our support team to look up your Lightsail information more
+ // easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s LoadBalancerTlsCertificate) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancerTlsCertificate) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *LoadBalancerTlsCertificate) SetArn(v string) *LoadBalancerTlsCertificate {
+ s.Arn = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *LoadBalancerTlsCertificate) SetCreatedAt(v time.Time) *LoadBalancerTlsCertificate {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *LoadBalancerTlsCertificate) SetDomainName(v string) *LoadBalancerTlsCertificate {
+ s.DomainName = &v
+ return s
+}
+
+// SetDomainValidationRecords sets the DomainValidationRecords field's value.
+func (s *LoadBalancerTlsCertificate) SetDomainValidationRecords(v []*LoadBalancerTlsCertificateDomainValidationRecord) *LoadBalancerTlsCertificate {
+ s.DomainValidationRecords = v
+ return s
+}
+
+// SetFailureReason sets the FailureReason field's value.
+func (s *LoadBalancerTlsCertificate) SetFailureReason(v string) *LoadBalancerTlsCertificate {
+ s.FailureReason = &v
+ return s
+}
+
+// SetIsAttached sets the IsAttached field's value.
+func (s *LoadBalancerTlsCertificate) SetIsAttached(v bool) *LoadBalancerTlsCertificate {
+ s.IsAttached = &v
+ return s
+}
+
+// SetIssuedAt sets the IssuedAt field's value.
+func (s *LoadBalancerTlsCertificate) SetIssuedAt(v time.Time) *LoadBalancerTlsCertificate {
+ s.IssuedAt = &v
+ return s
+}
+
+// SetIssuer sets the Issuer field's value.
+func (s *LoadBalancerTlsCertificate) SetIssuer(v string) *LoadBalancerTlsCertificate {
+ s.Issuer = &v
+ return s
+}
+
+// SetKeyAlgorithm sets the KeyAlgorithm field's value.
+func (s *LoadBalancerTlsCertificate) SetKeyAlgorithm(v string) *LoadBalancerTlsCertificate {
+ s.KeyAlgorithm = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *LoadBalancerTlsCertificate) SetLoadBalancerName(v string) *LoadBalancerTlsCertificate {
+ s.LoadBalancerName = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *LoadBalancerTlsCertificate) SetLocation(v *ResourceLocation) *LoadBalancerTlsCertificate {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *LoadBalancerTlsCertificate) SetName(v string) *LoadBalancerTlsCertificate {
+ s.Name = &v
+ return s
+}
+
+// SetNotAfter sets the NotAfter field's value.
+func (s *LoadBalancerTlsCertificate) SetNotAfter(v time.Time) *LoadBalancerTlsCertificate {
+ s.NotAfter = &v
+ return s
+}
+
+// SetNotBefore sets the NotBefore field's value.
+func (s *LoadBalancerTlsCertificate) SetNotBefore(v time.Time) *LoadBalancerTlsCertificate {
+ s.NotBefore = &v
+ return s
+}
+
+// SetRenewalSummary sets the RenewalSummary field's value.
+func (s *LoadBalancerTlsCertificate) SetRenewalSummary(v *LoadBalancerTlsCertificateRenewalSummary) *LoadBalancerTlsCertificate {
+ s.RenewalSummary = v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *LoadBalancerTlsCertificate) SetResourceType(v string) *LoadBalancerTlsCertificate {
+ s.ResourceType = &v
+ return s
+}
+
+// SetRevocationReason sets the RevocationReason field's value.
+func (s *LoadBalancerTlsCertificate) SetRevocationReason(v string) *LoadBalancerTlsCertificate {
+ s.RevocationReason = &v
+ return s
+}
+
+// SetRevokedAt sets the RevokedAt field's value.
+func (s *LoadBalancerTlsCertificate) SetRevokedAt(v time.Time) *LoadBalancerTlsCertificate {
+ s.RevokedAt = &v
+ return s
+}
+
+// SetSerial sets the Serial field's value.
+func (s *LoadBalancerTlsCertificate) SetSerial(v string) *LoadBalancerTlsCertificate {
+ s.Serial = &v
+ return s
+}
+
+// SetSignatureAlgorithm sets the SignatureAlgorithm field's value.
+func (s *LoadBalancerTlsCertificate) SetSignatureAlgorithm(v string) *LoadBalancerTlsCertificate {
+ s.SignatureAlgorithm = &v
+ return s
+}
+
+// SetStatus sets the Status field's value.
+func (s *LoadBalancerTlsCertificate) SetStatus(v string) *LoadBalancerTlsCertificate {
+ s.Status = &v
+ return s
+}
+
+// SetSubject sets the Subject field's value.
+func (s *LoadBalancerTlsCertificate) SetSubject(v string) *LoadBalancerTlsCertificate {
+ s.Subject = &v
+ return s
+}
+
+// SetSubjectAlternativeNames sets the SubjectAlternativeNames field's value.
+func (s *LoadBalancerTlsCertificate) SetSubjectAlternativeNames(v []*string) *LoadBalancerTlsCertificate {
+ s.SubjectAlternativeNames = v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *LoadBalancerTlsCertificate) SetSupportCode(v string) *LoadBalancerTlsCertificate {
+ s.SupportCode = &v
+ return s
+}
+
+// Contains information about the domain names on a TLS/SSL certificate that
+// you will use to validate domain ownership.
+type LoadBalancerTlsCertificateDomainValidationOption struct {
+ _ struct{} `type:"structure"`
+
+ // A fully qualified domain name in the certificate request.
+ DomainName *string `locationName:"domainName" type:"string"`
+
+ // The status of the domain validation. Valid values are listed below.
+ ValidationStatus *string `locationName:"validationStatus" type:"string" enum:"LoadBalancerTlsCertificateDomainStatus"`
+}
+
+// String returns the string representation
+func (s LoadBalancerTlsCertificateDomainValidationOption) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancerTlsCertificateDomainValidationOption) GoString() string {
+ return s.String()
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationOption) SetDomainName(v string) *LoadBalancerTlsCertificateDomainValidationOption {
+ s.DomainName = &v
+ return s
+}
+
+// SetValidationStatus sets the ValidationStatus field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationOption) SetValidationStatus(v string) *LoadBalancerTlsCertificateDomainValidationOption {
+ s.ValidationStatus = &v
+ return s
+}
+
+// Describes the validation record of each domain name in the TLS/SSL certificate.
+type LoadBalancerTlsCertificateDomainValidationRecord struct {
+ _ struct{} `type:"structure"`
+
+ // The domain name against which your TLS/SSL certificate was validated.
+ DomainName *string `locationName:"domainName" type:"string"`
+
+ // A fully qualified domain name in the certificate. For example, example.com.
+ Name *string `locationName:"name" type:"string"`
+
+ // The type of validation record. For example, CNAME for domain validation.
+ Type *string `locationName:"type" type:"string"`
+
+ // The validation status. Valid values are listed below.
+ ValidationStatus *string `locationName:"validationStatus" type:"string" enum:"LoadBalancerTlsCertificateDomainStatus"`
+
+ // The value for that type.
+ Value *string `locationName:"value" type:"string"`
+}
+
+// String returns the string representation
+func (s LoadBalancerTlsCertificateDomainValidationRecord) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancerTlsCertificateDomainValidationRecord) GoString() string {
+ return s.String()
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetDomainName(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
+ s.DomainName = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetName(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
+ s.Name = &v
+ return s
+}
+
+// SetType sets the Type field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetType(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
+ s.Type = &v
+ return s
+}
+
+// SetValidationStatus sets the ValidationStatus field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetValidationStatus(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
+ s.ValidationStatus = &v
+ return s
+}
+
+// SetValue sets the Value field's value.
+func (s *LoadBalancerTlsCertificateDomainValidationRecord) SetValue(v string) *LoadBalancerTlsCertificateDomainValidationRecord {
+ s.Value = &v
+ return s
+}
+
+// Contains information about the status of Lightsail's managed renewal for
+// the certificate.
+type LoadBalancerTlsCertificateRenewalSummary struct {
+ _ struct{} `type:"structure"`
+
+ // Contains information about the validation of each domain name in the certificate,
+ // as it pertains to Lightsail's managed renewal. This is different from the
+ // initial validation that occurs as a result of the RequestCertificate request.
+ DomainValidationOptions []*LoadBalancerTlsCertificateDomainValidationOption `locationName:"domainValidationOptions" type:"list"`
+
+ // The status of Lightsail's managed renewal of the certificate. Valid values
+ // are listed below.
+ RenewalStatus *string `locationName:"renewalStatus" type:"string" enum:"LoadBalancerTlsCertificateRenewalStatus"`
+}
+
+// String returns the string representation
+func (s LoadBalancerTlsCertificateRenewalSummary) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancerTlsCertificateRenewalSummary) GoString() string {
+ return s.String()
+}
+
+// SetDomainValidationOptions sets the DomainValidationOptions field's value.
+func (s *LoadBalancerTlsCertificateRenewalSummary) SetDomainValidationOptions(v []*LoadBalancerTlsCertificateDomainValidationOption) *LoadBalancerTlsCertificateRenewalSummary {
+ s.DomainValidationOptions = v
+ return s
+}
+
+// SetRenewalStatus sets the RenewalStatus field's value.
+func (s *LoadBalancerTlsCertificateRenewalSummary) SetRenewalStatus(v string) *LoadBalancerTlsCertificateRenewalSummary {
+ s.RenewalStatus = &v
+ return s
+}
+
+// Provides a summary of TLS/SSL certificate metadata.
+type LoadBalancerTlsCertificateSummary struct {
+ _ struct{} `type:"structure"`
+
+ // When true, the TLS/SSL certificate is attached to the Lightsail load balancer.
+ IsAttached *bool `locationName:"isAttached" type:"boolean"`
+
+ // The name of the TLS/SSL certificate.
+ Name *string `locationName:"name" type:"string"`
+}
+
+// String returns the string representation
+func (s LoadBalancerTlsCertificateSummary) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s LoadBalancerTlsCertificateSummary) GoString() string {
+ return s.String()
+}
+
+// SetIsAttached sets the IsAttached field's value.
+func (s *LoadBalancerTlsCertificateSummary) SetIsAttached(v bool) *LoadBalancerTlsCertificateSummary {
+ s.IsAttached = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *LoadBalancerTlsCertificateSummary) SetName(v string) *LoadBalancerTlsCertificateSummary {
+ s.Name = &v
+ return s
+}
+
+// Describes the metric data point.
+type MetricDatapoint struct {
+ _ struct{} `type:"structure"`
+
+ // The average.
+ Average *float64 `locationName:"average" type:"double"`
+
+ // The maximum.
+ Maximum *float64 `locationName:"maximum" type:"double"`
+
+ // The minimum.
+ Minimum *float64 `locationName:"minimum" type:"double"`
+
+ // The sample count.
+ SampleCount *float64 `locationName:"sampleCount" type:"double"`
+
+ // The sum.
+ Sum *float64 `locationName:"sum" type:"double"`
+
+ // The timestamp (e.g., 1479816991.349).
+ Timestamp *time.Time `locationName:"timestamp" type:"timestamp" timestampFormat:"unix"`
+
+ // The unit.
+ Unit *string `locationName:"unit" type:"string" enum:"MetricUnit"`
+}
+
+// String returns the string representation
+func (s MetricDatapoint) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s MetricDatapoint) GoString() string {
+ return s.String()
+}
+
+// SetAverage sets the Average field's value.
+func (s *MetricDatapoint) SetAverage(v float64) *MetricDatapoint {
+ s.Average = &v
+ return s
+}
+
+// SetMaximum sets the Maximum field's value.
+func (s *MetricDatapoint) SetMaximum(v float64) *MetricDatapoint {
+ s.Maximum = &v
+ return s
+}
+
+// SetMinimum sets the Minimum field's value.
+func (s *MetricDatapoint) SetMinimum(v float64) *MetricDatapoint {
+ s.Minimum = &v
+ return s
+}
+
+// SetSampleCount sets the SampleCount field's value.
+func (s *MetricDatapoint) SetSampleCount(v float64) *MetricDatapoint {
+ s.SampleCount = &v
+ return s
+}
+
+// SetSum sets the Sum field's value.
+func (s *MetricDatapoint) SetSum(v float64) *MetricDatapoint {
+ s.Sum = &v
+ return s
+}
+
+// SetTimestamp sets the Timestamp field's value.
+func (s *MetricDatapoint) SetTimestamp(v time.Time) *MetricDatapoint {
+ s.Timestamp = &v
+ return s
+}
+
+// SetUnit sets the Unit field's value.
+func (s *MetricDatapoint) SetUnit(v string) *MetricDatapoint {
+ s.Unit = &v
+ return s
+}
+
+// Describes the monthly data transfer in and out of your virtual private server
+// (or instance).
+type MonthlyTransfer struct {
+ _ struct{} `type:"structure"`
+
+ // The amount allocated per month (in GB).
+ GbPerMonthAllocated *int64 `locationName:"gbPerMonthAllocated" type:"integer"`
+}
+
+// String returns the string representation
+func (s MonthlyTransfer) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s MonthlyTransfer) GoString() string {
+ return s.String()
+}
+
+// SetGbPerMonthAllocated sets the GbPerMonthAllocated field's value.
+func (s *MonthlyTransfer) SetGbPerMonthAllocated(v int64) *MonthlyTransfer {
+ s.GbPerMonthAllocated = &v
+ return s
+}
+
+type OpenInstancePublicPortsInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance for which you want to open the public ports.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // An array of key-value pairs containing information about the port mappings.
+ //
+ // PortInfo is a required field
+ PortInfo *PortInfo `locationName:"portInfo" type:"structure" required:"true"`
+}
+
+// String returns the string representation
+func (s OpenInstancePublicPortsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s OpenInstancePublicPortsInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *OpenInstancePublicPortsInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "OpenInstancePublicPortsInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.PortInfo == nil {
+ invalidParams.Add(request.NewErrParamRequired("PortInfo"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *OpenInstancePublicPortsInput) SetInstanceName(v string) *OpenInstancePublicPortsInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetPortInfo sets the PortInfo field's value.
+func (s *OpenInstancePublicPortsInput) SetPortInfo(v *PortInfo) *OpenInstancePublicPortsInput {
+ s.PortInfo = v
+ return s
+}
+
+type OpenInstancePublicPortsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s OpenInstancePublicPortsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s OpenInstancePublicPortsOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *OpenInstancePublicPortsOutput) SetOperation(v *Operation) *OpenInstancePublicPortsOutput {
+ s.Operation = v
+ return s
+}
+
+// Describes the API operation.
+type Operation struct {
+ _ struct{} `type:"structure"`
+
+ // The timestamp when the operation was initialized (e.g., 1479816991.349).
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The error code.
+ ErrorCode *string `locationName:"errorCode" type:"string"`
+
+ // The error details.
+ ErrorDetails *string `locationName:"errorDetails" type:"string"`
+
+ // The ID of the operation.
+ Id *string `locationName:"id" type:"string"`
+
+ // A Boolean value indicating whether the operation is terminal.
+ IsTerminal *bool `locationName:"isTerminal" type:"boolean"`
+
+ // The region and Availability Zone.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // Details about the operation (e.g., Debian-1GB-Ohio-1).
+ OperationDetails *string `locationName:"operationDetails" type:"string"`
+
+ // The type of operation.
+ OperationType *string `locationName:"operationType" type:"string" enum:"OperationType"`
+
+ // The resource name.
+ ResourceName *string `locationName:"resourceName" type:"string"`
+
+ // The resource type.
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The status of the operation.
+ Status *string `locationName:"status" type:"string" enum:"OperationStatus"`
+
+ // The timestamp when the status was changed (e.g., 1479816991.349).
+ StatusChangedAt *time.Time `locationName:"statusChangedAt" type:"timestamp" timestampFormat:"unix"`
+}
+
+// String returns the string representation
+func (s Operation) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Operation) GoString() string {
+ return s.String()
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *Operation) SetCreatedAt(v time.Time) *Operation {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetErrorCode sets the ErrorCode field's value.
+func (s *Operation) SetErrorCode(v string) *Operation {
+ s.ErrorCode = &v
+ return s
+}
+
+// SetErrorDetails sets the ErrorDetails field's value.
+func (s *Operation) SetErrorDetails(v string) *Operation {
+ s.ErrorDetails = &v
+ return s
+}
+
+// SetId sets the Id field's value.
+func (s *Operation) SetId(v string) *Operation {
+ s.Id = &v
+ return s
+}
+
+// SetIsTerminal sets the IsTerminal field's value.
+func (s *Operation) SetIsTerminal(v bool) *Operation {
+ s.IsTerminal = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *Operation) SetLocation(v *ResourceLocation) *Operation {
+ s.Location = v
+ return s
+}
+
+// SetOperationDetails sets the OperationDetails field's value.
+func (s *Operation) SetOperationDetails(v string) *Operation {
+ s.OperationDetails = &v
+ return s
+}
+
+// SetOperationType sets the OperationType field's value.
+func (s *Operation) SetOperationType(v string) *Operation {
+ s.OperationType = &v
+ return s
+}
+
+// SetResourceName sets the ResourceName field's value.
+func (s *Operation) SetResourceName(v string) *Operation {
+ s.ResourceName = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *Operation) SetResourceType(v string) *Operation {
+ s.ResourceType = &v
+ return s
+}
+
+// SetStatus sets the Status field's value.
+func (s *Operation) SetStatus(v string) *Operation {
+ s.Status = &v
+ return s
+}
+
+// SetStatusChangedAt sets the StatusChangedAt field's value.
+func (s *Operation) SetStatusChangedAt(v time.Time) *Operation {
+ s.StatusChangedAt = &v
+ return s
+}
+
+// The password data for the Windows Server-based instance, including the ciphertext
+// and the key pair name.
+type PasswordData struct {
+ _ struct{} `type:"structure"`
+
+ // The encrypted password. Ciphertext will be an empty string if access to your
+ // new instance is not ready yet. When you create an instance, it can take up
+ // to 15 minutes for the instance to be ready.
+ //
+ // If you use the default key pair (LightsailDefaultKeyPair), the decrypted
+ // password will be available in the password field.
+ //
+ // If you are using a custom key pair, you need to use your own means of decryption.
+ //
+ // If you change the Administrator password on the instance, Lightsail will
+ // continue to return the original ciphertext value. When accessing the instance
+ // using RDP, you need to manually enter the Administrator password after changing
+ // it from the default.
+ Ciphertext *string `locationName:"ciphertext" type:"string"`
+
+ // The name of the key pair that you used when creating your instance. If no
+ // key pair name was specified when creating the instance, Lightsail uses the
+ // default key pair (LightsailDefaultKeyPair).
+ //
+ // If you are using a custom key pair, you need to use your own means of decrypting
+ // your password using the ciphertext. Lightsail creates the ciphertext by encrypting
+ // your password with the public key part of this key pair.
+ KeyPairName *string `locationName:"keyPairName" type:"string"`
+}
+
+// String returns the string representation
+func (s PasswordData) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PasswordData) GoString() string {
+ return s.String()
+}
+
+// SetCiphertext sets the Ciphertext field's value.
+func (s *PasswordData) SetCiphertext(v string) *PasswordData {
+ s.Ciphertext = &v
+ return s
+}
+
+// SetKeyPairName sets the KeyPairName field's value.
+func (s *PasswordData) SetKeyPairName(v string) *PasswordData {
+ s.KeyPairName = &v
+ return s
+}
+
+type PeerVpcInput struct {
+ _ struct{} `type:"structure"`
+}
+
+// String returns the string representation
+func (s PeerVpcInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PeerVpcInput) GoString() string {
+ return s.String()
+}
+
+type PeerVpcOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s PeerVpcOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PeerVpcOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *PeerVpcOutput) SetOperation(v *Operation) *PeerVpcOutput {
+ s.Operation = v
+ return s
+}
+
+// Describes information about the ports on your virtual private server (or
+// instance).
+type PortInfo struct {
+ _ struct{} `type:"structure"`
+
+ // The first port in the range.
+ FromPort *int64 `locationName:"fromPort" type:"integer"`
+
+ // The protocol.
+ Protocol *string `locationName:"protocol" type:"string" enum:"NetworkProtocol"`
+
+ // The last port in the range.
+ ToPort *int64 `locationName:"toPort" type:"integer"`
+}
+
+// String returns the string representation
+func (s PortInfo) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PortInfo) GoString() string {
+ return s.String()
+}
+
+// SetFromPort sets the FromPort field's value.
+func (s *PortInfo) SetFromPort(v int64) *PortInfo {
+ s.FromPort = &v
+ return s
+}
+
+// SetProtocol sets the Protocol field's value.
+func (s *PortInfo) SetProtocol(v string) *PortInfo {
+ s.Protocol = &v
+ return s
+}
+
+// SetToPort sets the ToPort field's value.
+func (s *PortInfo) SetToPort(v int64) *PortInfo {
+ s.ToPort = &v
+ return s
+}
+
+type PutInstancePublicPortsInput struct {
+ _ struct{} `type:"structure"`
+
+ // The Lightsail instance name of the public port(s) you are setting.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+
+ // Specifies information about the public port(s).
+ //
+ // PortInfos is a required field
+ PortInfos []*PortInfo `locationName:"portInfos" type:"list" required:"true"`
+}
+
+// String returns the string representation
+func (s PutInstancePublicPortsInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PutInstancePublicPortsInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *PutInstancePublicPortsInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "PutInstancePublicPortsInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+ if s.PortInfos == nil {
+ invalidParams.Add(request.NewErrParamRequired("PortInfos"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *PutInstancePublicPortsInput) SetInstanceName(v string) *PutInstancePublicPortsInput {
+ s.InstanceName = &v
+ return s
+}
+
+// SetPortInfos sets the PortInfos field's value.
+func (s *PutInstancePublicPortsInput) SetPortInfos(v []*PortInfo) *PutInstancePublicPortsInput {
+ s.PortInfos = v
+ return s
+}
+
+type PutInstancePublicPortsOutput struct {
+ _ struct{} `type:"structure"`
+
+ // Describes metadata about the operation you just executed.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s PutInstancePublicPortsOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s PutInstancePublicPortsOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *PutInstancePublicPortsOutput) SetOperation(v *Operation) *PutInstancePublicPortsOutput {
+ s.Operation = v
+ return s
+}
+
+type RebootInstanceInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance to reboot.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s RebootInstanceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s RebootInstanceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *RebootInstanceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "RebootInstanceInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *RebootInstanceInput) SetInstanceName(v string) *RebootInstanceInput {
+ s.InstanceName = &v
+ return s
+}
+
+type RebootInstanceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s RebootInstanceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s RebootInstanceOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *RebootInstanceOutput) SetOperations(v []*Operation) *RebootInstanceOutput {
+ s.Operations = v
+ return s
+}
+
+// Describes the AWS Region.
+type Region struct {
+ _ struct{} `type:"structure"`
+
+ // The Availability Zones. Follows the format us-east-2a (case-sensitive).
+ AvailabilityZones []*AvailabilityZone `locationName:"availabilityZones" type:"list"`
+
+ // The continent code (e.g., NA, meaning North America).
+ ContinentCode *string `locationName:"continentCode" type:"string"`
+
+ // The description of the AWS Region (e.g., This region is recommended to serve
+ // users in the eastern United States and eastern Canada).
+ Description *string `locationName:"description" type:"string"`
+
+ // The display name (e.g., Ohio).
+ DisplayName *string `locationName:"displayName" type:"string"`
+
+ // The region name (e.g., us-east-2).
+ Name *string `locationName:"name" type:"string" enum:"RegionName"`
+}
+
+// String returns the string representation
+func (s Region) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s Region) GoString() string {
+ return s.String()
+}
+
+// SetAvailabilityZones sets the AvailabilityZones field's value.
+func (s *Region) SetAvailabilityZones(v []*AvailabilityZone) *Region {
+ s.AvailabilityZones = v
+ return s
+}
+
+// SetContinentCode sets the ContinentCode field's value.
+func (s *Region) SetContinentCode(v string) *Region {
+ s.ContinentCode = &v
+ return s
+}
+
+// SetDescription sets the Description field's value.
+func (s *Region) SetDescription(v string) *Region {
+ s.Description = &v
+ return s
+}
+
+// SetDisplayName sets the DisplayName field's value.
+func (s *Region) SetDisplayName(v string) *Region {
+ s.DisplayName = &v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *Region) SetName(v string) *Region {
+ s.Name = &v
+ return s
+}
+
+type ReleaseStaticIpInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the static IP to delete.
+ //
+ // StaticIpName is a required field
+ StaticIpName *string `locationName:"staticIpName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s ReleaseStaticIpInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s ReleaseStaticIpInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *ReleaseStaticIpInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "ReleaseStaticIpInput"}
+ if s.StaticIpName == nil {
+ invalidParams.Add(request.NewErrParamRequired("StaticIpName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetStaticIpName sets the StaticIpName field's value.
+func (s *ReleaseStaticIpInput) SetStaticIpName(v string) *ReleaseStaticIpInput {
+ s.StaticIpName = &v
+ return s
+}
+
+type ReleaseStaticIpOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s ReleaseStaticIpOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s ReleaseStaticIpOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *ReleaseStaticIpOutput) SetOperations(v []*Operation) *ReleaseStaticIpOutput {
+ s.Operations = v
+ return s
+}
+
+// Describes the resource location.
+type ResourceLocation struct {
+ _ struct{} `type:"structure"`
+
+ // The Availability Zone. Follows the format us-east-2a (case-sensitive).
+ AvailabilityZone *string `locationName:"availabilityZone" type:"string"`
+
+ // The AWS Region name.
+ RegionName *string `locationName:"regionName" type:"string" enum:"RegionName"`
+}
+
+// String returns the string representation
+func (s ResourceLocation) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s ResourceLocation) GoString() string {
+ return s.String()
+}
+
+// SetAvailabilityZone sets the AvailabilityZone field's value.
+func (s *ResourceLocation) SetAvailabilityZone(v string) *ResourceLocation {
+ s.AvailabilityZone = &v
+ return s
+}
+
+// SetRegionName sets the RegionName field's value.
+func (s *ResourceLocation) SetRegionName(v string) *ResourceLocation {
+ s.RegionName = &v
+ return s
+}
+
+type StartInstanceInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the instance (a virtual private server) to start.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s StartInstanceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s StartInstanceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *StartInstanceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "StartInstanceInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *StartInstanceInput) SetInstanceName(v string) *StartInstanceInput {
+ s.InstanceName = &v
+ return s
+}
+
+type StartInstanceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s StartInstanceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s StartInstanceOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *StartInstanceOutput) SetOperations(v []*Operation) *StartInstanceOutput {
+ s.Operations = v
+ return s
+}
+
+// Describes the static IP.
+type StaticIp struct {
+ _ struct{} `type:"structure"`
+
+ // The Amazon Resource Name (ARN) of the static IP (e.g., arn:aws:lightsail:us-east-2:123456789101:StaticIp/9cbb4a9e-f8e3-4dfe-b57e-12345EXAMPLE).
+ Arn *string `locationName:"arn" type:"string"`
+
+ // The instance where the static IP is attached (e.g., Amazon_Linux-1GB-Ohio-1).
+ AttachedTo *string `locationName:"attachedTo" type:"string"`
+
+ // The timestamp when the static IP was created (e.g., 1479735304.222).
+ CreatedAt *time.Time `locationName:"createdAt" type:"timestamp" timestampFormat:"unix"`
+
+ // The static IP address.
+ IpAddress *string `locationName:"ipAddress" type:"string"`
+
+ // A Boolean value indicating whether the static IP is attached.
+ IsAttached *bool `locationName:"isAttached" type:"boolean"`
+
+ // The region and Availability Zone where the static IP was created.
+ Location *ResourceLocation `locationName:"location" type:"structure"`
+
+ // The name of the static IP (e.g., StaticIP-Ohio-EXAMPLE).
+ Name *string `locationName:"name" type:"string"`
+
+ // The resource type (usually StaticIp).
+ ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"`
+
+ // The support code. Include this code in your email to support when you have
+ // questions about an instance or another resource in Lightsail. This code enables
+ // our support team to look up your Lightsail information more easily.
+ SupportCode *string `locationName:"supportCode" type:"string"`
+}
+
+// String returns the string representation
+func (s StaticIp) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s StaticIp) GoString() string {
+ return s.String()
+}
+
+// SetArn sets the Arn field's value.
+func (s *StaticIp) SetArn(v string) *StaticIp {
+ s.Arn = &v
+ return s
+}
+
+// SetAttachedTo sets the AttachedTo field's value.
+func (s *StaticIp) SetAttachedTo(v string) *StaticIp {
+ s.AttachedTo = &v
+ return s
+}
+
+// SetCreatedAt sets the CreatedAt field's value.
+func (s *StaticIp) SetCreatedAt(v time.Time) *StaticIp {
+ s.CreatedAt = &v
+ return s
+}
+
+// SetIpAddress sets the IpAddress field's value.
+func (s *StaticIp) SetIpAddress(v string) *StaticIp {
+ s.IpAddress = &v
+ return s
+}
+
+// SetIsAttached sets the IsAttached field's value.
+func (s *StaticIp) SetIsAttached(v bool) *StaticIp {
+ s.IsAttached = &v
+ return s
+}
+
+// SetLocation sets the Location field's value.
+func (s *StaticIp) SetLocation(v *ResourceLocation) *StaticIp {
+ s.Location = v
+ return s
+}
+
+// SetName sets the Name field's value.
+func (s *StaticIp) SetName(v string) *StaticIp {
+ s.Name = &v
+ return s
+}
+
+// SetResourceType sets the ResourceType field's value.
+func (s *StaticIp) SetResourceType(v string) *StaticIp {
+ s.ResourceType = &v
+ return s
+}
+
+// SetSupportCode sets the SupportCode field's value.
+func (s *StaticIp) SetSupportCode(v string) *StaticIp {
+ s.SupportCode = &v
+ return s
+}
+
+type StopInstanceInput struct {
+ _ struct{} `type:"structure"`
+
+ // When set to True, forces a Lightsail instance that is stuck in a stopping
+ // state to stop.
+ //
+ // Only use the force parameter if your instance is stuck in the stopping state.
+ // In any other state, your instance should stop normally without adding this
+ // parameter to your API request.
+ Force *bool `locationName:"force" type:"boolean"`
+
+ // The name of the instance (a virtual private server) to stop.
+ //
+ // InstanceName is a required field
+ InstanceName *string `locationName:"instanceName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s StopInstanceInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s StopInstanceInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *StopInstanceInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "StopInstanceInput"}
+ if s.InstanceName == nil {
+ invalidParams.Add(request.NewErrParamRequired("InstanceName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetForce sets the Force field's value.
+func (s *StopInstanceInput) SetForce(v bool) *StopInstanceInput {
+ s.Force = &v
+ return s
+}
+
+// SetInstanceName sets the InstanceName field's value.
+func (s *StopInstanceInput) SetInstanceName(v string) *StopInstanceInput {
+ s.InstanceName = &v
+ return s
+}
+
+type StopInstanceOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s StopInstanceOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s StopInstanceOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *StopInstanceOutput) SetOperations(v []*Operation) *StopInstanceOutput {
+ s.Operations = v
+ return s
+}
+
+type UnpeerVpcInput struct {
+ _ struct{} `type:"structure"`
+}
+
+// String returns the string representation
+func (s UnpeerVpcInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UnpeerVpcInput) GoString() string {
+ return s.String()
+}
+
+type UnpeerVpcOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operation *Operation `locationName:"operation" type:"structure"`
+}
+
+// String returns the string representation
+func (s UnpeerVpcOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UnpeerVpcOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperation sets the Operation field's value.
+func (s *UnpeerVpcOutput) SetOperation(v *Operation) *UnpeerVpcOutput {
+ s.Operation = v
+ return s
+}
+
+type UpdateDomainEntryInput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the domain entry.
+ //
+ // DomainEntry is a required field
+ DomainEntry *DomainEntry `locationName:"domainEntry" type:"structure" required:"true"`
+
+ // The name of the domain recordset to update.
+ //
+ // DomainName is a required field
+ DomainName *string `locationName:"domainName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s UpdateDomainEntryInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UpdateDomainEntryInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *UpdateDomainEntryInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "UpdateDomainEntryInput"}
+ if s.DomainEntry == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainEntry"))
+ }
+ if s.DomainName == nil {
+ invalidParams.Add(request.NewErrParamRequired("DomainName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetDomainEntry sets the DomainEntry field's value.
+func (s *UpdateDomainEntryInput) SetDomainEntry(v *DomainEntry) *UpdateDomainEntryInput {
+ s.DomainEntry = v
+ return s
+}
+
+// SetDomainName sets the DomainName field's value.
+func (s *UpdateDomainEntryInput) SetDomainName(v string) *UpdateDomainEntryInput {
+ s.DomainName = &v
+ return s
+}
+
+type UpdateDomainEntryOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An array of key-value pairs containing information about the request operation.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s UpdateDomainEntryOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UpdateDomainEntryOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *UpdateDomainEntryOutput) SetOperations(v []*Operation) *UpdateDomainEntryOutput {
+ s.Operations = v
+ return s
+}
+
+type UpdateLoadBalancerAttributeInput struct {
+ _ struct{} `type:"structure"`
+
+ // The name of the attribute you want to update. Valid values are below.
+ //
+ // AttributeName is a required field
+ AttributeName *string `locationName:"attributeName" type:"string" required:"true" enum:"LoadBalancerAttributeName"`
+
+ // The value that you want to specify for the attribute name.
+ //
+ // AttributeValue is a required field
+ AttributeValue *string `locationName:"attributeValue" min:"1" type:"string" required:"true"`
+
+ // The name of the load balancer that you want to modify.
+ //
+ // LoadBalancerName is a required field
+ LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"`
+}
+
+// String returns the string representation
+func (s UpdateLoadBalancerAttributeInput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UpdateLoadBalancerAttributeInput) GoString() string {
+ return s.String()
+}
+
+// Validate inspects the fields of the type to determine if they are valid.
+func (s *UpdateLoadBalancerAttributeInput) Validate() error {
+ invalidParams := request.ErrInvalidParams{Context: "UpdateLoadBalancerAttributeInput"}
+ if s.AttributeName == nil {
+ invalidParams.Add(request.NewErrParamRequired("AttributeName"))
+ }
+ if s.AttributeValue == nil {
+ invalidParams.Add(request.NewErrParamRequired("AttributeValue"))
+ }
+ if s.AttributeValue != nil && len(*s.AttributeValue) < 1 {
+ invalidParams.Add(request.NewErrParamMinLen("AttributeValue", 1))
+ }
+ if s.LoadBalancerName == nil {
+ invalidParams.Add(request.NewErrParamRequired("LoadBalancerName"))
+ }
+
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ }
+ return nil
+}
+
+// SetAttributeName sets the AttributeName field's value.
+func (s *UpdateLoadBalancerAttributeInput) SetAttributeName(v string) *UpdateLoadBalancerAttributeInput {
+ s.AttributeName = &v
+ return s
+}
+
+// SetAttributeValue sets the AttributeValue field's value.
+func (s *UpdateLoadBalancerAttributeInput) SetAttributeValue(v string) *UpdateLoadBalancerAttributeInput {
+ s.AttributeValue = &v
+ return s
+}
+
+// SetLoadBalancerName sets the LoadBalancerName field's value.
+func (s *UpdateLoadBalancerAttributeInput) SetLoadBalancerName(v string) *UpdateLoadBalancerAttributeInput {
+ s.LoadBalancerName = &v
+ return s
+}
+
+type UpdateLoadBalancerAttributeOutput struct {
+ _ struct{} `type:"structure"`
+
+ // An object describing the API operations.
+ Operations []*Operation `locationName:"operations" type:"list"`
+}
+
+// String returns the string representation
+func (s UpdateLoadBalancerAttributeOutput) String() string {
+ return awsutil.Prettify(s)
+}
+
+// GoString returns the string representation
+func (s UpdateLoadBalancerAttributeOutput) GoString() string {
+ return s.String()
+}
+
+// SetOperations sets the Operations field's value.
+func (s *UpdateLoadBalancerAttributeOutput) SetOperations(v []*Operation) *UpdateLoadBalancerAttributeOutput {
+ s.Operations = v
+ return s
+}
+
+const (
+ // AccessDirectionInbound is a AccessDirection enum value
+ AccessDirectionInbound = "inbound"
+
+ // AccessDirectionOutbound is a AccessDirection enum value
+ AccessDirectionOutbound = "outbound"
+)
+
+const (
+ // BlueprintTypeOs is a BlueprintType enum value
+ BlueprintTypeOs = "os"
+
+ // BlueprintTypeApp is a BlueprintType enum value
+ BlueprintTypeApp = "app"
+)
+
+const (
+ // DiskSnapshotStatePending is a DiskSnapshotState enum value
+ DiskSnapshotStatePending = "pending"
+
+ // DiskSnapshotStateCompleted is a DiskSnapshotState enum value
+ DiskSnapshotStateCompleted = "completed"
+
+ // DiskSnapshotStateError is a DiskSnapshotState enum value
+ DiskSnapshotStateError = "error"
+
+ // DiskSnapshotStateUnknown is a DiskSnapshotState enum value
+ DiskSnapshotStateUnknown = "unknown"
+)
+
+const (
+ // DiskStatePending is a DiskState enum value
+ DiskStatePending = "pending"
+
+ // DiskStateError is a DiskState enum value
+ DiskStateError = "error"
+
+ // DiskStateAvailable is a DiskState enum value
+ DiskStateAvailable = "available"
+
+ // DiskStateInUse is a DiskState enum value
+ DiskStateInUse = "in-use"
+
+ // DiskStateUnknown is a DiskState enum value
+ DiskStateUnknown = "unknown"
+)
+
+const (
+ // InstanceAccessProtocolSsh is a InstanceAccessProtocol enum value
+ InstanceAccessProtocolSsh = "ssh"
+
+ // InstanceAccessProtocolRdp is a InstanceAccessProtocol enum value
+ InstanceAccessProtocolRdp = "rdp"
+)
+
+const (
+ // InstanceHealthReasonLbRegistrationInProgress is a InstanceHealthReason enum value
+ InstanceHealthReasonLbRegistrationInProgress = "Lb.RegistrationInProgress"
+
+ // InstanceHealthReasonLbInitialHealthChecking is a InstanceHealthReason enum value
+ InstanceHealthReasonLbInitialHealthChecking = "Lb.InitialHealthChecking"
+
+ // InstanceHealthReasonLbInternalError is a InstanceHealthReason enum value
+ InstanceHealthReasonLbInternalError = "Lb.InternalError"
+
+ // InstanceHealthReasonInstanceResponseCodeMismatch is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceResponseCodeMismatch = "Instance.ResponseCodeMismatch"
+
+ // InstanceHealthReasonInstanceTimeout is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceTimeout = "Instance.Timeout"
+
+ // InstanceHealthReasonInstanceFailedHealthChecks is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceFailedHealthChecks = "Instance.FailedHealthChecks"
+
+ // InstanceHealthReasonInstanceNotRegistered is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceNotRegistered = "Instance.NotRegistered"
+
+ // InstanceHealthReasonInstanceNotInUse is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceNotInUse = "Instance.NotInUse"
+
+ // InstanceHealthReasonInstanceDeregistrationInProgress is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceDeregistrationInProgress = "Instance.DeregistrationInProgress"
+
+ // InstanceHealthReasonInstanceInvalidState is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceInvalidState = "Instance.InvalidState"
+
+ // InstanceHealthReasonInstanceIpUnusable is a InstanceHealthReason enum value
+ InstanceHealthReasonInstanceIpUnusable = "Instance.IpUnusable"
+)
+
+const (
+ // InstanceHealthStateInitial is a InstanceHealthState enum value
+ InstanceHealthStateInitial = "initial"
+
+ // InstanceHealthStateHealthy is a InstanceHealthState enum value
+ InstanceHealthStateHealthy = "healthy"
+
+ // InstanceHealthStateUnhealthy is a InstanceHealthState enum value
+ InstanceHealthStateUnhealthy = "unhealthy"
+
+ // InstanceHealthStateUnused is a InstanceHealthState enum value
+ InstanceHealthStateUnused = "unused"
+
+ // InstanceHealthStateDraining is a InstanceHealthState enum value
+ InstanceHealthStateDraining = "draining"
+
+ // InstanceHealthStateUnavailable is a InstanceHealthState enum value
+ InstanceHealthStateUnavailable = "unavailable"
+)
+
+const (
+ // InstanceMetricNameCpuutilization is a InstanceMetricName enum value
+ InstanceMetricNameCpuutilization = "CPUUtilization"
+
+ // InstanceMetricNameNetworkIn is a InstanceMetricName enum value
+ InstanceMetricNameNetworkIn = "NetworkIn"
+
+ // InstanceMetricNameNetworkOut is a InstanceMetricName enum value
+ InstanceMetricNameNetworkOut = "NetworkOut"
+
+ // InstanceMetricNameStatusCheckFailed is a InstanceMetricName enum value
+ InstanceMetricNameStatusCheckFailed = "StatusCheckFailed"
+
+ // InstanceMetricNameStatusCheckFailedInstance is a InstanceMetricName enum value
+ InstanceMetricNameStatusCheckFailedInstance = "StatusCheckFailed_Instance"
+
+ // InstanceMetricNameStatusCheckFailedSystem is a InstanceMetricName enum value
+ InstanceMetricNameStatusCheckFailedSystem = "StatusCheckFailed_System"
+)
+
+const (
+ // InstancePlatformLinuxUnix is a InstancePlatform enum value
+ InstancePlatformLinuxUnix = "LINUX_UNIX"
+
+ // InstancePlatformWindows is a InstancePlatform enum value
+ InstancePlatformWindows = "WINDOWS"
+)
+
+const (
+ // InstanceSnapshotStatePending is a InstanceSnapshotState enum value
+ InstanceSnapshotStatePending = "pending"
+
+ // InstanceSnapshotStateError is a InstanceSnapshotState enum value
+ InstanceSnapshotStateError = "error"
+
+ // InstanceSnapshotStateAvailable is a InstanceSnapshotState enum value
+ InstanceSnapshotStateAvailable = "available"
+)
+
+const (
+ // LoadBalancerAttributeNameHealthCheckPath is a LoadBalancerAttributeName enum value
+ LoadBalancerAttributeNameHealthCheckPath = "HealthCheckPath"
+
+ // LoadBalancerAttributeNameSessionStickinessEnabled is a LoadBalancerAttributeName enum value
+ LoadBalancerAttributeNameSessionStickinessEnabled = "SessionStickinessEnabled"
+
+ // LoadBalancerAttributeNameSessionStickinessLbCookieDurationSeconds is a LoadBalancerAttributeName enum value
+ LoadBalancerAttributeNameSessionStickinessLbCookieDurationSeconds = "SessionStickiness_LB_CookieDurationSeconds"
+)
+
+const (
+ // LoadBalancerMetricNameClientTlsnegotiationErrorCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameClientTlsnegotiationErrorCount = "ClientTLSNegotiationErrorCount"
+
+ // LoadBalancerMetricNameHealthyHostCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHealthyHostCount = "HealthyHostCount"
+
+ // LoadBalancerMetricNameUnhealthyHostCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameUnhealthyHostCount = "UnhealthyHostCount"
+
+ // LoadBalancerMetricNameHttpcodeLb4xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeLb4xxCount = "HTTPCode_LB_4XX_Count"
+
+ // LoadBalancerMetricNameHttpcodeLb5xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeLb5xxCount = "HTTPCode_LB_5XX_Count"
+
+ // LoadBalancerMetricNameHttpcodeInstance2xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeInstance2xxCount = "HTTPCode_Instance_2XX_Count"
+
+ // LoadBalancerMetricNameHttpcodeInstance3xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeInstance3xxCount = "HTTPCode_Instance_3XX_Count"
+
+ // LoadBalancerMetricNameHttpcodeInstance4xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeInstance4xxCount = "HTTPCode_Instance_4XX_Count"
+
+ // LoadBalancerMetricNameHttpcodeInstance5xxCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameHttpcodeInstance5xxCount = "HTTPCode_Instance_5XX_Count"
+
+ // LoadBalancerMetricNameInstanceResponseTime is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameInstanceResponseTime = "InstanceResponseTime"
+
+ // LoadBalancerMetricNameRejectedConnectionCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameRejectedConnectionCount = "RejectedConnectionCount"
+
+ // LoadBalancerMetricNameRequestCount is a LoadBalancerMetricName enum value
+ LoadBalancerMetricNameRequestCount = "RequestCount"
+)
+
+const (
+ // LoadBalancerProtocolHttpHttps is a LoadBalancerProtocol enum value
+ LoadBalancerProtocolHttpHttps = "HTTP_HTTPS"
+
+ // LoadBalancerProtocolHttp is a LoadBalancerProtocol enum value
+ LoadBalancerProtocolHttp = "HTTP"
+)
+
+const (
+ // LoadBalancerStateActive is a LoadBalancerState enum value
+ LoadBalancerStateActive = "active"
+
+ // LoadBalancerStateProvisioning is a LoadBalancerState enum value
+ LoadBalancerStateProvisioning = "provisioning"
+
+ // LoadBalancerStateActiveImpaired is a LoadBalancerState enum value
+ LoadBalancerStateActiveImpaired = "active_impaired"
+
+ // LoadBalancerStateFailed is a LoadBalancerState enum value
+ LoadBalancerStateFailed = "failed"
+
+ // LoadBalancerStateUnknown is a LoadBalancerState enum value
+ LoadBalancerStateUnknown = "unknown"
+)
+
+const (
+ // LoadBalancerTlsCertificateDomainStatusPendingValidation is a LoadBalancerTlsCertificateDomainStatus enum value
+ LoadBalancerTlsCertificateDomainStatusPendingValidation = "PENDING_VALIDATION"
+
+ // LoadBalancerTlsCertificateDomainStatusFailed is a LoadBalancerTlsCertificateDomainStatus enum value
+ LoadBalancerTlsCertificateDomainStatusFailed = "FAILED"
+
+ // LoadBalancerTlsCertificateDomainStatusSuccess is a LoadBalancerTlsCertificateDomainStatus enum value
+ LoadBalancerTlsCertificateDomainStatusSuccess = "SUCCESS"
+)
+
+const (
+ // LoadBalancerTlsCertificateFailureReasonNoAvailableContacts is a LoadBalancerTlsCertificateFailureReason enum value
+ LoadBalancerTlsCertificateFailureReasonNoAvailableContacts = "NO_AVAILABLE_CONTACTS"
+
+ // LoadBalancerTlsCertificateFailureReasonAdditionalVerificationRequired is a LoadBalancerTlsCertificateFailureReason enum value
+ LoadBalancerTlsCertificateFailureReasonAdditionalVerificationRequired = "ADDITIONAL_VERIFICATION_REQUIRED"
+
+ // LoadBalancerTlsCertificateFailureReasonDomainNotAllowed is a LoadBalancerTlsCertificateFailureReason enum value
+ LoadBalancerTlsCertificateFailureReasonDomainNotAllowed = "DOMAIN_NOT_ALLOWED"
+
+ // LoadBalancerTlsCertificateFailureReasonInvalidPublicDomain is a LoadBalancerTlsCertificateFailureReason enum value
+ LoadBalancerTlsCertificateFailureReasonInvalidPublicDomain = "INVALID_PUBLIC_DOMAIN"
+
+ // LoadBalancerTlsCertificateFailureReasonOther is a LoadBalancerTlsCertificateFailureReason enum value
+ LoadBalancerTlsCertificateFailureReasonOther = "OTHER"
+)
+
+const (
+ // LoadBalancerTlsCertificateRenewalStatusPendingAutoRenewal is a LoadBalancerTlsCertificateRenewalStatus enum value
+ LoadBalancerTlsCertificateRenewalStatusPendingAutoRenewal = "PENDING_AUTO_RENEWAL"
+
+ // LoadBalancerTlsCertificateRenewalStatusPendingValidation is a LoadBalancerTlsCertificateRenewalStatus enum value
+ LoadBalancerTlsCertificateRenewalStatusPendingValidation = "PENDING_VALIDATION"
+
+ // LoadBalancerTlsCertificateRenewalStatusSuccess is a LoadBalancerTlsCertificateRenewalStatus enum value
+ LoadBalancerTlsCertificateRenewalStatusSuccess = "SUCCESS"
+
+ // LoadBalancerTlsCertificateRenewalStatusFailed is a LoadBalancerTlsCertificateRenewalStatus enum value
+ LoadBalancerTlsCertificateRenewalStatusFailed = "FAILED"
+)
+
+const (
+ // LoadBalancerTlsCertificateRevocationReasonUnspecified is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonUnspecified = "UNSPECIFIED"
+
+ // LoadBalancerTlsCertificateRevocationReasonKeyCompromise is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonKeyCompromise = "KEY_COMPROMISE"
+
+ // LoadBalancerTlsCertificateRevocationReasonCaCompromise is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonCaCompromise = "CA_COMPROMISE"
+
+ // LoadBalancerTlsCertificateRevocationReasonAffiliationChanged is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonAffiliationChanged = "AFFILIATION_CHANGED"
+
+ // LoadBalancerTlsCertificateRevocationReasonSuperceded is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonSuperceded = "SUPERCEDED"
+
+ // LoadBalancerTlsCertificateRevocationReasonCessationOfOperation is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonCessationOfOperation = "CESSATION_OF_OPERATION"
+
+ // LoadBalancerTlsCertificateRevocationReasonCertificateHold is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonCertificateHold = "CERTIFICATE_HOLD"
+
+ // LoadBalancerTlsCertificateRevocationReasonRemoveFromCrl is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonRemoveFromCrl = "REMOVE_FROM_CRL"
+
+ // LoadBalancerTlsCertificateRevocationReasonPrivilegeWithdrawn is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonPrivilegeWithdrawn = "PRIVILEGE_WITHDRAWN"
+
+ // LoadBalancerTlsCertificateRevocationReasonAACompromise is a LoadBalancerTlsCertificateRevocationReason enum value
+ LoadBalancerTlsCertificateRevocationReasonAACompromise = "A_A_COMPROMISE"
+)
+
+const (
+ // LoadBalancerTlsCertificateStatusPendingValidation is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusPendingValidation = "PENDING_VALIDATION"
+
+ // LoadBalancerTlsCertificateStatusIssued is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusIssued = "ISSUED"
+
+ // LoadBalancerTlsCertificateStatusInactive is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusInactive = "INACTIVE"
+
+ // LoadBalancerTlsCertificateStatusExpired is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusExpired = "EXPIRED"
+
+ // LoadBalancerTlsCertificateStatusValidationTimedOut is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusValidationTimedOut = "VALIDATION_TIMED_OUT"
+
+ // LoadBalancerTlsCertificateStatusRevoked is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusRevoked = "REVOKED"
+
+ // LoadBalancerTlsCertificateStatusFailed is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusFailed = "FAILED"
+
+ // LoadBalancerTlsCertificateStatusUnknown is a LoadBalancerTlsCertificateStatus enum value
+ LoadBalancerTlsCertificateStatusUnknown = "UNKNOWN"
+)
+
+const (
+ // MetricStatisticMinimum is a MetricStatistic enum value
+ MetricStatisticMinimum = "Minimum"
+
+ // MetricStatisticMaximum is a MetricStatistic enum value
+ MetricStatisticMaximum = "Maximum"
+
+ // MetricStatisticSum is a MetricStatistic enum value
+ MetricStatisticSum = "Sum"
+
+ // MetricStatisticAverage is a MetricStatistic enum value
+ MetricStatisticAverage = "Average"
+
+ // MetricStatisticSampleCount is a MetricStatistic enum value
+ MetricStatisticSampleCount = "SampleCount"
+)
+
+const (
+ // MetricUnitSeconds is a MetricUnit enum value
+ MetricUnitSeconds = "Seconds"
+
+ // MetricUnitMicroseconds is a MetricUnit enum value
+ MetricUnitMicroseconds = "Microseconds"
+
+ // MetricUnitMilliseconds is a MetricUnit enum value
+ MetricUnitMilliseconds = "Milliseconds"
+
+ // MetricUnitBytes is a MetricUnit enum value
+ MetricUnitBytes = "Bytes"
+
+ // MetricUnitKilobytes is a MetricUnit enum value
+ MetricUnitKilobytes = "Kilobytes"
+
+ // MetricUnitMegabytes is a MetricUnit enum value
+ MetricUnitMegabytes = "Megabytes"
+
+ // MetricUnitGigabytes is a MetricUnit enum value
+ MetricUnitGigabytes = "Gigabytes"
+
+ // MetricUnitTerabytes is a MetricUnit enum value
+ MetricUnitTerabytes = "Terabytes"
+
+ // MetricUnitBits is a MetricUnit enum value
+ MetricUnitBits = "Bits"
+
+ // MetricUnitKilobits is a MetricUnit enum value
+ MetricUnitKilobits = "Kilobits"
+
+ // MetricUnitMegabits is a MetricUnit enum value
+ MetricUnitMegabits = "Megabits"
+
+ // MetricUnitGigabits is a MetricUnit enum value
+ MetricUnitGigabits = "Gigabits"
+
+ // MetricUnitTerabits is a MetricUnit enum value
+ MetricUnitTerabits = "Terabits"
+
+ // MetricUnitPercent is a MetricUnit enum value
+ MetricUnitPercent = "Percent"
+
+ // MetricUnitCount is a MetricUnit enum value
+ MetricUnitCount = "Count"
+
+ // MetricUnitBytesSecond is a MetricUnit enum value
+ MetricUnitBytesSecond = "Bytes/Second"
+
+ // MetricUnitKilobytesSecond is a MetricUnit enum value
+ MetricUnitKilobytesSecond = "Kilobytes/Second"
+
+ // MetricUnitMegabytesSecond is a MetricUnit enum value
+ MetricUnitMegabytesSecond = "Megabytes/Second"
+
+ // MetricUnitGigabytesSecond is a MetricUnit enum value
+ MetricUnitGigabytesSecond = "Gigabytes/Second"
+
+ // MetricUnitTerabytesSecond is a MetricUnit enum value
+ MetricUnitTerabytesSecond = "Terabytes/Second"
+
+ // MetricUnitBitsSecond is a MetricUnit enum value
+ MetricUnitBitsSecond = "Bits/Second"
+
+ // MetricUnitKilobitsSecond is a MetricUnit enum value
+ MetricUnitKilobitsSecond = "Kilobits/Second"
+
+ // MetricUnitMegabitsSecond is a MetricUnit enum value
+ MetricUnitMegabitsSecond = "Megabits/Second"
+
+ // MetricUnitGigabitsSecond is a MetricUnit enum value
+ MetricUnitGigabitsSecond = "Gigabits/Second"
+
+ // MetricUnitTerabitsSecond is a MetricUnit enum value
+ MetricUnitTerabitsSecond = "Terabits/Second"
+
+ // MetricUnitCountSecond is a MetricUnit enum value
+ MetricUnitCountSecond = "Count/Second"
+
+ // MetricUnitNone is a MetricUnit enum value
+ MetricUnitNone = "None"
+)
+
+const (
+ // NetworkProtocolTcp is a NetworkProtocol enum value
+ NetworkProtocolTcp = "tcp"
+
+ // NetworkProtocolAll is a NetworkProtocol enum value
+ NetworkProtocolAll = "all"
+
+ // NetworkProtocolUdp is a NetworkProtocol enum value
+ NetworkProtocolUdp = "udp"
+)
+
+const (
+ // OperationStatusNotStarted is a OperationStatus enum value
+ OperationStatusNotStarted = "NotStarted"
+
+ // OperationStatusStarted is a OperationStatus enum value
+ OperationStatusStarted = "Started"
+
+ // OperationStatusFailed is a OperationStatus enum value
+ OperationStatusFailed = "Failed"
+
+ // OperationStatusCompleted is a OperationStatus enum value
+ OperationStatusCompleted = "Completed"
+)
+
+const (
+ // OperationTypeDeleteInstance is a OperationType enum value
+ OperationTypeDeleteInstance = "DeleteInstance"
+
+ // OperationTypeCreateInstance is a OperationType enum value
+ OperationTypeCreateInstance = "CreateInstance"
+
+ // OperationTypeStopInstance is a OperationType enum value
+ OperationTypeStopInstance = "StopInstance"
+
+ // OperationTypeStartInstance is a OperationType enum value
+ OperationTypeStartInstance = "StartInstance"
+
+ // OperationTypeRebootInstance is a OperationType enum value
+ OperationTypeRebootInstance = "RebootInstance"
+
+ // OperationTypeOpenInstancePublicPorts is a OperationType enum value
+ OperationTypeOpenInstancePublicPorts = "OpenInstancePublicPorts"
+
+ // OperationTypePutInstancePublicPorts is a OperationType enum value
+ OperationTypePutInstancePublicPorts = "PutInstancePublicPorts"
+
+ // OperationTypeCloseInstancePublicPorts is a OperationType enum value
+ OperationTypeCloseInstancePublicPorts = "CloseInstancePublicPorts"
+
+ // OperationTypeAllocateStaticIp is a OperationType enum value
+ OperationTypeAllocateStaticIp = "AllocateStaticIp"
+
+ // OperationTypeReleaseStaticIp is a OperationType enum value
+ OperationTypeReleaseStaticIp = "ReleaseStaticIp"
+
+ // OperationTypeAttachStaticIp is a OperationType enum value
+ OperationTypeAttachStaticIp = "AttachStaticIp"
+
+ // OperationTypeDetachStaticIp is a OperationType enum value
+ OperationTypeDetachStaticIp = "DetachStaticIp"
+
+ // OperationTypeUpdateDomainEntry is a OperationType enum value
+ OperationTypeUpdateDomainEntry = "UpdateDomainEntry"
+
+ // OperationTypeDeleteDomainEntry is a OperationType enum value
+ OperationTypeDeleteDomainEntry = "DeleteDomainEntry"
+
+ // OperationTypeCreateDomain is a OperationType enum value
+ OperationTypeCreateDomain = "CreateDomain"
+
+ // OperationTypeDeleteDomain is a OperationType enum value
+ OperationTypeDeleteDomain = "DeleteDomain"
+
+ // OperationTypeCreateInstanceSnapshot is a OperationType enum value
+ OperationTypeCreateInstanceSnapshot = "CreateInstanceSnapshot"
+
+ // OperationTypeDeleteInstanceSnapshot is a OperationType enum value
+ OperationTypeDeleteInstanceSnapshot = "DeleteInstanceSnapshot"
+
+ // OperationTypeCreateInstancesFromSnapshot is a OperationType enum value
+ OperationTypeCreateInstancesFromSnapshot = "CreateInstancesFromSnapshot"
+
+ // OperationTypeCreateLoadBalancer is a OperationType enum value
+ OperationTypeCreateLoadBalancer = "CreateLoadBalancer"
+
+ // OperationTypeDeleteLoadBalancer is a OperationType enum value
+ OperationTypeDeleteLoadBalancer = "DeleteLoadBalancer"
+
+ // OperationTypeAttachInstancesToLoadBalancer is a OperationType enum value
+ OperationTypeAttachInstancesToLoadBalancer = "AttachInstancesToLoadBalancer"
+
+ // OperationTypeDetachInstancesFromLoadBalancer is a OperationType enum value
+ OperationTypeDetachInstancesFromLoadBalancer = "DetachInstancesFromLoadBalancer"
+
+ // OperationTypeUpdateLoadBalancerAttribute is a OperationType enum value
+ OperationTypeUpdateLoadBalancerAttribute = "UpdateLoadBalancerAttribute"
+
+ // OperationTypeCreateLoadBalancerTlsCertificate is a OperationType enum value
+ OperationTypeCreateLoadBalancerTlsCertificate = "CreateLoadBalancerTlsCertificate"
+
+ // OperationTypeDeleteLoadBalancerTlsCertificate is a OperationType enum value
+ OperationTypeDeleteLoadBalancerTlsCertificate = "DeleteLoadBalancerTlsCertificate"
+
+ // OperationTypeAttachLoadBalancerTlsCertificate is a OperationType enum value
+ OperationTypeAttachLoadBalancerTlsCertificate = "AttachLoadBalancerTlsCertificate"
+
+ // OperationTypeCreateDisk is a OperationType enum value
+ OperationTypeCreateDisk = "CreateDisk"
+
+ // OperationTypeDeleteDisk is a OperationType enum value
+ OperationTypeDeleteDisk = "DeleteDisk"
+
+ // OperationTypeAttachDisk is a OperationType enum value
+ OperationTypeAttachDisk = "AttachDisk"
+
+ // OperationTypeDetachDisk is a OperationType enum value
+ OperationTypeDetachDisk = "DetachDisk"
+
+ // OperationTypeCreateDiskSnapshot is a OperationType enum value
+ OperationTypeCreateDiskSnapshot = "CreateDiskSnapshot"
+
+ // OperationTypeDeleteDiskSnapshot is a OperationType enum value
+ OperationTypeDeleteDiskSnapshot = "DeleteDiskSnapshot"
+
+ // OperationTypeCreateDiskFromSnapshot is a OperationType enum value
+ OperationTypeCreateDiskFromSnapshot = "CreateDiskFromSnapshot"
+)
+
+const (
+ // PortAccessTypePublic is a PortAccessType enum value
+ PortAccessTypePublic = "Public"
+
+ // PortAccessTypePrivate is a PortAccessType enum value
+ PortAccessTypePrivate = "Private"
+)
+
+const (
+ // PortStateOpen is a PortState enum value
+ PortStateOpen = "open"
+
+ // PortStateClosed is a PortState enum value
+ PortStateClosed = "closed"
+)
+
+const (
+ // RegionNameUsEast1 is a RegionName enum value
+ RegionNameUsEast1 = "us-east-1"
+
+ // RegionNameUsEast2 is a RegionName enum value
+ RegionNameUsEast2 = "us-east-2"
+
+ // RegionNameUsWest1 is a RegionName enum value
+ RegionNameUsWest1 = "us-west-1"
+
+ // RegionNameUsWest2 is a RegionName enum value
+ RegionNameUsWest2 = "us-west-2"
+
+ // RegionNameEuWest1 is a RegionName enum value
+ RegionNameEuWest1 = "eu-west-1"
+
+ // RegionNameEuCentral1 is a RegionName enum value
+ RegionNameEuCentral1 = "eu-central-1"
+
+ // RegionNameApSouth1 is a RegionName enum value
+ RegionNameApSouth1 = "ap-south-1"
+
+ // RegionNameApSoutheast1 is a RegionName enum value
+ RegionNameApSoutheast1 = "ap-southeast-1"
+
+ // RegionNameApSoutheast2 is a RegionName enum value
+ RegionNameApSoutheast2 = "ap-southeast-2"
+
+ // RegionNameApNortheast1 is a RegionName enum value
+ RegionNameApNortheast1 = "ap-northeast-1"
+
+ // RegionNameApNortheast2 is a RegionName enum value
+ RegionNameApNortheast2 = "ap-northeast-2"
+)
+
+const (
+ // ResourceTypeInstance is a ResourceType enum value
+ ResourceTypeInstance = "Instance"
+
+ // ResourceTypeStaticIp is a ResourceType enum value
+ ResourceTypeStaticIp = "StaticIp"
+
+ // ResourceTypeKeyPair is a ResourceType enum value
+ ResourceTypeKeyPair = "KeyPair"
+
+ // ResourceTypeInstanceSnapshot is a ResourceType enum value
+ ResourceTypeInstanceSnapshot = "InstanceSnapshot"
+
+ // ResourceTypeDomain is a ResourceType enum value
+ ResourceTypeDomain = "Domain"
+
+ // ResourceTypePeeredVpc is a ResourceType enum value
+ ResourceTypePeeredVpc = "PeeredVpc"
+
+ // ResourceTypeLoadBalancer is a ResourceType enum value
+ ResourceTypeLoadBalancer = "LoadBalancer"
+
+ // ResourceTypeLoadBalancerTlsCertificate is a ResourceType enum value
+ ResourceTypeLoadBalancerTlsCertificate = "LoadBalancerTlsCertificate"
+
+ // ResourceTypeDisk is a ResourceType enum value
+ ResourceTypeDisk = "Disk"
+
+ // ResourceTypeDiskSnapshot is a ResourceType enum value
+ ResourceTypeDiskSnapshot = "DiskSnapshot"
+)
diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go
new file mode 100644
index 000000000..9c52815bb
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go
@@ -0,0 +1,40 @@
+// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
+
+// Package lightsail provides the client and types for making API
+// requests to Amazon Lightsail.
+//
+// Amazon Lightsail is the easiest way to get started with AWS for developers
+// who just need virtual private servers. Lightsail includes everything you
+// need to launch your project quickly - a virtual machine, SSD-based storage,
+// data transfer, DNS management, and a static IP - for a low, predictable price.
+// You manage those Lightsail servers through the Lightsail console or by using
+// the API or command-line interface (CLI).
+//
+// For more information about Lightsail concepts and tasks, see the Lightsail
+// Dev Guide (https://lightsail.aws.amazon.com/ls/docs/all).
+//
+// To use the Lightsail API or the CLI, you will need to use AWS Identity and
+// Access Management (IAM) to generate access keys. For details about how to
+// set this up, see the Lightsail Dev Guide (http://lightsail.aws.amazon.com/ls/docs/how-to/article/lightsail-how-to-set-up-access-keys-to-use-sdk-api-cli).
+//
+// See https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28 for more information on this service.
+//
+// See lightsail package documentation for more information.
+// https://docs.aws.amazon.com/sdk-for-go/api/service/lightsail/
+//
+// Using the Client
+//
+// To contact Amazon Lightsail with the SDK use the New function to create
+// a new service client. With that client you can make API requests to the service.
+// These clients are safe to use concurrently.
+//
+// See the SDK's documentation for more information on how to use the SDK.
+// https://docs.aws.amazon.com/sdk-for-go/api/
+//
+// See aws.Config documentation for more information on configuring SDK clients.
+// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
+//
+// See the Amazon Lightsail client Lightsail for more
+// information on creating client for this service.
+// https://docs.aws.amazon.com/sdk-for-go/api/service/lightsail/#New
+package lightsail
diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go
new file mode 100644
index 000000000..d1ef481f2
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go
@@ -0,0 +1,55 @@
+// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
+
+package lightsail
+
+const (
+
+ // ErrCodeAccessDeniedException for service response error code
+ // "AccessDeniedException".
+ //
+ // Lightsail throws this exception when the user cannot be authenticated or
+ // uses invalid credentials to access a resource.
+ ErrCodeAccessDeniedException = "AccessDeniedException"
+
+ // ErrCodeAccountSetupInProgressException for service response error code
+ // "AccountSetupInProgressException".
+ //
+ // Lightsail throws this exception when an account is still in the setup in
+ // progress state.
+ ErrCodeAccountSetupInProgressException = "AccountSetupInProgressException"
+
+ // ErrCodeInvalidInputException for service response error code
+ // "InvalidInputException".
+ //
+ // Lightsail throws this exception when user input does not conform to the validation
+ // rules of an input field.
+ //
+ // Domain-related APIs are only available in the N. Virginia (us-east-1) Region.
+ // Please set your Region configuration to us-east-1 to create, view, or edit
+ // these resources.
+ ErrCodeInvalidInputException = "InvalidInputException"
+
+ // ErrCodeNotFoundException for service response error code
+ // "NotFoundException".
+ //
+ // Lightsail throws this exception when it cannot find a resource.
+ ErrCodeNotFoundException = "NotFoundException"
+
+ // ErrCodeOperationFailureException for service response error code
+ // "OperationFailureException".
+ //
+ // Lightsail throws this exception when an operation fails to execute.
+ ErrCodeOperationFailureException = "OperationFailureException"
+
+ // ErrCodeServiceException for service response error code
+ // "ServiceException".
+ //
+ // A general service exception.
+ ErrCodeServiceException = "ServiceException"
+
+ // ErrCodeUnauthenticatedException for service response error code
+ // "UnauthenticatedException".
+ //
+ // Lightsail throws this exception when the user has not been authenticated.
+ ErrCodeUnauthenticatedException = "UnauthenticatedException"
+)
diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go
new file mode 100644
index 000000000..a76cf79e0
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/service.go
@@ -0,0 +1,95 @@
+// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
+
+package lightsail
+
+import (
+ "github.com/aws/aws-sdk-go/aws"
+ "github.com/aws/aws-sdk-go/aws/client"
+ "github.com/aws/aws-sdk-go/aws/client/metadata"
+ "github.com/aws/aws-sdk-go/aws/request"
+ "github.com/aws/aws-sdk-go/aws/signer/v4"
+ "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
+)
+
+// Lightsail provides the API operation methods for making requests to
+// Amazon Lightsail. See this package's package overview docs
+// for details on the service.
+//
+// Lightsail methods are safe to use concurrently. It is not safe to
+// modify mutate any of the struct's properties though.
+type Lightsail struct {
+ *client.Client
+}
+
+// Used for custom client initialization logic
+var initClient func(*client.Client)
+
+// Used for custom request initialization logic
+var initRequest func(*request.Request)
+
+// Service information constants
+const (
+ ServiceName = "lightsail" // Service endpoint prefix API calls made to.
+ EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
+)
+
+// New creates a new instance of the Lightsail client with a session.
+// If additional configuration is needed for the client instance use the optional
+// aws.Config parameter to add your extra config.
+//
+// Example:
+// // Create a Lightsail client from just a session.
+// svc := lightsail.New(mySession)
+//
+// // Create a Lightsail client with additional configuration
+// svc := lightsail.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
+func New(p client.ConfigProvider, cfgs ...*aws.Config) *Lightsail {
+ c := p.ClientConfig(EndpointsID, cfgs...)
+ return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
+}
+
+// newClient creates, initializes and returns a new service client instance.
+func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Lightsail {
+ svc := &Lightsail{
+ Client: client.New(
+ cfg,
+ metadata.ClientInfo{
+ ServiceName: ServiceName,
+ SigningName: signingName,
+ SigningRegion: signingRegion,
+ Endpoint: endpoint,
+ APIVersion: "2016-11-28",
+ JSONVersion: "1.1",
+ TargetPrefix: "Lightsail_20161128",
+ },
+ handlers,
+ ),
+ }
+
+ // Handlers
+ svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
+ svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
+ svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
+ svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
+ svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
+
+ // Run custom client initialization if present
+ if initClient != nil {
+ initClient(svc.Client)
+ }
+
+ return svc
+}
+
+// newRequest creates a new request for a Lightsail operation and runs any
+// custom request initialization.
+func (c *Lightsail) newRequest(op *request.Operation, params, data interface{}) *request.Request {
+ req := c.NewRequest(op, params, data)
+
+ // Run custom request initialization if present
+ if initRequest != nil {
+ initRequest(req)
+ }
+
+ return req
+}
diff --git a/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_config.go b/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_config.go
index a2bf65c3d..c4ee4287e 100644
--- a/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_config.go
+++ b/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_config.go
@@ -38,7 +38,7 @@ func (p *Provider) buildConfiguration(sfClient sfClient) (*types.Configuration,
"filterServicesByLabelValue": filterServicesByLabelValue, // FIXME unused
// Backend functions
- "getWeight": getFuncServiceStringLabel(label.TraefikWeight, label.DefaultWeight),
+ "getWeight": getFuncServiceIntLabel(label.TraefikWeight, label.DefaultWeightInt),
"getProtocol": getFuncServiceStringLabel(label.TraefikProtocol, label.DefaultProtocol),
"getMaxConn": getMaxConn,
"getHealthCheck": getHealthCheck,
@@ -46,8 +46,8 @@ func (p *Provider) buildConfiguration(sfClient sfClient) (*types.Configuration,
"getLoadBalancer": getLoadBalancer,
// Frontend Functions
- "getPriority": getFuncServiceStringLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriority),
- "getPassHostHeader": getFuncServiceStringLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeader),
+ "getPriority": getFuncServiceIntLabel(label.TraefikFrontendPriority, label.DefaultFrontendPriorityInt),
+ "getPassHostHeader": getFuncServiceBoolLabel(label.TraefikFrontendPassHostHeader, label.DefaultPassHostHeaderBool),
"getPassTLSCert": getFuncBoolLabel(label.TraefikFrontendPassTLSCert, false),
"getEntryPoints": getFuncServiceSliceStringLabel(label.TraefikFrontendEntryPoints),
"getBasicAuth": getFuncServiceSliceStringLabel(label.TraefikFrontendAuthBasic),
diff --git a/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go b/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go
index 14112e486..663118a08 100644
--- a/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go
+++ b/vendor/github.com/containous/traefik-extra-service-fabric/servicefabric_labelfuncs.go
@@ -30,6 +30,18 @@ func getFuncServiceStringLabel(labelName string, defaultValue string) func(servi
}
}
+func getFuncServiceIntLabel(labelName string, defaultValue int) func(service ServiceItemExtended) int {
+ return func(service ServiceItemExtended) int {
+ return label.GetIntValue(service.Labels, labelName, defaultValue)
+ }
+}
+
+func getFuncServiceBoolLabel(labelName string, defaultValue bool) func(service ServiceItemExtended) bool {
+ return func(service ServiceItemExtended) bool {
+ return label.GetBoolValue(service.Labels, labelName, defaultValue)
+ }
+}
+
func getFuncServiceSliceStringLabel(labelName string) func(service ServiceItemExtended) []string {
return func(service ServiceItemExtended) []string {
return label.GetSliceStringValue(service.Labels, labelName)
diff --git a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go
index 2f59a2223..f97738124 100644
--- a/vendor/github.com/dgrijalva/jwt-go/ecdsa.go
+++ b/vendor/github.com/dgrijalva/jwt-go/ecdsa.go
@@ -14,6 +14,7 @@ var (
)
// Implements the ECDSA family of signing methods signing methods
+// Expects *ecdsa.PrivateKey for signing and *ecdsa.PublicKey for verification
type SigningMethodECDSA struct {
Name string
Hash crypto.Hash
diff --git a/vendor/github.com/dgrijalva/jwt-go/errors.go b/vendor/github.com/dgrijalva/jwt-go/errors.go
index 662df19d4..1c93024aa 100644
--- a/vendor/github.com/dgrijalva/jwt-go/errors.go
+++ b/vendor/github.com/dgrijalva/jwt-go/errors.go
@@ -51,13 +51,9 @@ func (e ValidationError) Error() string {
} else {
return "token is invalid"
}
- return e.Inner.Error()
}
// No errors
func (e *ValidationError) valid() bool {
- if e.Errors > 0 {
- return false
- }
- return true
+ return e.Errors == 0
}
diff --git a/vendor/github.com/dgrijalva/jwt-go/hmac.go b/vendor/github.com/dgrijalva/jwt-go/hmac.go
index c22991925..addbe5d40 100644
--- a/vendor/github.com/dgrijalva/jwt-go/hmac.go
+++ b/vendor/github.com/dgrijalva/jwt-go/hmac.go
@@ -7,6 +7,7 @@ import (
)
// Implements the HMAC-SHA family of signing methods signing methods
+// Expects key type of []byte for both signing and validation
type SigningMethodHMAC struct {
Name string
Hash crypto.Hash
@@ -90,5 +91,5 @@ func (m *SigningMethodHMAC) Sign(signingString string, key interface{}) (string,
return EncodeSegment(hasher.Sum(nil)), nil
}
- return "", ErrInvalidKey
+ return "", ErrInvalidKeyType
}
diff --git a/vendor/github.com/dgrijalva/jwt-go/parser.go b/vendor/github.com/dgrijalva/jwt-go/parser.go
index 7020c52a1..d6901d9ad 100644
--- a/vendor/github.com/dgrijalva/jwt-go/parser.go
+++ b/vendor/github.com/dgrijalva/jwt-go/parser.go
@@ -8,8 +8,9 @@ import (
)
type Parser struct {
- ValidMethods []string // If populated, only these methods will be considered valid
- UseJSONNumber bool // Use JSON Number format in JSON decoder
+ ValidMethods []string // If populated, only these methods will be considered valid
+ UseJSONNumber bool // Use JSON Number format in JSON decoder
+ SkipClaimsValidation bool // Skip claims validation during token parsing
}
// Parse, validate, and return a token.
@@ -20,55 +21,9 @@ func (p *Parser) Parse(tokenString string, keyFunc Keyfunc) (*Token, error) {
}
func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token, error) {
- parts := strings.Split(tokenString, ".")
- if len(parts) != 3 {
- return nil, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
- }
-
- var err error
- token := &Token{Raw: tokenString}
-
- // parse Header
- var headerBytes []byte
- if headerBytes, err = DecodeSegment(parts[0]); err != nil {
- if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
- return token, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
- }
- return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
- }
- if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
- return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
- }
-
- // parse Claims
- var claimBytes []byte
- token.Claims = claims
-
- if claimBytes, err = DecodeSegment(parts[1]); err != nil {
- return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
- }
- dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
- if p.UseJSONNumber {
- dec.UseNumber()
- }
- // JSON Decode. Special case for map type to avoid weird pointer behavior
- if c, ok := token.Claims.(MapClaims); ok {
- err = dec.Decode(&c)
- } else {
- err = dec.Decode(&claims)
- }
- // Handle decode error
+ token, parts, err := p.ParseUnverified(tokenString, claims)
if err != nil {
- return token, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
- }
-
- // Lookup signature method
- if method, ok := token.Header["alg"].(string); ok {
- if token.Method = GetSigningMethod(method); token.Method == nil {
- return token, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
- }
- } else {
- return token, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
+ return token, err
}
// Verify signing method is in the required set
@@ -95,20 +50,25 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
}
if key, err = keyFunc(token); err != nil {
// keyFunc returned an error
+ if ve, ok := err.(*ValidationError); ok {
+ return token, ve
+ }
return token, &ValidationError{Inner: err, Errors: ValidationErrorUnverifiable}
}
vErr := &ValidationError{}
// Validate Claims
- if err := token.Claims.Valid(); err != nil {
+ if !p.SkipClaimsValidation {
+ if err := token.Claims.Valid(); err != nil {
- // If the Claims Valid returned an error, check if it is a validation error,
- // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
- if e, ok := err.(*ValidationError); !ok {
- vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
- } else {
- vErr = e
+ // If the Claims Valid returned an error, check if it is a validation error,
+ // If it was another error type, create a ValidationError with a generic ClaimsInvalid flag set
+ if e, ok := err.(*ValidationError); !ok {
+ vErr = &ValidationError{Inner: err, Errors: ValidationErrorClaimsInvalid}
+ } else {
+ vErr = e
+ }
}
}
@@ -126,3 +86,63 @@ func (p *Parser) ParseWithClaims(tokenString string, claims Claims, keyFunc Keyf
return token, vErr
}
+
+// WARNING: Don't use this method unless you know what you're doing
+//
+// This method parses the token but doesn't validate the signature. It's only
+// ever useful in cases where you know the signature is valid (because it has
+// been checked previously in the stack) and you want to extract values from
+// it.
+func (p *Parser) ParseUnverified(tokenString string, claims Claims) (token *Token, parts []string, err error) {
+ parts = strings.Split(tokenString, ".")
+ if len(parts) != 3 {
+ return nil, parts, NewValidationError("token contains an invalid number of segments", ValidationErrorMalformed)
+ }
+
+ token = &Token{Raw: tokenString}
+
+ // parse Header
+ var headerBytes []byte
+ if headerBytes, err = DecodeSegment(parts[0]); err != nil {
+ if strings.HasPrefix(strings.ToLower(tokenString), "bearer ") {
+ return token, parts, NewValidationError("tokenstring should not contain 'bearer '", ValidationErrorMalformed)
+ }
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+ if err = json.Unmarshal(headerBytes, &token.Header); err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+
+ // parse Claims
+ var claimBytes []byte
+ token.Claims = claims
+
+ if claimBytes, err = DecodeSegment(parts[1]); err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+ dec := json.NewDecoder(bytes.NewBuffer(claimBytes))
+ if p.UseJSONNumber {
+ dec.UseNumber()
+ }
+ // JSON Decode. Special case for map type to avoid weird pointer behavior
+ if c, ok := token.Claims.(MapClaims); ok {
+ err = dec.Decode(&c)
+ } else {
+ err = dec.Decode(&claims)
+ }
+ // Handle decode error
+ if err != nil {
+ return token, parts, &ValidationError{Inner: err, Errors: ValidationErrorMalformed}
+ }
+
+ // Lookup signature method
+ if method, ok := token.Header["alg"].(string); ok {
+ if token.Method = GetSigningMethod(method); token.Method == nil {
+ return token, parts, NewValidationError("signing method (alg) is unavailable.", ValidationErrorUnverifiable)
+ }
+ } else {
+ return token, parts, NewValidationError("signing method (alg) is unspecified.", ValidationErrorUnverifiable)
+ }
+
+ return token, parts, nil
+}
diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa.go b/vendor/github.com/dgrijalva/jwt-go/rsa.go
index 0ae0b1984..e4caf1ca4 100644
--- a/vendor/github.com/dgrijalva/jwt-go/rsa.go
+++ b/vendor/github.com/dgrijalva/jwt-go/rsa.go
@@ -7,6 +7,7 @@ import (
)
// Implements the RSA family of signing methods signing methods
+// Expects *rsa.PrivateKey for signing and *rsa.PublicKey for validation
type SigningMethodRSA struct {
Name string
Hash crypto.Hash
@@ -44,7 +45,7 @@ func (m *SigningMethodRSA) Alg() string {
}
// Implements the Verify method from SigningMethod
-// For this signing method, must be an rsa.PublicKey structure.
+// For this signing method, must be an *rsa.PublicKey structure.
func (m *SigningMethodRSA) Verify(signingString, signature string, key interface{}) error {
var err error
@@ -73,7 +74,7 @@ func (m *SigningMethodRSA) Verify(signingString, signature string, key interface
}
// Implements the Sign method from SigningMethod
-// For this signing method, must be an rsa.PrivateKey structure.
+// For this signing method, must be an *rsa.PrivateKey structure.
func (m *SigningMethodRSA) Sign(signingString string, key interface{}) (string, error) {
var rsaKey *rsa.PrivateKey
var ok bool
diff --git a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go
index 213a90dbb..a5ababf95 100644
--- a/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go
+++ b/vendor/github.com/dgrijalva/jwt-go/rsa_utils.go
@@ -39,6 +39,38 @@ func ParseRSAPrivateKeyFromPEM(key []byte) (*rsa.PrivateKey, error) {
return pkey, nil
}
+// Parse PEM encoded PKCS1 or PKCS8 private key protected with password
+func ParseRSAPrivateKeyFromPEMWithPassword(key []byte, password string) (*rsa.PrivateKey, error) {
+ var err error
+
+ // Parse PEM block
+ var block *pem.Block
+ if block, _ = pem.Decode(key); block == nil {
+ return nil, ErrKeyMustBePEMEncoded
+ }
+
+ var parsedKey interface{}
+
+ var blockDecrypted []byte
+ if blockDecrypted, err = x509.DecryptPEMBlock(block, []byte(password)); err != nil {
+ return nil, err
+ }
+
+ if parsedKey, err = x509.ParsePKCS1PrivateKey(blockDecrypted); err != nil {
+ if parsedKey, err = x509.ParsePKCS8PrivateKey(blockDecrypted); err != nil {
+ return nil, err
+ }
+ }
+
+ var pkey *rsa.PrivateKey
+ var ok bool
+ if pkey, ok = parsedKey.(*rsa.PrivateKey); !ok {
+ return nil, ErrNotRSAPrivateKey
+ }
+
+ return pkey, nil
+}
+
// Parse PEM encoded PKCS1 or PKCS8 public key
func ParseRSAPublicKeyFromPEM(key []byte) (*rsa.PublicKey, error) {
var err error
diff --git a/vendor/github.com/namedotcom/go/LICENSE b/vendor/github.com/namedotcom/go/LICENSE
new file mode 100644
index 000000000..42c65b5c9
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Name.com
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/namedotcom/go/namecom/dns.go b/vendor/github.com/namedotcom/go/namecom/dns.go
new file mode 100644
index 000000000..dd951725d
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/dns.go
@@ -0,0 +1,133 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListRecords returns all records for a zone.
+func (n *NameCom) ListRecords(request *ListRecordsRequest) (*ListRecordsResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/records", request.DomainName)
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListRecordsResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetRecord returns details about an individual record.
+func (n *NameCom) GetRecord(request *GetRecordRequest) (*Record, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/records/%d", request.DomainName, request.ID)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Record{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateRecord creates a new record in the zone.
+func (n *NameCom) CreateRecord(request *Record) (*Record, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/records", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Record{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// UpdateRecord replaces the record with the new record that is passed.
+func (n *NameCom) UpdateRecord(request *Record) (*Record, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/records/%d", request.DomainName, request.ID)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.put(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Record{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DeleteRecord deletes a record from the zone.
+func (n *NameCom) DeleteRecord(request *DeleteRecordRequest) (*EmptyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/records/%d", request.DomainName, request.ID)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.delete(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmptyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/dnssecs.go b/vendor/github.com/namedotcom/go/namecom/dnssecs.go
new file mode 100644
index 000000000..91d17c26c
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/dnssecs.go
@@ -0,0 +1,102 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListDNSSECs lists all of the DNSSEC keys registered with the registry.
+func (n *NameCom) ListDNSSECs(request *ListDNSSECsRequest) (*ListDNSSECsResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/dnssec", request.DomainName)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListDNSSECsResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetDNSSEC retrieves the details for a key registered with the registry.
+func (n *NameCom) GetDNSSEC(request *GetDNSSECRequest) (*DNSSEC, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/dnssec/%s", request.DomainName, request.Digest)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &DNSSEC{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateDNSSEC registers a DNSSEC key with the registry.
+func (n *NameCom) CreateDNSSEC(request *DNSSEC) (*DNSSEC, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/dnssec", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &DNSSEC{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DeleteDNSSEC removes a DNSSEC key from the registry.
+func (n *NameCom) DeleteDNSSEC(request *DeleteDNSSECRequest) (*EmptyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/dnssec/%s", request.DomainName, request.Digest)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.delete(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmptyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/domains.go b/vendor/github.com/namedotcom/go/namecom/domains.go
new file mode 100644
index 000000000..bee080beb
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/domains.go
@@ -0,0 +1,382 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListDomains returns all domains in the account. It omits some information that can be retrieved from GetDomain.
+func (n *NameCom) ListDomains(request *ListDomainsRequest) (*ListDomainsResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListDomainsResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetDomain returns details about a specific domain
+func (n *NameCom) GetDomain(request *GetDomainRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s", request.DomainName)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateDomain purchases a new domain. Domains that are not regularly priced require the purchase_price field to be specified.
+func (n *NameCom) CreateDomain(request *CreateDomainRequest) (*CreateDomainResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &CreateDomainResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// EnableAutorenew enables the domain to be automatically renewed when it gets close to expiring.
+func (n *NameCom) EnableAutorenew(request *EnableAutorenewForDomainRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DisableAutorenew disables automatic renewals, thus requiring the domain to be renewed manually.
+func (n *NameCom) DisableAutorenew(request *DisableAutorenewForDomainRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// RenewDomain will renew a domain. Purchase_price is required if the renewal is not regularly priced.
+func (n *NameCom) RenewDomain(request *RenewDomainRequest) (*RenewDomainResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &RenewDomainResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetAuthCodeForDomain returns the Transfer Authorization Code for the domain.
+func (n *NameCom) GetAuthCodeForDomain(request *AuthCodeRequest) (*AuthCodeResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ values := url.Values{}
+ if request.DomainName != "" {
+ values.Set("domainName", request.DomainName)
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &AuthCodeResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// PurchasePrivacy will add Whois Privacy protection to a domain or will an renew existing subscription.
+func (n *NameCom) PurchasePrivacy(request *PrivacyRequest) (*PrivacyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &PrivacyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// SetNameservers will set the nameservers for the Domain.
+func (n *NameCom) SetNameservers(request *SetNameserversRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s:setNameservers", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// SetContacts will set the contacts for the Domain.
+func (n *NameCom) SetContacts(request *SetContactsRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// LockDomain will lock a domain so that it cannot be transfered to another registrar.
+func (n *NameCom) LockDomain(request *LockDomainRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// UnlockDomain will unlock a domain so that it can be transfered to another registrar.
+func (n *NameCom) UnlockDomain(request *UnlockDomainRequest) (*Domain, error) {
+ endpoint := fmt.Sprintf("/v4/domains")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Domain{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CheckAvailability will check a list of domains to see if they are purchaseable. A Maximum of 50 domains can be specified.
+func (n *NameCom) CheckAvailability(request *AvailabilityRequest) (*SearchResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains:checkAvailability")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &SearchResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// Search will perform a search for specified keywords.
+func (n *NameCom) Search(request *SearchRequest) (*SearchResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains:search")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &SearchResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// SearchStream will return JSON encoded SearchResults as they are recieved from the registry. The SearchResults are separated by newlines. This can allow clients to react to results before the search is fully completed.
+func (n *NameCom) SearchStream(request *SearchRequest) (*SearchResult, error) {
+ endpoint := fmt.Sprintf("/v4/domains:searchStream")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &SearchResult{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/emailforwardings.go b/vendor/github.com/namedotcom/go/namecom/emailforwardings.go
new file mode 100644
index 000000000..dab80cf6b
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/emailforwardings.go
@@ -0,0 +1,133 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListEmailForwardings returns a pagenated list of email forwarding entries for a domain.
+func (n *NameCom) ListEmailForwardings(request *ListEmailForwardingsRequest) (*ListEmailForwardingsResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/email/forwarding", request.DomainName)
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListEmailForwardingsResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetEmailForwarding returns an email forwarding entry.
+func (n *NameCom) GetEmailForwarding(request *GetEmailForwardingRequest) (*EmailForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/email/forwarding/%s", request.DomainName, request.EmailBox)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmailForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateEmailForwarding creates an email forwarding entry. If this is the first email forwarding entry, it may modify the MX records for the domain accordingly.
+func (n *NameCom) CreateEmailForwarding(request *EmailForwarding) (*EmailForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/email/forwarding", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmailForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// UpdateEmailForwarding updates which email address the email is being forwarded to.
+func (n *NameCom) UpdateEmailForwarding(request *EmailForwarding) (*EmailForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/email/forwarding/%s", request.DomainName, request.EmailBox)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.put(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmailForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DeleteEmailForwarding deletes the email forwarding entry.
+func (n *NameCom) DeleteEmailForwarding(request *DeleteEmailForwardingRequest) (*EmptyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/email/forwarding/%s", request.DomainName, request.EmailBox)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.delete(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmptyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/hello.go b/vendor/github.com/namedotcom/go/namecom/hello.go
new file mode 100644
index 000000000..a65ed256e
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/hello.go
@@ -0,0 +1,31 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// HelloFunc returns some information about the API server.
+func (n *NameCom) HelloFunc(request *HelloRequest) (*HelloResponse, error) {
+ endpoint := fmt.Sprintf("/v4/hello")
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &HelloResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/namecom.go b/vendor/github.com/namedotcom/go/namecom/namecom.go
new file mode 100644
index 000000000..3c27483dd
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/namecom.go
@@ -0,0 +1,729 @@
+/*
+Package namecom provides a client for accessing the Name.com v4 API.
+
+See https://www.name.com/api-docs for an introduction
+to the Name.com v4 API.
+
+Creating a Client
+
+To start working with this package, create a client with user credentials
+
+ nc := namecom.New("username","apitoken")
+
+To check if the username and token are correct using the HelloFunc endpoint
+
+ response, err := nc.HelloFunc(&namecom.HelloRequest{})
+ if err != nil {
+ // TODO: handle error
+ }
+
+*/
+package namecom
+
+import (
+ "encoding/json"
+ "io"
+ "net/http"
+ "net/url"
+ "time"
+
+ "github.com/pkg/errors"
+)
+
+// NameCom is a client for connecting to the Name.com API.
+type NameCom struct {
+ Server string
+ User string
+ Token string
+ Client *http.Client
+}
+
+// New creates a new NameCom client using the production environment server endpoint.
+func New(user, token string) *NameCom {
+ return &NameCom{
+ Server: "api.name.com",
+ User: user,
+ Token: token,
+ Client: &http.Client{
+ Timeout: 10 * time.Second,
+ },
+ }
+}
+
+// Test creates a new NameCom client using the test environment server enpoint.
+func Test(user, token string) *NameCom {
+ return &NameCom{
+ Server: "api.dev.name.com",
+ User: user,
+ Token: token,
+ Client: &http.Client{
+ Timeout: 10 * time.Second,
+ },
+ }
+}
+
+// Error allows an ErrorResponse object to implement the error interface.
+func (er ErrorResponse) Error() string {
+ return er.Message + ": " + er.Details
+}
+
+func (n *NameCom) errorResponse(resp *http.Response) error {
+ er := &ErrorResponse{}
+ err := json.NewDecoder(resp.Body).Decode(er)
+ if err != nil {
+ return errors.Wrap(err, "api returned unexpected response")
+ }
+
+ return errors.WithStack(er)
+}
+
+func (n *NameCom) get(endpoint string, values url.Values) (io.Reader, error) {
+ if len(values) == 0 {
+ endpoint = endpoint + "?" + values.Encode()
+ }
+ return n.doRequest("GET", endpoint, nil)
+}
+
+func (n *NameCom) post(endpoint string, post io.Reader) (io.Reader, error) {
+ return n.doRequest("POST", endpoint, post)
+}
+
+func (n *NameCom) put(endpoint string, post io.Reader) (io.Reader, error) {
+ return n.doRequest("PUT", endpoint, post)
+}
+
+func (n *NameCom) delete(endpoint string, post io.Reader) (io.Reader, error) {
+ return n.doRequest("DELETE", endpoint, post)
+}
+
+func (n *NameCom) doRequest(method, endpoint string, post io.Reader) (io.Reader, error) {
+ if n.User == "" || n.Token == "" {
+ return nil, errors.New("both User and Token must be specified")
+ }
+ if n.Server == "" {
+ n.Server = "api.name.com"
+ }
+ if n.Client == nil {
+ n.Client = &http.Client{Timeout: 10 * time.Second}
+ }
+
+ url := "https://" + n.Server + endpoint
+
+ req, err := http.NewRequest(method, url, post)
+ if err != nil {
+ return nil, err
+ }
+
+ req.SetBasicAuth(n.User, n.Token)
+
+ resp, err := n.Client.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode != 200 {
+ return nil, n.errorResponse(resp)
+ }
+
+ return resp.Body, nil
+}
+
+// EmptyResponse is an empty response used for DELETE endpoints.
+type EmptyResponse struct {
+}
+
+// ErrorResponse is what is returned if the HTTP status code is not 200.
+type ErrorResponse struct {
+ // Message is the error message.
+ Message string `json:"message,omitempty"`
+ // Details may have some additional details about the error.
+ Details string `json:"details,omitempty"`
+}
+
+// Record is an individual DNS resource record.
+type Record struct {
+ // Unique record id. Value is ignored on Create, and must match the URI on Update.
+ ID int32 `json:"id,omitempty"`
+ // DomainName is the zone that the record belongs to.
+ DomainName string `json:"domainName,omitempty"`
+ // Host is the hostname relative to the zone: e.g. for a record for blog.example.org, domain would be "example.org" and host would be "blog".
+ // An apex record would be specified by either an empty host "" or "@".
+ // A SRV record would be specified by "_{service}._{protocal}.{host}": e.g. "_sip._tcp.phone" for _sip._tcp.phone.example.org.
+ Host string `json:"host,omitempty"`
+ // FQDN is the Fully Qualified Domain Name. It is the combination of the host and the domain name. It always ends in a ".". FQDN is ignored in CreateRecord, specify via the Host field instead.
+ Fqdn string `json:"fqdn,omitempty"`
+ // Type is one of the following: A, AAAA, ANAME, CNAME, MX, NS, SRV, or TXT.
+ Type string `json:"type,omitempty"`
+ // Answer is either the IP address for A or AAAA records; the target for ANAME, CNAME, MX, or NS records; the text for TXT records.
+ // For SRV records, answer has the following format: "{weight} {port} {target}" e.g. "1 5061 sip.example.org".
+ Answer string `json:"answer,omitempty"`
+ // TTL is the time this record can be cached for in seconds. Name.com allows a minimum TTL of 300, or 5 minutes.
+ TTL uint32 `json:"ttl,omitempty"`
+ // Priority is only required for MX and SRV records, it is ignored for all others.
+ Priority uint32 `json:"priority,omitempty"`
+}
+
+// ListRecordsRequest requests a list of records that exist for the domain
+type ListRecordsRequest struct {
+ // DomainName is the zone to list the records for.
+ DomainName string `json:"domainName,omitempty"`
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListRecordsResponse is the response for the ListRecords function.
+type ListRecordsResponse struct {
+ // Records contains the records in the zone
+ Records []*Record `json:"records,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetRecordRequest requests the record identified by id and domain.
+type GetRecordRequest struct {
+ // DomainName is the zone the record exists in
+ DomainName string `json:"domainName,omitempty"`
+ // ID is the server-assigned unique identifier for this record
+ ID int32 `json:"id,omitempty"`
+}
+
+// DeleteRecordRequest deletes a specific record
+type DeleteRecordRequest struct {
+ // DomainName is the zone that the record to be deleted exists in.
+ DomainName string `json:"domainName,omitempty"`
+ // ID is the server-assigned unique identifier for the Record to be deleted. If the Record with that ID does not exist in the specified Domain, an error is returned.
+ ID int32 `json:"id,omitempty"`
+}
+
+// DNSSEC contains all the data required to create a DS record at the registry.
+type DNSSEC struct {
+ // DomainName is the domain name.
+ DomainName string `json:"domainName,omitempty"`
+ // KeyTag contains the key tag value of the DNSKEY RR that validates this signature. The algorithm to generate it is here: https://tools.ietf.org/html/rfc4034#appendix-B
+ KeyTag int32 `json:"keyTag,omitempty"`
+ // Algorithm is an integer identifying the algorithm used for signing. Valid values can be found here: https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
+ Algorithm int32 `json:"algorithm,omitempty"`
+ // DigestType is an integer identifying the algorithm used to create the digest. Valid values can be found here: https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml
+ DigestType int32 `json:"digestType,omitempty"`
+ // Digest is a digest of the DNSKEY RR that is registered with the registry.
+ Digest string `json:"digest,omitempty"`
+}
+
+// ListDNSSECsRequest contains the domain name to list DS records for.
+type ListDNSSECsRequest struct {
+ // DomainName is the domain name to list keys for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// ListDNSSECsResponse contains the list of DS records at the registry.
+type ListDNSSECsResponse struct {
+ // Dnssec is the list of registered DNSSEC keys.
+ Dnssec []*DNSSEC `json:"dnssec,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetDNSSECRequest gets the information for a specific DS record at the registry.
+type GetDNSSECRequest struct {
+ // DomainName is the domain name.
+ DomainName string `json:"domainName,omitempty"`
+ // Digest is the digest for the DNSKEY RR to retrieve.
+ Digest string `json:"digest,omitempty"`
+}
+
+// DeleteDNSSECRequest specifies the domain name and digest to remove from the registry.
+type DeleteDNSSECRequest struct {
+ // DomainName is the domain name the key is registered for.
+ DomainName string `json:"domainName,omitempty"`
+ // Digest is the digest for the DNSKEY RR to remove from the registry.
+ Digest string `json:"digest,omitempty"`
+}
+
+// Contact contains all the contact data.
+type Contact struct {
+ // First name of the contact.
+ FirstName string `json:"firstName,omitempty"`
+ // Last name of the contact.
+ LastName string `json:"lastName,omitempty"`
+ // Company name of the contact. Leave blank if the contact is an individual as some registries will assume it is a corporate entity otherwise.
+ CompanyName string `json:"companyName,omitempty"`
+ // Address1 is the first line of the contact's address.
+ Address1 string `json:"address1,omitempty"`
+ // Address2 is the second line of the contact's address.
+ Address2 string `json:"address2,omitempty"`
+ // City of the contact's address.
+ City string `json:"city,omitempty"`
+ // State or Province for the contact's address.
+ State string `json:"state,omitempty"`
+ // Zip or Postal Code for the contact's address.
+ Zip string `json:"zip,omitempty"`
+ // Country code for the contact's address. Required to be a ISO 3166-1 alpha-2 code.
+ Country string `json:"country,omitempty"`
+ // Phone number of the contact. Should be specified in the following format: "+cc.llllllll" where cc is the country code and llllllll is the local number.
+ Phone string `json:"phone,omitempty"`
+ // Fax number of the contact. Should be specified in the following format: "+cc.llllllll" where cc is the country code and llllllll is the local number.
+ Fax string `json:"fax,omitempty"`
+ // Email of the contact. Should be a complete and valid email address.
+ Email string `json:"email,omitempty"`
+}
+
+// Contacts stores the contact information for the roles related to domains.
+type Contacts struct {
+ // Registrant is the rightful owner of the account and has the right to use and/or sell the domain name. They are able to make changes to all account, domain, and product settings. This information should be reviewed and updated regularly to ensure accuracy.
+ Registrant *Contact `json:"registrant,omitempty"`
+ // Registrants often designate an administrative contact to manage their domain name(s). They primarily deal with business information such as the name on record, postal address, and contact information for the official registrant.
+ Admin *Contact `json:"admin,omitempty"`
+ // The technical contact manages and maintains a domain’s nameservers. If you’re working with a web designer or someone in a similar role, you many want to assign them as a technical contact.
+ Tech *Contact `json:"tech,omitempty"`
+ // The billing contact is the party responsible for paying bills for the account and taking care of renewals.
+ Billing *Contact `json:"billing,omitempty"`
+}
+
+// Domain lists all the data for a domain.
+type Domain struct {
+ // DomainName is the punycode encoded value of the domain name.
+ DomainName string `json:"domainName,omitempty"`
+ // Nameservers is the list of nameservers for this domain. If unspecified it defaults to your account default nameservers.
+ Nameservers []string `json:"nameservers,omitempty"`
+ // Contacts for the domain.
+ Contacts *Contacts `json:"contacts,omitempty"`
+ // PrivacyEnabled reflects if Whois Privacy is enabled for this domain.
+ PrivacyEnabled bool `json:"privacyEnabled,omitempty"`
+ // Locked indicates that the domain cannot be transfered to another registrar.
+ Locked bool `json:"locked,omitempty"`
+ // AutorenewEnabled indicates if the domain will attempt to renew automatically before expiration.
+ AutorenewEnabled bool `json:"autorenewEnabled,omitempty"`
+ // ExpireDate is the date the domain will expire.
+ ExpireDate string `json:"expireDate,omitempty"`
+ // CreateDate is the date the domain was created at the registry.
+ CreateDate string `json:"createDate,omitempty"`
+ // RenewalPrice is the price to renew the domain. It may be required for the RenewDomain command.
+ RenewalPrice float64 `json:"renewalPrice,omitempty"`
+}
+
+// SearchRequest is used to specify the search parameters.
+type SearchRequest struct {
+ // Timeout is a value in milliseconds on how long to perform the search for. Valid timeouts are between 500ms to 5,000ms. If not specified, timeout defaults to 1,000ms.
+ // Since some additional processing is performed on the results, a response may take longer then the timeout.
+ Timeout int32 `json:"timeout,omitempty"`
+ // Keyword is the search term to search for. It can be just a word, or a whole domain name.
+ Keyword string `json:"keyword,omitempty"`
+ // TLDFilter will limit results to only contain the specified TLDs.
+ TldFilter []string `json:"tldFilter,omitempty"`
+ // PromoCode is not implemented yet.
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// AvailabilityRequest is used to list the domain names to check availability for.
+type AvailabilityRequest struct {
+ // DomainNames is the list of domains to check if they are available.
+ DomainNames []string `json:"domainNames,omitempty"`
+ // PromoCode is not implemented yet.
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// SearchResult is returned by the CheckAvailability, Search, and SearchStream functions.
+type SearchResult struct {
+ // DomainName is the punycode encoding of the result domain name.
+ DomainName string `json:"domainName,omitempty"`
+ // SLD is first portion of the domain_name.
+ Sld string `json:"sld,omitempty"`
+ // TLD is the rest of the domain_name after the SLD.
+ Tld string `json:"tld,omitempty"`
+ // Purchaseable indicates whether the search result is available for purchase.
+ Purchasable bool `json:"purchasable,omitempty"`
+ // Premium indicates that this search result is a premium result and the purchase_price needs to be passed to the DomainCreate command.
+ Premium bool `json:"premium,omitempty"`
+ // PurchasePrice is the price for purchasing this domain for 1 year. Purchase_price is always in USD.
+ PurchasePrice float64 `json:"purchasePrice,omitempty"`
+ // PurchaseType indicates what kind of purchase this result is for. It should be passed to the DomainCreate command.
+ PurchaseType string `json:"purchaseType,omitempty"`
+ // RenewalPrice is the annual renewal price for this domain as it may be different then the purchase_price.
+ RenewalPrice float64 `json:"renewalPrice,omitempty"`
+}
+
+// SearchResponse returns a list of search results.
+type SearchResponse struct {
+ // Results of the search are returned here, the order should not be relied upon.
+ Results []*SearchResult `json:"results,omitempty"`
+}
+
+// ListDomainsRequest is used to pass the pagination parameters to the ListDomains function.
+type ListDomainsRequest struct {
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListDomainsResponse is the response from a list request, it contains the paginated list of Domains.
+type ListDomainsResponse struct {
+ // Domains is the list of domains in your account.
+ Domains []*Domain `json:"domains,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetDomainRequest specifies the domain name to request data for in the GetDomain function.
+type GetDomainRequest struct {
+ // DomainName is the domain to retrieve.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// CreateDomainRequest has the information that is needed to create a domain with the CreateDomain function.
+type CreateDomainRequest struct {
+ // Domain is the domain object to create. If privacy_enabled is set, Whois Privacy will also be purchased for an additional amount.
+ Domain *Domain `json:"domain,omitempty"`
+ // PurchasePrice is the amount to pay for the domain. If privacy_enabled is set, the regular price for whois protection will be added automatically. If VAT tax applies, it will also be added automatically.
+ // PurchasePrice is required if purchase_type is not "registration" or if it is a premium domain.
+ PurchasePrice float64 `json:"purchasePrice,omitempty"`
+ // PurchaseType defaults to "registration" but should be copied from the result of a search command otherwise.
+ PurchaseType string `json:"purchaseType,omitempty"`
+ // Years is for how many years to register the domain for. Years defaults to 1 if not passed and cannot be more than 10.
+ // If passing purchase_price make sure to adjust it accordingly.
+ Years int32 `json:"years,omitempty"`
+ // TLDRequirements is a way to pass additional data that is required by some registries.
+ TldRequirements map[string]string `json:"tldRequirements,omitempty"`
+ // PromoCode is not yet implemented.
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// CreateDomainResponse contains the domain info as well as the order info for the created domain.
+type CreateDomainResponse struct {
+ // Domain is the newly created domain.
+ Domain *Domain `json:"domain,omitempty"`
+ // Order is an identifier for this purchase.
+ Order int32 `json:"order,omitempty"`
+ // TotalPaid is the total amount paid, including VAT and whois protection.
+ TotalPaid float64 `json:"totalPaid,omitempty"`
+}
+
+// RenewDomainRequest passes the domain name and purchase parameters to the RenewDomain function.
+type RenewDomainRequest struct {
+ // DomainName is the domain to renew.
+ DomainName string `json:"domainName,omitempty"`
+ // PurchasePrice is the amount to pay for the domain renewal. If VAT tax applies, it will also be added automatically.
+ // PurchasePrice is required if this is a premium domain.
+ PurchasePrice float64 `json:"purchasePrice,omitempty"`
+ // Years is for how many years to renew the domain for. Years defaults to 1 if not passed and cannot be more than 10.
+ Years int32 `json:"years,omitempty"`
+ // PromoCode is not yet implemented.
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// RenewDomainResponse contains the updated domain info as well as the order info for the renewed domain.
+type RenewDomainResponse struct {
+ // Domain reflects the status of the domain after renewing.
+ Domain *Domain `json:"domain,omitempty"`
+ // Order is an identifier for this purchase
+ Order int32 `json:"order,omitempty"`
+ // TotalPaid is the total amount paid, including VAT.
+ TotalPaid float64 `json:"totalPaid,omitempty"`
+}
+
+// AuthCodeRequest passes the domain name to the GetAuthCodeForDomain funtion.
+type AuthCodeRequest struct {
+ // DomainName is the domain name to retrieve the authorization code for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// AuthCodeResponse returns the auth code from the GetAuthCodeForDomain funtion.
+type AuthCodeResponse struct {
+ // AuthCode is the authorization code needed to transfer a domain to another registrar. If you are storing auth codes, be sure to store them in a secure manner.
+ AuthCode string `json:"authCode,omitempty"`
+}
+
+// PrivacyRequest passes the domain name as well as the purchase parameters to the PurchasePrivacy function.
+type PrivacyRequest struct {
+ // DomainName is the domain to purchase Whois Privacy for.
+ DomainName string `json:"domainName,omitempty"`
+ // PurchasePrice is the amount you expect to pay.
+ PurchasePrice float64 `json:"purchasePrice,omitempty"`
+ // Years is the number of years you wish to purchase Whois Privacy for. Years defaults to 1 and cannot be more then the domain expiration date.
+ Years int32 `json:"years,omitempty"`
+ // PromoCode is not yet implemented
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// PrivacyResponse contains the updated domain info as well as the order info for the newly purchased Whois Privacy.
+type PrivacyResponse struct {
+ // Domain is the status of the domain after the purchase of Whois Privacy.
+ Domain *Domain `json:"domain,omitempty"`
+ // Order is an identifier for this purchase.
+ Order int32 `json:"order,omitempty"`
+ // TotalPaid is the total amount paid, including VAT.
+ TotalPaid float64 `json:"totalPaid,omitempty"`
+}
+
+// SetNameserversRequest passes the list of nameservers to set for the SetNameserver function.
+type SetNameserversRequest struct {
+ // DomainName is the domain name to set the nameservers for.
+ DomainName string `json:"domainName,omitempty"`
+ // Namesevers is a list of the nameservers to set. Nameservers should already be set up and hosting the zone properly as some registries will verify before allowing the change.
+ Nameservers []string `json:"nameservers,omitempty"`
+}
+
+// SetContactsRequest passes the contact info for each role to the SetContacts function.
+type SetContactsRequest struct {
+ // DomainName is the domain name to set the contacts for.
+ DomainName string `json:"domainName,omitempty"`
+ // Contacts is the list of contacts to set.
+ Contacts *Contacts `json:"contacts,omitempty"`
+}
+
+// EnableAutorenewForDomainRequest is used to pass the domain name to the EnableAutorenewForDomain function.
+type EnableAutorenewForDomainRequest struct {
+ // DomainName is the domain name to enable autorenew for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// DisableAutorenewForDomainRequest is used to pass the domain name to the DisableAutorenewForDomain function.
+type DisableAutorenewForDomainRequest struct {
+ // DomainName is the domain name to disable autorenew for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// LockDomainRequest is used to pass the domain name to the LockDomain function.
+type LockDomainRequest struct {
+ // DomainName is the domain name to lock.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// UnlockDomainRequest is used to pass the domain name to the UnlockDomain function.
+type UnlockDomainRequest struct {
+ // DomainName is the domain name to unlock.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// EmailForwarding contains all the information for an email forwarding entry.
+type EmailForwarding struct {
+ // DomainName is the domain part of the email address to forward.
+ DomainName string `json:"domainName,omitempty"`
+ // EmailBox is the user portion of the email address to forward.
+ EmailBox string `json:"emailBox,omitempty"`
+ // EmailTo is the entire email address to forward email to.
+ EmailTo string `json:"emailTo,omitempty"`
+}
+
+// ListEmailForwardingsRequest passes the domain name and pagination information to the ListEmailForwardings function.
+type ListEmailForwardingsRequest struct {
+ // DomainName is the domain to list email forwarded boxes for.
+ DomainName string `json:"domainName,omitempty"`
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return.
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListEmailForwardingsResponse returns the list of email forwarding entries as well as the pagination information.
+type ListEmailForwardingsResponse struct {
+ // EmailForwarding is the list of forwarded email boxes.
+ EmailForwarding []*EmailForwarding `json:"emailForwarding,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetEmailForwardingRequest passes the domain name and email box to request the email forwarding information for.
+type GetEmailForwardingRequest struct {
+ // DomainName is the domain to list email forwarded box for.
+ DomainName string `json:"domainName,omitempty"`
+ // EmailBox is which email box to retrieve.
+ EmailBox string `json:"emailBox,omitempty"`
+}
+
+// DeleteEmailForwardingRequest passes the domain name and email box to the DeleteEmailForwarding function.
+type DeleteEmailForwardingRequest struct {
+ // DomainName is the domain to delete the email forwarded box from.
+ DomainName string `json:"domainName,omitempty"`
+ // EmailBox is which email box to delete.
+ EmailBox string `json:"emailBox,omitempty"`
+}
+
+// HelloRequest doesn't take any parameters.
+type HelloRequest struct {
+}
+
+// HelloResponse is the response from the HelloFunc command
+type HelloResponse struct {
+ // ServerName is an identfier for which server is being accessed.
+ ServerName string `json:"serverName,omitempty"`
+ // Motd is a message of the day. It might provide some useful information.
+ Motd string `json:"motd,omitempty"`
+ // Username is the account name you are currently logged into.
+ Username string `json:"username,omitempty"`
+ // ServerTime is the current date/time at the server.
+ ServerTime string `json:"serverTime,omitempty"`
+}
+
+// Transfer contains the information related to a transfer of a domain name to Name.com.
+type Transfer struct {
+ // DomainName is the domain to be transfered to Name.com.
+ DomainName string `json:"domainName,omitempty"`
+ // Email is the email address that the approval email was sent to. Not every TLD requries an approval email. This is usaully pulled from Whois.
+ Email string `json:"email,omitempty"`
+ // Status is the current status of the transfer. Details about statuses can be found in the following Knowledge Base article: .
+ Status string `json:"status,omitempty"`
+}
+
+// ListTransfersRequest passes the pagination information to the ListTransfers function.
+type ListTransfersRequest struct {
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListTransfersResponse returns the list of pending transfers as well as the paginiation information if relevent.
+type ListTransfersResponse struct {
+ // Transfers is a list of pending transfers
+ Transfers []*Transfer `json:"transfers,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetTransferRequest passes the domain name to the GetTransfer function.
+type GetTransferRequest struct {
+ // DomainName is the domain you want to get the transfer information for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// CreateTransferRequest passes the required transfer info to the CreateTransfer function.
+type CreateTransferRequest struct {
+ // DomainName is the domain you want to transfer to Name.com.
+ DomainName string `json:"domainName,omitempty"`
+ // AuthCode is the authorization code for the transfer. Not all TLDs require authorization codes, but most do.
+ AuthCode string `json:"authCode,omitempty"`
+ // PrivacyEnabled is a flag on whether to purchase Whois Privacy with the transfer.
+ PrivacyEnabled bool `json:"privacyEnabled,omitempty"`
+ // PurchasePrice is the amount to pay for the transfer of the domain. If privacy_enabled is set, the regular price for Whois Privacy will be added automatically. If VAT tax applies, it will also be added automatically.
+ // PurchasePrice is required if the domain to transfer is a premium domain.
+ PurchasePrice float64 `json:"purchasePrice,omitempty"`
+ // PromoCode is not implemented yet
+ PromoCode string `json:"promoCode,omitempty"`
+}
+
+// CreateTransferResponse returns the newly created transfer resource as well as the order information.
+type CreateTransferResponse struct {
+ // Transfer is the transfer resource created.
+ Transfer *Transfer `json:"transfer,omitempty"`
+ // Order is an identifier for this purchase.
+ Order int32 `json:"order,omitempty"`
+ // TotalPaid is the total amount paid, including VAT and Whois Privacy.
+ TotalPaid float64 `json:"totalPaid,omitempty"`
+}
+
+// CancelTransferRequest passes the domain name to be canceled to the CancelTransfer function.
+type CancelTransferRequest struct {
+ // DomainName is the domain to cancel the transfer for.
+ DomainName string `json:"domainName,omitempty"`
+}
+
+// URLForwarding is the model for URL forwarding entries.
+type URLForwarding struct {
+ // DomainName is the domain part of the hostname to forward.
+ DomainName string `json:"domainName,omitempty"`
+ // Host is the entirety of the hostname. i.e. www.example.org
+ Host string `json:"host,omitempty"`
+ // ForwardsTo is the URL this host will be forwarded to.
+ ForwardsTo string `json:"forwardsTo,omitempty"`
+ // Type is the type of forwarding. Valid types are: Masked - This retains the original domain in the address bar and will not reveal or display the actual destination URL. If you are forwarding knowledgebase.ninja to Name.com, the address bar will say knowledgebase.ninja. This is sometimes called iframe forwarding. And: Redirect - This does not retain the original domain in the address bar, so the user will see it change and realize they were forwarded from the URL they originally entered. If you are forwarding knowledgebase.ninja to Name.com, the address bar will say Name.com. This is also called 301 forwarding.
+ Type string `json:"type,omitempty"`
+ // Title is the title for the html page to use if the type is masked. Values are ignored for types other then "masked".
+ Title string `json:"title,omitempty"`
+ // Meta is the meta tags to add to the html page if the type is masked. ex: "". Values are ignored for types other then "masked".
+ Meta string `json:"meta,omitempty"`
+}
+
+// ListURLForwardingsRequest is the request for the ListURLForwardings function.
+type ListURLForwardingsRequest struct {
+ // DomainName is the domain to list URL forwarding entries for.
+ DomainName string `json:"domainName,omitempty"`
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return.
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListURLForwardingsResponse is the response for the ListURLForwardings function.
+type ListURLForwardingsResponse struct {
+ // URLForwarding is the list of URL forwarding entries.
+ URLForwarding []*URLForwarding `json:"urlForwarding,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetURLForwardingRequest is the request for the GetURLForwarding function.
+type GetURLForwardingRequest struct {
+ // DomainName is the domain to list URL forwarding entry for.
+ DomainName string `json:"domainName,omitempty"`
+ // Host is the part of the domain name before the domain. i.e. www is the host for www.example.org.
+ Host string `json:"host,omitempty"`
+}
+
+// DeleteURLForwardingRequest is the request for the DeleteURLForwarding function.
+type DeleteURLForwardingRequest struct {
+ // DomainName is the domain to delete the URL forwardind entry from.
+ DomainName string `json:"domainName,omitempty"`
+ // Host is the part of the domain name before the domain. i.e. www is the host for www.example.org.
+ Host string `json:"host,omitempty"`
+}
+
+// VanityNameserver contains the hostname as well as the list of IP addresses for nameservers.
+type VanityNameserver struct {
+ // DomainName is the domain the nameserver is a subdomain of.
+ DomainName string `json:"domainName,omitempty"`
+ // Hostname is the hostname of the nameserver.
+ Hostname string `json:"hostname,omitempty"`
+ // IPs is a list of IP addresses that are used for glue records for this nameserver.
+ Ips []string `json:"ips,omitempty"`
+}
+
+// ListVanityNameserversRequest passes the domain name as well as the pagination parameters to the ListVanityNameservers function.
+type ListVanityNameserversRequest struct {
+ // DomainName is the domain to list the vanity nameservers for.
+ DomainName string `json:"domainName,omitempty"`
+ // Per Page is the number of records to return per request. Per Page defaults to 1,000.
+ PerPage int32 `json:"perPage,omitempty"`
+ // Page is which page to return
+ Page int32 `json:"page,omitempty"`
+}
+
+// ListVanityNameserversResponse returns the list of vanity nameservers for the domain.
+type ListVanityNameserversResponse struct {
+ // VanityNameservers is the list of vanity nameservers.
+ VanityNameservers []*VanityNameserver `json:"vanityNameservers,omitempty"`
+ // NextPage is the identifier for the next page of results. It is only populated if there is another page of results after the current page.
+ NextPage int32 `json:"nextPage,omitempty"`
+ // LastPage is the identifier for the final page of results. It is only populated if there is another page of results after the current page.
+ LastPage int32 `json:"lastPage,omitempty"`
+}
+
+// GetVanityNameserverRequest passes the hostname to get the details for.
+type GetVanityNameserverRequest struct {
+ // DomainName is the domain to for the vanity nameserver.
+ DomainName string `json:"domainName,omitempty"`
+ // Hostname is the hostname for the vanity nameserver.
+ Hostname string `json:"hostname,omitempty"`
+}
+
+// DeleteVanityNameserverRequest passes which hostname to remove from the registry.
+type DeleteVanityNameserverRequest struct {
+ // DomainName is the domain of the vanity nameserver to delete.
+ DomainName string `json:"domainName,omitempty"`
+ // Hostname is the hostname of the vanity nameserver to delete.
+ Hostname string `json:"hostname,omitempty"`
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/transfers.go b/vendor/github.com/namedotcom/go/namecom/transfers.go
new file mode 100644
index 000000000..814e525f8
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/transfers.go
@@ -0,0 +1,108 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListTransfers lists all pending transfer in requests. To get the information related to a non-pending transfer, you can use the GetTransfer function for that.
+func (n *NameCom) ListTransfers(request *ListTransfersRequest) (*ListTransfersResponse, error) {
+ endpoint := fmt.Sprintf("/v4/transfers")
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListTransfersResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetTransfer gets details for a transfer request.
+func (n *NameCom) GetTransfer(request *GetTransferRequest) (*Transfer, error) {
+ endpoint := fmt.Sprintf("/v4/transfers/%s", request.DomainName)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Transfer{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateTransfer purchases a new domain transfer request.
+func (n *NameCom) CreateTransfer(request *CreateTransferRequest) (*CreateTransferResponse, error) {
+ endpoint := fmt.Sprintf("/v4/transfers")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &CreateTransferResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CancelTransfer cancels a pending transfer request and refunds the amount to account credit.
+func (n *NameCom) CancelTransfer(request *CancelTransferRequest) (*Transfer, error) {
+ endpoint := fmt.Sprintf("/v4/transfers")
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &Transfer{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/urlforwardings.go b/vendor/github.com/namedotcom/go/namecom/urlforwardings.go
new file mode 100644
index 000000000..1b608ebe6
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/urlforwardings.go
@@ -0,0 +1,133 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListURLForwardings returns a pagenated list of URL forwarding entries for a domain.
+func (n *NameCom) ListURLForwardings(request *ListURLForwardingsRequest) (*ListURLForwardingsResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/url/forwarding", request.DomainName)
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListURLForwardingsResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetURLForwarding returns an URL forwarding entry.
+func (n *NameCom) GetURLForwarding(request *GetURLForwardingRequest) (*URLForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/url/forwarding/%s", request.DomainName, request.Host)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &URLForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateURLForwarding creates an URL forwarding entry. If this is the first URL forwarding entry, it may modify the A records for the domain accordingly.
+func (n *NameCom) CreateURLForwarding(request *URLForwarding) (*URLForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/url/forwarding", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &URLForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// UpdateURLForwarding updates which URL the host is being forwarded to.
+func (n *NameCom) UpdateURLForwarding(request *URLForwarding) (*URLForwarding, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/url/forwarding/%s", request.DomainName, request.Host)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.put(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &URLForwarding{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DeleteURLForwarding deletes the URL forwarding entry.
+func (n *NameCom) DeleteURLForwarding(request *DeleteURLForwardingRequest) (*EmptyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/url/forwarding/%s", request.DomainName, request.Host)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.delete(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmptyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/namedotcom/go/namecom/vanitynameservers.go b/vendor/github.com/namedotcom/go/namecom/vanitynameservers.go
new file mode 100644
index 000000000..b46b249fd
--- /dev/null
+++ b/vendor/github.com/namedotcom/go/namecom/vanitynameservers.go
@@ -0,0 +1,133 @@
+package namecom
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/url"
+)
+
+var _ = bytes.MinRead
+
+// ListVanityNameservers lists all nameservers registered with the registry. It omits the IP addresses from the response. Those can be found from calling GetVanityNameserver.
+func (n *NameCom) ListVanityNameservers(request *ListVanityNameserversRequest) (*ListVanityNameserversResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/vanity_nameservers", request.DomainName)
+
+ values := url.Values{}
+ if request.PerPage != 0 {
+ values.Set("perPage", fmt.Sprintf("%d", request.PerPage))
+ }
+ if request.Page != 0 {
+ values.Set("page", fmt.Sprintf("%d", request.Page))
+ }
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &ListVanityNameserversResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// GetVanityNameserver gets the details for a vanity nameserver registered with the registry.
+func (n *NameCom) GetVanityNameserver(request *GetVanityNameserverRequest) (*VanityNameserver, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/vanity_nameservers/%s", request.DomainName, request.Hostname)
+
+ values := url.Values{}
+
+ body, err := n.get(endpoint, values)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &VanityNameserver{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// CreateVanityNameserver registers a nameserver with the registry.
+func (n *NameCom) CreateVanityNameserver(request *VanityNameserver) (*VanityNameserver, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/vanity_nameservers", request.DomainName)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.post(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &VanityNameserver{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// UpdateVanityNameserver allows you to update the glue record IP addresses at the registry.
+func (n *NameCom) UpdateVanityNameserver(request *VanityNameserver) (*VanityNameserver, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/vanity_nameservers/%s", request.DomainName, request.Hostname)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.put(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &VanityNameserver{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
+
+// DeleteVanityNameserver unregisteres the nameserver at the registry. This might fail if the registry believes the nameserver is in use.
+func (n *NameCom) DeleteVanityNameserver(request *DeleteVanityNameserverRequest) (*EmptyResponse, error) {
+ endpoint := fmt.Sprintf("/v4/domains/%s/vanity_nameservers/%s", request.DomainName, request.Hostname)
+
+ post := &bytes.Buffer{}
+ err := json.NewEncoder(post).Encode(request)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := n.delete(endpoint, post)
+ if err != nil {
+ return nil, err
+ }
+
+ resp := &EmptyResponse{}
+
+ err = json.NewDecoder(body).Decode(resp)
+ if err != nil {
+ return nil, err
+ }
+
+ return resp, nil
+}
diff --git a/vendor/github.com/tuvistavie/securerandom/srandom.go b/vendor/github.com/tuvistavie/securerandom/srandom.go
new file mode 100644
index 000000000..30c36f13a
--- /dev/null
+++ b/vendor/github.com/tuvistavie/securerandom/srandom.go
@@ -0,0 +1,70 @@
+package securerandom
+
+import (
+ "bytes"
+ "crypto/rand"
+ "encoding/base64"
+ "encoding/binary"
+ "encoding/hex"
+ "fmt"
+ "strings"
+)
+
+func RandomBytes(n int) ([]byte, error) {
+ bytes := make([]byte, n)
+ _, err := rand.Read(bytes)
+ if err != nil {
+ return nil, err
+ }
+ return bytes, nil
+}
+
+func Base64(n int, padded bool) (string, error) {
+ bytes, err := RandomBytes(n)
+ if err != nil {
+ return "", err
+ }
+ result := base64.StdEncoding.EncodeToString(bytes)
+ result = strings.Replace(result, "\n", "", -1)
+ if !padded {
+ result = strings.Replace(result, "=", "", -1)
+ }
+ return result, nil
+}
+
+func UrlSafeBase64(n int, padded bool) (string, error) {
+ result, err := Base64(n, padded)
+ if err != nil {
+ return "", err
+ }
+ result = strings.Replace(result, "+", "-", -1)
+ result = strings.Replace(result, "/", "_", -1)
+ return result, nil
+}
+
+func Hex(n int) (string, error) {
+ bytes, err := RandomBytes(n)
+ if err != nil {
+ return "", err
+ }
+ return hex.EncodeToString(bytes), nil
+}
+
+func Uuid() (string, error) {
+ var first, last uint32
+ var middle [4]uint16
+ randomBytes, err := RandomBytes(16)
+ if err != nil {
+ return "", err
+ }
+ buffer := bytes.NewBuffer(randomBytes)
+ binary.Read(buffer, binary.BigEndian, &first)
+ for i := 0; i < 4; i++ {
+ binary.Read(buffer, binary.BigEndian, &middle[i])
+ }
+ binary.Read(buffer, binary.BigEndian, &last)
+ middle[1] = (middle[1] & 0x0fff) | 0x4000
+ middle[2] = (middle[2] & 0x3fff) | 0x8000
+ return fmt.Sprintf("%08x-%04x-%04x-%04x-%04x%08x",
+ first, middle[0], middle[1], middle[2], middle[3], last), nil
+}
diff --git a/vendor/github.com/vulcand/oxy/buffer/buffer.go b/vendor/github.com/vulcand/oxy/buffer/buffer.go
index 735443d9f..6224fb8c7 100644
--- a/vendor/github.com/vulcand/oxy/buffer/buffer.go
+++ b/vendor/github.com/vulcand/oxy/buffer/buffer.go
@@ -349,9 +349,10 @@ func (b *bufferWriter) expectBody(r *http.Request) bool {
if (b.code >= 100 && b.code < 200) || b.code == 204 || b.code == 304 {
return false
}
- if b.header.Get("Content-Length") == "" && b.header.Get("Transfer-Encoding") == "" {
- return false
- }
+ // refer to https://github.com/vulcand/oxy/issues/113
+ // if b.header.Get("Content-Length") == "" && b.header.Get("Transfer-Encoding") == "" {
+ // return false
+ // }
if b.header.Get("Content-Length") == "0" {
return false
}
diff --git a/vendor/github.com/vulcand/oxy/cbreaker/cbreaker.go b/vendor/github.com/vulcand/oxy/cbreaker/cbreaker.go
index bdf1e9b58..e97f69d56 100644
--- a/vendor/github.com/vulcand/oxy/cbreaker/cbreaker.go
+++ b/vendor/github.com/vulcand/oxy/cbreaker/cbreaker.go
@@ -156,12 +156,12 @@ func (c *CircuitBreaker) activateFallback(w http.ResponseWriter, req *http.Reque
func (c *CircuitBreaker) serve(w http.ResponseWriter, req *http.Request) {
start := c.clock.UtcNow()
- p := &utils.ProxyWriter{W: w}
+ p := utils.NewSimpleProxyWriter(w)
c.next.ServeHTTP(p, req)
latency := c.clock.UtcNow().Sub(start)
- c.metrics.Record(p.Code, latency)
+ c.metrics.Record(p.StatusCode(), latency)
// Note that this call is less expensive than it looks -- checkCondition only performs the real check
// periodically. Because of that we can afford to call it here on every single response.
diff --git a/vendor/github.com/vulcand/oxy/forward/fwd.go b/vendor/github.com/vulcand/oxy/forward/fwd.go
index 789909e51..cf8f6eaef 100644
--- a/vendor/github.com/vulcand/oxy/forward/fwd.go
+++ b/vendor/github.com/vulcand/oxy/forward/fwd.go
@@ -221,7 +221,9 @@ func New(setters ...optSetter) (*Forwarder, error) {
}
if f.tlsClientConfig == nil {
- f.tlsClientConfig = f.httpForwarder.roundTripper.(*http.Transport).TLSClientConfig
+ if ht, ok := f.httpForwarder.roundTripper.(*http.Transport); ok {
+ f.tlsClientConfig = ht.TLSClientConfig
+ }
}
f.httpForwarder.roundTripper = ErrorHandlingRoundTripper{
@@ -444,9 +446,16 @@ func (f *httpForwarder) serveHTTP(w http.ResponseWriter, inReq *http.Request, ct
defer logEntry.Debug("vulcand/oxy/forward/http: completed ServeHttp on request")
}
- pw := &utils.ProxyWriter{
- W: w,
+ var pw utils.ProxyWriter
+
+ // Disable closeNotify when method GET for http pipelining
+ // Waiting for https://github.com/golang/go/issues/23921
+ if inReq.Method == http.MethodGet {
+ pw = utils.NewProxyWriterWithoutCloseNotify(w)
+ } else {
+ pw = utils.NewSimpleProxyWriter(w)
}
+
start := time.Now().UTC()
outReq := new(http.Request)
@@ -464,14 +473,14 @@ func (f *httpForwarder) serveHTTP(w http.ResponseWriter, inReq *http.Request, ct
if inReq.TLS != nil {
f.log.Debugf("vulcand/oxy/forward/http: Round trip: %v, code: %v, Length: %v, duration: %v tls:version: %x, tls:resume:%t, tls:csuite:%x, tls:server:%v",
- inReq.URL, pw.Code, pw.Length, time.Now().UTC().Sub(start),
+ inReq.URL, pw.StatusCode(), pw.GetLength(), time.Now().UTC().Sub(start),
inReq.TLS.Version,
inReq.TLS.DidResume,
inReq.TLS.CipherSuite,
inReq.TLS.ServerName)
} else {
f.log.Debugf("vulcand/oxy/forward/http: Round trip: %v, code: %v, Length: %v, duration: %v",
- inReq.URL, pw.Code, pw.Length, time.Now().UTC().Sub(start))
+ inReq.URL, pw.StatusCode(), pw.GetLength(), time.Now().UTC().Sub(start))
}
}
diff --git a/vendor/github.com/vulcand/oxy/roundrobin/rebalancer.go b/vendor/github.com/vulcand/oxy/roundrobin/rebalancer.go
index ac170b797..9e574e8d8 100644
--- a/vendor/github.com/vulcand/oxy/roundrobin/rebalancer.go
+++ b/vendor/github.com/vulcand/oxy/roundrobin/rebalancer.go
@@ -148,7 +148,7 @@ func (rb *Rebalancer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
defer logEntry.Debug("vulcand/oxy/roundrobin/rebalancer: competed ServeHttp on request")
}
- pw := &utils.ProxyWriter{W: w}
+ pw := utils.NewSimpleProxyWriter(w)
start := rb.clock.UtcNow()
// make shallow copy of request before changing anything to avoid side effects
@@ -194,7 +194,7 @@ func (rb *Rebalancer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
rb.next.Next().ServeHTTP(pw, &newReq)
- rb.recordMetrics(newReq.URL, pw.Code, rb.clock.UtcNow().Sub(start))
+ rb.recordMetrics(newReq.URL, pw.StatusCode(), rb.clock.UtcNow().Sub(start))
rb.adjustWeights()
}
diff --git a/vendor/github.com/vulcand/oxy/roundrobin/rr.go b/vendor/github.com/vulcand/oxy/roundrobin/rr.go
index 91c3692e8..137da6272 100644
--- a/vendor/github.com/vulcand/oxy/roundrobin/rr.go
+++ b/vendor/github.com/vulcand/oxy/roundrobin/rr.go
@@ -185,43 +185,43 @@ func (r *RoundRobin) RemoveServer(u *url.URL) error {
return nil
}
-func (rr *RoundRobin) Servers() []*url.URL {
- rr.mutex.Lock()
- defer rr.mutex.Unlock()
+func (r *RoundRobin) Servers() []*url.URL {
+ r.mutex.Lock()
+ defer r.mutex.Unlock()
- out := make([]*url.URL, len(rr.servers))
- for i, srv := range rr.servers {
+ out := make([]*url.URL, len(r.servers))
+ for i, srv := range r.servers {
out[i] = srv.url
}
return out
}
-func (rr *RoundRobin) ServerWeight(u *url.URL) (int, bool) {
- rr.mutex.Lock()
- defer rr.mutex.Unlock()
+func (r *RoundRobin) ServerWeight(u *url.URL) (int, bool) {
+ r.mutex.Lock()
+ defer r.mutex.Unlock()
- if s, _ := rr.findServerByURL(u); s != nil {
+ if s, _ := r.findServerByURL(u); s != nil {
return s.weight, true
}
return -1, false
}
// In case if server is already present in the load balancer, returns error
-func (rr *RoundRobin) UpsertServer(u *url.URL, options ...ServerOption) error {
- rr.mutex.Lock()
- defer rr.mutex.Unlock()
+func (r *RoundRobin) UpsertServer(u *url.URL, options ...ServerOption) error {
+ r.mutex.Lock()
+ defer r.mutex.Unlock()
if u == nil {
return fmt.Errorf("server URL can't be nil")
}
- if s, _ := rr.findServerByURL(u); s != nil {
+ if s, _ := r.findServerByURL(u); s != nil {
for _, o := range options {
if err := o(s); err != nil {
return err
}
}
- rr.resetState()
+ r.resetState()
return nil
}
@@ -236,8 +236,8 @@ func (rr *RoundRobin) UpsertServer(u *url.URL, options ...ServerOption) error {
srv.weight = defaultWeight
}
- rr.servers = append(rr.servers, srv)
- rr.resetState()
+ r.servers = append(r.servers, srv)
+ r.resetState()
return nil
}
@@ -262,9 +262,9 @@ func (r *RoundRobin) findServerByURL(u *url.URL) (*server, int) {
return nil, -1
}
-func (rr *RoundRobin) maxWeight() int {
+func (r *RoundRobin) maxWeight() int {
max := -1
- for _, s := range rr.servers {
+ for _, s := range r.servers {
if s.weight > max {
max = s.weight
}
@@ -272,9 +272,9 @@ func (rr *RoundRobin) maxWeight() int {
return max
}
-func (rr *RoundRobin) weightGcd() int {
+func (r *RoundRobin) weightGcd() int {
divisor := -1
- for _, s := range rr.servers {
+ for _, s := range r.servers {
if divisor == -1 {
divisor = s.weight
} else {
@@ -304,7 +304,15 @@ type server struct {
weight int
}
-const defaultWeight = 1
+var defaultWeight = 1
+
+func SetDefaultWeight(weight int) error {
+ if weight < 0 {
+ return fmt.Errorf("default weight should be >= 0")
+ }
+ defaultWeight = weight
+ return nil
+}
func sameURL(a, b *url.URL) bool {
return a.Path == b.Path && a.Host == b.Host && a.Scheme == b.Scheme
diff --git a/vendor/github.com/vulcand/oxy/utils/netutils.go b/vendor/github.com/vulcand/oxy/utils/netutils.go
index afdfbcfaf..e6e6eb6a4 100644
--- a/vendor/github.com/vulcand/oxy/utils/netutils.go
+++ b/vendor/github.com/vulcand/oxy/utils/netutils.go
@@ -12,16 +12,43 @@ import (
log "github.com/sirupsen/logrus"
)
-// ProxyWriter helps to capture response headers and status code
+type ProxyWriter interface {
+ http.ResponseWriter
+ GetLength() int64
+ StatusCode() int
+ GetWriter() http.ResponseWriter
+}
+
+// ProxyWriterWithoutCloseNotify helps to capture response headers and status code
// from the ServeHTTP. It can be safely passed to ServeHTTP handler,
// wrapping the real response writer.
-type ProxyWriter struct {
+type ProxyWriterWithoutCloseNotify struct {
W http.ResponseWriter
Code int
Length int64
}
-func (p *ProxyWriter) StatusCode() int {
+func NewProxyWriterWithoutCloseNotify(writer http.ResponseWriter) *ProxyWriterWithoutCloseNotify {
+ return &ProxyWriterWithoutCloseNotify{
+ W: writer,
+ }
+}
+
+func NewSimpleProxyWriter(writer http.ResponseWriter) *SimpleProxyWriter {
+ return &SimpleProxyWriter{
+ ProxyWriterWithoutCloseNotify: NewProxyWriterWithoutCloseNotify(writer),
+ }
+}
+
+type SimpleProxyWriter struct {
+ *ProxyWriterWithoutCloseNotify
+}
+
+func (p *ProxyWriterWithoutCloseNotify) GetWriter() http.ResponseWriter {
+ return p.W
+}
+
+func (p *ProxyWriterWithoutCloseNotify) StatusCode() int {
if p.Code == 0 {
// per contract standard lib will set this to http.StatusOK if not set
// by user, here we avoid the confusion by mirroring this logic
@@ -30,35 +57,39 @@ func (p *ProxyWriter) StatusCode() int {
return p.Code
}
-func (p *ProxyWriter) Header() http.Header {
+func (p *ProxyWriterWithoutCloseNotify) Header() http.Header {
return p.W.Header()
}
-func (p *ProxyWriter) Write(buf []byte) (int, error) {
+func (p *ProxyWriterWithoutCloseNotify) Write(buf []byte) (int, error) {
p.Length = p.Length + int64(len(buf))
return p.W.Write(buf)
}
-func (p *ProxyWriter) WriteHeader(code int) {
+func (p *ProxyWriterWithoutCloseNotify) WriteHeader(code int) {
p.Code = code
p.W.WriteHeader(code)
}
-func (p *ProxyWriter) Flush() {
+func (p *ProxyWriterWithoutCloseNotify) Flush() {
if f, ok := p.W.(http.Flusher); ok {
f.Flush()
}
}
-func (p *ProxyWriter) CloseNotify() <-chan bool {
- if cn, ok := p.W.(http.CloseNotifier); ok {
+func (p *ProxyWriterWithoutCloseNotify) GetLength() int64 {
+ return p.Length
+}
+
+func (p *SimpleProxyWriter) CloseNotify() <-chan bool {
+ if cn, ok := p.GetWriter().(http.CloseNotifier); ok {
return cn.CloseNotify()
}
- log.Warningf("Upstream ResponseWriter of type %v does not implement http.CloseNotifier. Returning dummy channel.", reflect.TypeOf(p.W))
+ log.Warningf("Upstream ResponseWriter of type %v does not implement http.CloseNotifier. Returning dummy channel.", reflect.TypeOf(p.GetWriter()))
return make(<-chan bool)
}
-func (p *ProxyWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
+func (p *ProxyWriterWithoutCloseNotify) Hijack() (net.Conn, *bufio.ReadWriter, error) {
if hi, ok := p.W.(http.Hijacker); ok {
return hi.Hijack()
}
diff --git a/vendor/github.com/xenolf/lego/acme/challenges.go b/vendor/github.com/xenolf/lego/acme/challenges.go
deleted file mode 100644
index 857900507..000000000
--- a/vendor/github.com/xenolf/lego/acme/challenges.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package acme
-
-// Challenge is a string that identifies a particular type and version of ACME challenge.
-type Challenge string
-
-const (
- // HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#http
- // Note: HTTP01ChallengePath returns the URL path to fulfill this challenge
- HTTP01 = Challenge("http-01")
- // TLSSNI01 is the "tls-sni-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#tls-with-server-name-indication-tls-sni
- // Note: TLSSNI01ChallengeCert returns a certificate to fulfill this challenge
- TLSSNI01 = Challenge("tls-sni-01")
- // DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#dns
- // Note: DNS01Record returns a DNS record which will fulfill this challenge
- DNS01 = Challenge("dns-01")
-)
diff --git a/vendor/github.com/xenolf/lego/acme/client.go b/vendor/github.com/xenolf/lego/acme/client.go
deleted file mode 100644
index bcb844371..000000000
--- a/vendor/github.com/xenolf/lego/acme/client.go
+++ /dev/null
@@ -1,825 +0,0 @@
-// Package acme implements the ACME protocol for Let's Encrypt and other conforming providers.
-package acme
-
-import (
- "crypto"
- "crypto/x509"
- "encoding/base64"
- "encoding/json"
- "errors"
- "fmt"
- "io/ioutil"
- "log"
- "net"
- "net/http"
- "regexp"
- "strconv"
- "strings"
- "time"
-)
-
-var (
- // Logger is an optional custom logger.
- Logger *log.Logger
-)
-
-const (
- // maxBodySize is the maximum size of body that we will read.
- maxBodySize = 1024 * 1024
-
- // overallRequestLimit is the overall number of request per second limited on the
- // “new-reg”, “new-authz” and “new-cert” endpoints. From the documentation the
- // limitation is 20 requests per second, but using 20 as value doesn't work but 18 do
- overallRequestLimit = 18
-)
-
-// logf writes a log entry. It uses Logger if not
-// nil, otherwise it uses the default log.Logger.
-func logf(format string, args ...interface{}) {
- if Logger != nil {
- Logger.Printf(format, args...)
- } else {
- log.Printf(format, args...)
- }
-}
-
-// User interface is to be implemented by users of this library.
-// It is used by the client type to get user specific information.
-type User interface {
- GetEmail() string
- GetRegistration() *RegistrationResource
- GetPrivateKey() crypto.PrivateKey
-}
-
-// Interface for all challenge solvers to implement.
-type solver interface {
- Solve(challenge challenge, domain string) error
-}
-
-type validateFunc func(j *jws, domain, uri string, chlng challenge) error
-
-// Client is the user-friendy way to ACME
-type Client struct {
- directory directory
- user User
- jws *jws
- keyType KeyType
- solvers map[Challenge]solver
-}
-
-// NewClient creates a new ACME client on behalf of the user. The client will depend on
-// the ACME directory located at caDirURL for the rest of its actions. A private
-// key of type keyType (see KeyType contants) will be generated when requesting a new
-// certificate if one isn't provided.
-func NewClient(caDirURL string, user User, keyType KeyType) (*Client, error) {
- privKey := user.GetPrivateKey()
- if privKey == nil {
- return nil, errors.New("private key was nil")
- }
-
- var dir directory
- if _, err := getJSON(caDirURL, &dir); err != nil {
- return nil, fmt.Errorf("get directory at '%s': %v", caDirURL, err)
- }
-
- if dir.NewRegURL == "" {
- return nil, errors.New("directory missing new registration URL")
- }
- if dir.NewAuthzURL == "" {
- return nil, errors.New("directory missing new authz URL")
- }
- if dir.NewCertURL == "" {
- return nil, errors.New("directory missing new certificate URL")
- }
- if dir.RevokeCertURL == "" {
- return nil, errors.New("directory missing revoke certificate URL")
- }
-
- jws := &jws{privKey: privKey, directoryURL: caDirURL}
-
- // REVIEW: best possibility?
- // Add all available solvers with the right index as per ACME
- // spec to this map. Otherwise they won`t be found.
- solvers := make(map[Challenge]solver)
- solvers[HTTP01] = &httpChallenge{jws: jws, validate: validate, provider: &HTTPProviderServer{}}
- solvers[TLSSNI01] = &tlsSNIChallenge{jws: jws, validate: validate, provider: &TLSProviderServer{}}
-
- return &Client{directory: dir, user: user, jws: jws, keyType: keyType, solvers: solvers}, nil
-}
-
-// SetChallengeProvider specifies a custom provider p that can solve the given challenge type.
-func (c *Client) SetChallengeProvider(challenge Challenge, p ChallengeProvider) error {
- switch challenge {
- case HTTP01:
- c.solvers[challenge] = &httpChallenge{jws: c.jws, validate: validate, provider: p}
- case TLSSNI01:
- c.solvers[challenge] = &tlsSNIChallenge{jws: c.jws, validate: validate, provider: p}
- case DNS01:
- c.solvers[challenge] = &dnsChallenge{jws: c.jws, validate: validate, provider: p}
- default:
- return fmt.Errorf("Unknown challenge %v", challenge)
- }
- return nil
-}
-
-// SetHTTPAddress specifies a custom interface:port to be used for HTTP based challenges.
-// If this option is not used, the default port 80 and all interfaces will be used.
-// To only specify a port and no interface use the ":port" notation.
-//
-// NOTE: This REPLACES any custom HTTP provider previously set by calling
-// c.SetChallengeProvider with the default HTTP challenge provider.
-func (c *Client) SetHTTPAddress(iface string) error {
- host, port, err := net.SplitHostPort(iface)
- if err != nil {
- return err
- }
-
- if chlng, ok := c.solvers[HTTP01]; ok {
- chlng.(*httpChallenge).provider = NewHTTPProviderServer(host, port)
- }
-
- return nil
-}
-
-// SetTLSAddress specifies a custom interface:port to be used for TLS based challenges.
-// If this option is not used, the default port 443 and all interfaces will be used.
-// To only specify a port and no interface use the ":port" notation.
-//
-// NOTE: This REPLACES any custom TLS-SNI provider previously set by calling
-// c.SetChallengeProvider with the default TLS-SNI challenge provider.
-func (c *Client) SetTLSAddress(iface string) error {
- host, port, err := net.SplitHostPort(iface)
- if err != nil {
- return err
- }
-
- if chlng, ok := c.solvers[TLSSNI01]; ok {
- chlng.(*tlsSNIChallenge).provider = NewTLSProviderServer(host, port)
- }
- return nil
-}
-
-// ExcludeChallenges explicitly removes challenges from the pool for solving.
-func (c *Client) ExcludeChallenges(challenges []Challenge) {
- // Loop through all challenges and delete the requested one if found.
- for _, challenge := range challenges {
- delete(c.solvers, challenge)
- }
-}
-
-// Register the current account to the ACME server.
-func (c *Client) Register() (*RegistrationResource, error) {
- if c == nil || c.user == nil {
- return nil, errors.New("acme: cannot register a nil client or user")
- }
- logf("[INFO] acme: Registering account for %s", c.user.GetEmail())
-
- regMsg := registrationMessage{
- Resource: "new-reg",
- }
- if c.user.GetEmail() != "" {
- regMsg.Contact = []string{"mailto:" + c.user.GetEmail()}
- } else {
- regMsg.Contact = []string{}
- }
-
- var serverReg Registration
- var regURI string
- hdr, err := postJSON(c.jws, c.directory.NewRegURL, regMsg, &serverReg)
- if err != nil {
- remoteErr, ok := err.(RemoteError)
- if ok && remoteErr.StatusCode == 409 {
- regURI = hdr.Get("Location")
- regMsg = registrationMessage{
- Resource: "reg",
- }
- if hdr, err = postJSON(c.jws, regURI, regMsg, &serverReg); err != nil {
- return nil, err
- }
- } else {
- return nil, err
- }
- }
-
- reg := &RegistrationResource{Body: serverReg}
-
- links := parseLinks(hdr["Link"])
-
- if regURI == "" {
- regURI = hdr.Get("Location")
- }
- reg.URI = regURI
- if links["terms-of-service"] != "" {
- reg.TosURL = links["terms-of-service"]
- }
-
- if links["next"] != "" {
- reg.NewAuthzURL = links["next"]
- } else {
- return nil, errors.New("acme: The server did not return 'next' link to proceed")
- }
-
- return reg, nil
-}
-
-// DeleteRegistration deletes the client's user registration from the ACME
-// server.
-func (c *Client) DeleteRegistration() error {
- if c == nil || c.user == nil {
- return errors.New("acme: cannot unregister a nil client or user")
- }
- logf("[INFO] acme: Deleting account for %s", c.user.GetEmail())
-
- regMsg := registrationMessage{
- Resource: "reg",
- Delete: true,
- }
-
- _, err := postJSON(c.jws, c.user.GetRegistration().URI, regMsg, nil)
- if err != nil {
- return err
- }
-
- return nil
-}
-
-// QueryRegistration runs a POST request on the client's registration and
-// returns the result.
-//
-// This is similar to the Register function, but acting on an existing
-// registration link and resource.
-func (c *Client) QueryRegistration() (*RegistrationResource, error) {
- if c == nil || c.user == nil {
- return nil, errors.New("acme: cannot query the registration of a nil client or user")
- }
- // Log the URL here instead of the email as the email may not be set
- logf("[INFO] acme: Querying account for %s", c.user.GetRegistration().URI)
-
- regMsg := registrationMessage{
- Resource: "reg",
- }
-
- var serverReg Registration
- hdr, err := postJSON(c.jws, c.user.GetRegistration().URI, regMsg, &serverReg)
- if err != nil {
- return nil, err
- }
-
- reg := &RegistrationResource{Body: serverReg}
-
- links := parseLinks(hdr["Link"])
- // Location: header is not returned so this needs to be populated off of
- // existing URI
- reg.URI = c.user.GetRegistration().URI
- if links["terms-of-service"] != "" {
- reg.TosURL = links["terms-of-service"]
- }
-
- if links["next"] != "" {
- reg.NewAuthzURL = links["next"]
- } else {
- return nil, errors.New("acme: No new-authz link in response to registration query")
- }
-
- return reg, nil
-}
-
-// AgreeToTOS updates the Client registration and sends the agreement to
-// the server.
-func (c *Client) AgreeToTOS() error {
- reg := c.user.GetRegistration()
-
- reg.Body.Agreement = c.user.GetRegistration().TosURL
- reg.Body.Resource = "reg"
- _, err := postJSON(c.jws, c.user.GetRegistration().URI, c.user.GetRegistration().Body, nil)
- return err
-}
-
-// ObtainCertificateForCSR tries to obtain a certificate matching the CSR passed into it.
-// The domains are inferred from the CommonName and SubjectAltNames, if any. The private key
-// for this CSR is not required.
-// If bundle is true, the []byte contains both the issuer certificate and
-// your issued certificate as a bundle.
-// This function will never return a partial certificate. If one domain in the list fails,
-// the whole certificate will fail.
-func (c *Client) ObtainCertificateForCSR(csr x509.CertificateRequest, bundle bool) (CertificateResource, map[string]error) {
- // figure out what domains it concerns
- // start with the common name
- domains := []string{csr.Subject.CommonName}
-
- // loop over the SubjectAltName DNS names
-DNSNames:
- for _, sanName := range csr.DNSNames {
- for _, existingName := range domains {
- if existingName == sanName {
- // duplicate; skip this name
- continue DNSNames
- }
- }
-
- // name is unique
- domains = append(domains, sanName)
- }
-
- if bundle {
- logf("[INFO][%s] acme: Obtaining bundled SAN certificate given a CSR", strings.Join(domains, ", "))
- } else {
- logf("[INFO][%s] acme: Obtaining SAN certificate given a CSR", strings.Join(domains, ", "))
- }
-
- challenges, failures := c.getChallenges(domains)
- // If any challenge fails - return. Do not generate partial SAN certificates.
- if len(failures) > 0 {
- for _, auth := range challenges {
- c.disableAuthz(auth)
- }
-
- return CertificateResource{}, failures
- }
-
- errs := c.solveChallenges(challenges)
- // If any challenge fails - return. Do not generate partial SAN certificates.
- if len(errs) > 0 {
- return CertificateResource{}, errs
- }
-
- logf("[INFO][%s] acme: Validations succeeded; requesting certificates", strings.Join(domains, ", "))
-
- cert, err := c.requestCertificateForCsr(challenges, bundle, csr.Raw, nil)
- if err != nil {
- for _, chln := range challenges {
- failures[chln.Domain] = err
- }
- }
-
- // Add the CSR to the certificate so that it can be used for renewals.
- cert.CSR = pemEncode(&csr)
-
- return cert, failures
-}
-
-// ObtainCertificate tries to obtain a single certificate using all domains passed into it.
-// The first domain in domains is used for the CommonName field of the certificate, all other
-// domains are added using the Subject Alternate Names extension. A new private key is generated
-// for every invocation of this function. If you do not want that you can supply your own private key
-// in the privKey parameter. If this parameter is non-nil it will be used instead of generating a new one.
-// If bundle is true, the []byte contains both the issuer certificate and
-// your issued certificate as a bundle.
-// This function will never return a partial certificate. If one domain in the list fails,
-// the whole certificate will fail.
-func (c *Client) ObtainCertificate(domains []string, bundle bool, privKey crypto.PrivateKey, mustStaple bool) (CertificateResource, map[string]error) {
- if bundle {
- logf("[INFO][%s] acme: Obtaining bundled SAN certificate", strings.Join(domains, ", "))
- } else {
- logf("[INFO][%s] acme: Obtaining SAN certificate", strings.Join(domains, ", "))
- }
-
- challenges, failures := c.getChallenges(domains)
- // If any challenge fails - return. Do not generate partial SAN certificates.
- if len(failures) > 0 {
- for _, auth := range challenges {
- c.disableAuthz(auth)
- }
-
- return CertificateResource{}, failures
- }
-
- errs := c.solveChallenges(challenges)
- // If any challenge fails - return. Do not generate partial SAN certificates.
- if len(errs) > 0 {
- return CertificateResource{}, errs
- }
-
- logf("[INFO][%s] acme: Validations succeeded; requesting certificates", strings.Join(domains, ", "))
-
- cert, err := c.requestCertificate(challenges, bundle, privKey, mustStaple)
- if err != nil {
- for _, chln := range challenges {
- failures[chln.Domain] = err
- }
- }
-
- return cert, failures
-}
-
-// RevokeCertificate takes a PEM encoded certificate or bundle and tries to revoke it at the CA.
-func (c *Client) RevokeCertificate(certificate []byte) error {
- certificates, err := parsePEMBundle(certificate)
- if err != nil {
- return err
- }
-
- x509Cert := certificates[0]
- if x509Cert.IsCA {
- return fmt.Errorf("Certificate bundle starts with a CA certificate")
- }
-
- encodedCert := base64.URLEncoding.EncodeToString(x509Cert.Raw)
-
- _, err = postJSON(c.jws, c.directory.RevokeCertURL, revokeCertMessage{Resource: "revoke-cert", Certificate: encodedCert}, nil)
- return err
-}
-
-// RenewCertificate takes a CertificateResource and tries to renew the certificate.
-// If the renewal process succeeds, the new certificate will ge returned in a new CertResource.
-// Please be aware that this function will return a new certificate in ANY case that is not an error.
-// If the server does not provide us with a new cert on a GET request to the CertURL
-// this function will start a new-cert flow where a new certificate gets generated.
-// If bundle is true, the []byte contains both the issuer certificate and
-// your issued certificate as a bundle.
-// For private key reuse the PrivateKey property of the passed in CertificateResource should be non-nil.
-func (c *Client) RenewCertificate(cert CertificateResource, bundle, mustStaple bool) (CertificateResource, error) {
- // Input certificate is PEM encoded. Decode it here as we may need the decoded
- // cert later on in the renewal process. The input may be a bundle or a single certificate.
- certificates, err := parsePEMBundle(cert.Certificate)
- if err != nil {
- return CertificateResource{}, err
- }
-
- x509Cert := certificates[0]
- if x509Cert.IsCA {
- return CertificateResource{}, fmt.Errorf("[%s] Certificate bundle starts with a CA certificate", cert.Domain)
- }
-
- // This is just meant to be informal for the user.
- timeLeft := x509Cert.NotAfter.Sub(time.Now().UTC())
- logf("[INFO][%s] acme: Trying renewal with %d hours remaining", cert.Domain, int(timeLeft.Hours()))
-
- // We always need to request a new certificate to renew.
- // Start by checking to see if the certificate was based off a CSR, and
- // use that if it's defined.
- if len(cert.CSR) > 0 {
- csr, err := pemDecodeTox509CSR(cert.CSR)
- if err != nil {
- return CertificateResource{}, err
- }
- newCert, failures := c.ObtainCertificateForCSR(*csr, bundle)
- return newCert, failures[cert.Domain]
- }
-
- var privKey crypto.PrivateKey
- if cert.PrivateKey != nil {
- privKey, err = parsePEMPrivateKey(cert.PrivateKey)
- if err != nil {
- return CertificateResource{}, err
- }
- }
-
- var domains []string
- var failures map[string]error
- // check for SAN certificate
- if len(x509Cert.DNSNames) > 1 {
- domains = append(domains, x509Cert.Subject.CommonName)
- for _, sanDomain := range x509Cert.DNSNames {
- if sanDomain == x509Cert.Subject.CommonName {
- continue
- }
- domains = append(domains, sanDomain)
- }
- } else {
- domains = append(domains, x509Cert.Subject.CommonName)
- }
-
- newCert, failures := c.ObtainCertificate(domains, bundle, privKey, mustStaple)
- return newCert, failures[cert.Domain]
-}
-
-// Looks through the challenge combinations to find a solvable match.
-// Then solves the challenges in series and returns.
-func (c *Client) solveChallenges(challenges []authorizationResource) map[string]error {
- // loop through the resources, basically through the domains.
- failures := make(map[string]error)
- for _, authz := range challenges {
- if authz.Body.Status == "valid" {
- // Boulder might recycle recent validated authz (see issue #267)
- logf("[INFO][%s] acme: Authorization already valid; skipping challenge", authz.Domain)
- continue
- }
- // no solvers - no solving
- if solvers := c.chooseSolvers(authz.Body, authz.Domain); solvers != nil {
- for i, solver := range solvers {
- // TODO: do not immediately fail if one domain fails to validate.
- err := solver.Solve(authz.Body.Challenges[i], authz.Domain)
- if err != nil {
- c.disableAuthz(authz)
- failures[authz.Domain] = err
- }
- }
- } else {
- c.disableAuthz(authz)
- failures[authz.Domain] = fmt.Errorf("[%s] acme: Could not determine solvers", authz.Domain)
- }
- }
-
- return failures
-}
-
-// Checks all combinations from the server and returns an array of
-// solvers which should get executed in series.
-func (c *Client) chooseSolvers(auth authorization, domain string) map[int]solver {
- for _, combination := range auth.Combinations {
- solvers := make(map[int]solver)
- for _, idx := range combination {
- if solver, ok := c.solvers[auth.Challenges[idx].Type]; ok {
- solvers[idx] = solver
- } else {
- logf("[INFO][%s] acme: Could not find solver for: %s", domain, auth.Challenges[idx].Type)
- }
- }
-
- // If we can solve the whole combination, return the solvers
- if len(solvers) == len(combination) {
- return solvers
- }
- }
- return nil
-}
-
-// Get the challenges needed to proof our identifier to the ACME server.
-func (c *Client) getChallenges(domains []string) ([]authorizationResource, map[string]error) {
- resc, errc := make(chan authorizationResource), make(chan domainError)
-
- delay := time.Second / overallRequestLimit
-
- for _, domain := range domains {
- time.Sleep(delay)
-
- go func(domain string) {
- authMsg := authorization{Resource: "new-authz", Identifier: identifier{Type: "dns", Value: domain}}
- var authz authorization
- hdr, err := postJSON(c.jws, c.user.GetRegistration().NewAuthzURL, authMsg, &authz)
- if err != nil {
- errc <- domainError{Domain: domain, Error: err}
- return
- }
-
- links := parseLinks(hdr["Link"])
- if links["next"] == "" {
- logf("[ERROR][%s] acme: Server did not provide next link to proceed", domain)
- errc <- domainError{Domain: domain, Error: errors.New("Server did not provide next link to proceed")}
- return
- }
-
- resc <- authorizationResource{Body: authz, NewCertURL: links["next"], AuthURL: hdr.Get("Location"), Domain: domain}
- }(domain)
- }
-
- responses := make(map[string]authorizationResource)
- failures := make(map[string]error)
- for i := 0; i < len(domains); i++ {
- select {
- case res := <-resc:
- responses[res.Domain] = res
- case err := <-errc:
- failures[err.Domain] = err.Error
- }
- }
-
- challenges := make([]authorizationResource, 0, len(responses))
- for _, domain := range domains {
- if challenge, ok := responses[domain]; ok {
- challenges = append(challenges, challenge)
- }
- }
-
- logAuthz(challenges)
-
- close(resc)
- close(errc)
-
- return challenges, failures
-}
-
-func logAuthz(authz []authorizationResource) {
- for _, auth := range authz {
- logf("[INFO][%s] AuthURL: %s", auth.Domain, auth.AuthURL)
- }
-}
-
-// cleanAuthz loops through the passed in slice and disables any auths which are not "valid"
-func (c *Client) disableAuthz(auth authorizationResource) error {
- var disabledAuth authorization
- _, err := postJSON(c.jws, auth.AuthURL, deactivateAuthMessage{Resource: "authz", Status: "deactivated"}, &disabledAuth)
- return err
-}
-
-func (c *Client) requestCertificate(authz []authorizationResource, bundle bool, privKey crypto.PrivateKey, mustStaple bool) (CertificateResource, error) {
- if len(authz) == 0 {
- return CertificateResource{}, errors.New("Passed no authorizations to requestCertificate!")
- }
-
- var err error
- if privKey == nil {
- privKey, err = generatePrivateKey(c.keyType)
- if err != nil {
- return CertificateResource{}, err
- }
- }
-
- // determine certificate name(s) based on the authorization resources
- commonName := authz[0]
- var san []string
- for _, auth := range authz[1:] {
- san = append(san, auth.Domain)
- }
-
- // TODO: should the CSR be customizable?
- csr, err := generateCsr(privKey, commonName.Domain, san, mustStaple)
- if err != nil {
- return CertificateResource{}, err
- }
-
- return c.requestCertificateForCsr(authz, bundle, csr, pemEncode(privKey))
-}
-
-func (c *Client) requestCertificateForCsr(authz []authorizationResource, bundle bool, csr []byte, privateKeyPem []byte) (CertificateResource, error) {
- commonName := authz[0]
-
- var authURLs []string
- for _, auth := range authz[1:] {
- authURLs = append(authURLs, auth.AuthURL)
- }
-
- csrString := base64.URLEncoding.EncodeToString(csr)
- jsonBytes, err := json.Marshal(csrMessage{Resource: "new-cert", Csr: csrString, Authorizations: authURLs})
- if err != nil {
- return CertificateResource{}, err
- }
-
- resp, err := c.jws.post(commonName.NewCertURL, jsonBytes)
- if err != nil {
- return CertificateResource{}, err
- }
-
- certRes := CertificateResource{
- Domain: commonName.Domain,
- CertURL: resp.Header.Get("Location"),
- PrivateKey: privateKeyPem,
- }
-
- maxChecks := 1000
- for i := 0; i < maxChecks; i++ {
- done, err := c.checkCertResponse(resp, &certRes, bundle)
- resp.Body.Close()
- if err != nil {
- return CertificateResource{}, err
- }
- if done {
- break
- }
- if i == maxChecks-1 {
- return CertificateResource{}, fmt.Errorf("polled for certificate %d times; giving up", i)
- }
- resp, err = httpGet(certRes.CertURL)
- if err != nil {
- return CertificateResource{}, err
- }
- }
-
- return certRes, nil
-}
-
-// checkCertResponse checks resp to see if a certificate is contained in the
-// response, and if so, loads it into certRes and returns true. If the cert
-// is not yet ready, it returns false. This function honors the waiting period
-// required by the Retry-After header of the response, if specified. This
-// function may read from resp.Body but does NOT close it. The certRes input
-// should already have the Domain (common name) field populated. If bundle is
-// true, the certificate will be bundled with the issuer's cert.
-func (c *Client) checkCertResponse(resp *http.Response, certRes *CertificateResource, bundle bool) (bool, error) {
- switch resp.StatusCode {
- case 201, 202:
- cert, err := ioutil.ReadAll(limitReader(resp.Body, maxBodySize))
- if err != nil {
- return false, err
- }
-
- // The server returns a body with a length of zero if the
- // certificate was not ready at the time this request completed.
- // Otherwise the body is the certificate.
- if len(cert) > 0 {
- certRes.CertStableURL = resp.Header.Get("Content-Location")
- certRes.AccountRef = c.user.GetRegistration().URI
-
- issuedCert := pemEncode(derCertificateBytes(cert))
-
- // The issuer certificate link is always supplied via an "up" link
- // in the response headers of a new certificate.
- links := parseLinks(resp.Header["Link"])
- issuerCert, err := c.getIssuerCertificate(links["up"])
- if err != nil {
- // If we fail to acquire the issuer cert, return the issued certificate - do not fail.
- logf("[WARNING][%s] acme: Could not bundle issuer certificate: %v", certRes.Domain, err)
- } else {
- issuerCert = pemEncode(derCertificateBytes(issuerCert))
-
- // If bundle is true, we want to return a certificate bundle.
- // To do this, we append the issuer cert to the issued cert.
- if bundle {
- issuedCert = append(issuedCert, issuerCert...)
- }
- }
-
- certRes.Certificate = issuedCert
- certRes.IssuerCertificate = issuerCert
- logf("[INFO][%s] Server responded with a certificate.", certRes.Domain)
- return true, nil
- }
-
- // The certificate was granted but is not yet issued.
- // Check retry-after and loop.
- ra := resp.Header.Get("Retry-After")
- retryAfter, err := strconv.Atoi(ra)
- if err != nil {
- return false, err
- }
-
- logf("[INFO][%s] acme: Server responded with status 202; retrying after %ds", certRes.Domain, retryAfter)
- time.Sleep(time.Duration(retryAfter) * time.Second)
-
- return false, nil
- default:
- return false, handleHTTPError(resp)
- }
-}
-
-// getIssuerCertificate requests the issuer certificate
-func (c *Client) getIssuerCertificate(url string) ([]byte, error) {
- logf("[INFO] acme: Requesting issuer cert from %s", url)
- resp, err := httpGet(url)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- issuerBytes, err := ioutil.ReadAll(limitReader(resp.Body, maxBodySize))
- if err != nil {
- return nil, err
- }
-
- _, err = x509.ParseCertificate(issuerBytes)
- if err != nil {
- return nil, err
- }
-
- return issuerBytes, err
-}
-
-func parseLinks(links []string) map[string]string {
- aBrkt := regexp.MustCompile("[<>]")
- slver := regexp.MustCompile("(.+) *= *\"(.+)\"")
- linkMap := make(map[string]string)
-
- for _, link := range links {
-
- link = aBrkt.ReplaceAllString(link, "")
- parts := strings.Split(link, ";")
-
- matches := slver.FindStringSubmatch(parts[1])
- if len(matches) > 0 {
- linkMap[matches[2]] = parts[0]
- }
- }
-
- return linkMap
-}
-
-// validate makes the ACME server start validating a
-// challenge response, only returning once it is done.
-func validate(j *jws, domain, uri string, chlng challenge) error {
- var challengeResponse challenge
-
- hdr, err := postJSON(j, uri, chlng, &challengeResponse)
- if err != nil {
- return err
- }
-
- // After the path is sent, the ACME server will access our server.
- // Repeatedly check the server for an updated status on our request.
- for {
- switch challengeResponse.Status {
- case "valid":
- logf("[INFO][%s] The server validated our request", domain)
- return nil
- case "pending":
- break
- case "invalid":
- return handleChallengeError(challengeResponse)
- default:
- return errors.New("The server returned an unexpected state.")
- }
-
- ra, err := strconv.Atoi(hdr.Get("Retry-After"))
- if err != nil {
- // The ACME server MUST return a Retry-After.
- // If it doesn't, we'll just poll hard.
- ra = 1
- }
- time.Sleep(time.Duration(ra) * time.Second)
-
- hdr, err = getJSON(uri, &challengeResponse)
- if err != nil {
- return err
- }
- }
-}
diff --git a/vendor/github.com/xenolf/lego/acme/crypto.go b/vendor/github.com/xenolf/lego/acme/crypto.go
deleted file mode 100644
index fa868a90d..000000000
--- a/vendor/github.com/xenolf/lego/acme/crypto.go
+++ /dev/null
@@ -1,347 +0,0 @@
-package acme
-
-import (
- "bytes"
- "crypto"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rand"
- "crypto/rsa"
- "crypto/x509"
- "crypto/x509/pkix"
- "encoding/base64"
- "encoding/pem"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "math/big"
- "net/http"
- "strings"
- "time"
-
- "encoding/asn1"
-
- "golang.org/x/crypto/ocsp"
-)
-
-// KeyType represents the key algo as well as the key size or curve to use.
-type KeyType string
-type derCertificateBytes []byte
-
-// Constants for all key types we support.
-const (
- EC256 = KeyType("P256")
- EC384 = KeyType("P384")
- RSA2048 = KeyType("2048")
- RSA4096 = KeyType("4096")
- RSA8192 = KeyType("8192")
-)
-
-const (
- // OCSPGood means that the certificate is valid.
- OCSPGood = ocsp.Good
- // OCSPRevoked means that the certificate has been deliberately revoked.
- OCSPRevoked = ocsp.Revoked
- // OCSPUnknown means that the OCSP responder doesn't know about the certificate.
- OCSPUnknown = ocsp.Unknown
- // OCSPServerFailed means that the OCSP responder failed to process the request.
- OCSPServerFailed = ocsp.ServerFailed
-)
-
-// Constants for OCSP must staple
-var (
- tlsFeatureExtensionOID = asn1.ObjectIdentifier{1, 3, 6, 1, 5, 5, 7, 1, 24}
- ocspMustStapleFeature = []byte{0x30, 0x03, 0x02, 0x01, 0x05}
-)
-
-// GetOCSPForCert takes a PEM encoded cert or cert bundle returning the raw OCSP response,
-// the parsed response, and an error, if any. The returned []byte can be passed directly
-// into the OCSPStaple property of a tls.Certificate. If the bundle only contains the
-// issued certificate, this function will try to get the issuer certificate from the
-// IssuingCertificateURL in the certificate. If the []byte and/or ocsp.Response return
-// values are nil, the OCSP status may be assumed OCSPUnknown.
-func GetOCSPForCert(bundle []byte) ([]byte, *ocsp.Response, error) {
- certificates, err := parsePEMBundle(bundle)
- if err != nil {
- return nil, nil, err
- }
-
- // We expect the certificate slice to be ordered downwards the chain.
- // SRV CRT -> CA. We need to pull the leaf and issuer certs out of it,
- // which should always be the first two certificates. If there's no
- // OCSP server listed in the leaf cert, there's nothing to do. And if
- // we have only one certificate so far, we need to get the issuer cert.
- issuedCert := certificates[0]
- if len(issuedCert.OCSPServer) == 0 {
- return nil, nil, errors.New("no OCSP server specified in cert")
- }
- if len(certificates) == 1 {
- // TODO: build fallback. If this fails, check the remaining array entries.
- if len(issuedCert.IssuingCertificateURL) == 0 {
- return nil, nil, errors.New("no issuing certificate URL")
- }
-
- resp, err := httpGet(issuedCert.IssuingCertificateURL[0])
- if err != nil {
- return nil, nil, err
- }
- defer resp.Body.Close()
-
- issuerBytes, err := ioutil.ReadAll(limitReader(resp.Body, 1024*1024))
- if err != nil {
- return nil, nil, err
- }
-
- issuerCert, err := x509.ParseCertificate(issuerBytes)
- if err != nil {
- return nil, nil, err
- }
-
- // Insert it into the slice on position 0
- // We want it ordered right SRV CRT -> CA
- certificates = append(certificates, issuerCert)
- }
- issuerCert := certificates[1]
-
- // Finally kick off the OCSP request.
- ocspReq, err := ocsp.CreateRequest(issuedCert, issuerCert, nil)
- if err != nil {
- return nil, nil, err
- }
-
- reader := bytes.NewReader(ocspReq)
- req, err := httpPost(issuedCert.OCSPServer[0], "application/ocsp-request", reader)
- if err != nil {
- return nil, nil, err
- }
- defer req.Body.Close()
-
- ocspResBytes, err := ioutil.ReadAll(limitReader(req.Body, 1024*1024))
- ocspRes, err := ocsp.ParseResponse(ocspResBytes, issuerCert)
- if err != nil {
- return nil, nil, err
- }
-
- return ocspResBytes, ocspRes, nil
-}
-
-func getKeyAuthorization(token string, key interface{}) (string, error) {
- var publicKey crypto.PublicKey
- switch k := key.(type) {
- case *ecdsa.PrivateKey:
- publicKey = k.Public()
- case *rsa.PrivateKey:
- publicKey = k.Public()
- }
-
- // Generate the Key Authorization for the challenge
- jwk := keyAsJWK(publicKey)
- if jwk == nil {
- return "", errors.New("Could not generate JWK from key.")
- }
- thumbBytes, err := jwk.Thumbprint(crypto.SHA256)
- if err != nil {
- return "", err
- }
-
- // unpad the base64URL
- keyThumb := base64.URLEncoding.EncodeToString(thumbBytes)
- index := strings.Index(keyThumb, "=")
- if index != -1 {
- keyThumb = keyThumb[:index]
- }
-
- return token + "." + keyThumb, nil
-}
-
-// parsePEMBundle parses a certificate bundle from top to bottom and returns
-// a slice of x509 certificates. This function will error if no certificates are found.
-func parsePEMBundle(bundle []byte) ([]*x509.Certificate, error) {
- var certificates []*x509.Certificate
- var certDERBlock *pem.Block
-
- for {
- certDERBlock, bundle = pem.Decode(bundle)
- if certDERBlock == nil {
- break
- }
-
- if certDERBlock.Type == "CERTIFICATE" {
- cert, err := x509.ParseCertificate(certDERBlock.Bytes)
- if err != nil {
- return nil, err
- }
- certificates = append(certificates, cert)
- }
- }
-
- if len(certificates) == 0 {
- return nil, errors.New("No certificates were found while parsing the bundle.")
- }
-
- return certificates, nil
-}
-
-func parsePEMPrivateKey(key []byte) (crypto.PrivateKey, error) {
- keyBlock, _ := pem.Decode(key)
-
- switch keyBlock.Type {
- case "RSA PRIVATE KEY":
- return x509.ParsePKCS1PrivateKey(keyBlock.Bytes)
- case "EC PRIVATE KEY":
- return x509.ParseECPrivateKey(keyBlock.Bytes)
- default:
- return nil, errors.New("Unknown PEM header value")
- }
-}
-
-func generatePrivateKey(keyType KeyType) (crypto.PrivateKey, error) {
-
- switch keyType {
- case EC256:
- return ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
- case EC384:
- return ecdsa.GenerateKey(elliptic.P384(), rand.Reader)
- case RSA2048:
- return rsa.GenerateKey(rand.Reader, 2048)
- case RSA4096:
- return rsa.GenerateKey(rand.Reader, 4096)
- case RSA8192:
- return rsa.GenerateKey(rand.Reader, 8192)
- }
-
- return nil, fmt.Errorf("Invalid KeyType: %s", keyType)
-}
-
-func generateCsr(privateKey crypto.PrivateKey, domain string, san []string, mustStaple bool) ([]byte, error) {
- template := x509.CertificateRequest{
- Subject: pkix.Name{
- CommonName: domain,
- },
- }
-
- if len(san) > 0 {
- template.DNSNames = san
- }
-
- if mustStaple {
- template.ExtraExtensions = append(template.ExtraExtensions, pkix.Extension{
- Id: tlsFeatureExtensionOID,
- Value: ocspMustStapleFeature,
- })
- }
-
- return x509.CreateCertificateRequest(rand.Reader, &template, privateKey)
-}
-
-func pemEncode(data interface{}) []byte {
- var pemBlock *pem.Block
- switch key := data.(type) {
- case *ecdsa.PrivateKey:
- keyBytes, _ := x509.MarshalECPrivateKey(key)
- pemBlock = &pem.Block{Type: "EC PRIVATE KEY", Bytes: keyBytes}
- case *rsa.PrivateKey:
- pemBlock = &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(key)}
- break
- case *x509.CertificateRequest:
- pemBlock = &pem.Block{Type: "CERTIFICATE REQUEST", Bytes: key.Raw}
- break
- case derCertificateBytes:
- pemBlock = &pem.Block{Type: "CERTIFICATE", Bytes: []byte(data.(derCertificateBytes))}
- }
-
- return pem.EncodeToMemory(pemBlock)
-}
-
-func pemDecode(data []byte) (*pem.Block, error) {
- pemBlock, _ := pem.Decode(data)
- if pemBlock == nil {
- return nil, fmt.Errorf("Pem decode did not yield a valid block. Is the certificate in the right format?")
- }
-
- return pemBlock, nil
-}
-
-func pemDecodeTox509(pem []byte) (*x509.Certificate, error) {
- pemBlock, err := pemDecode(pem)
- if pemBlock == nil {
- return nil, err
- }
-
- return x509.ParseCertificate(pemBlock.Bytes)
-}
-
-func pemDecodeTox509CSR(pem []byte) (*x509.CertificateRequest, error) {
- pemBlock, err := pemDecode(pem)
- if pemBlock == nil {
- return nil, err
- }
-
- if pemBlock.Type != "CERTIFICATE REQUEST" {
- return nil, fmt.Errorf("PEM block is not a certificate request")
- }
-
- return x509.ParseCertificateRequest(pemBlock.Bytes)
-}
-
-// GetPEMCertExpiration returns the "NotAfter" date of a PEM encoded certificate.
-// The certificate has to be PEM encoded. Any other encodings like DER will fail.
-func GetPEMCertExpiration(cert []byte) (time.Time, error) {
- pemBlock, err := pemDecode(cert)
- if pemBlock == nil {
- return time.Time{}, err
- }
-
- return getCertExpiration(pemBlock.Bytes)
-}
-
-// getCertExpiration returns the "NotAfter" date of a DER encoded certificate.
-func getCertExpiration(cert []byte) (time.Time, error) {
- pCert, err := x509.ParseCertificate(cert)
- if err != nil {
- return time.Time{}, err
- }
-
- return pCert.NotAfter, nil
-}
-
-func generatePemCert(privKey *rsa.PrivateKey, domain string) ([]byte, error) {
- derBytes, err := generateDerCert(privKey, time.Time{}, domain)
- if err != nil {
- return nil, err
- }
-
- return pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: derBytes}), nil
-}
-
-func generateDerCert(privKey *rsa.PrivateKey, expiration time.Time, domain string) ([]byte, error) {
- serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
- serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
- if err != nil {
- return nil, err
- }
-
- if expiration.IsZero() {
- expiration = time.Now().Add(365)
- }
-
- template := x509.Certificate{
- SerialNumber: serialNumber,
- Subject: pkix.Name{
- CommonName: "ACME Challenge TEMP",
- },
- NotBefore: time.Now(),
- NotAfter: expiration,
-
- KeyUsage: x509.KeyUsageKeyEncipherment,
- BasicConstraintsValid: true,
- DNSNames: []string{domain},
- }
-
- return x509.CreateCertificate(rand.Reader, &template, &template, &privKey.PublicKey, privKey)
-}
-
-func limitReader(rd io.ReadCloser, numBytes int64) io.ReadCloser {
- return http.MaxBytesReader(nil, rd, numBytes)
-}
diff --git a/vendor/github.com/xenolf/lego/acme/dns_challenge.go b/vendor/github.com/xenolf/lego/acme/dns_challenge.go
deleted file mode 100644
index d6844dcd4..000000000
--- a/vendor/github.com/xenolf/lego/acme/dns_challenge.go
+++ /dev/null
@@ -1,309 +0,0 @@
-package acme
-
-import (
- "crypto/sha256"
- "encoding/base64"
- "errors"
- "fmt"
- "log"
- "net"
- "strings"
- "time"
-
- "github.com/miekg/dns"
-)
-
-type preCheckDNSFunc func(fqdn, value string) (bool, error)
-
-var (
- // PreCheckDNS checks DNS propagation before notifying ACME that
- // the DNS challenge is ready.
- PreCheckDNS preCheckDNSFunc = checkDNSPropagation
- fqdnToZone = map[string]string{}
-)
-
-const defaultResolvConf = "/etc/resolv.conf"
-
-var defaultNameservers = []string{
- "google-public-dns-a.google.com:53",
- "google-public-dns-b.google.com:53",
-}
-
-var RecursiveNameservers = getNameservers(defaultResolvConf, defaultNameservers)
-
-// DNSTimeout is used to override the default DNS timeout of 10 seconds.
-var DNSTimeout = 10 * time.Second
-
-// getNameservers attempts to get systems nameservers before falling back to the defaults
-func getNameservers(path string, defaults []string) []string {
- config, err := dns.ClientConfigFromFile(path)
- if err != nil || len(config.Servers) == 0 {
- return defaults
- }
-
- systemNameservers := []string{}
- for _, server := range config.Servers {
- // ensure all servers have a port number
- if _, _, err := net.SplitHostPort(server); err != nil {
- systemNameservers = append(systemNameservers, net.JoinHostPort(server, "53"))
- } else {
- systemNameservers = append(systemNameservers, server)
- }
- }
- return systemNameservers
-}
-
-// DNS01Record returns a DNS record which will fulfill the `dns-01` challenge
-func DNS01Record(domain, keyAuth string) (fqdn string, value string, ttl int) {
- keyAuthShaBytes := sha256.Sum256([]byte(keyAuth))
- // base64URL encoding without padding
- keyAuthSha := base64.URLEncoding.EncodeToString(keyAuthShaBytes[:sha256.Size])
- value = strings.TrimRight(keyAuthSha, "=")
- ttl = 120
- fqdn = fmt.Sprintf("_acme-challenge.%s.", domain)
- return
-}
-
-// dnsChallenge implements the dns-01 challenge according to ACME 7.5
-type dnsChallenge struct {
- jws *jws
- validate validateFunc
- provider ChallengeProvider
-}
-
-func (s *dnsChallenge) Solve(chlng challenge, domain string) error {
- logf("[INFO][%s] acme: Trying to solve DNS-01", domain)
-
- if s.provider == nil {
- return errors.New("No DNS Provider configured")
- }
-
- // Generate the Key Authorization for the challenge
- keyAuth, err := getKeyAuthorization(chlng.Token, s.jws.privKey)
- if err != nil {
- return err
- }
-
- err = s.provider.Present(domain, chlng.Token, keyAuth)
- if err != nil {
- return fmt.Errorf("Error presenting token: %s", err)
- }
- defer func() {
- err := s.provider.CleanUp(domain, chlng.Token, keyAuth)
- if err != nil {
- log.Printf("Error cleaning up %s: %v ", domain, err)
- }
- }()
-
- fqdn, value, _ := DNS01Record(domain, keyAuth)
-
- logf("[INFO][%s] Checking DNS record propagation using %+v", domain, RecursiveNameservers)
-
- var timeout, interval time.Duration
- switch provider := s.provider.(type) {
- case ChallengeProviderTimeout:
- timeout, interval = provider.Timeout()
- default:
- timeout, interval = 60*time.Second, 2*time.Second
- }
-
- err = WaitFor(timeout, interval, func() (bool, error) {
- return PreCheckDNS(fqdn, value)
- })
- if err != nil {
- return err
- }
-
- return s.validate(s.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth})
-}
-
-// checkDNSPropagation checks if the expected TXT record has been propagated to all authoritative nameservers.
-func checkDNSPropagation(fqdn, value string) (bool, error) {
- // Initial attempt to resolve at the recursive NS
- r, err := dnsQuery(fqdn, dns.TypeTXT, RecursiveNameservers, true)
- if err != nil {
- return false, err
- }
- if r.Rcode == dns.RcodeSuccess {
- // If we see a CNAME here then use the alias
- for _, rr := range r.Answer {
- if cn, ok := rr.(*dns.CNAME); ok {
- if cn.Hdr.Name == fqdn {
- fqdn = cn.Target
- break
- }
- }
- }
- }
-
- authoritativeNss, err := lookupNameservers(fqdn)
- if err != nil {
- return false, err
- }
-
- return checkAuthoritativeNss(fqdn, value, authoritativeNss)
-}
-
-// checkAuthoritativeNss queries each of the given nameservers for the expected TXT record.
-func checkAuthoritativeNss(fqdn, value string, nameservers []string) (bool, error) {
- for _, ns := range nameservers {
- r, err := dnsQuery(fqdn, dns.TypeTXT, []string{net.JoinHostPort(ns, "53")}, false)
- if err != nil {
- return false, err
- }
-
- if r.Rcode != dns.RcodeSuccess {
- return false, fmt.Errorf("NS %s returned %s for %s", ns, dns.RcodeToString[r.Rcode], fqdn)
- }
-
- var found bool
- for _, rr := range r.Answer {
- if txt, ok := rr.(*dns.TXT); ok {
- if strings.Join(txt.Txt, "") == value {
- found = true
- break
- }
- }
- }
-
- if !found {
- return false, fmt.Errorf("NS %s did not return the expected TXT record", ns)
- }
- }
-
- return true, nil
-}
-
-// dnsQuery will query a nameserver, iterating through the supplied servers as it retries
-// The nameserver should include a port, to facilitate testing where we talk to a mock dns server.
-func dnsQuery(fqdn string, rtype uint16, nameservers []string, recursive bool) (in *dns.Msg, err error) {
- m := new(dns.Msg)
- m.SetQuestion(fqdn, rtype)
- m.SetEdns0(4096, false)
-
- if !recursive {
- m.RecursionDesired = false
- }
-
- // Will retry the request based on the number of servers (n+1)
- for i := 1; i <= len(nameservers)+1; i++ {
- ns := nameservers[i%len(nameservers)]
- udp := &dns.Client{Net: "udp", Timeout: DNSTimeout}
- in, _, err = udp.Exchange(m, ns)
-
- if err == dns.ErrTruncated {
- tcp := &dns.Client{Net: "tcp", Timeout: DNSTimeout}
- // If the TCP request succeeds, the err will reset to nil
- in, _, err = tcp.Exchange(m, ns)
- }
-
- if err == nil {
- break
- }
- }
- return
-}
-
-// lookupNameservers returns the authoritative nameservers for the given fqdn.
-func lookupNameservers(fqdn string) ([]string, error) {
- var authoritativeNss []string
-
- zone, err := FindZoneByFqdn(fqdn, RecursiveNameservers)
- if err != nil {
- return nil, fmt.Errorf("Could not determine the zone: %v", err)
- }
-
- r, err := dnsQuery(zone, dns.TypeNS, RecursiveNameservers, true)
- if err != nil {
- return nil, err
- }
-
- for _, rr := range r.Answer {
- if ns, ok := rr.(*dns.NS); ok {
- authoritativeNss = append(authoritativeNss, strings.ToLower(ns.Ns))
- }
- }
-
- if len(authoritativeNss) > 0 {
- return authoritativeNss, nil
- }
- return nil, fmt.Errorf("Could not determine authoritative nameservers")
-}
-
-// FindZoneByFqdn determines the zone apex for the given fqdn by recursing up the
-// domain labels until the nameserver returns a SOA record in the answer section.
-func FindZoneByFqdn(fqdn string, nameservers []string) (string, error) {
- // Do we have it cached?
- if zone, ok := fqdnToZone[fqdn]; ok {
- return zone, nil
- }
-
- labelIndexes := dns.Split(fqdn)
- for _, index := range labelIndexes {
- domain := fqdn[index:]
-
- in, err := dnsQuery(domain, dns.TypeSOA, nameservers, true)
- if err != nil {
- return "", err
- }
-
- // Any response code other than NOERROR and NXDOMAIN is treated as error
- if in.Rcode != dns.RcodeNameError && in.Rcode != dns.RcodeSuccess {
- return "", fmt.Errorf("Unexpected response code '%s' for %s",
- dns.RcodeToString[in.Rcode], domain)
- }
-
- // Check if we got a SOA RR in the answer section
- if in.Rcode == dns.RcodeSuccess {
-
- // CNAME records cannot/should not exist at the root of a zone.
- // So we skip a domain when a CNAME is found.
- if dnsMsgContainsCNAME(in) {
- continue
- }
-
- for _, ans := range in.Answer {
- if soa, ok := ans.(*dns.SOA); ok {
- zone := soa.Hdr.Name
- fqdnToZone[fqdn] = zone
- return zone, nil
- }
- }
- }
- }
-
- return "", fmt.Errorf("Could not find the start of authority")
-}
-
-// dnsMsgContainsCNAME checks for a CNAME answer in msg
-func dnsMsgContainsCNAME(msg *dns.Msg) bool {
- for _, ans := range msg.Answer {
- if _, ok := ans.(*dns.CNAME); ok {
- return true
- }
- }
- return false
-}
-
-// ClearFqdnCache clears the cache of fqdn to zone mappings. Primarily used in testing.
-func ClearFqdnCache() {
- fqdnToZone = map[string]string{}
-}
-
-// ToFqdn converts the name into a fqdn appending a trailing dot.
-func ToFqdn(name string) string {
- n := len(name)
- if n == 0 || name[n-1] == '.' {
- return name
- }
- return name + "."
-}
-
-// UnFqdn converts the fqdn into a name removing the trailing dot.
-func UnFqdn(name string) string {
- n := len(name)
- if n != 0 && name[n-1] == '.' {
- return name[:n-1]
- }
- return name
-}
diff --git a/vendor/github.com/xenolf/lego/acme/dns_challenge_manual.go b/vendor/github.com/xenolf/lego/acme/dns_challenge_manual.go
deleted file mode 100644
index 240384e60..000000000
--- a/vendor/github.com/xenolf/lego/acme/dns_challenge_manual.go
+++ /dev/null
@@ -1,53 +0,0 @@
-package acme
-
-import (
- "bufio"
- "fmt"
- "os"
-)
-
-const (
- dnsTemplate = "%s %d IN TXT \"%s\""
-)
-
-// DNSProviderManual is an implementation of the ChallengeProvider interface
-type DNSProviderManual struct{}
-
-// NewDNSProviderManual returns a DNSProviderManual instance.
-func NewDNSProviderManual() (*DNSProviderManual, error) {
- return &DNSProviderManual{}, nil
-}
-
-// Present prints instructions for manually creating the TXT record
-func (*DNSProviderManual) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := DNS01Record(domain, keyAuth)
- dnsRecord := fmt.Sprintf(dnsTemplate, fqdn, ttl, value)
-
- authZone, err := FindZoneByFqdn(fqdn, RecursiveNameservers)
- if err != nil {
- return err
- }
-
- logf("[INFO] acme: Please create the following TXT record in your %s zone:", authZone)
- logf("[INFO] acme: %s", dnsRecord)
- logf("[INFO] acme: Press 'Enter' when you are done")
-
- reader := bufio.NewReader(os.Stdin)
- _, _ = reader.ReadString('\n')
- return nil
-}
-
-// CleanUp prints instructions for manually removing the TXT record
-func (*DNSProviderManual) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, ttl := DNS01Record(domain, keyAuth)
- dnsRecord := fmt.Sprintf(dnsTemplate, fqdn, ttl, "...")
-
- authZone, err := FindZoneByFqdn(fqdn, RecursiveNameservers)
- if err != nil {
- return err
- }
-
- logf("[INFO] acme: You can now remove this TXT record from your %s zone:", authZone)
- logf("[INFO] acme: %s", dnsRecord)
- return nil
-}
diff --git a/vendor/github.com/xenolf/lego/acme/error.go b/vendor/github.com/xenolf/lego/acme/error.go
deleted file mode 100644
index e4bc934c2..000000000
--- a/vendor/github.com/xenolf/lego/acme/error.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package acme
-
-import (
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
- "strings"
-)
-
-const (
- tosAgreementError = "Must agree to subscriber agreement before any further actions"
- invalidNonceError = "JWS has invalid anti-replay nonce"
-)
-
-// RemoteError is the base type for all errors specific to the ACME protocol.
-type RemoteError struct {
- StatusCode int `json:"status,omitempty"`
- Type string `json:"type"`
- Detail string `json:"detail"`
-}
-
-func (e RemoteError) Error() string {
- return fmt.Sprintf("acme: Error %d - %s - %s", e.StatusCode, e.Type, e.Detail)
-}
-
-// TOSError represents the error which is returned if the user needs to
-// accept the TOS.
-// TODO: include the new TOS url if we can somehow obtain it.
-type TOSError struct {
- RemoteError
-}
-
-// NonceError represents the error which is returned if the
-// nonce sent by the client was not accepted by the server.
-type NonceError struct {
- RemoteError
-}
-
-type domainError struct {
- Domain string
- Error error
-}
-
-type challengeError struct {
- RemoteError
- records []validationRecord
-}
-
-func (c challengeError) Error() string {
-
- var errStr string
- for _, validation := range c.records {
- errStr = errStr + fmt.Sprintf("\tValidation for %s:%s\n\tResolved to:\n\t\t%s\n\tUsed: %s\n\n",
- validation.Hostname, validation.Port, strings.Join(validation.ResolvedAddresses, "\n\t\t"), validation.UsedAddress)
- }
-
- return fmt.Sprintf("%s\nError Detail:\n%s", c.RemoteError.Error(), errStr)
-}
-
-func handleHTTPError(resp *http.Response) error {
- var errorDetail RemoteError
-
- contentType := resp.Header.Get("Content-Type")
- if contentType == "application/json" || contentType == "application/problem+json" {
- err := json.NewDecoder(resp.Body).Decode(&errorDetail)
- if err != nil {
- return err
- }
- } else {
- detailBytes, err := ioutil.ReadAll(limitReader(resp.Body, maxBodySize))
- if err != nil {
- return err
- }
- errorDetail.Detail = string(detailBytes)
- }
-
- errorDetail.StatusCode = resp.StatusCode
-
- // Check for errors we handle specifically
- if errorDetail.StatusCode == http.StatusForbidden && errorDetail.Detail == tosAgreementError {
- return TOSError{errorDetail}
- }
-
- if errorDetail.StatusCode == http.StatusBadRequest && strings.HasPrefix(errorDetail.Detail, invalidNonceError) {
- return NonceError{errorDetail}
- }
-
- return errorDetail
-}
-
-func handleChallengeError(chlng challenge) error {
- return challengeError{chlng.Error, chlng.ValidationRecords}
-}
diff --git a/vendor/github.com/xenolf/lego/acme/http.go b/vendor/github.com/xenolf/lego/acme/http.go
deleted file mode 100644
index e469e0de2..000000000
--- a/vendor/github.com/xenolf/lego/acme/http.go
+++ /dev/null
@@ -1,160 +0,0 @@
-package acme
-
-import (
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "net"
- "net/http"
- "runtime"
- "strings"
- "time"
-)
-
-// UserAgent (if non-empty) will be tacked onto the User-Agent string in requests.
-var UserAgent string
-
-// HTTPClient is an HTTP client with a reasonable timeout value.
-var HTTPClient = http.Client{
- Transport: &http.Transport{
- Proxy: http.ProxyFromEnvironment,
- Dial: (&net.Dialer{
- Timeout: 30 * time.Second,
- KeepAlive: 30 * time.Second,
- }).Dial,
- TLSHandshakeTimeout: 15 * time.Second,
- ResponseHeaderTimeout: 15 * time.Second,
- ExpectContinueTimeout: 1 * time.Second,
- },
-}
-
-const (
- // defaultGoUserAgent is the Go HTTP package user agent string. Too
- // bad it isn't exported. If it changes, we should update it here, too.
- defaultGoUserAgent = "Go-http-client/1.1"
-
- // ourUserAgent is the User-Agent of this underlying library package.
- ourUserAgent = "xenolf-acme"
-)
-
-// httpHead performs a HEAD request with a proper User-Agent string.
-// The response body (resp.Body) is already closed when this function returns.
-func httpHead(url string) (resp *http.Response, err error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, fmt.Errorf("failed to head %q: %v", url, err)
- }
-
- req.Header.Set("User-Agent", userAgent())
-
- resp, err = HTTPClient.Do(req)
- if err != nil {
- return resp, fmt.Errorf("failed to do head %q: %v", url, err)
- }
- resp.Body.Close()
- return resp, err
-}
-
-// httpPost performs a POST request with a proper User-Agent string.
-// Callers should close resp.Body when done reading from it.
-func httpPost(url string, bodyType string, body io.Reader) (resp *http.Response, err error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, fmt.Errorf("failed to post %q: %v", url, err)
- }
- req.Header.Set("Content-Type", bodyType)
- req.Header.Set("User-Agent", userAgent())
-
- return HTTPClient.Do(req)
-}
-
-// httpGet performs a GET request with a proper User-Agent string.
-// Callers should close resp.Body when done reading from it.
-func httpGet(url string) (resp *http.Response, err error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, fmt.Errorf("failed to get %q: %v", url, err)
- }
- req.Header.Set("User-Agent", userAgent())
-
- return HTTPClient.Do(req)
-}
-
-// getJSON performs an HTTP GET request and parses the response body
-// as JSON, into the provided respBody object.
-func getJSON(uri string, respBody interface{}) (http.Header, error) {
- resp, err := httpGet(uri)
- if err != nil {
- return nil, fmt.Errorf("failed to get json %q: %v", uri, err)
- }
- defer resp.Body.Close()
-
- if resp.StatusCode >= http.StatusBadRequest {
- return resp.Header, handleHTTPError(resp)
- }
-
- return resp.Header, json.NewDecoder(resp.Body).Decode(respBody)
-}
-
-// postJSON performs an HTTP POST request and parses the response body
-// as JSON, into the provided respBody object.
-func postJSON(j *jws, uri string, reqBody, respBody interface{}) (http.Header, error) {
- jsonBytes, err := json.Marshal(reqBody)
- if err != nil {
- return nil, errors.New("Failed to marshal network message...")
- }
-
- resp, err := j.post(uri, jsonBytes)
- if err != nil {
- return nil, fmt.Errorf("Failed to post JWS message. -> %v", err)
- }
-
- defer resp.Body.Close()
-
- if resp.StatusCode >= http.StatusBadRequest {
-
- err := handleHTTPError(resp)
-
- switch err.(type) {
-
- case NonceError:
-
- // Retry once if the nonce was invalidated
-
- retryResp, err := j.post(uri, jsonBytes)
- if err != nil {
- return nil, fmt.Errorf("Failed to post JWS message. -> %v", err)
- }
-
- defer retryResp.Body.Close()
-
- if retryResp.StatusCode >= http.StatusBadRequest {
- return retryResp.Header, handleHTTPError(retryResp)
- }
-
- if respBody == nil {
- return retryResp.Header, nil
- }
-
- return retryResp.Header, json.NewDecoder(retryResp.Body).Decode(respBody)
-
- default:
- return resp.Header, err
-
- }
-
- }
-
- if respBody == nil {
- return resp.Header, nil
- }
-
- return resp.Header, json.NewDecoder(resp.Body).Decode(respBody)
-}
-
-// userAgent builds and returns the User-Agent string to use in requests.
-func userAgent() string {
- ua := fmt.Sprintf("%s (%s; %s) %s %s", defaultGoUserAgent, runtime.GOOS, runtime.GOARCH, ourUserAgent, UserAgent)
- return strings.TrimSpace(ua)
-}
diff --git a/vendor/github.com/xenolf/lego/acme/http_challenge.go b/vendor/github.com/xenolf/lego/acme/http_challenge.go
deleted file mode 100644
index 95cb1fd81..000000000
--- a/vendor/github.com/xenolf/lego/acme/http_challenge.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package acme
-
-import (
- "fmt"
- "log"
-)
-
-type httpChallenge struct {
- jws *jws
- validate validateFunc
- provider ChallengeProvider
-}
-
-// HTTP01ChallengePath returns the URL path for the `http-01` challenge
-func HTTP01ChallengePath(token string) string {
- return "/.well-known/acme-challenge/" + token
-}
-
-func (s *httpChallenge) Solve(chlng challenge, domain string) error {
-
- logf("[INFO][%s] acme: Trying to solve HTTP-01", domain)
-
- // Generate the Key Authorization for the challenge
- keyAuth, err := getKeyAuthorization(chlng.Token, s.jws.privKey)
- if err != nil {
- return err
- }
-
- err = s.provider.Present(domain, chlng.Token, keyAuth)
- if err != nil {
- return fmt.Errorf("[%s] error presenting token: %v", domain, err)
- }
- defer func() {
- err := s.provider.CleanUp(domain, chlng.Token, keyAuth)
- if err != nil {
- log.Printf("[%s] error cleaning up: %v", domain, err)
- }
- }()
-
- return s.validate(s.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth})
-}
diff --git a/vendor/github.com/xenolf/lego/acme/http_challenge_server.go b/vendor/github.com/xenolf/lego/acme/http_challenge_server.go
deleted file mode 100644
index 64c6a8280..000000000
--- a/vendor/github.com/xenolf/lego/acme/http_challenge_server.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package acme
-
-import (
- "fmt"
- "net"
- "net/http"
- "strings"
-)
-
-// HTTPProviderServer implements ChallengeProvider for `http-01` challenge
-// It may be instantiated without using the NewHTTPProviderServer function if
-// you want only to use the default values.
-type HTTPProviderServer struct {
- iface string
- port string
- done chan bool
- listener net.Listener
-}
-
-// NewHTTPProviderServer creates a new HTTPProviderServer on the selected interface and port.
-// Setting iface and / or port to an empty string will make the server fall back to
-// the "any" interface and port 80 respectively.
-func NewHTTPProviderServer(iface, port string) *HTTPProviderServer {
- return &HTTPProviderServer{iface: iface, port: port}
-}
-
-// Present starts a web server and makes the token available at `HTTP01ChallengePath(token)` for web requests.
-func (s *HTTPProviderServer) Present(domain, token, keyAuth string) error {
- if s.port == "" {
- s.port = "80"
- }
-
- var err error
- s.listener, err = net.Listen("tcp", net.JoinHostPort(s.iface, s.port))
- if err != nil {
- return fmt.Errorf("Could not start HTTP server for challenge -> %v", err)
- }
-
- s.done = make(chan bool)
- go s.serve(domain, token, keyAuth)
- return nil
-}
-
-// CleanUp closes the HTTP server and removes the token from `HTTP01ChallengePath(token)`
-func (s *HTTPProviderServer) CleanUp(domain, token, keyAuth string) error {
- if s.listener == nil {
- return nil
- }
- s.listener.Close()
- <-s.done
- return nil
-}
-
-func (s *HTTPProviderServer) serve(domain, token, keyAuth string) {
- path := HTTP01ChallengePath(token)
-
- // The handler validates the HOST header and request type.
- // For validation it then writes the token the server returned with the challenge
- mux := http.NewServeMux()
- mux.HandleFunc(path, func(w http.ResponseWriter, r *http.Request) {
- if strings.HasPrefix(r.Host, domain) && r.Method == "GET" {
- w.Header().Add("Content-Type", "text/plain")
- w.Write([]byte(keyAuth))
- logf("[INFO][%s] Served key authentication", domain)
- } else {
- logf("[WARN] Received request for domain %s with method %s but the domain did not match any challenge. Please ensure your are passing the HOST header properly.", r.Host, r.Method)
- w.Write([]byte("TEST"))
- }
- })
-
- httpServer := &http.Server{
- Handler: mux,
- }
- // Once httpServer is shut down we don't want any lingering
- // connections, so disable KeepAlives.
- httpServer.SetKeepAlivesEnabled(false)
- httpServer.Serve(s.listener)
- s.done <- true
-}
diff --git a/vendor/github.com/xenolf/lego/acme/jws.go b/vendor/github.com/xenolf/lego/acme/jws.go
deleted file mode 100644
index a39434342..000000000
--- a/vendor/github.com/xenolf/lego/acme/jws.go
+++ /dev/null
@@ -1,131 +0,0 @@
-package acme
-
-import (
- "bytes"
- "crypto"
- "crypto/ecdsa"
- "crypto/elliptic"
- "crypto/rsa"
- "fmt"
- "net/http"
- "sync"
-
- "gopkg.in/square/go-jose.v1"
-)
-
-type jws struct {
- directoryURL string
- privKey crypto.PrivateKey
- nonces nonceManager
-}
-
-func keyAsJWK(key interface{}) *jose.JsonWebKey {
- switch k := key.(type) {
- case *ecdsa.PublicKey:
- return &jose.JsonWebKey{Key: k, Algorithm: "EC"}
- case *rsa.PublicKey:
- return &jose.JsonWebKey{Key: k, Algorithm: "RSA"}
-
- default:
- return nil
- }
-}
-
-// Posts a JWS signed message to the specified URL.
-// It does NOT close the response body, so the caller must
-// do that if no error was returned.
-func (j *jws) post(url string, content []byte) (*http.Response, error) {
- signedContent, err := j.signContent(content)
- if err != nil {
- return nil, fmt.Errorf("Failed to sign content -> %s", err.Error())
- }
-
- resp, err := httpPost(url, "application/jose+json", bytes.NewBuffer([]byte(signedContent.FullSerialize())))
- if err != nil {
- return nil, fmt.Errorf("Failed to HTTP POST to %s -> %s", url, err.Error())
- }
-
- nonce, nonceErr := getNonceFromResponse(resp)
- if nonceErr == nil {
- j.nonces.Push(nonce)
- }
-
- return resp, nil
-}
-
-func (j *jws) signContent(content []byte) (*jose.JsonWebSignature, error) {
-
- var alg jose.SignatureAlgorithm
- switch k := j.privKey.(type) {
- case *rsa.PrivateKey:
- alg = jose.RS256
- case *ecdsa.PrivateKey:
- if k.Curve == elliptic.P256() {
- alg = jose.ES256
- } else if k.Curve == elliptic.P384() {
- alg = jose.ES384
- }
- }
-
- signer, err := jose.NewSigner(alg, j.privKey)
- if err != nil {
- return nil, fmt.Errorf("Failed to create jose signer -> %s", err.Error())
- }
- signer.SetNonceSource(j)
-
- signed, err := signer.Sign(content)
- if err != nil {
- return nil, fmt.Errorf("Failed to sign content -> %s", err.Error())
- }
- return signed, nil
-}
-
-func (j *jws) Nonce() (string, error) {
- if nonce, ok := j.nonces.Pop(); ok {
- return nonce, nil
- }
-
- return getNonce(j.directoryURL)
-}
-
-type nonceManager struct {
- nonces []string
- sync.Mutex
-}
-
-func (n *nonceManager) Pop() (string, bool) {
- n.Lock()
- defer n.Unlock()
-
- if len(n.nonces) == 0 {
- return "", false
- }
-
- nonce := n.nonces[len(n.nonces)-1]
- n.nonces = n.nonces[:len(n.nonces)-1]
- return nonce, true
-}
-
-func (n *nonceManager) Push(nonce string) {
- n.Lock()
- defer n.Unlock()
- n.nonces = append(n.nonces, nonce)
-}
-
-func getNonce(url string) (string, error) {
- resp, err := httpHead(url)
- if err != nil {
- return "", fmt.Errorf("Failed to get nonce from HTTP HEAD -> %s", err.Error())
- }
-
- return getNonceFromResponse(resp)
-}
-
-func getNonceFromResponse(resp *http.Response) (string, error) {
- nonce := resp.Header.Get("Replay-Nonce")
- if nonce == "" {
- return "", fmt.Errorf("Server did not respond with a proper nonce header.")
- }
-
- return nonce, nil
-}
diff --git a/vendor/github.com/xenolf/lego/acme/messages.go b/vendor/github.com/xenolf/lego/acme/messages.go
deleted file mode 100644
index 79ccf154e..000000000
--- a/vendor/github.com/xenolf/lego/acme/messages.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package acme
-
-import (
- "time"
-
- "gopkg.in/square/go-jose.v1"
-)
-
-type directory struct {
- NewAuthzURL string `json:"new-authz"`
- NewCertURL string `json:"new-cert"`
- NewRegURL string `json:"new-reg"`
- RevokeCertURL string `json:"revoke-cert"`
-}
-
-type registrationMessage struct {
- Resource string `json:"resource"`
- Contact []string `json:"contact"`
- Delete bool `json:"delete,omitempty"`
-}
-
-// Registration is returned by the ACME server after the registration
-// The client implementation should save this registration somewhere.
-type Registration struct {
- Resource string `json:"resource,omitempty"`
- ID int `json:"id"`
- Key jose.JsonWebKey `json:"key"`
- Contact []string `json:"contact"`
- Agreement string `json:"agreement,omitempty"`
- Authorizations string `json:"authorizations,omitempty"`
- Certificates string `json:"certificates,omitempty"`
-}
-
-// RegistrationResource represents all important informations about a registration
-// of which the client needs to keep track itself.
-type RegistrationResource struct {
- Body Registration `json:"body,omitempty"`
- URI string `json:"uri,omitempty"`
- NewAuthzURL string `json:"new_authzr_uri,omitempty"`
- TosURL string `json:"terms_of_service,omitempty"`
-}
-
-type authorizationResource struct {
- Body authorization
- Domain string
- NewCertURL string
- AuthURL string
-}
-
-type authorization struct {
- Resource string `json:"resource,omitempty"`
- Identifier identifier `json:"identifier"`
- Status string `json:"status,omitempty"`
- Expires time.Time `json:"expires,omitempty"`
- Challenges []challenge `json:"challenges,omitempty"`
- Combinations [][]int `json:"combinations,omitempty"`
-}
-
-type identifier struct {
- Type string `json:"type"`
- Value string `json:"value"`
-}
-
-type validationRecord struct {
- URI string `json:"url,omitempty"`
- Hostname string `json:"hostname,omitempty"`
- Port string `json:"port,omitempty"`
- ResolvedAddresses []string `json:"addressesResolved,omitempty"`
- UsedAddress string `json:"addressUsed,omitempty"`
-}
-
-type challenge struct {
- Resource string `json:"resource,omitempty"`
- Type Challenge `json:"type,omitempty"`
- Status string `json:"status,omitempty"`
- URI string `json:"uri,omitempty"`
- Token string `json:"token,omitempty"`
- KeyAuthorization string `json:"keyAuthorization,omitempty"`
- TLS bool `json:"tls,omitempty"`
- Iterations int `json:"n,omitempty"`
- Error RemoteError `json:"error,omitempty"`
- ValidationRecords []validationRecord `json:"validationRecord,omitempty"`
-}
-
-type csrMessage struct {
- Resource string `json:"resource,omitempty"`
- Csr string `json:"csr"`
- Authorizations []string `json:"authorizations"`
-}
-
-type revokeCertMessage struct {
- Resource string `json:"resource"`
- Certificate string `json:"certificate"`
-}
-
-type deactivateAuthMessage struct {
- Resource string `json:"resource,omitempty"`
- Status string `jsom:"status"`
-}
-
-// CertificateResource represents a CA issued certificate.
-// PrivateKey, Certificate and IssuerCertificate are all
-// already PEM encoded and can be directly written to disk.
-// Certificate may be a certificate bundle, depending on the
-// options supplied to create it.
-type CertificateResource struct {
- Domain string `json:"domain"`
- CertURL string `json:"certUrl"`
- CertStableURL string `json:"certStableUrl"`
- AccountRef string `json:"accountRef,omitempty"`
- PrivateKey []byte `json:"-"`
- Certificate []byte `json:"-"`
- IssuerCertificate []byte `json:"-"`
- CSR []byte `json:"-"`
-}
diff --git a/vendor/github.com/xenolf/lego/acme/pop_challenge.go b/vendor/github.com/xenolf/lego/acme/pop_challenge.go
deleted file mode 100644
index 8d2a213b0..000000000
--- a/vendor/github.com/xenolf/lego/acme/pop_challenge.go
+++ /dev/null
@@ -1 +0,0 @@
-package acme
diff --git a/vendor/github.com/xenolf/lego/acme/provider.go b/vendor/github.com/xenolf/lego/acme/provider.go
deleted file mode 100644
index d177ff07a..000000000
--- a/vendor/github.com/xenolf/lego/acme/provider.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package acme
-
-import "time"
-
-// ChallengeProvider enables implementing a custom challenge
-// provider. Present presents the solution to a challenge available to
-// be solved. CleanUp will be called by the challenge if Present ends
-// in a non-error state.
-type ChallengeProvider interface {
- Present(domain, token, keyAuth string) error
- CleanUp(domain, token, keyAuth string) error
-}
-
-// ChallengeProviderTimeout allows for implementing a
-// ChallengeProvider where an unusually long timeout is required when
-// waiting for an ACME challenge to be satisfied, such as when
-// checking for DNS record progagation. If an implementor of a
-// ChallengeProvider provides a Timeout method, then the return values
-// of the Timeout method will be used when appropriate by the acme
-// package. The interval value is the time between checks.
-//
-// The default values used for timeout and interval are 60 seconds and
-// 2 seconds respectively. These are used when no Timeout method is
-// defined for the ChallengeProvider.
-type ChallengeProviderTimeout interface {
- ChallengeProvider
- Timeout() (timeout, interval time.Duration)
-}
diff --git a/vendor/github.com/xenolf/lego/acme/tls_sni_challenge.go b/vendor/github.com/xenolf/lego/acme/tls_sni_challenge.go
deleted file mode 100644
index 34383cbfa..000000000
--- a/vendor/github.com/xenolf/lego/acme/tls_sni_challenge.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package acme
-
-import (
- "crypto/rsa"
- "crypto/sha256"
- "crypto/tls"
- "encoding/hex"
- "fmt"
- "log"
-)
-
-type tlsSNIChallenge struct {
- jws *jws
- validate validateFunc
- provider ChallengeProvider
-}
-
-func (t *tlsSNIChallenge) Solve(chlng challenge, domain string) error {
- // FIXME: https://github.com/ietf-wg-acme/acme/pull/22
- // Currently we implement this challenge to track boulder, not the current spec!
-
- logf("[INFO][%s] acme: Trying to solve TLS-SNI-01", domain)
-
- // Generate the Key Authorization for the challenge
- keyAuth, err := getKeyAuthorization(chlng.Token, t.jws.privKey)
- if err != nil {
- return err
- }
-
- err = t.provider.Present(domain, chlng.Token, keyAuth)
- if err != nil {
- return fmt.Errorf("[%s] error presenting token: %v", domain, err)
- }
- defer func() {
- err := t.provider.CleanUp(domain, chlng.Token, keyAuth)
- if err != nil {
- log.Printf("[%s] error cleaning up: %v", domain, err)
- }
- }()
- return t.validate(t.jws, domain, chlng.URI, challenge{Resource: "challenge", Type: chlng.Type, Token: chlng.Token, KeyAuthorization: keyAuth})
-}
-
-// TLSSNI01ChallengeCert returns a certificate and target domain for the `tls-sni-01` challenge
-func TLSSNI01ChallengeCert(keyAuth string) (tls.Certificate, string, error) {
- // generate a new RSA key for the certificates
- tempPrivKey, err := generatePrivateKey(RSA2048)
- if err != nil {
- return tls.Certificate{}, "", err
- }
- rsaPrivKey := tempPrivKey.(*rsa.PrivateKey)
- rsaPrivPEM := pemEncode(rsaPrivKey)
-
- zBytes := sha256.Sum256([]byte(keyAuth))
- z := hex.EncodeToString(zBytes[:sha256.Size])
- domain := fmt.Sprintf("%s.%s.acme.invalid", z[:32], z[32:])
- tempCertPEM, err := generatePemCert(rsaPrivKey, domain)
- if err != nil {
- return tls.Certificate{}, "", err
- }
-
- certificate, err := tls.X509KeyPair(tempCertPEM, rsaPrivPEM)
- if err != nil {
- return tls.Certificate{}, "", err
- }
-
- return certificate, domain, nil
-}
diff --git a/vendor/github.com/xenolf/lego/acme/tls_sni_challenge_server.go b/vendor/github.com/xenolf/lego/acme/tls_sni_challenge_server.go
deleted file mode 100644
index df00fbb5a..000000000
--- a/vendor/github.com/xenolf/lego/acme/tls_sni_challenge_server.go
+++ /dev/null
@@ -1,62 +0,0 @@
-package acme
-
-import (
- "crypto/tls"
- "fmt"
- "net"
- "net/http"
-)
-
-// TLSProviderServer implements ChallengeProvider for `TLS-SNI-01` challenge
-// It may be instantiated without using the NewTLSProviderServer function if
-// you want only to use the default values.
-type TLSProviderServer struct {
- iface string
- port string
- done chan bool
- listener net.Listener
-}
-
-// NewTLSProviderServer creates a new TLSProviderServer on the selected interface and port.
-// Setting iface and / or port to an empty string will make the server fall back to
-// the "any" interface and port 443 respectively.
-func NewTLSProviderServer(iface, port string) *TLSProviderServer {
- return &TLSProviderServer{iface: iface, port: port}
-}
-
-// Present makes the keyAuth available as a cert
-func (s *TLSProviderServer) Present(domain, token, keyAuth string) error {
- if s.port == "" {
- s.port = "443"
- }
-
- cert, _, err := TLSSNI01ChallengeCert(keyAuth)
- if err != nil {
- return err
- }
-
- tlsConf := new(tls.Config)
- tlsConf.Certificates = []tls.Certificate{cert}
-
- s.listener, err = tls.Listen("tcp", net.JoinHostPort(s.iface, s.port), tlsConf)
- if err != nil {
- return fmt.Errorf("Could not start HTTPS server for challenge -> %v", err)
- }
-
- s.done = make(chan bool)
- go func() {
- http.Serve(s.listener, nil)
- s.done <- true
- }()
- return nil
-}
-
-// CleanUp closes the HTTP server.
-func (s *TLSProviderServer) CleanUp(domain, token, keyAuth string) error {
- if s.listener == nil {
- return nil
- }
- s.listener.Close()
- <-s.done
- return nil
-}
diff --git a/vendor/github.com/xenolf/lego/acme/utils.go b/vendor/github.com/xenolf/lego/acme/utils.go
deleted file mode 100644
index 2fa0db304..000000000
--- a/vendor/github.com/xenolf/lego/acme/utils.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package acme
-
-import (
- "fmt"
- "time"
-)
-
-// WaitFor polls the given function 'f', once every 'interval', up to 'timeout'.
-func WaitFor(timeout, interval time.Duration, f func() (bool, error)) error {
- var lastErr string
- timeup := time.After(timeout)
- for {
- select {
- case <-timeup:
- return fmt.Errorf("Time limit exceeded. Last error: %s", lastErr)
- default:
- }
-
- stop, err := f()
- if stop {
- return nil
- }
- if err != nil {
- lastErr = err.Error()
- }
-
- time.Sleep(interval)
- }
-}
diff --git a/vendor/github.com/xenolf/lego/acmev2/challenges.go b/vendor/github.com/xenolf/lego/acmev2/challenges.go
index cf7bd7f75..8fcc5bf87 100644
--- a/vendor/github.com/xenolf/lego/acmev2/challenges.go
+++ b/vendor/github.com/xenolf/lego/acmev2/challenges.go
@@ -1,13 +1,13 @@
-package acme
+package acmev2
// Challenge is a string that identifies a particular type and version of ACME challenge.
type Challenge string
const (
- // HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#http
+ // HTTP01 is the "http-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acmev2.md#http
// Note: HTTP01ChallengePath returns the URL path to fulfill this challenge
HTTP01 = Challenge("http-01")
- // DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acme.md#dns
+ // DNS01 is the "dns-01" ACME challenge https://github.com/ietf-wg-acme/acme/blob/master/draft-ietf-acme-acmev2.md#dns
// Note: DNS01Record returns a DNS record which will fulfill this challenge
DNS01 = Challenge("dns-01")
)
diff --git a/vendor/github.com/xenolf/lego/acmev2/client.go b/vendor/github.com/xenolf/lego/acmev2/client.go
index 40acdbc14..649c8d9cf 100644
--- a/vendor/github.com/xenolf/lego/acmev2/client.go
+++ b/vendor/github.com/xenolf/lego/acmev2/client.go
@@ -1,5 +1,5 @@
-// Package acme implements the ACME protocol for Let's Encrypt and other conforming providers.
-package acme
+// package acmev2 implements the ACME protocol for Let's Encrypt and other conforming providers.
+package acmev2
import (
"crypto"
@@ -482,6 +482,7 @@ func (c *Client) createOrderForIdentifiers(domains []string) (orderResource, err
orderRes := orderResource{
URL: hdr.Get("Location"),
+ Domains: domains,
orderMessage: response,
}
return orderRes, nil
@@ -590,7 +591,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr
}
// determine certificate name(s) based on the authorization resources
- commonName := order.Identifiers[0].Value
+ commonName := order.Domains[0]
var san []string
for _, auth := range order.Identifiers {
san = append(san, auth.Value)
@@ -606,12 +607,7 @@ func (c *Client) requestCertificateForOrder(order orderResource, bundle bool, pr
}
func (c *Client) requestCertificateForCsr(order orderResource, bundle bool, csr []byte, privateKeyPem []byte) (CertificateResource, error) {
- commonName := order.Identifiers[0].Value
-
- var authURLs []string
- for _, auth := range order.Identifiers[1:] {
- authURLs = append(authURLs, auth.Value)
- }
+ commonName := order.Domains[0]
csrString := base64.RawURLEncoding.EncodeToString(csr)
var retOrder orderMessage
diff --git a/vendor/github.com/xenolf/lego/acmev2/crypto.go b/vendor/github.com/xenolf/lego/acmev2/crypto.go
index e50ca30d8..8f299a65b 100644
--- a/vendor/github.com/xenolf/lego/acmev2/crypto.go
+++ b/vendor/github.com/xenolf/lego/acmev2/crypto.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"bytes"
diff --git a/vendor/github.com/xenolf/lego/acmev2/dns_challenge.go b/vendor/github.com/xenolf/lego/acmev2/dns_challenge.go
index d129dacc6..d57a4bd63 100644
--- a/vendor/github.com/xenolf/lego/acmev2/dns_challenge.go
+++ b/vendor/github.com/xenolf/lego/acmev2/dns_challenge.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"crypto/sha256"
diff --git a/vendor/github.com/xenolf/lego/acmev2/dns_challenge_manual.go b/vendor/github.com/xenolf/lego/acmev2/dns_challenge_manual.go
index 240384e60..85dd9ca88 100644
--- a/vendor/github.com/xenolf/lego/acmev2/dns_challenge_manual.go
+++ b/vendor/github.com/xenolf/lego/acmev2/dns_challenge_manual.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"bufio"
diff --git a/vendor/github.com/xenolf/lego/acmev2/error.go b/vendor/github.com/xenolf/lego/acmev2/error.go
index 650270b1e..15cbc02bb 100644
--- a/vendor/github.com/xenolf/lego/acmev2/error.go
+++ b/vendor/github.com/xenolf/lego/acmev2/error.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"encoding/json"
diff --git a/vendor/github.com/xenolf/lego/acmev2/http.go b/vendor/github.com/xenolf/lego/acmev2/http.go
index b93e53445..bc51a36db 100644
--- a/vendor/github.com/xenolf/lego/acmev2/http.go
+++ b/vendor/github.com/xenolf/lego/acmev2/http.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"encoding/json"
diff --git a/vendor/github.com/xenolf/lego/acmev2/http_challenge.go b/vendor/github.com/xenolf/lego/acmev2/http_challenge.go
index b6c969fe2..687297b94 100644
--- a/vendor/github.com/xenolf/lego/acmev2/http_challenge.go
+++ b/vendor/github.com/xenolf/lego/acmev2/http_challenge.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"fmt"
diff --git a/vendor/github.com/xenolf/lego/acmev2/http_challenge_server.go b/vendor/github.com/xenolf/lego/acmev2/http_challenge_server.go
index 64c6a8280..052d24050 100644
--- a/vendor/github.com/xenolf/lego/acmev2/http_challenge_server.go
+++ b/vendor/github.com/xenolf/lego/acmev2/http_challenge_server.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"fmt"
diff --git a/vendor/github.com/xenolf/lego/acmev2/jws.go b/vendor/github.com/xenolf/lego/acmev2/jws.go
index 9b87e437a..7ab8edb76 100644
--- a/vendor/github.com/xenolf/lego/acmev2/jws.go
+++ b/vendor/github.com/xenolf/lego/acmev2/jws.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"bytes"
diff --git a/vendor/github.com/xenolf/lego/acmev2/messages.go b/vendor/github.com/xenolf/lego/acmev2/messages.go
index 9981851d9..a3058dfb8 100644
--- a/vendor/github.com/xenolf/lego/acmev2/messages.go
+++ b/vendor/github.com/xenolf/lego/acmev2/messages.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"time"
@@ -34,7 +34,8 @@ type accountMessage struct {
}
type orderResource struct {
- URL string `json:"url,omitempty"`
+ URL string `json:"url,omitempty"`
+ Domains []string `json:"domains,omitempty"`
orderMessage `json:"body,omitempty"`
}
diff --git a/vendor/github.com/xenolf/lego/acmev2/pop_challenge.go b/vendor/github.com/xenolf/lego/acmev2/pop_challenge.go
index 8d2a213b0..f8f4e4e7c 100644
--- a/vendor/github.com/xenolf/lego/acmev2/pop_challenge.go
+++ b/vendor/github.com/xenolf/lego/acmev2/pop_challenge.go
@@ -1 +1 @@
-package acme
+package acmev2
diff --git a/vendor/github.com/xenolf/lego/acmev2/provider.go b/vendor/github.com/xenolf/lego/acmev2/provider.go
index d177ff07a..70fb525ab 100644
--- a/vendor/github.com/xenolf/lego/acmev2/provider.go
+++ b/vendor/github.com/xenolf/lego/acmev2/provider.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import "time"
diff --git a/vendor/github.com/xenolf/lego/acmev2/utils.go b/vendor/github.com/xenolf/lego/acmev2/utils.go
index 2fa0db304..86df09124 100644
--- a/vendor/github.com/xenolf/lego/acmev2/utils.go
+++ b/vendor/github.com/xenolf/lego/acmev2/utils.go
@@ -1,4 +1,4 @@
-package acme
+package acmev2
import (
"fmt"
diff --git a/vendor/github.com/xenolf/lego/providers/dns/auroradns/auroradns.go b/vendor/github.com/xenolf/lego/providers/dns/auroradns/auroradns.go
index 55b48f9b4..4acf0b386 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/auroradns/auroradns.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/auroradns/auroradns.go
@@ -2,12 +2,13 @@ package auroradns
import (
"fmt"
+ "os"
+ "sync"
+
"github.com/edeckers/auroradnsclient"
"github.com/edeckers/auroradnsclient/records"
"github.com/edeckers/auroradnsclient/zones"
- "github.com/xenolf/lego/acme"
- "os"
- "sync"
+ "github.com/xenolf/lego/acmev2"
)
// DNSProvider describes a provider for AuroraDNS
@@ -64,9 +65,9 @@ func (provider *DNSProvider) getZoneInformationByName(name string) (zones.ZoneRe
// Present creates a record with a secret
func (provider *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
@@ -80,7 +81,7 @@ func (provider *DNSProvider) Present(domain, token, keyAuth string) error {
subdomain := fqdn[0 : len(fqdn)-len(authZone)-1]
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
zoneRecord, err := provider.getZoneInformationByName(authZone)
@@ -106,7 +107,7 @@ func (provider *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes a given record that was generated by Present
func (provider *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
provider.recordIDsMu.Lock()
recordID, ok := provider.recordIDs[fqdn]
@@ -116,12 +117,12 @@ func (provider *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return fmt.Errorf("Unknown recordID for '%s'", fqdn)
}
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
zoneRecord, err := provider.getZoneInformationByName(authZone)
if err != nil {
diff --git a/vendor/github.com/xenolf/lego/providers/dns/azure/azure.go b/vendor/github.com/xenolf/lego/providers/dns/azure/azure.go
index 6a30b318a..c11ca8fc1 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/azure/azure.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/azure/azure.go
@@ -4,28 +4,29 @@
package azure
import (
+ "context"
"fmt"
"os"
+ "strings"
"time"
- "github.com/Azure/azure-sdk-for-go/arm/dns"
-
- "strings"
-
+ "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/adal"
"github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
type DNSProvider struct {
clientId string
clientSecret string
subscriptionId string
tenantId string
resourceGroup string
+
+ context context.Context
}
// NewDNSProvider returns a DNSProvider instance configured for azure.
@@ -53,6 +54,8 @@ func NewDNSProviderCredentials(clientId, clientSecret, subscriptionId, tenantId,
subscriptionId: subscriptionId,
tenantId: tenantId,
resourceGroup: resourceGroup,
+ // TODO: A timeout can be added here for cancellation purposes.
+ context: context.Background(),
}, nil
}
@@ -64,7 +67,7 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
// Present creates a TXT record to fulfil the dns-01 challenge
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -74,7 +77,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
spt, err := c.newServicePrincipalTokenFromCredentials(azure.PublicCloud.ResourceManagerEndpoint)
rsc.Authorizer = autorest.NewBearerAuthorizer(spt)
- relative := toRelativeRecord(fqdn, acme.ToFqdn(zone))
+ relative := toRelativeRecord(fqdn, acmev2.ToFqdn(zone))
rec := dns.RecordSet{
Name: &relative,
RecordSetProperties: &dns.RecordSetProperties{
@@ -82,7 +85,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
TxtRecords: &[]dns.TxtRecord{dns.TxtRecord{Value: &[]string{value}}},
},
}
- _, err = rsc.CreateOrUpdate(c.resourceGroup, zone, relative, dns.TXT, rec, "", "")
+ _, err = rsc.CreateOrUpdate(c.context, c.resourceGroup, zone, relative, dns.TXT, rec, "", "")
if err != nil {
return err
@@ -93,23 +96,23 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// Returns the relative record to the domain
func toRelativeRecord(domain, zone string) string {
- return acme.UnFqdn(strings.TrimSuffix(domain, zone))
+ return acmev2.UnFqdn(strings.TrimSuffix(domain, zone))
}
// CleanUp removes the TXT record matching the specified parameters
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
}
- relative := toRelativeRecord(fqdn, acme.ToFqdn(zone))
+ relative := toRelativeRecord(fqdn, acmev2.ToFqdn(zone))
rsc := dns.NewRecordSetsClient(c.subscriptionId)
spt, err := c.newServicePrincipalTokenFromCredentials(azure.PublicCloud.ResourceManagerEndpoint)
rsc.Authorizer = autorest.NewBearerAuthorizer(spt)
- _, err = rsc.Delete(c.resourceGroup, zone, relative, dns.TXT, "")
+ _, err = rsc.Delete(c.context, c.resourceGroup, zone, relative, dns.TXT, "")
if err != nil {
return err
}
@@ -119,7 +122,7 @@ func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
// Checks that azure has a zone for this domain name.
func (c *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
@@ -130,7 +133,7 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
dc := dns.NewZonesClient(c.subscriptionId)
dc.Authorizer = autorest.NewBearerAuthorizer(spt)
- zone, err := dc.Get(c.resourceGroup, acme.UnFqdn(authZone))
+ zone, err := dc.Get(c.context, c.resourceGroup, acmev2.UnFqdn(authZone))
if err != nil {
return "", err
diff --git a/vendor/github.com/xenolf/lego/providers/dns/bluecat/bluecat.go b/vendor/github.com/xenolf/lego/providers/dns/bluecat/bluecat.go
new file mode 100644
index 000000000..2bb02230e
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/bluecat/bluecat.go
@@ -0,0 +1,419 @@
+// Package bluecat implements a DNS provider for solving the DNS-01 challenge
+// using a self-hosted Bluecat Address Manager.
+package bluecat
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "os"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+
+ "io/ioutil"
+
+ "github.com/xenolf/lego/acmev2"
+)
+
+const bluecatUrlTemplate = "%s/Services/REST/v1"
+const configType = "Configuration"
+const viewType = "View"
+const txtType = "TXTRecord"
+const zoneType = "Zone"
+
+type entityResponse struct {
+ Id uint `json:"id"`
+ Name string `json:"name"`
+ Type string `json:"type"`
+ Properties string `json:"properties"`
+}
+
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface that uses
+// Bluecat's Address Manager REST API to manage TXT records for a domain.
+type DNSProvider struct {
+ baseUrl string
+ userName string
+ password string
+ configName string
+ dnsView string
+ token string
+ httpClient *http.Client
+}
+
+// NewDNSProvider returns a DNSProvider instance configured for Bluecat DNS.
+// Credentials must be passed in the environment variables: BLUECAT_SERVER_URL,
+// BLUECAT_USER_NAME and BLUECAT_PASSWORD. BLUECAT_SERVER_URL should have the
+// scheme, hostname, and port (if required) of the authoritative Bluecat BAM
+// server. The REST endpoint will be appended. In addition, the Configuration name
+// and external DNS View Name must be passed in BLUECAT_CONFIG_NAME and
+// BLUECAT_DNS_VIEW
+func NewDNSProvider() (*DNSProvider, error) {
+ server := os.Getenv("BLUECAT_SERVER_URL")
+ userName := os.Getenv("BLUECAT_USER_NAME")
+ password := os.Getenv("BLUECAT_PASSWORD")
+ configName := os.Getenv("BLUECAT_CONFIG_NAME")
+ dnsView := os.Getenv("BLUECAT_DNS_VIEW")
+ httpClient := http.Client{Timeout: time.Duration(30 * time.Second)}
+ return NewDNSProviderCredentials(server, userName, password, configName, dnsView, httpClient)
+}
+
+// NewDNSProviderCredentials uses the supplied credentials to return a
+// DNSProvider instance configured for Bluecat DNS.
+func NewDNSProviderCredentials(server, userName, password, configName, dnsView string, httpClient http.Client) (*DNSProvider, error) {
+ if server == "" || userName == "" || password == "" || configName == "" || dnsView == "" {
+ return nil, fmt.Errorf("Bluecat credentials missing")
+ }
+
+ return &DNSProvider{
+ baseUrl: fmt.Sprintf(bluecatUrlTemplate, server),
+ userName: userName,
+ password: password,
+ configName: configName,
+ dnsView: dnsView,
+ httpClient: http.DefaultClient,
+ }, nil
+}
+
+// Send a REST request, using query parameters specified. The Authorization
+// header will be set if we have an active auth token
+func (d *DNSProvider) sendRequest(method, resource string, payload interface{}, queryArgs map[string]string) (*http.Response, error) {
+ url := fmt.Sprintf("%s/%s", d.baseUrl, resource)
+
+ body, err := json.Marshal(payload)
+ if err != nil {
+ return nil, err
+ }
+
+ req, err := http.NewRequest(method, url, bytes.NewReader(body))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/json")
+ if len(d.token) > 0 {
+ req.Header.Set("Authorization", d.token)
+ }
+
+ // Add all query parameters
+ q := req.URL.Query()
+ for argName, argVal := range queryArgs {
+ q.Add(argName, argVal)
+ }
+ req.URL.RawQuery = q.Encode()
+ resp, err := d.httpClient.Do(req)
+ if err != nil {
+ return nil, err
+ }
+
+ if resp.StatusCode >= 400 {
+ errBytes, _ := ioutil.ReadAll(resp.Body)
+ errResp := string(errBytes)
+ return nil, fmt.Errorf("Bluecat API request failed with HTTP status code %d\n Full message: %s",
+ resp.StatusCode, errResp)
+ }
+
+ return resp, nil
+}
+
+// Starts a new Bluecat API Session. Authenticates using customerName, userName,
+// password and receives a token to be used in for subsequent requests.
+func (d *DNSProvider) login() error {
+ queryArgs := map[string]string{
+ "username": d.userName,
+ "password": d.password,
+ }
+
+ resp, err := d.sendRequest("GET", "login", nil, queryArgs)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ authBytes, _ := ioutil.ReadAll(resp.Body)
+ authResp := string(authBytes)
+
+ if strings.Contains(authResp, "Authentication Error") {
+ msg := strings.Trim(authResp, "\"")
+ return fmt.Errorf("Bluecat API request failed: %s", msg)
+ }
+ // Upon success, API responds with "Session Token-> BAMAuthToken: dQfuRMTUxNjc3MjcyNDg1ODppcGFybXM= <- for User : username"
+ re := regexp.MustCompile("BAMAuthToken: [^ ]+")
+ token := re.FindString(authResp)
+ d.token = token
+ return nil
+}
+
+// Destroys Bluecat Session
+func (d *DNSProvider) logout() error {
+ if len(d.token) == 0 {
+ // nothing to do
+ return nil
+ }
+
+ resp, err := d.sendRequest("GET", "logout", nil, nil)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ if resp.StatusCode != 200 {
+ return fmt.Errorf("Bluecat API request failed to delete session with HTTP status code %d", resp.StatusCode)
+ } else {
+ authBytes, _ := ioutil.ReadAll(resp.Body)
+ authResp := string(authBytes)
+
+ if !strings.Contains(authResp, "successfully") {
+ msg := strings.Trim(authResp, "\"")
+ return fmt.Errorf("Bluecat API request failed to delete session: %s", msg)
+ }
+ }
+
+ d.token = ""
+
+ return nil
+}
+
+// Lookup the entity ID of the configuration named in our properties
+func (d *DNSProvider) lookupConfId() (uint, error) {
+ queryArgs := map[string]string{
+ "parentId": strconv.Itoa(0),
+ "name": d.configName,
+ "type": configType,
+ }
+
+ resp, err := d.sendRequest("GET", "getEntityByName", nil, queryArgs)
+ if err != nil {
+ return 0, err
+ }
+ defer resp.Body.Close()
+
+ var conf entityResponse
+ err = json.NewDecoder(resp.Body).Decode(&conf)
+ if err != nil {
+ return 0, err
+ }
+ return conf.Id, nil
+}
+
+// Find the DNS view with the given name within
+func (d *DNSProvider) lookupViewId(viewName string) (uint, error) {
+ confId, err := d.lookupConfId()
+ if err != nil {
+ return 0, err
+ }
+
+ queryArgs := map[string]string{
+ "parentId": strconv.FormatUint(uint64(confId), 10),
+ "name": d.dnsView,
+ "type": viewType,
+ }
+
+ resp, err := d.sendRequest("GET", "getEntityByName", nil, queryArgs)
+ if err != nil {
+ return 0, err
+ }
+ defer resp.Body.Close()
+
+ var view entityResponse
+ err = json.NewDecoder(resp.Body).Decode(&view)
+ if err != nil {
+ return 0, err
+ }
+
+ return view.Id, nil
+}
+
+// Return the entityId of the parent zone by recursing from the root view
+// Also return the simple name of the host
+func (d *DNSProvider) lookupParentZoneId(viewId uint, fqdn string) (uint, string, error) {
+ parentViewId := viewId
+ name := ""
+
+ if fqdn != "" {
+ zones := strings.Split(strings.Trim(fqdn, "."), ".")
+ last := len(zones) - 1
+ name = zones[0]
+
+ for i := last; i > -1; i-- {
+ zoneId, err := d.getZone(parentViewId, zones[i])
+ if err != nil || zoneId == 0 {
+ return parentViewId, name, err
+ }
+ if i > 0 {
+ name = strings.Join(zones[0:i], ".")
+ }
+ parentViewId = zoneId
+ }
+ }
+
+ return parentViewId, name, nil
+}
+
+// Get the DNS zone with the specified name under the parentId
+func (d *DNSProvider) getZone(parentId uint, name string) (uint, error) {
+
+ queryArgs := map[string]string{
+ "parentId": strconv.FormatUint(uint64(parentId), 10),
+ "name": name,
+ "type": zoneType,
+ }
+
+ resp, err := d.sendRequest("GET", "getEntityByName", nil, queryArgs)
+ // Return an empty zone if the named zone doesn't exist
+ if resp != nil && resp.StatusCode == 404 {
+ return 0, fmt.Errorf("Bluecat API could not find zone named %s", name)
+ }
+ if err != nil {
+ return 0, err
+ }
+ defer resp.Body.Close()
+
+ var zone entityResponse
+ err = json.NewDecoder(resp.Body).Decode(&zone)
+ if err != nil {
+ return 0, err
+ }
+
+ return zone.Id, nil
+}
+
+// Present creates a TXT record using the specified parameters
+// This will *not* create a subzone to contain the TXT record,
+// so make sure the FQDN specified is within an extant zone.
+func (d *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+
+ err := d.login()
+ if err != nil {
+ return err
+ }
+
+ viewId, err := d.lookupViewId(d.dnsView)
+ if err != nil {
+ return err
+ }
+
+ parentZoneId, name, err := d.lookupParentZoneId(viewId, fqdn)
+
+ queryArgs := map[string]string{
+ "parentId": strconv.FormatUint(uint64(parentZoneId), 10),
+ }
+
+ body := bluecatEntity{
+ Name: name,
+ Type: "TXTRecord",
+ Properties: fmt.Sprintf("ttl=%d|absoluteName=%s|txt=%s|", ttl, fqdn, value),
+ }
+
+ resp, err := d.sendRequest("POST", "addEntity", body, queryArgs)
+
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ addTxtBytes, _ := ioutil.ReadAll(resp.Body)
+ addTxtResp := string(addTxtBytes)
+ // addEntity responds only with body text containing the ID of the created record
+ _, err = strconv.ParseUint(addTxtResp, 10, 64)
+ if err != nil {
+ return fmt.Errorf("Bluecat API addEntity request failed: %s", addTxtResp)
+ }
+
+ err = d.deploy(uint(parentZoneId))
+ if err != nil {
+ return err
+ }
+
+ err = d.logout()
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+// Deploy the DNS config for the specified entity to the authoritative servers
+func (d *DNSProvider) deploy(entityId uint) error {
+ queryArgs := map[string]string{
+ "entityId": strconv.FormatUint(uint64(entityId), 10),
+ }
+
+ resp, err := d.sendRequest("POST", "quickDeploy", nil, queryArgs)
+
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ return nil
+}
+
+// CleanUp removes the TXT record matching the specified parameters
+func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
+
+ err := d.login()
+ if err != nil {
+ return err
+ }
+
+ viewId, err := d.lookupViewId(d.dnsView)
+ if err != nil {
+ return err
+ }
+
+ parentId, name, err := d.lookupParentZoneId(viewId, fqdn)
+ if err != nil {
+ return err
+ }
+
+ queryArgs := map[string]string{
+ "parentId": strconv.FormatUint(uint64(parentId), 10),
+ "name": name,
+ "type": txtType,
+ }
+
+ resp, err := d.sendRequest("GET", "getEntityByName", nil, queryArgs)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ var txtRec entityResponse
+ err = json.NewDecoder(resp.Body).Decode(&txtRec)
+ if err != nil {
+ return err
+ }
+ queryArgs = map[string]string{
+ "objectId": strconv.FormatUint(uint64(txtRec.Id), 10),
+ }
+
+ resp, err = d.sendRequest("DELETE", "delete", nil, queryArgs)
+ if err != nil {
+ return err
+ }
+ defer resp.Body.Close()
+
+ err = d.deploy(parentId)
+ if err != nil {
+ return err
+ }
+
+ err = d.logout()
+ if err != nil {
+ return err
+ }
+
+ return nil
+}
+
+//JSON body for Bluecat entity requests and responses
+type bluecatEntity struct {
+ ID string `json:"id,omitempty"`
+ Name string `json:"name"`
+ Type string `json:"type"`
+ Properties string `json:"properties"`
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/cloudflare/cloudflare.go b/vendor/github.com/xenolf/lego/providers/dns/cloudflare/cloudflare.go
index 84952238d..ccea830ad 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/cloudflare/cloudflare.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/cloudflare/cloudflare.go
@@ -11,14 +11,14 @@ import (
"os"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// CloudFlareAPIURL represents the API endpoint to call.
// TODO: Unexport?
const CloudFlareAPIURL = "https://api.cloudflare.com/client/v4"
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
type DNSProvider struct {
authEmail string
authKey string
@@ -54,7 +54,7 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
// Present creates a TXT record to fulfil the dns-01 challenge
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -62,7 +62,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
rec := cloudFlareRecord{
Type: "TXT",
- Name: acme.UnFqdn(fqdn),
+ Name: acmev2.UnFqdn(fqdn),
Content: value,
TTL: 120,
}
@@ -82,7 +82,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
record, err := c.findTxtRecord(fqdn)
if err != nil {
@@ -104,12 +104,12 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
Name string `json:"name"`
}
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
- result, err := c.makeRequest("GET", "/zones?name="+acme.UnFqdn(authZone), nil)
+ result, err := c.makeRequest("GET", "/zones?name="+acmev2.UnFqdn(authZone), nil)
if err != nil {
return "", err
}
@@ -135,7 +135,7 @@ func (c *DNSProvider) findTxtRecord(fqdn string) (*cloudFlareRecord, error) {
result, err := c.makeRequest(
"GET",
- fmt.Sprintf("/zones/%s/dns_records?per_page=1000&type=TXT&name=%s", zoneID, acme.UnFqdn(fqdn)),
+ fmt.Sprintf("/zones/%s/dns_records?per_page=1000&type=TXT&name=%s", zoneID, acmev2.UnFqdn(fqdn)),
nil,
)
if err != nil {
@@ -149,7 +149,7 @@ func (c *DNSProvider) findTxtRecord(fqdn string) (*cloudFlareRecord, error) {
}
for _, rec := range records {
- if rec.Name == acme.UnFqdn(fqdn) {
+ if rec.Name == acmev2.UnFqdn(fqdn) {
return &rec, nil
}
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go b/vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go
index 57efdeaec..e69c60260 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/cloudxns/cloudxns.go
@@ -13,12 +13,12 @@ import (
"strconv"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
const cloudXNSBaseURL = "https://www.cloudxns.net/api2/"
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
type DNSProvider struct {
apiKey string
secretKey string
@@ -48,7 +48,7 @@ func NewDNSProviderCredentials(apiKey, secretKey string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -59,7 +59,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -79,7 +79,7 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
Domain string `json:"domain"`
}
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
@@ -117,7 +117,7 @@ func (c *DNSProvider) findTxtRecord(zoneID, fqdn string) (string, error) {
}
for _, record := range records {
- if record.Host == acme.UnFqdn(fqdn) && record.Type == "TXT" {
+ if record.Host == acmev2.UnFqdn(fqdn) && record.Type == "TXT" {
return record.RecordID, nil
}
}
@@ -133,7 +133,7 @@ func (c *DNSProvider) addTxtRecord(zoneID, fqdn, value string, ttl int) error {
payload := cloudXNSRecord{
ID: id,
- Host: acme.UnFqdn(fqdn),
+ Host: acmev2.UnFqdn(fqdn),
Value: value,
Type: "TXT",
LineID: 1,
@@ -183,7 +183,7 @@ func (c *DNSProvider) makeRequest(method, uri string, body []byte) (json.RawMess
req.Header.Set("API-HMAC", c.hmac(url, requestDate, string(body)))
req.Header.Set("API-FORMAT", "json")
- resp, err := acme.HTTPClient.Do(req)
+ resp, err := acmev2.HTTPClient.Do(req)
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/digitalocean/digitalocean.go b/vendor/github.com/xenolf/lego/providers/dns/digitalocean/digitalocean.go
index da261b39a..deb0548be 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/digitalocean/digitalocean.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/digitalocean/digitalocean.go
@@ -11,10 +11,10 @@ import (
"sync"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
// that uses DigitalOcean's REST API to manage TXT records for a domain.
type DNSProvider struct {
apiAuthToken string
@@ -49,6 +49,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
RecordType string `json:"type"`
Name string `json:"name"`
Data string `json:"data"`
+ TTL int `json:"ttl"`
}
// txtRecordResponse represents a response from DO's API after making a TXT record
@@ -61,17 +62,17 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
} `json:"domain_record"`
}
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
reqURL := fmt.Sprintf("%s/v2/domains/%s/records", digitalOceanBaseURL, authZone)
- reqData := txtRecordRequest{RecordType: "TXT", Name: fqdn, Data: value}
+ reqData := txtRecordRequest{RecordType: "TXT", Name: fqdn, Data: value, TTL: 30}
body, err := json.Marshal(reqData)
if err != nil {
return err
@@ -112,7 +113,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
// get the record's unique ID from when we created it
d.recordIDsMu.Lock()
@@ -122,12 +123,12 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return fmt.Errorf("unknown record ID for '%s'", fqdn)
}
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
reqURL := fmt.Sprintf("%s/v2/domains/%s/records/%d", digitalOceanBaseURL, authZone, recordID)
req, err := http.NewRequest("DELETE", reqURL, nil)
@@ -164,3 +165,9 @@ type digitalOceanAPIError struct {
}
var digitalOceanBaseURL = "https://api.digitalocean.com"
+
+// Timeout returns the timeout and interval to use when checking for DNS
+// propagation. Adjusting here to cope with spikes in propagation times.
+func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
+ return 60 * time.Second, 5 * time.Second
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/dns_providers.go b/vendor/github.com/xenolf/lego/providers/dns/dns_providers.go
index 062353098..2f1344a69 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/dns_providers.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/dns_providers.go
@@ -4,23 +4,30 @@ package dns
import (
"fmt"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
"github.com/xenolf/lego/providers/dns/auroradns"
"github.com/xenolf/lego/providers/dns/azure"
+ "github.com/xenolf/lego/providers/dns/bluecat"
"github.com/xenolf/lego/providers/dns/cloudflare"
"github.com/xenolf/lego/providers/dns/cloudxns"
"github.com/xenolf/lego/providers/dns/digitalocean"
"github.com/xenolf/lego/providers/dns/dnsimple"
"github.com/xenolf/lego/providers/dns/dnsmadeeasy"
"github.com/xenolf/lego/providers/dns/dnspod"
+ "github.com/xenolf/lego/providers/dns/duckdns"
"github.com/xenolf/lego/providers/dns/dyn"
+ "github.com/xenolf/lego/providers/dns/exec"
"github.com/xenolf/lego/providers/dns/exoscale"
+ "github.com/xenolf/lego/providers/dns/fastdns"
"github.com/xenolf/lego/providers/dns/gandi"
"github.com/xenolf/lego/providers/dns/gandiv5"
- "github.com/xenolf/lego/providers/dns/googlecloud"
+ "github.com/xenolf/lego/providers/dns/glesys"
"github.com/xenolf/lego/providers/dns/godaddy"
+ "github.com/xenolf/lego/providers/dns/googlecloud"
+ "github.com/xenolf/lego/providers/dns/lightsail"
"github.com/xenolf/lego/providers/dns/linode"
"github.com/xenolf/lego/providers/dns/namecheap"
+ "github.com/xenolf/lego/providers/dns/namedotcom"
"github.com/xenolf/lego/providers/dns/ns1"
"github.com/xenolf/lego/providers/dns/otc"
"github.com/xenolf/lego/providers/dns/ovh"
@@ -31,14 +38,16 @@ import (
"github.com/xenolf/lego/providers/dns/vultr"
)
-func NewDNSChallengeProviderByName(name string) (acme.ChallengeProvider, error) {
+func NewDNSChallengeProviderByName(name string) (acmev2.ChallengeProvider, error) {
var err error
- var provider acme.ChallengeProvider
+ var provider acmev2.ChallengeProvider
switch name {
case "azure":
provider, err = azure.NewDNSProvider()
case "auroradns":
provider, err = auroradns.NewDNSProvider()
+ case "bluecat":
+ provider, err = bluecat.NewDNSProvider()
case "cloudflare":
provider, err = cloudflare.NewDNSProvider()
case "cloudxns":
@@ -51,24 +60,34 @@ func NewDNSChallengeProviderByName(name string) (acme.ChallengeProvider, error)
provider, err = dnsmadeeasy.NewDNSProvider()
case "dnspod":
provider, err = dnspod.NewDNSProvider()
+ case "duckdns":
+ provider, err = duckdns.NewDNSProvider()
case "dyn":
provider, err = dyn.NewDNSProvider()
+ case "fastdns":
+ provider, err = fastdns.NewDNSProvider()
case "exoscale":
provider, err = exoscale.NewDNSProvider()
case "gandi":
provider, err = gandi.NewDNSProvider()
case "gandiv5":
provider, err = gandiv5.NewDNSProvider()
+ case "glesys":
+ provider, err = glesys.NewDNSProvider()
case "gcloud":
provider, err = googlecloud.NewDNSProvider()
case "godaddy":
provider, err = godaddy.NewDNSProvider()
+ case "lightsail":
+ provider, err = lightsail.NewDNSProvider()
case "linode":
provider, err = linode.NewDNSProvider()
case "manual":
- provider, err = acme.NewDNSProviderManual()
+ provider, err = acmev2.NewDNSProviderManual()
case "namecheap":
provider, err = namecheap.NewDNSProvider()
+ case "namedotcom":
+ provider, err = namedotcom.NewDNSProvider()
case "rackspace":
provider, err = rackspace.NewDNSProvider()
case "route53":
@@ -85,6 +104,8 @@ func NewDNSChallengeProviderByName(name string) (acme.ChallengeProvider, error)
provider, err = ns1.NewDNSProvider()
case "otc":
provider, err = otc.NewDNSProvider()
+ case "exec":
+ provider, err = exec.NewDNSProvider()
default:
err = fmt.Errorf("Unrecognised DNS provider: %s", name)
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/dnsimple/dnsimple.go b/vendor/github.com/xenolf/lego/providers/dns/dnsimple/dnsimple.go
index e3fea79ec..cebdff1ce 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/dnsimple/dnsimple.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/dnsimple/dnsimple.go
@@ -9,10 +9,10 @@ import (
"strings"
"github.com/dnsimple/dnsimple-go/dnsimple"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface.
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
type DNSProvider struct {
client *dnsimple.Client
}
@@ -47,7 +47,7 @@ func NewDNSProviderCredentials(accessToken, baseUrl string) (*DNSProvider, error
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zoneName, err := c.getHostedZone(domain)
@@ -71,7 +71,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
records, err := c.findTxtRecords(domain, fqdn)
if err != nil {
@@ -94,7 +94,7 @@ func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
}
func (c *DNSProvider) getHostedZone(domain string) (string, error) {
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
@@ -104,7 +104,7 @@ func (c *DNSProvider) getHostedZone(domain string) (string, error) {
return "", err
}
- zoneName := acme.UnFqdn(authZone)
+ zoneName := acmev2.UnFqdn(authZone)
zones, err := c.client.Zones.ListZones(accountID, &dnsimple.ZoneListOptions{NameLike: zoneName})
if err != nil {
@@ -159,7 +159,7 @@ func (c *DNSProvider) newTxtRecord(zoneName, fqdn, value string, ttl int) *dnsim
}
func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
if idx := strings.Index(name, "."+domain); idx != -1 {
return name[:idx]
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/dnsmadeeasy/dnsmadeeasy.go b/vendor/github.com/xenolf/lego/providers/dns/dnsmadeeasy/dnsmadeeasy.go
index c4363a4eb..9ea7b51f7 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/dnsmadeeasy/dnsmadeeasy.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/dnsmadeeasy/dnsmadeeasy.go
@@ -14,10 +14,10 @@ import (
"strings"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface that uses
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface that uses
// DNSMadeEasy's DNS API to manage TXT records for a domain.
type DNSProvider struct {
baseURL string
@@ -77,9 +77,9 @@ func NewDNSProviderCredentials(baseURL, apiKey, apiSecret string) (*DNSProvider,
// Present creates a TXT record using the specified parameters
func (d *DNSProvider) Present(domainName, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domainName, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domainName, keyAuth)
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
@@ -104,9 +104,9 @@ func (d *DNSProvider) Present(domainName, token, keyAuth string) error {
// CleanUp removes the TXT records matching the specified parameters
func (d *DNSProvider) CleanUp(domainName, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domainName, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domainName, keyAuth)
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/dnspod/dnspod.go b/vendor/github.com/xenolf/lego/providers/dns/dnspod/dnspod.go
index 0ce08a8bb..4942eba75 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/dnspod/dnspod.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/dnspod/dnspod.go
@@ -8,10 +8,10 @@ import (
"strings"
"github.com/decker502/dnspod-go"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface.
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
type DNSProvider struct {
client *dnspod.Client
}
@@ -38,7 +38,7 @@ func NewDNSProviderCredentials(key string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zoneID, zoneName, err := c.getHostedZone(domain)
if err != nil {
return err
@@ -55,7 +55,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
records, err := c.findTxtRecords(domain, fqdn)
if err != nil {
@@ -82,14 +82,14 @@ func (c *DNSProvider) getHostedZone(domain string) (string, string, error) {
return "", "", fmt.Errorf("dnspod API call failed: %v", err)
}
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return "", "", err
}
var hostedZone dnspod.Domain
for _, zone := range zones {
- if zone.Name == acme.UnFqdn(authZone) {
+ if zone.Name == acmev2.UnFqdn(authZone) {
hostedZone = zone
}
}
@@ -138,7 +138,7 @@ func (c *DNSProvider) findTxtRecords(domain, fqdn string) ([]dnspod.Record, erro
}
func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
if idx := strings.Index(name, "."+domain); idx != -1 {
return name[:idx]
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/duckdns/duckdns.go b/vendor/github.com/xenolf/lego/providers/dns/duckdns/duckdns.go
new file mode 100644
index 000000000..defafe35c
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/duckdns/duckdns.go
@@ -0,0 +1,82 @@
+// Adds lego support for http://duckdns.org .
+//
+// See http://www.duckdns.org/spec.jsp for more info on updating TXT records.
+package duckdns
+
+import (
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+
+ "github.com/xenolf/lego/acmev2"
+)
+
+// DNSProvider adds and removes the record for the DNS challenge
+type DNSProvider struct {
+ // The duckdns api token
+ token string
+}
+
+// NewDNSProvider returns a new DNS provider using
+// environment variable DUCKDNS_TOKEN for adding and removing the DNS record.
+func NewDNSProvider() (*DNSProvider, error) {
+ duckdnsToken := os.Getenv("DUCKDNS_TOKEN")
+
+ return NewDNSProviderCredentials(duckdnsToken)
+}
+
+// NewDNSProviderCredentials uses the supplied credentials to return a
+// DNSProvider instance configured for http://duckdns.org .
+func NewDNSProviderCredentials(duckdnsToken string) (*DNSProvider, error) {
+ if duckdnsToken == "" {
+ return nil, errors.New("environment variable DUCKDNS_TOKEN not set")
+ }
+
+ return &DNSProvider{token: duckdnsToken}, nil
+}
+
+// makeDuckdnsURL creates a url to clear the set or unset the TXT record.
+// txt == "" will clear the TXT record.
+func makeDuckdnsURL(domain, token, txt string) string {
+ requestBase := fmt.Sprintf("https://www.duckdns.org/update?domains=%s&token=%s", domain, token)
+ if txt == "" {
+ return requestBase + "&clear=true"
+ }
+ return requestBase + "&txt=" + txt
+}
+
+func issueDuckdnsRequest(url string) error {
+ response, err := acmev2.HTTPClient.Get(url)
+ if err != nil {
+ return err
+ }
+ defer response.Body.Close()
+
+ bodyBytes, err := ioutil.ReadAll(response.Body)
+ if err != nil {
+ return err
+ }
+ body := string(bodyBytes)
+ if body != "OK" {
+ return fmt.Errorf("Request to change TXT record for duckdns returned the following result (%s) this does not match expectation (OK) used url [%s]", body, url)
+ }
+ return nil
+}
+
+// Present creates a TXT record to fulfil the dns-01 challenge.
+// In duckdns you only have one TXT record shared with
+// the domain and all sub domains.
+//
+// To update the TXT record we just need to make one simple get request.
+func (d *DNSProvider) Present(domain, token, keyAuth string) error {
+ _, txtRecord, _ := acmev2.DNS01Record(domain, keyAuth)
+ url := makeDuckdnsURL(domain, d.token, txtRecord)
+ return issueDuckdnsRequest(url)
+}
+
+// CleanUp clears duckdns TXT record
+func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ url := makeDuckdnsURL(domain, d.token, "")
+ return issueDuckdnsRequest(url)
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/dyn/dyn.go b/vendor/github.com/xenolf/lego/providers/dns/dyn/dyn.go
index 384bc850c..b75febce8 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/dyn/dyn.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/dyn/dyn.go
@@ -11,7 +11,7 @@ import (
"strconv"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
var dynBaseURL = "https://api.dynect.net/REST"
@@ -30,7 +30,7 @@ type dynResponse struct {
Messages json.RawMessage `json:"msgs"`
}
-// DNSProvider is an implementation of the acme.ChallengeProvider interface that uses
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface that uses
// Dyn's Managed DNS API to manage TXT records for a domain.
type DNSProvider struct {
customerName string
@@ -87,11 +87,8 @@ func (d *DNSProvider) sendRequest(method, resource string, payload interface{})
}
defer resp.Body.Close()
- if resp.StatusCode >= 400 {
+ if resp.StatusCode >= 500 {
return nil, fmt.Errorf("Dyn API request failed with HTTP status code %d", resp.StatusCode)
- } else if resp.StatusCode == 307 {
- // TODO add support for HTTP 307 response and long running jobs
- return nil, fmt.Errorf("Dyn API request returned HTTP 307. This is currently unsupported")
}
var dynRes dynResponse
@@ -100,6 +97,13 @@ func (d *DNSProvider) sendRequest(method, resource string, payload interface{})
return nil, err
}
+ if resp.StatusCode >= 400 {
+ return nil, fmt.Errorf("Dyn API request failed with HTTP status code %d: %s", resp.StatusCode, dynRes.Messages)
+ } else if resp.StatusCode == 307 {
+ // TODO add support for HTTP 307 response and long running jobs
+ return nil, fmt.Errorf("Dyn API request returned HTTP 307. This is currently unsupported")
+ }
+
if dynRes.Status == "failure" {
// TODO add better error handling
return nil, fmt.Errorf("Dyn API request failed: %s", dynRes.Messages)
@@ -172,9 +176,9 @@ func (d *DNSProvider) logout() error {
// Present creates a TXT record using the specified parameters
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
@@ -228,9 +232,9 @@ func (d *DNSProvider) publish(zone, notes string) error {
// CleanUp removes the TXT record matching the specified parameters
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/exec/exec.go b/vendor/github.com/xenolf/lego/providers/dns/exec/exec.go
new file mode 100644
index 000000000..86f1aa5ee
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/exec/exec.go
@@ -0,0 +1,72 @@
+// Package exec implements a manual DNS provider which runs a program for
+// adding/removing the DNS record.
+//
+// The file name of the external program is specified in the environment
+// variable EXEC_PATH. When it is run by lego, three command-line parameters
+// are passed to it: The action ("present" or "cleanup"), the fully-qualified domain
+// name, the value for the record and the TTL.
+//
+// For example, requesting a certificate for the domain 'foo.example.com' can
+// be achieved by calling lego as follows:
+//
+// EXEC_PATH=./update-dns.sh \
+// lego --dns exec \
+// --domains foo.example.com \
+// --email invalid@example.com run
+//
+// It will then call the program './update-dns.sh' with like this:
+//
+// ./update-dns.sh "present" "_acme-challenge.foo.example.com." "MsijOYZxqyjGnFGwhjrhfg-Xgbl5r68WPda0J9EgqqI" "120"
+//
+// The program then needs to make sure the record is inserted. When it returns
+// an error via a non-zero exit code, lego aborts.
+//
+// When the record is to be removed again, the program is called with the first
+// command-line parameter set to "cleanup" instead of "present".
+package exec
+
+import (
+ "errors"
+ "os"
+ "os/exec"
+ "strconv"
+
+ "github.com/xenolf/lego/acmev2"
+)
+
+// DNSProvider adds and removes the record for the DNS challenge by calling a
+// program with command-line parameters.
+type DNSProvider struct {
+ program string
+}
+
+// NewDNSProvider returns a new DNS provider which runs the program in the
+// environment variable EXEC_PATH for adding and removing the DNS record.
+func NewDNSProvider() (*DNSProvider, error) {
+ s := os.Getenv("EXEC_PATH")
+ if s == "" {
+ return nil, errors.New("environment variable EXEC_PATH not set")
+ }
+
+ return &DNSProvider{program: s}, nil
+}
+
+// Present creates a TXT record to fulfil the dns-01 challenge.
+func (d *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+ cmd := exec.Command(d.program, "present", fqdn, value, strconv.Itoa(ttl))
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+
+ return cmd.Run()
+}
+
+// CleanUp removes the TXT record matching the specified parameters
+func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+ cmd := exec.Command(d.program, "cleanup", fqdn, value, strconv.Itoa(ttl))
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+
+ return cmd.Run()
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/exoscale/exoscale.go b/vendor/github.com/xenolf/lego/providers/dns/exoscale/exoscale.go
index 4b125e8df..5d97ac085 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/exoscale/exoscale.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/exoscale/exoscale.go
@@ -8,10 +8,10 @@ import (
"os"
"github.com/exoscale/egoscale"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface.
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
type DNSProvider struct {
client *egoscale.Client
}
@@ -42,7 +42,7 @@ func NewDNSProviderClient(key, secret, endpoint string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zone, recordName, err := c.FindZoneAndRecordName(fqdn, domain)
if err != nil {
return err
@@ -78,7 +78,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zone, recordName, err := c.FindZoneAndRecordName(fqdn, domain)
if err != nil {
return err
@@ -116,12 +116,12 @@ func (c *DNSProvider) FindExistingRecordId(zone, recordName string) (int64, erro
// Extract DNS zone and DNS entry name
func (c *DNSProvider) FindZoneAndRecordName(fqdn, domain string) (string, string, error) {
- zone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ zone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return "", "", err
}
- zone = acme.UnFqdn(zone)
- name := acme.UnFqdn(fqdn)
+ zone = acmev2.UnFqdn(zone)
+ name := acmev2.UnFqdn(fqdn)
name = name[:len(name)-len("."+zone)]
return zone, name, nil
diff --git a/vendor/github.com/xenolf/lego/providers/dns/fastdns/fastdns.go b/vendor/github.com/xenolf/lego/providers/dns/fastdns/fastdns.go
new file mode 100644
index 000000000..349f12d49
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/fastdns/fastdns.go
@@ -0,0 +1,139 @@
+package fastdns
+
+import (
+ "fmt"
+ "os"
+ "reflect"
+
+ configdns "github.com/akamai/AkamaiOPEN-edgegrid-golang/configdns-v1"
+ "github.com/akamai/AkamaiOPEN-edgegrid-golang/edgegrid"
+ "github.com/xenolf/lego/acmev2"
+)
+
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
+type DNSProvider struct {
+ config edgegrid.Config
+}
+
+// NewDNSProvider uses the supplied environment variables to return a DNSProvider instance:
+// AKAMAI_HOST, AKAMAI_CLIENT_TOKEN, AKAMAI_CLIENT_SECRET, AKAMAI_ACCESS_TOKEN
+func NewDNSProvider() (*DNSProvider, error) {
+ host := os.Getenv("AKAMAI_HOST")
+ clientToken := os.Getenv("AKAMAI_CLIENT_TOKEN")
+ clientSecret := os.Getenv("AKAMAI_CLIENT_SECRET")
+ accessToken := os.Getenv("AKAMAI_ACCESS_TOKEN")
+
+ return NewDNSProviderClient(host, clientToken, clientSecret, accessToken)
+}
+
+// NewDNSProviderClient uses the supplied parameters to return a DNSProvider instance
+// configured for FastDNS.
+func NewDNSProviderClient(host, clientToken, clientSecret, accessToken string) (*DNSProvider, error) {
+ if clientToken == "" || clientSecret == "" || accessToken == "" || host == "" {
+ return nil, fmt.Errorf("Akamai FastDNS credentials missing")
+ }
+ config := edgegrid.Config{
+ Host: host,
+ ClientToken: clientToken,
+ ClientSecret: clientSecret,
+ AccessToken: accessToken,
+ MaxBody: 131072,
+ }
+
+ return &DNSProvider{
+ config: config,
+ }, nil
+}
+
+// Present creates a TXT record to fullfil the dns-01 challenge.
+func (c *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+ zoneName, recordName, err := c.findZoneAndRecordName(fqdn, domain)
+ if err != nil {
+ return err
+ }
+
+ configdns.Init(c.config)
+
+ zone, err := configdns.GetZone(zoneName)
+ if err != nil {
+ return err
+ }
+
+ record := configdns.NewTxtRecord()
+ record.SetField("name", recordName)
+ record.SetField("ttl", ttl)
+ record.SetField("target", value)
+ record.SetField("active", true)
+
+ existingRecord := c.findExistingRecord(zone, recordName)
+
+ if existingRecord != nil {
+ if reflect.DeepEqual(existingRecord.ToMap(), record.ToMap()) {
+ return nil
+ }
+ zone.RemoveRecord(existingRecord)
+ return c.createRecord(zone, record)
+ }
+
+ return c.createRecord(zone, record)
+}
+
+// CleanUp removes the record matching the specified parameters.
+func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
+ zoneName, recordName, err := c.findZoneAndRecordName(fqdn, domain)
+ if err != nil {
+ return err
+ }
+
+ configdns.Init(c.config)
+
+ zone, err := configdns.GetZone(zoneName)
+ if err != nil {
+ return err
+ }
+
+ existingRecord := c.findExistingRecord(zone, recordName)
+
+ if existingRecord != nil {
+ err := zone.RemoveRecord(existingRecord)
+ if err != nil {
+ return err
+ }
+ return zone.Save()
+ }
+
+ return nil
+}
+
+func (c *DNSProvider) findZoneAndRecordName(fqdn, domain string) (string, string, error) {
+ zone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
+ if err != nil {
+ return "", "", err
+ }
+ zone = acmev2.UnFqdn(zone)
+ name := acmev2.UnFqdn(fqdn)
+ name = name[:len(name)-len("."+zone)]
+
+ return zone, name, nil
+}
+
+func (c *DNSProvider) findExistingRecord(zone *configdns.Zone, recordName string) *configdns.TxtRecord {
+ for _, r := range zone.Zone.Txt {
+ if r.Name == recordName {
+ return r
+ }
+ }
+
+ return nil
+}
+
+func (c *DNSProvider) createRecord(zone *configdns.Zone, record *configdns.TxtRecord) error {
+ err := zone.AddRecord(record)
+ if err != nil {
+ return err
+ }
+
+ return zone.Save()
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/gandi/gandi.go b/vendor/github.com/xenolf/lego/providers/dns/gandi/gandi.go
index 422b02a21..689fff1d1 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/gandi/gandi.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/gandi/gandi.go
@@ -14,7 +14,7 @@ import (
"sync"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// Gandi API reference: http://doc.rpc.gandi.net/index.html
@@ -26,7 +26,7 @@ var (
endpoint = "https://rpc.gandi.net/xmlrpc/"
// findZoneByFqdn determines the DNS zone of an fqdn. It is overridden
// during tests.
- findZoneByFqdn = acme.FindZoneByFqdn
+ findZoneByFqdn = acmev2.FindZoneByFqdn
)
// inProgressInfo contains information about an in-progress challenge
@@ -37,7 +37,7 @@ type inProgressInfo struct {
}
// DNSProvider is an implementation of the
-// acme.ChallengeProviderTimeout interface that uses Gandi's XML-RPC
+// acmev2.ChallengeProviderTimeout interface that uses Gandi's XML-RPC
// API to manage TXT records for a domain.
type DNSProvider struct {
apiKey string
@@ -70,12 +70,12 @@ func NewDNSProviderCredentials(apiKey string) (*DNSProvider, error) {
// does this by creating and activating a new temporary Gandi DNS
// zone. This new zone contains the TXT record.
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
if ttl < 300 {
ttl = 300 // 300 is gandi minimum value for ttl
}
// find authZone and Gandi zone_id for fqdn
- authZone, err := findZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := findZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Gandi DNS: findZoneByFqdn failure: %v", err)
}
@@ -103,7 +103,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// containing the required TXT record
newZoneName := fmt.Sprintf(
"%s [ACME Challenge %s]",
- acme.UnFqdn(authZone), time.Now().Format(time.RFC822Z))
+ acmev2.UnFqdn(authZone), time.Now().Format(time.RFC822Z))
newZoneID, err := d.cloneZone(zoneID, newZoneName)
if err != nil {
return err
@@ -138,7 +138,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// parameters. It does this by restoring the old Gandi DNS zone and
// removing the temporary one created by Present.
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
// acquire lock and retrieve zoneID, newZoneID and authZone
d.inProgressMu.Lock()
defer d.inProgressMu.Unlock()
diff --git a/vendor/github.com/xenolf/lego/providers/dns/gandiv5/gandiv5.go b/vendor/github.com/xenolf/lego/providers/dns/gandiv5/gandiv5.go
index 86cc7bf3f..6b96ef72a 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/gandiv5/gandiv5.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/gandiv5/gandiv5.go
@@ -12,7 +12,7 @@ import (
"sync"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// Gandi API reference: http://doc.livedns.gandi.net/
@@ -23,7 +23,7 @@ var (
endpoint = "https://dns.api.gandi.net/api/v5"
// findZoneByFqdn determines the DNS zone of an fqdn. It is overridden
// during tests.
- findZoneByFqdn = acme.FindZoneByFqdn
+ findZoneByFqdn = acmev2.FindZoneByFqdn
)
// inProgressInfo contains information about an in-progress challenge
@@ -33,7 +33,7 @@ type inProgressInfo struct {
}
// DNSProvider is an implementation of the
-// acme.ChallengeProviderTimeout interface that uses Gandi's LiveDNS
+// acmev2.ChallengeProviderTimeout interface that uses Gandi's LiveDNS
// API to manage TXT records for a domain.
type DNSProvider struct {
apiKey string
@@ -62,12 +62,12 @@ func NewDNSProviderCredentials(apiKey string) (*DNSProvider, error) {
// Present creates a TXT record using the specified parameters.
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
if ttl < 300 {
ttl = 300 // 300 is gandi minimum value for ttl
}
// find authZone
- authZone, err := findZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := findZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Gandi DNS: findZoneByFqdn failure: %v", err)
}
@@ -83,7 +83,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
d.inProgressMu.Lock()
defer d.inProgressMu.Unlock()
// add TXT record into authZone
- err = d.addTXTRecord(acme.UnFqdn(authZone), name, value, ttl)
+ err = d.addTXTRecord(acmev2.UnFqdn(authZone), name, value, ttl)
if err != nil {
return err
}
@@ -97,7 +97,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
// acquire lock and retrieve authZone
d.inProgressMu.Lock()
defer d.inProgressMu.Unlock()
@@ -109,7 +109,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
authZone := d.inProgressFQDNs[fqdn].authZone
delete(d.inProgressFQDNs, fqdn)
// delete TXT record from authZone
- err := d.deleteTXTRecord(acme.UnFqdn(authZone), fieldName)
+ err := d.deleteTXTRecord(acmev2.UnFqdn(authZone), fieldName)
if err != nil {
return err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/glesys/glesys.go b/vendor/github.com/xenolf/lego/providers/dns/glesys/glesys.go
new file mode 100644
index 000000000..7f8168b23
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/glesys/glesys.go
@@ -0,0 +1,211 @@
+// Package glesys implements a DNS provider for solving the DNS-01
+// challenge using GleSYS api.
+package glesys
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "log"
+ "net/http"
+ "os"
+ "strings"
+ "sync"
+ "time"
+
+ "github.com/xenolf/lego/acmev2"
+)
+
+// GleSYS API reference: https://github.com/GleSYS/API/wiki/API-Documentation
+
+// domainAPI is the GleSYS API endpoint used by Present and CleanUp.
+const domainAPI = "https://api.glesys.com/domain"
+
+var (
+ // Logger is used to log API communication results;
+ // if nil, the default log.Logger is used.
+ Logger *log.Logger
+)
+
+// logf writes a log entry. It uses Logger if not
+// nil, otherwise it uses the default log.Logger.
+func logf(format string, args ...interface{}) {
+ if Logger != nil {
+ Logger.Printf(format, args...)
+ } else {
+ log.Printf(format, args...)
+ }
+}
+
+// DNSProvider is an implementation of the
+// acmev2.ChallengeProviderTimeout interface that uses GleSYS
+// API to manage TXT records for a domain.
+type DNSProvider struct {
+ apiUser string
+ apiKey string
+ activeRecords map[string]int
+ inProgressMu sync.Mutex
+}
+
+// NewDNSProvider returns a DNSProvider instance configured for GleSYS.
+// Credentials must be passed in the environment variables: GLESYS_API_USER
+// and GLESYS_API_KEY.
+func NewDNSProvider() (*DNSProvider, error) {
+ apiUser := os.Getenv("GLESYS_API_USER")
+ apiKey := os.Getenv("GLESYS_API_KEY")
+ return NewDNSProviderCredentials(apiUser, apiKey)
+}
+
+// NewDNSProviderCredentials uses the supplied credentials to return a
+// DNSProvider instance configured for GleSYS.
+func NewDNSProviderCredentials(apiUser string, apiKey string) (*DNSProvider, error) {
+ if apiUser == "" || apiKey == "" {
+ return nil, fmt.Errorf("GleSYS DNS: Incomplete credentials provided")
+ }
+ return &DNSProvider{
+ apiUser: apiUser,
+ apiKey: apiKey,
+ activeRecords: make(map[string]int),
+ }, nil
+}
+
+// Present creates a TXT record using the specified parameters.
+func (d *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+ if ttl < 60 {
+ ttl = 60 // 60 is GleSYS minimum value for ttl
+ }
+ // find authZone
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
+ if err != nil {
+ return fmt.Errorf("GleSYS DNS: findZoneByFqdn failure: %v", err)
+ }
+ // determine name of TXT record
+ if !strings.HasSuffix(
+ strings.ToLower(fqdn), strings.ToLower("."+authZone)) {
+ return fmt.Errorf(
+ "GleSYS DNS: unexpected authZone %s for fqdn %s", authZone, fqdn)
+ }
+ name := fqdn[:len(fqdn)-len("."+authZone)]
+ // acquire lock and check there is not a challenge already in
+ // progress for this value of authZone
+ d.inProgressMu.Lock()
+ defer d.inProgressMu.Unlock()
+ // add TXT record into authZone
+ recordId, err := d.addTXTRecord(domain, acmev2.UnFqdn(authZone), name, value, ttl)
+ if err != nil {
+ return err
+ }
+ // save data necessary for CleanUp
+ d.activeRecords[fqdn] = recordId
+ return nil
+}
+
+// CleanUp removes the TXT record matching the specified parameters.
+func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
+ // acquire lock and retrieve authZone
+ d.inProgressMu.Lock()
+ defer d.inProgressMu.Unlock()
+ if _, ok := d.activeRecords[fqdn]; !ok {
+ // if there is no cleanup information then just return
+ return nil
+ }
+ recordId := d.activeRecords[fqdn]
+ delete(d.activeRecords, fqdn)
+ // delete TXT record from authZone
+ err := d.deleteTXTRecord(domain, recordId)
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+// Timeout returns the values (20*time.Minute, 20*time.Second) which
+// are used by the acme package as timeout and check interval values
+// when checking for DNS record propagation with GleSYS.
+func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
+ return 20 * time.Minute, 20 * time.Second
+}
+
+// types for JSON method calls, parameters, and responses
+
+type addRecordRequest struct {
+ Domainname string `json:"domainname"`
+ Host string `json:"host"`
+ Type string `json:"type"`
+ Data string `json:"data"`
+ Ttl int `json:"ttl,omitempty"`
+}
+
+type deleteRecordRequest struct {
+ Recordid int `json:"recordid"`
+}
+
+type responseStruct struct {
+ Response struct {
+ Status struct {
+ Code int `json:"code"`
+ } `json:"status"`
+ Record deleteRecordRequest `json:"record"`
+ } `json:"response"`
+}
+
+// POSTing/Marshalling/Unmarshalling
+
+func (d *DNSProvider) sendRequest(method string, resource string, payload interface{}) (*responseStruct, error) {
+ url := fmt.Sprintf("%s/%s", domainAPI, resource)
+
+ body, err := json.Marshal(payload)
+ if err != nil {
+ return nil, err
+ }
+ req, err := http.NewRequest(method, url, bytes.NewReader(body))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/json")
+ req.SetBasicAuth(d.apiUser, d.apiKey)
+
+ client := &http.Client{Timeout: time.Duration(10 * time.Second)}
+ resp, err := client.Do(req)
+ if err != nil {
+ return nil, err
+ }
+ defer resp.Body.Close()
+
+ if resp.StatusCode >= 400 {
+ return nil, fmt.Errorf("GleSYS DNS: request failed with HTTP status code %d", resp.StatusCode)
+ }
+ var response responseStruct
+ err = json.NewDecoder(resp.Body).Decode(&response)
+
+ return &response, err
+}
+
+// functions to perform API actions
+
+func (d *DNSProvider) addTXTRecord(fqdn string, domain string, name string, value string, ttl int) (int, error) {
+ response, err := d.sendRequest("POST", "addrecord", addRecordRequest{
+ Domainname: domain,
+ Host: name,
+ Type: "TXT",
+ Data: value,
+ Ttl: ttl,
+ })
+ if response != nil && response.Response.Status.Code == 200 {
+ logf("[INFO][%s] GleSYS DNS: Successfully created recordid %d", fqdn, response.Response.Record.Recordid)
+ return response.Response.Record.Recordid, nil
+ }
+ return 0, err
+}
+
+func (d *DNSProvider) deleteTXTRecord(fqdn string, recordid int) error {
+ response, err := d.sendRequest("POST", "deleterecord", deleteRecordRequest{
+ Recordid: recordid,
+ })
+ if response != nil && response.Response.Status.Code == 200 {
+ logf("[INFO][%s] GleSYS DNS: Successfully deleted recordid %d", fqdn, recordid)
+ }
+ return err
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/godaddy/godaddy.go b/vendor/github.com/xenolf/lego/providers/dns/godaddy/godaddy.go
index 4112f6628..de55a9f22 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/godaddy/godaddy.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/godaddy/godaddy.go
@@ -10,15 +10,16 @@ import (
"bytes"
"encoding/json"
- "github.com/xenolf/lego/acme"
"io/ioutil"
"strings"
+
+ "github.com/xenolf/lego/acmev2"
)
// GoDaddyAPIURL represents the API endpoint to call.
const apiURL = "https://api.godaddy.com"
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
type DNSProvider struct {
apiKey string
apiSecret string
@@ -50,7 +51,7 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
}
func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
if idx := strings.Index(name, "."+domain); idx != -1 {
return name[:idx]
}
@@ -59,7 +60,7 @@ func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
// Present creates a TXT record to fulfil the dns-01 challenge
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
domainZone, err := c.getZone(fqdn)
if err != nil {
return err
@@ -105,7 +106,7 @@ func (c *DNSProvider) updateRecords(records []DNSRecord, domainZone string, reco
// CleanUp sets null value in the TXT DNS record as GoDaddy has no proper DELETE record method
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
domainZone, err := c.getZone(fqdn)
if err != nil {
return err
@@ -124,12 +125,12 @@ func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
}
func (c *DNSProvider) getZone(fqdn string) (string, error) {
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
- return acme.UnFqdn(authZone), nil
+ return acmev2.UnFqdn(authZone), nil
}
func (c *DNSProvider) makeRequest(method, uri string, body io.Reader) (*http.Response, error) {
diff --git a/vendor/github.com/xenolf/lego/providers/dns/googlecloud/googlecloud.go b/vendor/github.com/xenolf/lego/providers/dns/googlecloud/googlecloud.go
index ba753f6dc..052c8dae5 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/googlecloud/googlecloud.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/googlecloud/googlecloud.go
@@ -8,7 +8,7 @@ import (
"os"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
"golang.org/x/net/context"
"golang.org/x/oauth2"
@@ -88,7 +88,7 @@ func NewDNSProviderServiceAccount(project string, saFile string) (*DNSProvider,
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(domain)
if err != nil {
@@ -135,7 +135,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(domain)
if err != nil {
@@ -167,7 +167,7 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
// getHostedZone returns the managed-zone
func (c *DNSProvider) getHostedZone(domain string) (string, error) {
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/lightsail/lightsail.go b/vendor/github.com/xenolf/lego/providers/dns/lightsail/lightsail.go
new file mode 100644
index 000000000..4bd709d13
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/lightsail/lightsail.go
@@ -0,0 +1,107 @@
+// Package lightsail implements a DNS provider for solving the DNS-01 challenge
+// using AWS Lightsail DNS.
+package lightsail
+
+import (
+ "math/rand"
+ "time"
+
+ "github.com/aws/aws-sdk-go/aws"
+ "github.com/aws/aws-sdk-go/aws/client"
+ "github.com/aws/aws-sdk-go/aws/request"
+ "github.com/aws/aws-sdk-go/aws/session"
+ "github.com/aws/aws-sdk-go/service/lightsail"
+ "github.com/xenolf/lego/acmev2"
+)
+
+const (
+ maxRetries = 5
+)
+
+// DNSProvider implements the acmev2.ChallengeProvider interface
+type DNSProvider struct {
+ client *lightsail.Lightsail
+}
+
+// customRetryer implements the client.Retryer interface by composing the
+// DefaultRetryer. It controls the logic for retrying recoverable request
+// errors (e.g. when rate limits are exceeded).
+type customRetryer struct {
+ client.DefaultRetryer
+}
+
+// RetryRules overwrites the DefaultRetryer's method.
+// It uses a basic exponential backoff algorithm that returns an initial
+// delay of ~400ms with an upper limit of ~30 seconds which should prevent
+// causing a high number of consecutive throttling errors.
+// For reference: Route 53 enforces an account-wide(!) 5req/s query limit.
+func (d customRetryer) RetryRules(r *request.Request) time.Duration {
+ retryCount := r.RetryCount
+ if retryCount > 7 {
+ retryCount = 7
+ }
+
+ delay := (1 << uint(retryCount)) * (rand.Intn(50) + 200)
+ return time.Duration(delay) * time.Millisecond
+}
+
+// NewDNSProvider returns a DNSProvider instance configured for the AWS
+// Lightsail service.
+//
+// AWS Credentials are automatically detected in the following locations
+// and prioritized in the following order:
+// 1. Environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
+// [AWS_SESSION_TOKEN], [DNS_ZONE]
+// 2. Shared credentials file (defaults to ~/.aws/credentials)
+// 3. Amazon EC2 IAM role
+//
+// public hosted zone via the FQDN.
+//
+// See also: https://github.com/aws/aws-sdk-go/wiki/configuring-sdk
+func NewDNSProvider() (*DNSProvider, error) {
+ r := customRetryer{}
+ r.NumMaxRetries = maxRetries
+ config := request.WithRetryer(aws.NewConfig(), r)
+ client := lightsail.New(session.New(config))
+
+ return &DNSProvider{
+ client: client,
+ }, nil
+}
+
+// Present creates a TXT record using the specified parameters
+func (r *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
+ value = `"` + value + `"`
+ err := r.newTxtRecord(domain, fqdn, value)
+ return err
+}
+
+// CleanUp removes the TXT record matching the specified parameters
+func (r *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
+ value = `"` + value + `"`
+ params := &lightsail.DeleteDomainEntryInput{
+ DomainName: aws.String(domain),
+ DomainEntry: &lightsail.DomainEntry{
+ Name: aws.String(fqdn),
+ Type: aws.String("TXT"),
+ Target: aws.String(value),
+ },
+ }
+ _, err := r.client.DeleteDomainEntry(params)
+ return err
+}
+
+func (r *DNSProvider) newTxtRecord(domain string, fqdn string, value string) error {
+ params := &lightsail.CreateDomainEntryInput{
+ DomainName: aws.String(domain),
+ DomainEntry: &lightsail.DomainEntry{
+ Name: aws.String(fqdn),
+ Target: aws.String(value),
+ Type: aws.String("TXT"),
+ },
+ }
+ _, err := r.client.CreateDomainEntry(params)
+ return err
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/linode/linode.go b/vendor/github.com/xenolf/lego/providers/dns/linode/linode.go
index a91d2b489..4c6345ac7 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/linode/linode.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/linode/linode.go
@@ -9,7 +9,7 @@ import (
"time"
"github.com/timewasted/linode/dns"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
const (
@@ -23,7 +23,7 @@ type hostedZoneInfo struct {
resourceName string
}
-// DNSProvider implements the acme.ChallengeProvider interface.
+// DNSProvider implements the acmev2.ChallengeProvider interface.
type DNSProvider struct {
linode *dns.DNS
}
@@ -66,13 +66,13 @@ func (p *DNSProvider) Timeout() (timeout, interval time.Duration) {
// Present creates a TXT record using the specified parameters.
func (p *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := p.getHostedZoneInfo(fqdn)
if err != nil {
return err
}
- if _, err = p.linode.CreateDomainResourceTXT(zone.domainId, acme.UnFqdn(fqdn), value, 60); err != nil {
+ if _, err = p.linode.CreateDomainResourceTXT(zone.domainId, acmev2.UnFqdn(fqdn), value, 60); err != nil {
return err
}
@@ -81,7 +81,7 @@ func (p *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (p *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := p.getHostedZoneInfo(fqdn)
if err != nil {
return err
@@ -112,14 +112,14 @@ func (p *DNSProvider) CleanUp(domain, token, keyAuth string) error {
func (p *DNSProvider) getHostedZoneInfo(fqdn string) (*hostedZoneInfo, error) {
// Lookup the zone that handles the specified FQDN.
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return nil, err
}
resourceName := strings.TrimSuffix(fqdn, "."+authZone)
// Query the authority zone.
- domain, err := p.linode.GetDomain(acme.UnFqdn(authZone))
+ domain, err := p.linode.GetDomain(acmev2.UnFqdn(authZone))
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/namecheap/namecheap.go b/vendor/github.com/xenolf/lego/providers/dns/namecheap/namecheap.go
index d7eb40935..f21bfeeb3 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/namecheap/namecheap.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/namecheap/namecheap.go
@@ -12,7 +12,7 @@ import (
"strings"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// Notes about namecheap's tool API:
@@ -132,7 +132,7 @@ type challenge struct {
// newChallenge builds a challenge record from a domain name, a challenge
// authentication key, and a map of available TLDs.
func newChallenge(domain, keyAuth string, tlds map[string]string) (*challenge, error) {
- domain = acme.UnFqdn(domain)
+ domain = acmev2.UnFqdn(domain)
parts := strings.Split(domain, ".")
// Find the longest matching TLD.
@@ -155,7 +155,7 @@ func newChallenge(domain, keyAuth string, tlds map[string]string) (*challenge, e
host = strings.Join(parts[:longest-1], ".")
}
- key, keyValue, _ := acme.DNS01Record(domain, keyAuth)
+ key, keyValue, _ := acmev2.DNS01Record(domain, keyAuth)
return &challenge{
domain: domain,
diff --git a/vendor/github.com/xenolf/lego/providers/dns/namedotcom/namedotcom.go b/vendor/github.com/xenolf/lego/providers/dns/namedotcom/namedotcom.go
new file mode 100644
index 000000000..0bd3a43ee
--- /dev/null
+++ b/vendor/github.com/xenolf/lego/providers/dns/namedotcom/namedotcom.go
@@ -0,0 +1,124 @@
+// Package namedotcom implements a DNS provider for solving the DNS-01 challenge
+// using Name.com's DNS service.
+package namedotcom
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ "github.com/namedotcom/go/namecom"
+ "github.com/xenolf/lego/acmev2"
+)
+
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
+type DNSProvider struct {
+ client *namecom.NameCom
+}
+
+// NewDNSProvider returns a DNSProvider instance configured for namedotcom.
+// Credentials must be passed in the environment variables: NAMECOM_USERNAME and NAMECOM_API_TOKEN
+func NewDNSProvider() (*DNSProvider, error) {
+ username := os.Getenv("NAMECOM_USERNAME")
+ apiToken := os.Getenv("NAMECOM_API_TOKEN")
+ server := os.Getenv("NAMECOM_SERVER")
+
+ return NewDNSProviderCredentials(username, apiToken, server)
+}
+
+// NewDNSProviderCredentials uses the supplied credentials to return a
+// DNSProvider instance configured for namedotcom.
+func NewDNSProviderCredentials(username, apiToken, server string) (*DNSProvider, error) {
+ if username == "" {
+ return nil, fmt.Errorf("Name.com Username is required")
+ }
+ if apiToken == "" {
+ return nil, fmt.Errorf("Name.com API token is required")
+ }
+
+ client := namecom.New(username, apiToken)
+
+ if server != "" {
+ client.Server = server
+ }
+
+ return &DNSProvider{client: client}, nil
+}
+
+// Present creates a TXT record to fulfil the dns-01 challenge.
+func (c *DNSProvider) Present(domain, token, keyAuth string) error {
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
+
+ request := &namecom.Record{
+ DomainName: domain,
+ Host: c.extractRecordName(fqdn, domain),
+ Type: "TXT",
+ TTL: uint32(ttl),
+ Answer: value,
+ }
+
+ _, err := c.client.CreateRecord(request)
+ if err != nil {
+ return fmt.Errorf("namedotcom API call failed: %v", err)
+ }
+
+ return nil
+}
+
+// CleanUp removes the TXT record matching the specified parameters.
+func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
+
+ records, err := c.getRecords(domain)
+ if err != nil {
+ return err
+ }
+
+ for _, rec := range records {
+ if rec.Fqdn == fqdn && rec.Type == "TXT" {
+ request := &namecom.DeleteRecordRequest{
+ DomainName: domain,
+ ID: rec.ID,
+ }
+ _, err := c.client.DeleteRecord(request)
+ if err != nil {
+ return err
+ }
+ }
+ }
+
+ return nil
+}
+
+func (c *DNSProvider) getRecords(domain string) ([]*namecom.Record, error) {
+ var (
+ err error
+ records []*namecom.Record
+ response *namecom.ListRecordsResponse
+ )
+
+ request := &namecom.ListRecordsRequest{
+ DomainName: domain,
+ Page: 1,
+ }
+
+ for request.Page > 0 {
+ response, err = c.client.ListRecords(request)
+ if err != nil {
+ return nil, err
+ }
+
+ records = append(records, response.Records...)
+ request.Page = response.NextPage
+ }
+
+ return records, nil
+}
+
+func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
+ name := acmev2.UnFqdn(fqdn)
+ if idx := strings.Index(name, "."+domain); idx != -1 {
+ return name[:idx]
+ }
+ return name
+}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/ns1/ns1.go b/vendor/github.com/xenolf/lego/providers/dns/ns1/ns1.go
index 105d73f89..d7afcfc89 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/ns1/ns1.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/ns1/ns1.go
@@ -8,12 +8,12 @@ import (
"os"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
"gopkg.in/ns1/ns1-go.v2/rest"
"gopkg.in/ns1/ns1-go.v2/rest/model/dns"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface.
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
type DNSProvider struct {
client *rest.Client
}
@@ -43,7 +43,7 @@ func NewDNSProviderCredentials(key string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the dns-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(domain)
if err != nil {
@@ -61,14 +61,14 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(domain)
if err != nil {
return err
}
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
_, err = c.client.Records.Delete(zone.Zone, name, "TXT")
return err
}
@@ -83,7 +83,7 @@ func (c *DNSProvider) getHostedZone(domain string) (*dns.Zone, error) {
}
func (c *DNSProvider) newTxtRecord(zone *dns.Zone, fqdn, value string, ttl int) *dns.Record {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
return &dns.Record{
Type: "TXT",
diff --git a/vendor/github.com/xenolf/lego/providers/dns/otc/otc.go b/vendor/github.com/xenolf/lego/providers/dns/otc/otc.go
index 86bcaa9b7..8b243d624 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/otc/otc.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/otc/otc.go
@@ -12,10 +12,10 @@ import (
"os"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface that uses
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface that uses
// OTC's Managed DNS API to manage TXT records for a domain.
type DNSProvider struct {
identityEndpoint string
@@ -313,13 +313,13 @@ func (d *DNSProvider) deleteRecordSet(zoneID, recordID string) error {
// Present creates a TXT record using the specified parameters
func (d *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
if ttl < 300 {
ttl = 300 // 300 is otc minimum value for ttl
}
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
@@ -362,9 +362,9 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/ovh/ovh.go b/vendor/github.com/xenolf/lego/providers/dns/ovh/ovh.go
index 290a8d7df..417de2e2c 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/ovh/ovh.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/ovh/ovh.go
@@ -9,13 +9,13 @@ import (
"sync"
"github.com/ovh/go-ovh/ovh"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// OVH API reference: https://eu.api.ovh.com/
// Create a Token: https://eu.api.ovh.com/createToken/
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
// that uses OVH's REST API to manage TXT records for a domain.
type DNSProvider struct {
client *ovh.Client
@@ -78,15 +78,15 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
Zone string `json:"zone"`
}
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
// Parse domain name
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
subDomain := d.extractRecordName(fqdn, authZone)
reqURL := fmt.Sprintf("/domain/zone/%s/record", authZone)
@@ -117,7 +117,7 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
// get the record's unique ID from when we created it
d.recordIDsMu.Lock()
@@ -127,12 +127,12 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
return fmt.Errorf("unknown record ID for '%s'", fqdn)
}
- authZone, err := acme.FindZoneByFqdn(acme.ToFqdn(domain), acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(acmev2.ToFqdn(domain), acmev2.RecursiveNameservers)
if err != nil {
return fmt.Errorf("Could not determine zone for domain: '%s'. %s", domain, err)
}
- authZone = acme.UnFqdn(authZone)
+ authZone = acmev2.UnFqdn(authZone)
reqURL := fmt.Sprintf("/domain/zone/%s/record/%d", authZone, recordID)
@@ -151,7 +151,7 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
}
func (d *DNSProvider) extractRecordName(fqdn, domain string) string {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
if idx := strings.Index(name, "."+domain); idx != -1 {
return name[:idx]
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/pdns/pdns.go b/vendor/github.com/xenolf/lego/providers/dns/pdns/pdns.go
index a7856e6d0..0ce84c6b9 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/pdns/pdns.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/pdns/pdns.go
@@ -14,10 +14,10 @@ import (
"strings"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
type DNSProvider struct {
apiKey string
host *url.URL
@@ -65,7 +65,7 @@ func (c *DNSProvider) Timeout() (timeout, interval time.Duration) {
// Present creates a TXT record to fulfil the dns-01 challenge
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(fqdn)
if err != nil {
return err
@@ -75,7 +75,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// pre-v1 API wants non-fqdn
if c.apiVersion == 0 {
- name = acme.UnFqdn(fqdn)
+ name = acmev2.UnFqdn(fqdn)
}
rec := pdnsRecord{
@@ -117,7 +117,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zone, err := c.getHostedZone(fqdn)
if err != nil {
@@ -153,7 +153,7 @@ func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
func (c *DNSProvider) getHostedZone(fqdn string) (*hostedZone, error) {
var zone hostedZone
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return nil, err
}
@@ -172,7 +172,7 @@ func (c *DNSProvider) getHostedZone(fqdn string) (*hostedZone, error) {
url = ""
for _, zone := range zones {
- if acme.UnFqdn(zone.Name) == acme.UnFqdn(authZone) {
+ if acmev2.UnFqdn(zone.Name) == acmev2.UnFqdn(authZone) {
url = zone.URL
}
}
@@ -215,7 +215,7 @@ func (c *DNSProvider) findTxtRecord(fqdn string) (*rrSet, error) {
}
for _, set := range zone.RRSets {
- if (set.Name == acme.UnFqdn(fqdn) || set.Name == fqdn) && set.Type == "TXT" {
+ if (set.Name == acmev2.UnFqdn(fqdn) || set.Name == fqdn) && set.Type == "TXT" {
return &set, nil
}
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/rackspace/rackspace.go b/vendor/github.com/xenolf/lego/providers/dns/rackspace/rackspace.go
index 13daa8c8a..97a2bc9c9 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/rackspace/rackspace.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/rackspace/rackspace.go
@@ -11,13 +11,13 @@ import (
"os"
"time"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
// rackspaceAPIURL represents the Identity API endpoint to call
var rackspaceAPIURL = "https://identity.api.rackspacecloud.com/v2.0/tokens"
-// DNSProvider is an implementation of the acme.ChallengeProvider interface
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface
// used to store the reusable token and DNS API endpoint
type DNSProvider struct {
token string
@@ -126,7 +126,7 @@ func NewDNSProviderCredentials(user, key string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the dns-01 challenge
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -134,7 +134,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
rec := RackspaceRecords{
RackspaceRecord: []RackspaceRecord{{
- Name: acme.UnFqdn(fqdn),
+ Name: acmev2.UnFqdn(fqdn),
Type: "TXT",
Data: value,
TTL: 300,
@@ -156,7 +156,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zoneID, err := c.getHostedZoneID(fqdn)
if err != nil {
return err
@@ -187,12 +187,12 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (int, error) {
} `json:"domains"`
}
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return 0, err
}
- result, err := c.makeRequest("GET", fmt.Sprintf("/domains?name=%s", acme.UnFqdn(authZone)), nil)
+ result, err := c.makeRequest("GET", fmt.Sprintf("/domains?name=%s", acmev2.UnFqdn(authZone)), nil)
if err != nil {
return 0, err
}
@@ -213,7 +213,7 @@ func (c *DNSProvider) getHostedZoneID(fqdn string) (int, error) {
// findTxtRecord searches a DNS zone for a TXT record with a specific name
func (c *DNSProvider) findTxtRecord(fqdn string, zoneID int) (*RackspaceRecord, error) {
- result, err := c.makeRequest("GET", fmt.Sprintf("/domains/%d/records?type=TXT&name=%s", zoneID, acme.UnFqdn(fqdn)), nil)
+ result, err := c.makeRequest("GET", fmt.Sprintf("/domains/%d/records?type=TXT&name=%s", zoneID, acmev2.UnFqdn(fqdn)), nil)
if err != nil {
return nil, err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/rfc2136/rfc2136.go b/vendor/github.com/xenolf/lego/providers/dns/rfc2136/rfc2136.go
index dde42ddf1..c185de162 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/rfc2136/rfc2136.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/rfc2136/rfc2136.go
@@ -10,10 +10,10 @@ import (
"time"
"github.com/miekg/dns"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface that
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface that
// uses dynamic DNS updates (RFC 2136) to create TXT records on a nameserver.
type DNSProvider struct {
nameserver string
@@ -27,7 +27,7 @@ type DNSProvider struct {
// dynamic update. Configured with environment variables:
// RFC2136_NAMESERVER: Network address in the form "host" or "host:port".
// RFC2136_TSIG_ALGORITHM: Defaults to hmac-md5.sig-alg.reg.int. (HMAC-MD5).
-// See https://github.com/miekg/dns/blob/master/tsig.go for supported values.
+// See https://github.com/miekg/dns/blob/master/tsig.go for supported values.
// RFC2136_TSIG_KEY: Name of the secret key as defined in DNS server configuration.
// RFC2136_TSIG_SECRET: Secret key payload.
// RFC2136_TIMEOUT: DNS propagation timeout in time.ParseDuration format. (60s)
@@ -88,24 +88,24 @@ func NewDNSProviderCredentials(nameserver, tsigAlgorithm, tsigKey, tsigSecret, t
// Returns the timeout configured with RFC2136_TIMEOUT, or 60s.
func (d *DNSProvider) Timeout() (timeout, interval time.Duration) {
- return d.timeout, 2 * time.Second
+ return d.timeout, 2 * time.Second
}
// Present creates a TXT record using the specified parameters
func (r *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
return r.changeRecord("INSERT", fqdn, value, ttl)
}
// CleanUp removes the TXT record matching the specified parameters
func (r *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
return r.changeRecord("REMOVE", fqdn, value, ttl)
}
func (r *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error {
// Find the zone for the given fqdn
- zone, err := acme.FindZoneByFqdn(fqdn, []string{r.nameserver})
+ zone, err := acmev2.FindZoneByFqdn(fqdn, []string{r.nameserver})
if err != nil {
return err
}
diff --git a/vendor/github.com/xenolf/lego/providers/dns/route53/route53.go b/vendor/github.com/xenolf/lego/providers/dns/route53/route53.go
index 934f0a2d4..82d13cef1 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/route53/route53.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/route53/route53.go
@@ -14,7 +14,7 @@ import (
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/route53"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
const (
@@ -22,7 +22,7 @@ const (
route53TTL = 10
)
-// DNSProvider implements the acme.ChallengeProvider interface
+// DNSProvider implements the acmev2.ChallengeProvider interface
type DNSProvider struct {
client *route53.Route53
hostedZoneID string
@@ -80,14 +80,14 @@ func NewDNSProvider() (*DNSProvider, error) {
// Present creates a TXT record using the specified parameters
func (r *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
value = `"` + value + `"`
return r.changeRecord("UPSERT", fqdn, value, route53TTL)
}
// CleanUp removes the TXT record matching the specified parameters
func (r *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, value, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, _ := acmev2.DNS01Record(domain, keyAuth)
value = `"` + value + `"`
return r.changeRecord("DELETE", fqdn, value, route53TTL)
}
@@ -119,7 +119,7 @@ func (r *DNSProvider) changeRecord(action, fqdn, value string, ttl int) error {
statusID := resp.ChangeInfo.Id
- return acme.WaitFor(120*time.Second, 4*time.Second, func() (bool, error) {
+ return acmev2.WaitFor(120*time.Second, 4*time.Second, func() (bool, error) {
reqParams := &route53.GetChangeInput{
Id: statusID,
}
@@ -139,14 +139,14 @@ func (r *DNSProvider) getHostedZoneID(fqdn string) (string, error) {
return r.hostedZoneID, nil
}
- authZone, err := acme.FindZoneByFqdn(fqdn, acme.RecursiveNameservers)
+ authZone, err := acmev2.FindZoneByFqdn(fqdn, acmev2.RecursiveNameservers)
if err != nil {
return "", err
}
// .DNSName should not have a trailing dot
reqParams := &route53.ListHostedZonesByNameInput{
- DNSName: aws.String(acme.UnFqdn(authZone)),
+ DNSName: aws.String(acmev2.UnFqdn(authZone)),
}
resp, err := r.client.ListHostedZonesByName(reqParams)
if err != nil {
diff --git a/vendor/github.com/xenolf/lego/providers/dns/vultr/vultr.go b/vendor/github.com/xenolf/lego/providers/dns/vultr/vultr.go
index bc2067579..6e0633264 100644
--- a/vendor/github.com/xenolf/lego/providers/dns/vultr/vultr.go
+++ b/vendor/github.com/xenolf/lego/providers/dns/vultr/vultr.go
@@ -9,10 +9,10 @@ import (
"strings"
vultr "github.com/JamesClonk/vultr/lib"
- "github.com/xenolf/lego/acme"
+ "github.com/xenolf/lego/acmev2"
)
-// DNSProvider is an implementation of the acme.ChallengeProvider interface.
+// DNSProvider is an implementation of the acmev2.ChallengeProvider interface.
type DNSProvider struct {
client *vultr.Client
}
@@ -40,7 +40,7 @@ func NewDNSProviderCredentials(apiKey string) (*DNSProvider, error) {
// Present creates a TXT record to fulfil the DNS-01 challenge.
func (c *DNSProvider) Present(domain, token, keyAuth string) error {
- fqdn, value, ttl := acme.DNS01Record(domain, keyAuth)
+ fqdn, value, ttl := acmev2.DNS01Record(domain, keyAuth)
zoneDomain, err := c.getHostedZone(domain)
if err != nil {
@@ -59,7 +59,7 @@ func (c *DNSProvider) Present(domain, token, keyAuth string) error {
// CleanUp removes the TXT record matching the specified parameters.
func (c *DNSProvider) CleanUp(domain, token, keyAuth string) error {
- fqdn, _, _ := acme.DNS01Record(domain, keyAuth)
+ fqdn, _, _ := acmev2.DNS01Record(domain, keyAuth)
zoneDomain, records, err := c.findTxtRecords(domain, fqdn)
if err != nil {
@@ -119,7 +119,7 @@ func (c *DNSProvider) findTxtRecords(domain, fqdn string) (string, []vultr.DNSRe
}
func (c *DNSProvider) extractRecordName(fqdn, domain string) string {
- name := acme.UnFqdn(fqdn)
+ name := acmev2.UnFqdn(fqdn)
if idx := strings.Index(name, "."+domain); idx != -1 {
return name[:idx]
}
diff --git a/vendor/gopkg.in/mattes/go-expand-tilde.v1/tilde.go b/vendor/gopkg.in/mattes/go-expand-tilde.v1/tilde.go
new file mode 100644
index 000000000..f3bed6090
--- /dev/null
+++ b/vendor/gopkg.in/mattes/go-expand-tilde.v1/tilde.go
@@ -0,0 +1,46 @@
+package tilde
+
+import (
+ "errors"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+)
+
+var (
+ ErrNoHome = errors.New("no home found")
+)
+
+func Expand(path string) (string, error) {
+ if !strings.HasPrefix(path, "~") {
+ return path, nil
+ }
+
+ home, err := Home()
+ if err != nil {
+ return "", err
+ }
+
+ return home + path[1:], nil
+}
+
+func Home() (string, error) {
+ home := ""
+
+ switch runtime.GOOS {
+ case "windows":
+ home = filepath.Join(os.Getenv("HomeDrive"), os.Getenv("HomePath"))
+ if home == "" {
+ home = os.Getenv("UserProfile")
+ }
+
+ default:
+ home = os.Getenv("HOME")
+ }
+
+ if home == "" {
+ return "", ErrNoHome
+ }
+ return home, nil
+}
diff --git a/vendor/gopkg.in/square/go-jose.v1/asymmetric.go b/vendor/gopkg.in/square/go-jose.v1/asymmetric.go
deleted file mode 100644
index cd36c21da..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/asymmetric.go
+++ /dev/null
@@ -1,520 +0,0 @@
-/*-
- * Copyright 2014 Square 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 jose
-
-import (
- "crypto"
- "crypto/aes"
- "crypto/ecdsa"
- "crypto/rand"
- "crypto/rsa"
- "crypto/sha1"
- "crypto/sha256"
- "errors"
- "fmt"
- "math/big"
-
- "gopkg.in/square/go-jose.v1/cipher"
-)
-
-// A generic RSA-based encrypter/verifier
-type rsaEncrypterVerifier struct {
- publicKey *rsa.PublicKey
-}
-
-// A generic RSA-based decrypter/signer
-type rsaDecrypterSigner struct {
- privateKey *rsa.PrivateKey
-}
-
-// A generic EC-based encrypter/verifier
-type ecEncrypterVerifier struct {
- publicKey *ecdsa.PublicKey
-}
-
-// A key generator for ECDH-ES
-type ecKeyGenerator struct {
- size int
- algID string
- publicKey *ecdsa.PublicKey
-}
-
-// A generic EC-based decrypter/signer
-type ecDecrypterSigner struct {
- privateKey *ecdsa.PrivateKey
-}
-
-// newRSARecipient creates recipientKeyInfo based on the given key.
-func newRSARecipient(keyAlg KeyAlgorithm, publicKey *rsa.PublicKey) (recipientKeyInfo, error) {
- // Verify that key management algorithm is supported by this encrypter
- switch keyAlg {
- case RSA1_5, RSA_OAEP, RSA_OAEP_256:
- default:
- return recipientKeyInfo{}, ErrUnsupportedAlgorithm
- }
-
- if publicKey == nil {
- return recipientKeyInfo{}, errors.New("invalid public key")
- }
-
- return recipientKeyInfo{
- keyAlg: keyAlg,
- keyEncrypter: &rsaEncrypterVerifier{
- publicKey: publicKey,
- },
- }, nil
-}
-
-// newRSASigner creates a recipientSigInfo based on the given key.
-func newRSASigner(sigAlg SignatureAlgorithm, privateKey *rsa.PrivateKey) (recipientSigInfo, error) {
- // Verify that key management algorithm is supported by this encrypter
- switch sigAlg {
- case RS256, RS384, RS512, PS256, PS384, PS512:
- default:
- return recipientSigInfo{}, ErrUnsupportedAlgorithm
- }
-
- if privateKey == nil {
- return recipientSigInfo{}, errors.New("invalid private key")
- }
-
- return recipientSigInfo{
- sigAlg: sigAlg,
- publicKey: &JsonWebKey{
- Key: &privateKey.PublicKey,
- },
- signer: &rsaDecrypterSigner{
- privateKey: privateKey,
- },
- }, nil
-}
-
-// newECDHRecipient creates recipientKeyInfo based on the given key.
-func newECDHRecipient(keyAlg KeyAlgorithm, publicKey *ecdsa.PublicKey) (recipientKeyInfo, error) {
- // Verify that key management algorithm is supported by this encrypter
- switch keyAlg {
- case ECDH_ES, ECDH_ES_A128KW, ECDH_ES_A192KW, ECDH_ES_A256KW:
- default:
- return recipientKeyInfo{}, ErrUnsupportedAlgorithm
- }
-
- if publicKey == nil || !publicKey.Curve.IsOnCurve(publicKey.X, publicKey.Y) {
- return recipientKeyInfo{}, errors.New("invalid public key")
- }
-
- return recipientKeyInfo{
- keyAlg: keyAlg,
- keyEncrypter: &ecEncrypterVerifier{
- publicKey: publicKey,
- },
- }, nil
-}
-
-// newECDSASigner creates a recipientSigInfo based on the given key.
-func newECDSASigner(sigAlg SignatureAlgorithm, privateKey *ecdsa.PrivateKey) (recipientSigInfo, error) {
- // Verify that key management algorithm is supported by this encrypter
- switch sigAlg {
- case ES256, ES384, ES512:
- default:
- return recipientSigInfo{}, ErrUnsupportedAlgorithm
- }
-
- if privateKey == nil {
- return recipientSigInfo{}, errors.New("invalid private key")
- }
-
- return recipientSigInfo{
- sigAlg: sigAlg,
- publicKey: &JsonWebKey{
- Key: &privateKey.PublicKey,
- },
- signer: &ecDecrypterSigner{
- privateKey: privateKey,
- },
- }, nil
-}
-
-// Encrypt the given payload and update the object.
-func (ctx rsaEncrypterVerifier) encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) {
- encryptedKey, err := ctx.encrypt(cek, alg)
- if err != nil {
- return recipientInfo{}, err
- }
-
- return recipientInfo{
- encryptedKey: encryptedKey,
- header: &rawHeader{},
- }, nil
-}
-
-// Encrypt the given payload. Based on the key encryption algorithm,
-// this will either use RSA-PKCS1v1.5 or RSA-OAEP (with SHA-1 or SHA-256).
-func (ctx rsaEncrypterVerifier) encrypt(cek []byte, alg KeyAlgorithm) ([]byte, error) {
- switch alg {
- case RSA1_5:
- return rsa.EncryptPKCS1v15(randReader, ctx.publicKey, cek)
- case RSA_OAEP:
- return rsa.EncryptOAEP(sha1.New(), randReader, ctx.publicKey, cek, []byte{})
- case RSA_OAEP_256:
- return rsa.EncryptOAEP(sha256.New(), randReader, ctx.publicKey, cek, []byte{})
- }
-
- return nil, ErrUnsupportedAlgorithm
-}
-
-// Decrypt the given payload and return the content encryption key.
-func (ctx rsaDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) {
- return ctx.decrypt(recipient.encryptedKey, KeyAlgorithm(headers.Alg), generator)
-}
-
-// Decrypt the given payload. Based on the key encryption algorithm,
-// this will either use RSA-PKCS1v1.5 or RSA-OAEP (with SHA-1 or SHA-256).
-func (ctx rsaDecrypterSigner) decrypt(jek []byte, alg KeyAlgorithm, generator keyGenerator) ([]byte, error) {
- // Note: The random reader on decrypt operations is only used for blinding,
- // so stubbing is meanlingless (hence the direct use of rand.Reader).
- switch alg {
- case RSA1_5:
- defer func() {
- // DecryptPKCS1v15SessionKey sometimes panics on an invalid payload
- // because of an index out of bounds error, which we want to ignore.
- // This has been fixed in Go 1.3.1 (released 2014/08/13), the recover()
- // only exists for preventing crashes with unpatched versions.
- // See: https://groups.google.com/forum/#!topic/golang-dev/7ihX6Y6kx9k
- // See: https://code.google.com/p/go/source/detail?r=58ee390ff31602edb66af41ed10901ec95904d33
- _ = recover()
- }()
-
- // Perform some input validation.
- keyBytes := ctx.privateKey.PublicKey.N.BitLen() / 8
- if keyBytes != len(jek) {
- // Input size is incorrect, the encrypted payload should always match
- // the size of the public modulus (e.g. using a 2048 bit key will
- // produce 256 bytes of output). Reject this since it's invalid input.
- return nil, ErrCryptoFailure
- }
-
- cek, _, err := generator.genKey()
- if err != nil {
- return nil, ErrCryptoFailure
- }
-
- // When decrypting an RSA-PKCS1v1.5 payload, we must take precautions to
- // prevent chosen-ciphertext attacks as described in RFC 3218, "Preventing
- // the Million Message Attack on Cryptographic Message Syntax". We are
- // therefore deliberately ignoring errors here.
- _ = rsa.DecryptPKCS1v15SessionKey(rand.Reader, ctx.privateKey, jek, cek)
-
- return cek, nil
- case RSA_OAEP:
- // Use rand.Reader for RSA blinding
- return rsa.DecryptOAEP(sha1.New(), rand.Reader, ctx.privateKey, jek, []byte{})
- case RSA_OAEP_256:
- // Use rand.Reader for RSA blinding
- return rsa.DecryptOAEP(sha256.New(), rand.Reader, ctx.privateKey, jek, []byte{})
- }
-
- return nil, ErrUnsupportedAlgorithm
-}
-
-// Sign the given payload
-func (ctx rsaDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) {
- var hash crypto.Hash
-
- switch alg {
- case RS256, PS256:
- hash = crypto.SHA256
- case RS384, PS384:
- hash = crypto.SHA384
- case RS512, PS512:
- hash = crypto.SHA512
- default:
- return Signature{}, ErrUnsupportedAlgorithm
- }
-
- hasher := hash.New()
-
- // According to documentation, Write() on hash never fails
- _, _ = hasher.Write(payload)
- hashed := hasher.Sum(nil)
-
- var out []byte
- var err error
-
- switch alg {
- case RS256, RS384, RS512:
- out, err = rsa.SignPKCS1v15(randReader, ctx.privateKey, hash, hashed)
- case PS256, PS384, PS512:
- out, err = rsa.SignPSS(randReader, ctx.privateKey, hash, hashed, &rsa.PSSOptions{
- SaltLength: rsa.PSSSaltLengthAuto,
- })
- }
-
- if err != nil {
- return Signature{}, err
- }
-
- return Signature{
- Signature: out,
- protected: &rawHeader{},
- }, nil
-}
-
-// Verify the given payload
-func (ctx rsaEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error {
- var hash crypto.Hash
-
- switch alg {
- case RS256, PS256:
- hash = crypto.SHA256
- case RS384, PS384:
- hash = crypto.SHA384
- case RS512, PS512:
- hash = crypto.SHA512
- default:
- return ErrUnsupportedAlgorithm
- }
-
- hasher := hash.New()
-
- // According to documentation, Write() on hash never fails
- _, _ = hasher.Write(payload)
- hashed := hasher.Sum(nil)
-
- switch alg {
- case RS256, RS384, RS512:
- return rsa.VerifyPKCS1v15(ctx.publicKey, hash, hashed, signature)
- case PS256, PS384, PS512:
- return rsa.VerifyPSS(ctx.publicKey, hash, hashed, signature, nil)
- }
-
- return ErrUnsupportedAlgorithm
-}
-
-// Encrypt the given payload and update the object.
-func (ctx ecEncrypterVerifier) encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) {
- switch alg {
- case ECDH_ES:
- // ECDH-ES mode doesn't wrap a key, the shared secret is used directly as the key.
- return recipientInfo{
- header: &rawHeader{},
- }, nil
- case ECDH_ES_A128KW, ECDH_ES_A192KW, ECDH_ES_A256KW:
- default:
- return recipientInfo{}, ErrUnsupportedAlgorithm
- }
-
- generator := ecKeyGenerator{
- algID: string(alg),
- publicKey: ctx.publicKey,
- }
-
- switch alg {
- case ECDH_ES_A128KW:
- generator.size = 16
- case ECDH_ES_A192KW:
- generator.size = 24
- case ECDH_ES_A256KW:
- generator.size = 32
- }
-
- kek, header, err := generator.genKey()
- if err != nil {
- return recipientInfo{}, err
- }
-
- block, err := aes.NewCipher(kek)
- if err != nil {
- return recipientInfo{}, err
- }
-
- jek, err := josecipher.KeyWrap(block, cek)
- if err != nil {
- return recipientInfo{}, err
- }
-
- return recipientInfo{
- encryptedKey: jek,
- header: &header,
- }, nil
-}
-
-// Get key size for EC key generator
-func (ctx ecKeyGenerator) keySize() int {
- return ctx.size
-}
-
-// Get a content encryption key for ECDH-ES
-func (ctx ecKeyGenerator) genKey() ([]byte, rawHeader, error) {
- priv, err := ecdsa.GenerateKey(ctx.publicKey.Curve, randReader)
- if err != nil {
- return nil, rawHeader{}, err
- }
-
- out := josecipher.DeriveECDHES(ctx.algID, []byte{}, []byte{}, priv, ctx.publicKey, ctx.size)
-
- headers := rawHeader{
- Epk: &JsonWebKey{
- Key: &priv.PublicKey,
- },
- }
-
- return out, headers, nil
-}
-
-// Decrypt the given payload and return the content encryption key.
-func (ctx ecDecrypterSigner) decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) {
- if headers.Epk == nil {
- return nil, errors.New("square/go-jose: missing epk header")
- }
-
- publicKey, ok := headers.Epk.Key.(*ecdsa.PublicKey)
- if publicKey == nil || !ok {
- return nil, errors.New("square/go-jose: invalid epk header")
- }
-
- if !ctx.privateKey.Curve.IsOnCurve(publicKey.X, publicKey.Y) {
- return nil, errors.New("square/go-jose: invalid public key in epk header")
- }
-
- apuData := headers.Apu.bytes()
- apvData := headers.Apv.bytes()
-
- deriveKey := func(algID string, size int) []byte {
- return josecipher.DeriveECDHES(algID, apuData, apvData, ctx.privateKey, publicKey, size)
- }
-
- var keySize int
-
- switch KeyAlgorithm(headers.Alg) {
- case ECDH_ES:
- // ECDH-ES uses direct key agreement, no key unwrapping necessary.
- return deriveKey(string(headers.Enc), generator.keySize()), nil
- case ECDH_ES_A128KW:
- keySize = 16
- case ECDH_ES_A192KW:
- keySize = 24
- case ECDH_ES_A256KW:
- keySize = 32
- default:
- return nil, ErrUnsupportedAlgorithm
- }
-
- key := deriveKey(headers.Alg, keySize)
- block, err := aes.NewCipher(key)
- if err != nil {
- return nil, err
- }
-
- return josecipher.KeyUnwrap(block, recipient.encryptedKey)
-}
-
-// Sign the given payload
-func (ctx ecDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) (Signature, error) {
- var expectedBitSize int
- var hash crypto.Hash
-
- switch alg {
- case ES256:
- expectedBitSize = 256
- hash = crypto.SHA256
- case ES384:
- expectedBitSize = 384
- hash = crypto.SHA384
- case ES512:
- expectedBitSize = 521
- hash = crypto.SHA512
- }
-
- curveBits := ctx.privateKey.Curve.Params().BitSize
- if expectedBitSize != curveBits {
- return Signature{}, fmt.Errorf("square/go-jose: expected %d bit key, got %d bits instead", expectedBitSize, curveBits)
- }
-
- hasher := hash.New()
-
- // According to documentation, Write() on hash never fails
- _, _ = hasher.Write(payload)
- hashed := hasher.Sum(nil)
-
- r, s, err := ecdsa.Sign(randReader, ctx.privateKey, hashed)
- if err != nil {
- return Signature{}, err
- }
-
- keyBytes := curveBits / 8
- if curveBits%8 > 0 {
- keyBytes += 1
- }
-
- // We serialize the outpus (r and s) into big-endian byte arrays and pad
- // them with zeros on the left to make sure the sizes work out. Both arrays
- // must be keyBytes long, and the output must be 2*keyBytes long.
- rBytes := r.Bytes()
- rBytesPadded := make([]byte, keyBytes)
- copy(rBytesPadded[keyBytes-len(rBytes):], rBytes)
-
- sBytes := s.Bytes()
- sBytesPadded := make([]byte, keyBytes)
- copy(sBytesPadded[keyBytes-len(sBytes):], sBytes)
-
- out := append(rBytesPadded, sBytesPadded...)
-
- return Signature{
- Signature: out,
- protected: &rawHeader{},
- }, nil
-}
-
-// Verify the given payload
-func (ctx ecEncrypterVerifier) verifyPayload(payload []byte, signature []byte, alg SignatureAlgorithm) error {
- var keySize int
- var hash crypto.Hash
-
- switch alg {
- case ES256:
- keySize = 32
- hash = crypto.SHA256
- case ES384:
- keySize = 48
- hash = crypto.SHA384
- case ES512:
- keySize = 66
- hash = crypto.SHA512
- default:
- return ErrUnsupportedAlgorithm
- }
-
- if len(signature) != 2*keySize {
- return fmt.Errorf("square/go-jose: invalid signature size, have %d bytes, wanted %d", len(signature), 2*keySize)
- }
-
- hasher := hash.New()
-
- // According to documentation, Write() on hash never fails
- _, _ = hasher.Write(payload)
- hashed := hasher.Sum(nil)
-
- r := big.NewInt(0).SetBytes(signature[:keySize])
- s := big.NewInt(0).SetBytes(signature[keySize:])
-
- match := ecdsa.Verify(ctx.publicKey, hashed, r, s)
- if !match {
- return errors.New("square/go-jose: ecdsa signature failed to verify")
- }
-
- return nil
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/cipher/cbc_hmac.go b/vendor/gopkg.in/square/go-jose.v1/cipher/cbc_hmac.go
deleted file mode 100644
index 126b85ce2..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/cipher/cbc_hmac.go
+++ /dev/null
@@ -1,196 +0,0 @@
-/*-
- * Copyright 2014 Square 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 josecipher
-
-import (
- "bytes"
- "crypto/cipher"
- "crypto/hmac"
- "crypto/sha256"
- "crypto/sha512"
- "crypto/subtle"
- "encoding/binary"
- "errors"
- "hash"
-)
-
-const (
- nonceBytes = 16
-)
-
-// NewCBCHMAC instantiates a new AEAD based on CBC+HMAC.
-func NewCBCHMAC(key []byte, newBlockCipher func([]byte) (cipher.Block, error)) (cipher.AEAD, error) {
- keySize := len(key) / 2
- integrityKey := key[:keySize]
- encryptionKey := key[keySize:]
-
- blockCipher, err := newBlockCipher(encryptionKey)
- if err != nil {
- return nil, err
- }
-
- var hash func() hash.Hash
- switch keySize {
- case 16:
- hash = sha256.New
- case 24:
- hash = sha512.New384
- case 32:
- hash = sha512.New
- }
-
- return &cbcAEAD{
- hash: hash,
- blockCipher: blockCipher,
- authtagBytes: keySize,
- integrityKey: integrityKey,
- }, nil
-}
-
-// An AEAD based on CBC+HMAC
-type cbcAEAD struct {
- hash func() hash.Hash
- authtagBytes int
- integrityKey []byte
- blockCipher cipher.Block
-}
-
-func (ctx *cbcAEAD) NonceSize() int {
- return nonceBytes
-}
-
-func (ctx *cbcAEAD) Overhead() int {
- // Maximum overhead is block size (for padding) plus auth tag length, where
- // the length of the auth tag is equivalent to the key size.
- return ctx.blockCipher.BlockSize() + ctx.authtagBytes
-}
-
-// Seal encrypts and authenticates the plaintext.
-func (ctx *cbcAEAD) Seal(dst, nonce, plaintext, data []byte) []byte {
- // Output buffer -- must take care not to mangle plaintext input.
- ciphertext := make([]byte, uint64(len(plaintext))+uint64(ctx.Overhead()))[:len(plaintext)]
- copy(ciphertext, plaintext)
- ciphertext = padBuffer(ciphertext, ctx.blockCipher.BlockSize())
-
- cbc := cipher.NewCBCEncrypter(ctx.blockCipher, nonce)
-
- cbc.CryptBlocks(ciphertext, ciphertext)
- authtag := ctx.computeAuthTag(data, nonce, ciphertext)
-
- ret, out := resize(dst, uint64(len(dst))+uint64(len(ciphertext))+uint64(len(authtag)))
- copy(out, ciphertext)
- copy(out[len(ciphertext):], authtag)
-
- return ret
-}
-
-// Open decrypts and authenticates the ciphertext.
-func (ctx *cbcAEAD) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
- if len(ciphertext) < ctx.authtagBytes {
- return nil, errors.New("square/go-jose: invalid ciphertext (too short)")
- }
-
- offset := len(ciphertext) - ctx.authtagBytes
- expectedTag := ctx.computeAuthTag(data, nonce, ciphertext[:offset])
- match := subtle.ConstantTimeCompare(expectedTag, ciphertext[offset:])
- if match != 1 {
- return nil, errors.New("square/go-jose: invalid ciphertext (auth tag mismatch)")
- }
-
- cbc := cipher.NewCBCDecrypter(ctx.blockCipher, nonce)
-
- // Make copy of ciphertext buffer, don't want to modify in place
- buffer := append([]byte{}, []byte(ciphertext[:offset])...)
-
- if len(buffer)%ctx.blockCipher.BlockSize() > 0 {
- return nil, errors.New("square/go-jose: invalid ciphertext (invalid length)")
- }
-
- cbc.CryptBlocks(buffer, buffer)
-
- // Remove padding
- plaintext, err := unpadBuffer(buffer, ctx.blockCipher.BlockSize())
- if err != nil {
- return nil, err
- }
-
- ret, out := resize(dst, uint64(len(dst))+uint64(len(plaintext)))
- copy(out, plaintext)
-
- return ret, nil
-}
-
-// Compute an authentication tag
-func (ctx *cbcAEAD) computeAuthTag(aad, nonce, ciphertext []byte) []byte {
- buffer := make([]byte, uint64(len(aad))+uint64(len(nonce))+uint64(len(ciphertext))+8)
- n := 0
- n += copy(buffer, aad)
- n += copy(buffer[n:], nonce)
- n += copy(buffer[n:], ciphertext)
- binary.BigEndian.PutUint64(buffer[n:], uint64(len(aad))*8)
-
- // According to documentation, Write() on hash.Hash never fails.
- hmac := hmac.New(ctx.hash, ctx.integrityKey)
- _, _ = hmac.Write(buffer)
-
- return hmac.Sum(nil)[:ctx.authtagBytes]
-}
-
-// resize ensures the the given slice has a capacity of at least n bytes.
-// If the capacity of the slice is less than n, a new slice is allocated
-// and the existing data will be copied.
-func resize(in []byte, n uint64) (head, tail []byte) {
- if uint64(cap(in)) >= n {
- head = in[:n]
- } else {
- head = make([]byte, n)
- copy(head, in)
- }
-
- tail = head[len(in):]
- return
-}
-
-// Apply padding
-func padBuffer(buffer []byte, blockSize int) []byte {
- missing := blockSize - (len(buffer) % blockSize)
- ret, out := resize(buffer, uint64(len(buffer))+uint64(missing))
- padding := bytes.Repeat([]byte{byte(missing)}, missing)
- copy(out, padding)
- return ret
-}
-
-// Remove padding
-func unpadBuffer(buffer []byte, blockSize int) ([]byte, error) {
- if len(buffer)%blockSize != 0 {
- return nil, errors.New("square/go-jose: invalid padding")
- }
-
- last := buffer[len(buffer)-1]
- count := int(last)
-
- if count == 0 || count > blockSize || count > len(buffer) {
- return nil, errors.New("square/go-jose: invalid padding")
- }
-
- padding := bytes.Repeat([]byte{last}, count)
- if !bytes.HasSuffix(buffer, padding) {
- return nil, errors.New("square/go-jose: invalid padding")
- }
-
- return buffer[:len(buffer)-count], nil
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/cipher/concat_kdf.go b/vendor/gopkg.in/square/go-jose.v1/cipher/concat_kdf.go
deleted file mode 100644
index f62c3bdba..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/cipher/concat_kdf.go
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * Copyright 2014 Square 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 josecipher
-
-import (
- "crypto"
- "encoding/binary"
- "hash"
- "io"
-)
-
-type concatKDF struct {
- z, info []byte
- i uint32
- cache []byte
- hasher hash.Hash
-}
-
-// NewConcatKDF builds a KDF reader based on the given inputs.
-func NewConcatKDF(hash crypto.Hash, z, algID, ptyUInfo, ptyVInfo, supPubInfo, supPrivInfo []byte) io.Reader {
- buffer := make([]byte, uint64(len(algID))+uint64(len(ptyUInfo))+uint64(len(ptyVInfo))+uint64(len(supPubInfo))+uint64(len(supPrivInfo)))
- n := 0
- n += copy(buffer, algID)
- n += copy(buffer[n:], ptyUInfo)
- n += copy(buffer[n:], ptyVInfo)
- n += copy(buffer[n:], supPubInfo)
- copy(buffer[n:], supPrivInfo)
-
- hasher := hash.New()
-
- return &concatKDF{
- z: z,
- info: buffer,
- hasher: hasher,
- cache: []byte{},
- i: 1,
- }
-}
-
-func (ctx *concatKDF) Read(out []byte) (int, error) {
- copied := copy(out, ctx.cache)
- ctx.cache = ctx.cache[copied:]
-
- for copied < len(out) {
- ctx.hasher.Reset()
-
- // Write on a hash.Hash never fails
- _ = binary.Write(ctx.hasher, binary.BigEndian, ctx.i)
- _, _ = ctx.hasher.Write(ctx.z)
- _, _ = ctx.hasher.Write(ctx.info)
-
- hash := ctx.hasher.Sum(nil)
- chunkCopied := copy(out[copied:], hash)
- copied += chunkCopied
- ctx.cache = hash[chunkCopied:]
-
- ctx.i++
- }
-
- return copied, nil
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/cipher/ecdh_es.go b/vendor/gopkg.in/square/go-jose.v1/cipher/ecdh_es.go
deleted file mode 100644
index f23d49e1f..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/cipher/ecdh_es.go
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * Copyright 2014 Square 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 josecipher
-
-import (
- "crypto"
- "crypto/ecdsa"
- "encoding/binary"
-)
-
-// DeriveECDHES derives a shared encryption key using ECDH/ConcatKDF as described in JWE/JWA.
-// It is an error to call this function with a private/public key that are not on the same
-// curve. Callers must ensure that the keys are valid before calling this function. Output
-// size may be at most 1<<16 bytes (64 KiB).
-func DeriveECDHES(alg string, apuData, apvData []byte, priv *ecdsa.PrivateKey, pub *ecdsa.PublicKey, size int) []byte {
- if size > 1<<16 {
- panic("ECDH-ES output size too large, must be less than 1<<16")
- }
-
- // algId, partyUInfo, partyVInfo inputs must be prefixed with the length
- algID := lengthPrefixed([]byte(alg))
- ptyUInfo := lengthPrefixed(apuData)
- ptyVInfo := lengthPrefixed(apvData)
-
- // suppPubInfo is the encoded length of the output size in bits
- supPubInfo := make([]byte, 4)
- binary.BigEndian.PutUint32(supPubInfo, uint32(size)*8)
-
- if !priv.PublicKey.Curve.IsOnCurve(pub.X, pub.Y) {
- panic("public key not on same curve as private key")
- }
-
- z, _ := priv.PublicKey.Curve.ScalarMult(pub.X, pub.Y, priv.D.Bytes())
- reader := NewConcatKDF(crypto.SHA256, z.Bytes(), algID, ptyUInfo, ptyVInfo, supPubInfo, []byte{})
-
- key := make([]byte, size)
-
- // Read on the KDF will never fail
- _, _ = reader.Read(key)
- return key
-}
-
-func lengthPrefixed(data []byte) []byte {
- out := make([]byte, len(data)+4)
- binary.BigEndian.PutUint32(out, uint32(len(data)))
- copy(out[4:], data)
- return out
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/cipher/key_wrap.go b/vendor/gopkg.in/square/go-jose.v1/cipher/key_wrap.go
deleted file mode 100644
index 1d36d5015..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/cipher/key_wrap.go
+++ /dev/null
@@ -1,109 +0,0 @@
-/*-
- * Copyright 2014 Square 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 josecipher
-
-import (
- "crypto/cipher"
- "crypto/subtle"
- "encoding/binary"
- "errors"
-)
-
-var defaultIV = []byte{0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6, 0xA6}
-
-// KeyWrap implements NIST key wrapping; it wraps a content encryption key (cek) with the given block cipher.
-func KeyWrap(block cipher.Block, cek []byte) ([]byte, error) {
- if len(cek)%8 != 0 {
- return nil, errors.New("square/go-jose: key wrap input must be 8 byte blocks")
- }
-
- n := len(cek) / 8
- r := make([][]byte, n)
-
- for i := range r {
- r[i] = make([]byte, 8)
- copy(r[i], cek[i*8:])
- }
-
- buffer := make([]byte, 16)
- tBytes := make([]byte, 8)
- copy(buffer, defaultIV)
-
- for t := 0; t < 6*n; t++ {
- copy(buffer[8:], r[t%n])
-
- block.Encrypt(buffer, buffer)
-
- binary.BigEndian.PutUint64(tBytes, uint64(t+1))
-
- for i := 0; i < 8; i++ {
- buffer[i] = buffer[i] ^ tBytes[i]
- }
- copy(r[t%n], buffer[8:])
- }
-
- out := make([]byte, (n+1)*8)
- copy(out, buffer[:8])
- for i := range r {
- copy(out[(i+1)*8:], r[i])
- }
-
- return out, nil
-}
-
-// KeyUnwrap implements NIST key unwrapping; it unwraps a content encryption key (cek) with the given block cipher.
-func KeyUnwrap(block cipher.Block, ciphertext []byte) ([]byte, error) {
- if len(ciphertext)%8 != 0 {
- return nil, errors.New("square/go-jose: key wrap input must be 8 byte blocks")
- }
-
- n := (len(ciphertext) / 8) - 1
- r := make([][]byte, n)
-
- for i := range r {
- r[i] = make([]byte, 8)
- copy(r[i], ciphertext[(i+1)*8:])
- }
-
- buffer := make([]byte, 16)
- tBytes := make([]byte, 8)
- copy(buffer[:8], ciphertext[:8])
-
- for t := 6*n - 1; t >= 0; t-- {
- binary.BigEndian.PutUint64(tBytes, uint64(t+1))
-
- for i := 0; i < 8; i++ {
- buffer[i] = buffer[i] ^ tBytes[i]
- }
- copy(buffer[8:], r[t%n])
-
- block.Decrypt(buffer, buffer)
-
- copy(r[t%n], buffer[8:])
- }
-
- if subtle.ConstantTimeCompare(buffer[:8], defaultIV) == 0 {
- return nil, errors.New("square/go-jose: failed to unwrap key")
- }
-
- out := make([]byte, n*8)
- for i := range r {
- copy(out[i*8:], r[i])
- }
-
- return out, nil
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/crypter.go b/vendor/gopkg.in/square/go-jose.v1/crypter.go
deleted file mode 100644
index b3bdaec80..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/crypter.go
+++ /dev/null
@@ -1,416 +0,0 @@
-/*-
- * Copyright 2014 Square 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 jose
-
-import (
- "crypto/ecdsa"
- "crypto/rsa"
- "errors"
- "fmt"
- "reflect"
-)
-
-// Encrypter represents an encrypter which produces an encrypted JWE object.
-type Encrypter interface {
- Encrypt(plaintext []byte) (*JsonWebEncryption, error)
- EncryptWithAuthData(plaintext []byte, aad []byte) (*JsonWebEncryption, error)
- SetCompression(alg CompressionAlgorithm)
-}
-
-// MultiEncrypter represents an encrypter which supports multiple recipients.
-type MultiEncrypter interface {
- Encrypt(plaintext []byte) (*JsonWebEncryption, error)
- EncryptWithAuthData(plaintext []byte, aad []byte) (*JsonWebEncryption, error)
- SetCompression(alg CompressionAlgorithm)
- AddRecipient(alg KeyAlgorithm, encryptionKey interface{}) error
-}
-
-// A generic content cipher
-type contentCipher interface {
- keySize() int
- encrypt(cek []byte, aad, plaintext []byte) (*aeadParts, error)
- decrypt(cek []byte, aad []byte, parts *aeadParts) ([]byte, error)
-}
-
-// A key generator (for generating/getting a CEK)
-type keyGenerator interface {
- keySize() int
- genKey() ([]byte, rawHeader, error)
-}
-
-// A generic key encrypter
-type keyEncrypter interface {
- encryptKey(cek []byte, alg KeyAlgorithm) (recipientInfo, error) // Encrypt a key
-}
-
-// A generic key decrypter
-type keyDecrypter interface {
- decryptKey(headers rawHeader, recipient *recipientInfo, generator keyGenerator) ([]byte, error) // Decrypt a key
-}
-
-// A generic encrypter based on the given key encrypter and content cipher.
-type genericEncrypter struct {
- contentAlg ContentEncryption
- compressionAlg CompressionAlgorithm
- cipher contentCipher
- recipients []recipientKeyInfo
- keyGenerator keyGenerator
-}
-
-type recipientKeyInfo struct {
- keyID string
- keyAlg KeyAlgorithm
- keyEncrypter keyEncrypter
-}
-
-// SetCompression sets a compression algorithm to be applied before encryption.
-func (ctx *genericEncrypter) SetCompression(compressionAlg CompressionAlgorithm) {
- ctx.compressionAlg = compressionAlg
-}
-
-// NewEncrypter creates an appropriate encrypter based on the key type
-func NewEncrypter(alg KeyAlgorithm, enc ContentEncryption, encryptionKey interface{}) (Encrypter, error) {
- encrypter := &genericEncrypter{
- contentAlg: enc,
- compressionAlg: NONE,
- recipients: []recipientKeyInfo{},
- cipher: getContentCipher(enc),
- }
-
- if encrypter.cipher == nil {
- return nil, ErrUnsupportedAlgorithm
- }
-
- var keyID string
- var rawKey interface{}
- switch encryptionKey := encryptionKey.(type) {
- case *JsonWebKey:
- keyID = encryptionKey.KeyID
- rawKey = encryptionKey.Key
- default:
- rawKey = encryptionKey
- }
-
- switch alg {
- case DIRECT:
- // Direct encryption mode must be treated differently
- if reflect.TypeOf(rawKey) != reflect.TypeOf([]byte{}) {
- return nil, ErrUnsupportedKeyType
- }
- encrypter.keyGenerator = staticKeyGenerator{
- key: rawKey.([]byte),
- }
- recipient, _ := newSymmetricRecipient(alg, rawKey.([]byte))
- if keyID != "" {
- recipient.keyID = keyID
- }
- encrypter.recipients = []recipientKeyInfo{recipient}
- return encrypter, nil
- case ECDH_ES:
- // ECDH-ES (w/o key wrapping) is similar to DIRECT mode
- typeOf := reflect.TypeOf(rawKey)
- if typeOf != reflect.TypeOf(&ecdsa.PublicKey{}) {
- return nil, ErrUnsupportedKeyType
- }
- encrypter.keyGenerator = ecKeyGenerator{
- size: encrypter.cipher.keySize(),
- algID: string(enc),
- publicKey: rawKey.(*ecdsa.PublicKey),
- }
- recipient, _ := newECDHRecipient(alg, rawKey.(*ecdsa.PublicKey))
- if keyID != "" {
- recipient.keyID = keyID
- }
- encrypter.recipients = []recipientKeyInfo{recipient}
- return encrypter, nil
- default:
- // Can just add a standard recipient
- encrypter.keyGenerator = randomKeyGenerator{
- size: encrypter.cipher.keySize(),
- }
- err := encrypter.AddRecipient(alg, encryptionKey)
- return encrypter, err
- }
-}
-
-// NewMultiEncrypter creates a multi-encrypter based on the given parameters
-func NewMultiEncrypter(enc ContentEncryption) (MultiEncrypter, error) {
- cipher := getContentCipher(enc)
-
- if cipher == nil {
- return nil, ErrUnsupportedAlgorithm
- }
-
- encrypter := &genericEncrypter{
- contentAlg: enc,
- compressionAlg: NONE,
- recipients: []recipientKeyInfo{},
- cipher: cipher,
- keyGenerator: randomKeyGenerator{
- size: cipher.keySize(),
- },
- }
-
- return encrypter, nil
-}
-
-func (ctx *genericEncrypter) AddRecipient(alg KeyAlgorithm, encryptionKey interface{}) (err error) {
- var recipient recipientKeyInfo
-
- switch alg {
- case DIRECT, ECDH_ES:
- return fmt.Errorf("square/go-jose: key algorithm '%s' not supported in multi-recipient mode", alg)
- }
-
- recipient, err = makeJWERecipient(alg, encryptionKey)
-
- if err == nil {
- ctx.recipients = append(ctx.recipients, recipient)
- }
- return err
-}
-
-func makeJWERecipient(alg KeyAlgorithm, encryptionKey interface{}) (recipientKeyInfo, error) {
- switch encryptionKey := encryptionKey.(type) {
- case *rsa.PublicKey:
- return newRSARecipient(alg, encryptionKey)
- case *ecdsa.PublicKey:
- return newECDHRecipient(alg, encryptionKey)
- case []byte:
- return newSymmetricRecipient(alg, encryptionKey)
- case *JsonWebKey:
- recipient, err := makeJWERecipient(alg, encryptionKey.Key)
- if err == nil && encryptionKey.KeyID != "" {
- recipient.keyID = encryptionKey.KeyID
- }
- return recipient, err
- default:
- return recipientKeyInfo{}, ErrUnsupportedKeyType
- }
-}
-
-// newDecrypter creates an appropriate decrypter based on the key type
-func newDecrypter(decryptionKey interface{}) (keyDecrypter, error) {
- switch decryptionKey := decryptionKey.(type) {
- case *rsa.PrivateKey:
- return &rsaDecrypterSigner{
- privateKey: decryptionKey,
- }, nil
- case *ecdsa.PrivateKey:
- return &ecDecrypterSigner{
- privateKey: decryptionKey,
- }, nil
- case []byte:
- return &symmetricKeyCipher{
- key: decryptionKey,
- }, nil
- case *JsonWebKey:
- return newDecrypter(decryptionKey.Key)
- default:
- return nil, ErrUnsupportedKeyType
- }
-}
-
-// Implementation of encrypt method producing a JWE object.
-func (ctx *genericEncrypter) Encrypt(plaintext []byte) (*JsonWebEncryption, error) {
- return ctx.EncryptWithAuthData(plaintext, nil)
-}
-
-// Implementation of encrypt method producing a JWE object.
-func (ctx *genericEncrypter) EncryptWithAuthData(plaintext, aad []byte) (*JsonWebEncryption, error) {
- obj := &JsonWebEncryption{}
- obj.aad = aad
-
- obj.protected = &rawHeader{
- Enc: ctx.contentAlg,
- }
- obj.recipients = make([]recipientInfo, len(ctx.recipients))
-
- if len(ctx.recipients) == 0 {
- return nil, fmt.Errorf("square/go-jose: no recipients to encrypt to")
- }
-
- cek, headers, err := ctx.keyGenerator.genKey()
- if err != nil {
- return nil, err
- }
-
- obj.protected.merge(&headers)
-
- for i, info := range ctx.recipients {
- recipient, err := info.keyEncrypter.encryptKey(cek, info.keyAlg)
- if err != nil {
- return nil, err
- }
-
- recipient.header.Alg = string(info.keyAlg)
- if info.keyID != "" {
- recipient.header.Kid = info.keyID
- }
- obj.recipients[i] = recipient
- }
-
- if len(ctx.recipients) == 1 {
- // Move per-recipient headers into main protected header if there's
- // only a single recipient.
- obj.protected.merge(obj.recipients[0].header)
- obj.recipients[0].header = nil
- }
-
- if ctx.compressionAlg != NONE {
- plaintext, err = compress(ctx.compressionAlg, plaintext)
- if err != nil {
- return nil, err
- }
-
- obj.protected.Zip = ctx.compressionAlg
- }
-
- authData := obj.computeAuthData()
- parts, err := ctx.cipher.encrypt(cek, authData, plaintext)
- if err != nil {
- return nil, err
- }
-
- obj.iv = parts.iv
- obj.ciphertext = parts.ciphertext
- obj.tag = parts.tag
-
- return obj, nil
-}
-
-// Decrypt and validate the object and return the plaintext. Note that this
-// function does not support multi-recipient, if you desire multi-recipient
-// decryption use DecryptMulti instead.
-func (obj JsonWebEncryption) Decrypt(decryptionKey interface{}) ([]byte, error) {
- headers := obj.mergedHeaders(nil)
-
- if len(obj.recipients) > 1 {
- return nil, errors.New("square/go-jose: too many recipients in payload; expecting only one")
- }
-
- if len(headers.Crit) > 0 {
- return nil, fmt.Errorf("square/go-jose: unsupported crit header")
- }
-
- decrypter, err := newDecrypter(decryptionKey)
- if err != nil {
- return nil, err
- }
-
- cipher := getContentCipher(headers.Enc)
- if cipher == nil {
- return nil, fmt.Errorf("square/go-jose: unsupported enc value '%s'", string(headers.Enc))
- }
-
- generator := randomKeyGenerator{
- size: cipher.keySize(),
- }
-
- parts := &aeadParts{
- iv: obj.iv,
- ciphertext: obj.ciphertext,
- tag: obj.tag,
- }
-
- authData := obj.computeAuthData()
-
- var plaintext []byte
- recipient := obj.recipients[0]
- recipientHeaders := obj.mergedHeaders(&recipient)
-
- cek, err := decrypter.decryptKey(recipientHeaders, &recipient, generator)
- if err == nil {
- // Found a valid CEK -- let's try to decrypt.
- plaintext, err = cipher.decrypt(cek, authData, parts)
- }
-
- if plaintext == nil {
- return nil, ErrCryptoFailure
- }
-
- // The "zip" header parameter may only be present in the protected header.
- if obj.protected.Zip != "" {
- plaintext, err = decompress(obj.protected.Zip, plaintext)
- }
-
- return plaintext, err
-}
-
-// DecryptMulti decrypts and validates the object and returns the plaintexts,
-// with support for multiple recipients. It returns the index of the recipient
-// for which the decryption was successful, the merged headers for that recipient,
-// and the plaintext.
-func (obj JsonWebEncryption) DecryptMulti(decryptionKey interface{}) (int, JoseHeader, []byte, error) {
- globalHeaders := obj.mergedHeaders(nil)
-
- if len(globalHeaders.Crit) > 0 {
- return -1, JoseHeader{}, nil, fmt.Errorf("square/go-jose: unsupported crit header")
- }
-
- decrypter, err := newDecrypter(decryptionKey)
- if err != nil {
- return -1, JoseHeader{}, nil, err
- }
-
- cipher := getContentCipher(globalHeaders.Enc)
- if cipher == nil {
- return -1, JoseHeader{}, nil, fmt.Errorf("square/go-jose: unsupported enc value '%s'", string(globalHeaders.Enc))
- }
-
- generator := randomKeyGenerator{
- size: cipher.keySize(),
- }
-
- parts := &aeadParts{
- iv: obj.iv,
- ciphertext: obj.ciphertext,
- tag: obj.tag,
- }
-
- authData := obj.computeAuthData()
-
- index := -1
- var plaintext []byte
- var headers rawHeader
-
- for i, recipient := range obj.recipients {
- recipientHeaders := obj.mergedHeaders(&recipient)
-
- cek, err := decrypter.decryptKey(recipientHeaders, &recipient, generator)
- if err == nil {
- // Found a valid CEK -- let's try to decrypt.
- plaintext, err = cipher.decrypt(cek, authData, parts)
- if err == nil {
- index = i
- headers = recipientHeaders
- break
- }
- }
- }
-
- if plaintext == nil || err != nil {
- return -1, JoseHeader{}, nil, ErrCryptoFailure
- }
-
- // The "zip" header parameter may only be present in the protected header.
- if obj.protected.Zip != "" {
- plaintext, err = decompress(obj.protected.Zip, plaintext)
- }
-
- return index, headers.sanitized(), plaintext, err
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/doc.go b/vendor/gopkg.in/square/go-jose.v1/doc.go
deleted file mode 100644
index b4cd1e989..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/doc.go
+++ /dev/null
@@ -1,26 +0,0 @@
-/*-
- * Copyright 2014 Square 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 jose aims to provide an implementation of the Javascript Object Signing
-and Encryption set of standards. For the moment, it mainly focuses on
-encryption and signing based on the JSON Web Encryption and JSON Web Signature
-standards. The library supports both the compact and full serialization
-formats, and has optional support for multiple recipients.
-
-*/
-package jose // import "gopkg.in/square/go-jose.v1"
diff --git a/vendor/gopkg.in/square/go-jose.v1/encoding.go b/vendor/gopkg.in/square/go-jose.v1/encoding.go
deleted file mode 100644
index dde0a42db..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/encoding.go
+++ /dev/null
@@ -1,193 +0,0 @@
-/*-
- * Copyright 2014 Square 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 jose
-
-import (
- "bytes"
- "compress/flate"
- "encoding/base64"
- "encoding/binary"
- "io"
- "math/big"
- "regexp"
- "strings"
-
- "gopkg.in/square/go-jose.v1/json"
-)
-
-var stripWhitespaceRegex = regexp.MustCompile("\\s")
-
-// Url-safe base64 encode that strips padding
-func base64URLEncode(data []byte) string {
- var result = base64.URLEncoding.EncodeToString(data)
- return strings.TrimRight(result, "=")
-}
-
-// Url-safe base64 decoder that adds padding
-func base64URLDecode(data string) ([]byte, error) {
- var missing = (4 - len(data)%4) % 4
- data += strings.Repeat("=", missing)
- return base64.URLEncoding.DecodeString(data)
-}
-
-// Helper function to serialize known-good objects.
-// Precondition: value is not a nil pointer.
-func mustSerializeJSON(value interface{}) []byte {
- out, err := json.Marshal(value)
- if err != nil {
- panic(err)
- }
- // We never want to serialize the top-level value "null," since it's not a
- // valid JOSE message. But if a caller passes in a nil pointer to this method,
- // MarshalJSON will happily serialize it as the top-level value "null". If
- // that value is then embedded in another operation, for instance by being
- // base64-encoded and fed as input to a signing algorithm
- // (https://github.com/square/go-jose/issues/22), the result will be
- // incorrect. Because this method is intended for known-good objects, and a nil
- // pointer is not a known-good object, we are free to panic in this case.
- // Note: It's not possible to directly check whether the data pointed at by an
- // interface is a nil pointer, so we do this hacky workaround.
- // https://groups.google.com/forum/#!topic/golang-nuts/wnH302gBa4I
- if string(out) == "null" {
- panic("Tried to serialize a nil pointer.")
- }
- return out
-}
-
-// Strip all newlines and whitespace
-func stripWhitespace(data string) string {
- return stripWhitespaceRegex.ReplaceAllString(data, "")
-}
-
-// Perform compression based on algorithm
-func compress(algorithm CompressionAlgorithm, input []byte) ([]byte, error) {
- switch algorithm {
- case DEFLATE:
- return deflate(input)
- default:
- return nil, ErrUnsupportedAlgorithm
- }
-}
-
-// Perform decompression based on algorithm
-func decompress(algorithm CompressionAlgorithm, input []byte) ([]byte, error) {
- switch algorithm {
- case DEFLATE:
- return inflate(input)
- default:
- return nil, ErrUnsupportedAlgorithm
- }
-}
-
-// Compress with DEFLATE
-func deflate(input []byte) ([]byte, error) {
- output := new(bytes.Buffer)
-
- // Writing to byte buffer, err is always nil
- writer, _ := flate.NewWriter(output, 1)
- _, _ = io.Copy(writer, bytes.NewBuffer(input))
-
- err := writer.Close()
- return output.Bytes(), err
-}
-
-// Decompress with DEFLATE
-func inflate(input []byte) ([]byte, error) {
- output := new(bytes.Buffer)
- reader := flate.NewReader(bytes.NewBuffer(input))
-
- _, err := io.Copy(output, reader)
- if err != nil {
- return nil, err
- }
-
- err = reader.Close()
- return output.Bytes(), err
-}
-
-// byteBuffer represents a slice of bytes that can be serialized to url-safe base64.
-type byteBuffer struct {
- data []byte
-}
-
-func newBuffer(data []byte) *byteBuffer {
- if data == nil {
- return nil
- }
- return &byteBuffer{
- data: data,
- }
-}
-
-func newFixedSizeBuffer(data []byte, length int) *byteBuffer {
- if len(data) > length {
- panic("square/go-jose: invalid call to newFixedSizeBuffer (len(data) > length)")
- }
- pad := make([]byte, length-len(data))
- return newBuffer(append(pad, data...))
-}
-
-func newBufferFromInt(num uint64) *byteBuffer {
- data := make([]byte, 8)
- binary.BigEndian.PutUint64(data, num)
- return newBuffer(bytes.TrimLeft(data, "\x00"))
-}
-
-func (b *byteBuffer) MarshalJSON() ([]byte, error) {
- return json.Marshal(b.base64())
-}
-
-func (b *byteBuffer) UnmarshalJSON(data []byte) error {
- var encoded string
- err := json.Unmarshal(data, &encoded)
- if err != nil {
- return err
- }
-
- if encoded == "" {
- return nil
- }
-
- decoded, err := base64URLDecode(encoded)
- if err != nil {
- return err
- }
-
- *b = *newBuffer(decoded)
-
- return nil
-}
-
-func (b *byteBuffer) base64() string {
- return base64URLEncode(b.data)
-}
-
-func (b *byteBuffer) bytes() []byte {
- // Handling nil here allows us to transparently handle nil slices when serializing.
- if b == nil {
- return nil
- }
- return b.data
-}
-
-func (b byteBuffer) bigInt() *big.Int {
- return new(big.Int).SetBytes(b.data)
-}
-
-func (b byteBuffer) toInt() int {
- return int(b.bigInt().Int64())
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/json/LICENSE b/vendor/gopkg.in/square/go-jose.v1/json/LICENSE
deleted file mode 100644
index 744875676..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/json/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2012 The Go Authors. 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.
- * Neither the name of Google Inc. nor the names of its
-contributors may 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
-OWNER 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/gopkg.in/square/go-jose.v1/json/decode.go b/vendor/gopkg.in/square/go-jose.v1/json/decode.go
deleted file mode 100644
index 37457e5a8..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/json/decode.go
+++ /dev/null
@@ -1,1183 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Represents JSON data structure using native Go types: booleans, floats,
-// strings, arrays, and maps.
-
-package json
-
-import (
- "bytes"
- "encoding"
- "encoding/base64"
- "errors"
- "fmt"
- "reflect"
- "runtime"
- "strconv"
- "unicode"
- "unicode/utf16"
- "unicode/utf8"
-)
-
-// Unmarshal parses the JSON-encoded data and stores the result
-// in the value pointed to by v.
-//
-// Unmarshal uses the inverse of the encodings that
-// Marshal uses, allocating maps, slices, and pointers as necessary,
-// with the following additional rules:
-//
-// To unmarshal JSON into a pointer, Unmarshal first handles the case of
-// the JSON being the JSON literal null. In that case, Unmarshal sets
-// the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into
-// the value pointed at by the pointer. If the pointer is nil, Unmarshal
-// allocates a new value for it to point to.
-//
-// To unmarshal JSON into a struct, Unmarshal matches incoming object
-// keys to the keys used by Marshal (either the struct field name or its tag),
-// preferring an exact match but also accepting a case-insensitive match.
-// Unmarshal will only set exported fields of the struct.
-//
-// To unmarshal JSON into an interface value,
-// Unmarshal stores one of these in the interface value:
-//
-// bool, for JSON booleans
-// float64, for JSON numbers
-// string, for JSON strings
-// []interface{}, for JSON arrays
-// map[string]interface{}, for JSON objects
-// nil for JSON null
-//
-// To unmarshal a JSON array into a slice, Unmarshal resets the slice length
-// to zero and then appends each element to the slice.
-// As a special case, to unmarshal an empty JSON array into a slice,
-// Unmarshal replaces the slice with a new empty slice.
-//
-// To unmarshal a JSON array into a Go array, Unmarshal decodes
-// JSON array elements into corresponding Go array elements.
-// If the Go array is smaller than the JSON array,
-// the additional JSON array elements are discarded.
-// If the JSON array is smaller than the Go array,
-// the additional Go array elements are set to zero values.
-//
-// To unmarshal a JSON object into a string-keyed map, Unmarshal first
-// establishes a map to use, If the map is nil, Unmarshal allocates a new map.
-// Otherwise Unmarshal reuses the existing map, keeping existing entries.
-// Unmarshal then stores key-value pairs from the JSON object into the map.
-//
-// If a JSON value is not appropriate for a given target type,
-// or if a JSON number overflows the target type, Unmarshal
-// skips that field and completes the unmarshaling as best it can.
-// If no more serious errors are encountered, Unmarshal returns
-// an UnmarshalTypeError describing the earliest such error.
-//
-// The JSON null value unmarshals into an interface, map, pointer, or slice
-// by setting that Go value to nil. Because null is often used in JSON to mean
-// ``not present,'' unmarshaling a JSON null into any other Go type has no effect
-// on the value and produces no error.
-//
-// When unmarshaling quoted strings, invalid UTF-8 or
-// invalid UTF-16 surrogate pairs are not treated as an error.
-// Instead, they are replaced by the Unicode replacement
-// character U+FFFD.
-//
-func Unmarshal(data []byte, v interface{}) error {
- // Check for well-formedness.
- // Avoids filling out half a data structure
- // before discovering a JSON syntax error.
- var d decodeState
- err := checkValid(data, &d.scan)
- if err != nil {
- return err
- }
-
- d.init(data)
- return d.unmarshal(v)
-}
-
-// Unmarshaler is the interface implemented by objects
-// that can unmarshal a JSON description of themselves.
-// The input can be assumed to be a valid encoding of
-// a JSON value. UnmarshalJSON must copy the JSON data
-// if it wishes to retain the data after returning.
-type Unmarshaler interface {
- UnmarshalJSON([]byte) error
-}
-
-// An UnmarshalTypeError describes a JSON value that was
-// not appropriate for a value of a specific Go type.
-type UnmarshalTypeError struct {
- Value string // description of JSON value - "bool", "array", "number -5"
- Type reflect.Type // type of Go value it could not be assigned to
- Offset int64 // error occurred after reading Offset bytes
-}
-
-func (e *UnmarshalTypeError) Error() string {
- return "json: cannot unmarshal " + e.Value + " into Go value of type " + e.Type.String()
-}
-
-// An UnmarshalFieldError describes a JSON object key that
-// led to an unexported (and therefore unwritable) struct field.
-// (No longer used; kept for compatibility.)
-type UnmarshalFieldError struct {
- Key string
- Type reflect.Type
- Field reflect.StructField
-}
-
-func (e *UnmarshalFieldError) Error() string {
- return "json: cannot unmarshal object key " + strconv.Quote(e.Key) + " into unexported field " + e.Field.Name + " of type " + e.Type.String()
-}
-
-// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
-// (The argument to Unmarshal must be a non-nil pointer.)
-type InvalidUnmarshalError struct {
- Type reflect.Type
-}
-
-func (e *InvalidUnmarshalError) Error() string {
- if e.Type == nil {
- return "json: Unmarshal(nil)"
- }
-
- if e.Type.Kind() != reflect.Ptr {
- return "json: Unmarshal(non-pointer " + e.Type.String() + ")"
- }
- return "json: Unmarshal(nil " + e.Type.String() + ")"
-}
-
-func (d *decodeState) unmarshal(v interface{}) (err error) {
- defer func() {
- if r := recover(); r != nil {
- if _, ok := r.(runtime.Error); ok {
- panic(r)
- }
- err = r.(error)
- }
- }()
-
- rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr || rv.IsNil() {
- return &InvalidUnmarshalError{reflect.TypeOf(v)}
- }
-
- d.scan.reset()
- // We decode rv not rv.Elem because the Unmarshaler interface
- // test must be applied at the top level of the value.
- d.value(rv)
- return d.savedError
-}
-
-// A Number represents a JSON number literal.
-type Number string
-
-// String returns the literal text of the number.
-func (n Number) String() string { return string(n) }
-
-// Float64 returns the number as a float64.
-func (n Number) Float64() (float64, error) {
- return strconv.ParseFloat(string(n), 64)
-}
-
-// Int64 returns the number as an int64.
-func (n Number) Int64() (int64, error) {
- return strconv.ParseInt(string(n), 10, 64)
-}
-
-// isValidNumber reports whether s is a valid JSON number literal.
-func isValidNumber(s string) bool {
- // This function implements the JSON numbers grammar.
- // See https://tools.ietf.org/html/rfc7159#section-6
- // and http://json.org/number.gif
-
- if s == "" {
- return false
- }
-
- // Optional -
- if s[0] == '-' {
- s = s[1:]
- if s == "" {
- return false
- }
- }
-
- // Digits
- switch {
- default:
- return false
-
- case s[0] == '0':
- s = s[1:]
-
- case '1' <= s[0] && s[0] <= '9':
- s = s[1:]
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- }
- }
-
- // . followed by 1 or more digits.
- if len(s) >= 2 && s[0] == '.' && '0' <= s[1] && s[1] <= '9' {
- s = s[2:]
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- }
- }
-
- // e or E followed by an optional - or + and
- // 1 or more digits.
- if len(s) >= 2 && (s[0] == 'e' || s[0] == 'E') {
- s = s[1:]
- if s[0] == '+' || s[0] == '-' {
- s = s[1:]
- if s == "" {
- return false
- }
- }
- for len(s) > 0 && '0' <= s[0] && s[0] <= '9' {
- s = s[1:]
- }
- }
-
- // Make sure we are at the end.
- return s == ""
-}
-
-// decodeState represents the state while decoding a JSON value.
-type decodeState struct {
- data []byte
- off int // read offset in data
- scan scanner
- nextscan scanner // for calls to nextValue
- savedError error
- useNumber bool
-}
-
-// errPhase is used for errors that should not happen unless
-// there is a bug in the JSON decoder or something is editing
-// the data slice while the decoder executes.
-var errPhase = errors.New("JSON decoder out of sync - data changing underfoot?")
-
-func (d *decodeState) init(data []byte) *decodeState {
- d.data = data
- d.off = 0
- d.savedError = nil
- return d
-}
-
-// error aborts the decoding by panicking with err.
-func (d *decodeState) error(err error) {
- panic(err)
-}
-
-// saveError saves the first err it is called with,
-// for reporting at the end of the unmarshal.
-func (d *decodeState) saveError(err error) {
- if d.savedError == nil {
- d.savedError = err
- }
-}
-
-// next cuts off and returns the next full JSON value in d.data[d.off:].
-// The next value is known to be an object or array, not a literal.
-func (d *decodeState) next() []byte {
- c := d.data[d.off]
- item, rest, err := nextValue(d.data[d.off:], &d.nextscan)
- if err != nil {
- d.error(err)
- }
- d.off = len(d.data) - len(rest)
-
- // Our scanner has seen the opening brace/bracket
- // and thinks we're still in the middle of the object.
- // invent a closing brace/bracket to get it out.
- if c == '{' {
- d.scan.step(&d.scan, '}')
- } else {
- d.scan.step(&d.scan, ']')
- }
-
- return item
-}
-
-// scanWhile processes bytes in d.data[d.off:] until it
-// receives a scan code not equal to op.
-// It updates d.off and returns the new scan code.
-func (d *decodeState) scanWhile(op int) int {
- var newOp int
- for {
- if d.off >= len(d.data) {
- newOp = d.scan.eof()
- d.off = len(d.data) + 1 // mark processed EOF with len+1
- } else {
- c := d.data[d.off]
- d.off++
- newOp = d.scan.step(&d.scan, c)
- }
- if newOp != op {
- break
- }
- }
- return newOp
-}
-
-// value decodes a JSON value from d.data[d.off:] into the value.
-// it updates d.off to point past the decoded value.
-func (d *decodeState) value(v reflect.Value) {
- if !v.IsValid() {
- _, rest, err := nextValue(d.data[d.off:], &d.nextscan)
- if err != nil {
- d.error(err)
- }
- d.off = len(d.data) - len(rest)
-
- // d.scan thinks we're still at the beginning of the item.
- // Feed in an empty string - the shortest, simplest value -
- // so that it knows we got to the end of the value.
- if d.scan.redo {
- // rewind.
- d.scan.redo = false
- d.scan.step = stateBeginValue
- }
- d.scan.step(&d.scan, '"')
- d.scan.step(&d.scan, '"')
-
- n := len(d.scan.parseState)
- if n > 0 && d.scan.parseState[n-1] == parseObjectKey {
- // d.scan thinks we just read an object key; finish the object
- d.scan.step(&d.scan, ':')
- d.scan.step(&d.scan, '"')
- d.scan.step(&d.scan, '"')
- d.scan.step(&d.scan, '}')
- }
-
- return
- }
-
- switch op := d.scanWhile(scanSkipSpace); op {
- default:
- d.error(errPhase)
-
- case scanBeginArray:
- d.array(v)
-
- case scanBeginObject:
- d.object(v)
-
- case scanBeginLiteral:
- d.literal(v)
- }
-}
-
-type unquotedValue struct{}
-
-// valueQuoted is like value but decodes a
-// quoted string literal or literal null into an interface value.
-// If it finds anything other than a quoted string literal or null,
-// valueQuoted returns unquotedValue{}.
-func (d *decodeState) valueQuoted() interface{} {
- switch op := d.scanWhile(scanSkipSpace); op {
- default:
- d.error(errPhase)
-
- case scanBeginArray:
- d.array(reflect.Value{})
-
- case scanBeginObject:
- d.object(reflect.Value{})
-
- case scanBeginLiteral:
- switch v := d.literalInterface().(type) {
- case nil, string:
- return v
- }
- }
- return unquotedValue{}
-}
-
-// indirect walks down v allocating pointers as needed,
-// until it gets to a non-pointer.
-// if it encounters an Unmarshaler, indirect stops and returns that.
-// if decodingNull is true, indirect stops at the last pointer so it can be set to nil.
-func (d *decodeState) indirect(v reflect.Value, decodingNull bool) (Unmarshaler, encoding.TextUnmarshaler, reflect.Value) {
- // If v is a named type and is addressable,
- // start with its address, so that if the type has pointer methods,
- // we find them.
- if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() {
- v = v.Addr()
- }
- for {
- // Load value from interface, but only if the result will be
- // usefully addressable.
- if v.Kind() == reflect.Interface && !v.IsNil() {
- e := v.Elem()
- if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) {
- v = e
- continue
- }
- }
-
- if v.Kind() != reflect.Ptr {
- break
- }
-
- if v.Elem().Kind() != reflect.Ptr && decodingNull && v.CanSet() {
- break
- }
- if v.IsNil() {
- v.Set(reflect.New(v.Type().Elem()))
- }
- if v.Type().NumMethod() > 0 {
- if u, ok := v.Interface().(Unmarshaler); ok {
- return u, nil, reflect.Value{}
- }
- if u, ok := v.Interface().(encoding.TextUnmarshaler); ok {
- return nil, u, reflect.Value{}
- }
- }
- v = v.Elem()
- }
- return nil, nil, v
-}
-
-// array consumes an array from d.data[d.off-1:], decoding into the value v.
-// the first byte of the array ('[') has been read already.
-func (d *decodeState) array(v reflect.Value) {
- // Check for unmarshaler.
- u, ut, pv := d.indirect(v, false)
- if u != nil {
- d.off--
- err := u.UnmarshalJSON(d.next())
- if err != nil {
- d.error(err)
- }
- return
- }
- if ut != nil {
- d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)})
- d.off--
- d.next()
- return
- }
-
- v = pv
-
- // Check type of target.
- switch v.Kind() {
- case reflect.Interface:
- if v.NumMethod() == 0 {
- // Decoding into nil interface? Switch to non-reflect code.
- v.Set(reflect.ValueOf(d.arrayInterface()))
- return
- }
- // Otherwise it's invalid.
- fallthrough
- default:
- d.saveError(&UnmarshalTypeError{"array", v.Type(), int64(d.off)})
- d.off--
- d.next()
- return
- case reflect.Array:
- case reflect.Slice:
- break
- }
-
- i := 0
- for {
- // Look ahead for ] - can only happen on first iteration.
- op := d.scanWhile(scanSkipSpace)
- if op == scanEndArray {
- break
- }
-
- // Back up so d.value can have the byte we just read.
- d.off--
- d.scan.undo(op)
-
- // Get element of array, growing if necessary.
- if v.Kind() == reflect.Slice {
- // Grow slice if necessary
- if i >= v.Cap() {
- newcap := v.Cap() + v.Cap()/2
- if newcap < 4 {
- newcap = 4
- }
- newv := reflect.MakeSlice(v.Type(), v.Len(), newcap)
- reflect.Copy(newv, v)
- v.Set(newv)
- }
- if i >= v.Len() {
- v.SetLen(i + 1)
- }
- }
-
- if i < v.Len() {
- // Decode into element.
- d.value(v.Index(i))
- } else {
- // Ran out of fixed array: skip.
- d.value(reflect.Value{})
- }
- i++
-
- // Next token must be , or ].
- op = d.scanWhile(scanSkipSpace)
- if op == scanEndArray {
- break
- }
- if op != scanArrayValue {
- d.error(errPhase)
- }
- }
-
- if i < v.Len() {
- if v.Kind() == reflect.Array {
- // Array. Zero the rest.
- z := reflect.Zero(v.Type().Elem())
- for ; i < v.Len(); i++ {
- v.Index(i).Set(z)
- }
- } else {
- v.SetLen(i)
- }
- }
- if i == 0 && v.Kind() == reflect.Slice {
- v.Set(reflect.MakeSlice(v.Type(), 0, 0))
- }
-}
-
-var nullLiteral = []byte("null")
-
-// object consumes an object from d.data[d.off-1:], decoding into the value v.
-// the first byte ('{') of the object has been read already.
-func (d *decodeState) object(v reflect.Value) {
- // Check for unmarshaler.
- u, ut, pv := d.indirect(v, false)
- if u != nil {
- d.off--
- err := u.UnmarshalJSON(d.next())
- if err != nil {
- d.error(err)
- }
- return
- }
- if ut != nil {
- d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)})
- d.off--
- d.next() // skip over { } in input
- return
- }
- v = pv
-
- // Decoding into nil interface? Switch to non-reflect code.
- if v.Kind() == reflect.Interface && v.NumMethod() == 0 {
- v.Set(reflect.ValueOf(d.objectInterface()))
- return
- }
-
- // Check type of target: struct or map[string]T
- switch v.Kind() {
- case reflect.Map:
- // map must have string kind
- t := v.Type()
- if t.Key().Kind() != reflect.String {
- d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)})
- d.off--
- d.next() // skip over { } in input
- return
- }
- if v.IsNil() {
- v.Set(reflect.MakeMap(t))
- }
- case reflect.Struct:
-
- default:
- d.saveError(&UnmarshalTypeError{"object", v.Type(), int64(d.off)})
- d.off--
- d.next() // skip over { } in input
- return
- }
-
- var mapElem reflect.Value
- keys := map[string]bool{}
-
- for {
- // Read opening " of string key or closing }.
- op := d.scanWhile(scanSkipSpace)
- if op == scanEndObject {
- // closing } - can only happen on first iteration.
- break
- }
- if op != scanBeginLiteral {
- d.error(errPhase)
- }
-
- // Read key.
- start := d.off - 1
- op = d.scanWhile(scanContinue)
- item := d.data[start : d.off-1]
- key, ok := unquote(item)
- if !ok {
- d.error(errPhase)
- }
-
- // Check for duplicate keys.
- _, ok = keys[key]
- if !ok {
- keys[key] = true
- } else {
- d.error(fmt.Errorf("json: duplicate key '%s' in object", key))
- }
-
- // Figure out field corresponding to key.
- var subv reflect.Value
- destring := false // whether the value is wrapped in a string to be decoded first
-
- if v.Kind() == reflect.Map {
- elemType := v.Type().Elem()
- if !mapElem.IsValid() {
- mapElem = reflect.New(elemType).Elem()
- } else {
- mapElem.Set(reflect.Zero(elemType))
- }
- subv = mapElem
- } else {
- var f *field
- fields := cachedTypeFields(v.Type())
- for i := range fields {
- ff := &fields[i]
- if bytes.Equal(ff.nameBytes, []byte(key)) {
- f = ff
- break
- }
- }
- if f != nil {
- subv = v
- destring = f.quoted
- for _, i := range f.index {
- if subv.Kind() == reflect.Ptr {
- if subv.IsNil() {
- subv.Set(reflect.New(subv.Type().Elem()))
- }
- subv = subv.Elem()
- }
- subv = subv.Field(i)
- }
- }
- }
-
- // Read : before value.
- if op == scanSkipSpace {
- op = d.scanWhile(scanSkipSpace)
- }
- if op != scanObjectKey {
- d.error(errPhase)
- }
-
- // Read value.
- if destring {
- switch qv := d.valueQuoted().(type) {
- case nil:
- d.literalStore(nullLiteral, subv, false)
- case string:
- d.literalStore([]byte(qv), subv, true)
- default:
- d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal unquoted value into %v", subv.Type()))
- }
- } else {
- d.value(subv)
- }
-
- // Write value back to map;
- // if using struct, subv points into struct already.
- if v.Kind() == reflect.Map {
- kv := reflect.ValueOf(key).Convert(v.Type().Key())
- v.SetMapIndex(kv, subv)
- }
-
- // Next token must be , or }.
- op = d.scanWhile(scanSkipSpace)
- if op == scanEndObject {
- break
- }
- if op != scanObjectValue {
- d.error(errPhase)
- }
- }
-}
-
-// literal consumes a literal from d.data[d.off-1:], decoding into the value v.
-// The first byte of the literal has been read already
-// (that's how the caller knows it's a literal).
-func (d *decodeState) literal(v reflect.Value) {
- // All bytes inside literal return scanContinue op code.
- start := d.off - 1
- op := d.scanWhile(scanContinue)
-
- // Scan read one byte too far; back up.
- d.off--
- d.scan.undo(op)
-
- d.literalStore(d.data[start:d.off], v, false)
-}
-
-// convertNumber converts the number literal s to a float64 or a Number
-// depending on the setting of d.useNumber.
-func (d *decodeState) convertNumber(s string) (interface{}, error) {
- if d.useNumber {
- return Number(s), nil
- }
- f, err := strconv.ParseFloat(s, 64)
- if err != nil {
- return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)}
- }
- return f, nil
-}
-
-var numberType = reflect.TypeOf(Number(""))
-
-// literalStore decodes a literal stored in item into v.
-//
-// fromQuoted indicates whether this literal came from unwrapping a
-// string from the ",string" struct tag option. this is used only to
-// produce more helpful error messages.
-func (d *decodeState) literalStore(item []byte, v reflect.Value, fromQuoted bool) {
- // Check for unmarshaler.
- if len(item) == 0 {
- //Empty string given
- d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- return
- }
- wantptr := item[0] == 'n' // null
- u, ut, pv := d.indirect(v, wantptr)
- if u != nil {
- err := u.UnmarshalJSON(item)
- if err != nil {
- d.error(err)
- }
- return
- }
- if ut != nil {
- if item[0] != '"' {
- if fromQuoted {
- d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)})
- }
- return
- }
- s, ok := unquoteBytes(item)
- if !ok {
- if fromQuoted {
- d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.error(errPhase)
- }
- }
- err := ut.UnmarshalText(s)
- if err != nil {
- d.error(err)
- }
- return
- }
-
- v = pv
-
- switch c := item[0]; c {
- case 'n': // null
- switch v.Kind() {
- case reflect.Interface, reflect.Ptr, reflect.Map, reflect.Slice:
- v.Set(reflect.Zero(v.Type()))
- // otherwise, ignore null for primitives/string
- }
- case 't', 'f': // true, false
- value := c == 't'
- switch v.Kind() {
- default:
- if fromQuoted {
- d.saveError(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)})
- }
- case reflect.Bool:
- v.SetBool(value)
- case reflect.Interface:
- if v.NumMethod() == 0 {
- v.Set(reflect.ValueOf(value))
- } else {
- d.saveError(&UnmarshalTypeError{"bool", v.Type(), int64(d.off)})
- }
- }
-
- case '"': // string
- s, ok := unquoteBytes(item)
- if !ok {
- if fromQuoted {
- d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.error(errPhase)
- }
- }
- switch v.Kind() {
- default:
- d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)})
- case reflect.Slice:
- if v.Type().Elem().Kind() != reflect.Uint8 {
- d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)})
- break
- }
- b := make([]byte, base64.StdEncoding.DecodedLen(len(s)))
- n, err := base64.StdEncoding.Decode(b, s)
- if err != nil {
- d.saveError(err)
- break
- }
- v.SetBytes(b[:n])
- case reflect.String:
- v.SetString(string(s))
- case reflect.Interface:
- if v.NumMethod() == 0 {
- v.Set(reflect.ValueOf(string(s)))
- } else {
- d.saveError(&UnmarshalTypeError{"string", v.Type(), int64(d.off)})
- }
- }
-
- default: // number
- if c != '-' && (c < '0' || c > '9') {
- if fromQuoted {
- d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.error(errPhase)
- }
- }
- s := string(item)
- switch v.Kind() {
- default:
- if v.Kind() == reflect.String && v.Type() == numberType {
- v.SetString(s)
- if !isValidNumber(s) {
- d.error(fmt.Errorf("json: invalid number literal, trying to unmarshal %q into Number", item))
- }
- break
- }
- if fromQuoted {
- d.error(fmt.Errorf("json: invalid use of ,string struct tag, trying to unmarshal %q into %v", item, v.Type()))
- } else {
- d.error(&UnmarshalTypeError{"number", v.Type(), int64(d.off)})
- }
- case reflect.Interface:
- n, err := d.convertNumber(s)
- if err != nil {
- d.saveError(err)
- break
- }
- if v.NumMethod() != 0 {
- d.saveError(&UnmarshalTypeError{"number", v.Type(), int64(d.off)})
- break
- }
- v.Set(reflect.ValueOf(n))
-
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- n, err := strconv.ParseInt(s, 10, 64)
- if err != nil || v.OverflowInt(n) {
- d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)})
- break
- }
- v.SetInt(n)
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- n, err := strconv.ParseUint(s, 10, 64)
- if err != nil || v.OverflowUint(n) {
- d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)})
- break
- }
- v.SetUint(n)
-
- case reflect.Float32, reflect.Float64:
- n, err := strconv.ParseFloat(s, v.Type().Bits())
- if err != nil || v.OverflowFloat(n) {
- d.saveError(&UnmarshalTypeError{"number " + s, v.Type(), int64(d.off)})
- break
- }
- v.SetFloat(n)
- }
- }
-}
-
-// The xxxInterface routines build up a value to be stored
-// in an empty interface. They are not strictly necessary,
-// but they avoid the weight of reflection in this common case.
-
-// valueInterface is like value but returns interface{}
-func (d *decodeState) valueInterface() interface{} {
- switch d.scanWhile(scanSkipSpace) {
- default:
- d.error(errPhase)
- panic("unreachable")
- case scanBeginArray:
- return d.arrayInterface()
- case scanBeginObject:
- return d.objectInterface()
- case scanBeginLiteral:
- return d.literalInterface()
- }
-}
-
-// arrayInterface is like array but returns []interface{}.
-func (d *decodeState) arrayInterface() []interface{} {
- var v = make([]interface{}, 0)
- for {
- // Look ahead for ] - can only happen on first iteration.
- op := d.scanWhile(scanSkipSpace)
- if op == scanEndArray {
- break
- }
-
- // Back up so d.value can have the byte we just read.
- d.off--
- d.scan.undo(op)
-
- v = append(v, d.valueInterface())
-
- // Next token must be , or ].
- op = d.scanWhile(scanSkipSpace)
- if op == scanEndArray {
- break
- }
- if op != scanArrayValue {
- d.error(errPhase)
- }
- }
- return v
-}
-
-// objectInterface is like object but returns map[string]interface{}.
-func (d *decodeState) objectInterface() map[string]interface{} {
- m := make(map[string]interface{})
- keys := map[string]bool{}
-
- for {
- // Read opening " of string key or closing }.
- op := d.scanWhile(scanSkipSpace)
- if op == scanEndObject {
- // closing } - can only happen on first iteration.
- break
- }
- if op != scanBeginLiteral {
- d.error(errPhase)
- }
-
- // Read string key.
- start := d.off - 1
- op = d.scanWhile(scanContinue)
- item := d.data[start : d.off-1]
- key, ok := unquote(item)
- if !ok {
- d.error(errPhase)
- }
-
- // Check for duplicate keys.
- _, ok = keys[key]
- if !ok {
- keys[key] = true
- } else {
- d.error(fmt.Errorf("json: duplicate key '%s' in object", key))
- }
-
- // Read : before value.
- if op == scanSkipSpace {
- op = d.scanWhile(scanSkipSpace)
- }
- if op != scanObjectKey {
- d.error(errPhase)
- }
-
- // Read value.
- m[key] = d.valueInterface()
-
- // Next token must be , or }.
- op = d.scanWhile(scanSkipSpace)
- if op == scanEndObject {
- break
- }
- if op != scanObjectValue {
- d.error(errPhase)
- }
- }
- return m
-}
-
-// literalInterface is like literal but returns an interface value.
-func (d *decodeState) literalInterface() interface{} {
- // All bytes inside literal return scanContinue op code.
- start := d.off - 1
- op := d.scanWhile(scanContinue)
-
- // Scan read one byte too far; back up.
- d.off--
- d.scan.undo(op)
- item := d.data[start:d.off]
-
- switch c := item[0]; c {
- case 'n': // null
- return nil
-
- case 't', 'f': // true, false
- return c == 't'
-
- case '"': // string
- s, ok := unquote(item)
- if !ok {
- d.error(errPhase)
- }
- return s
-
- default: // number
- if c != '-' && (c < '0' || c > '9') {
- d.error(errPhase)
- }
- n, err := d.convertNumber(string(item))
- if err != nil {
- d.saveError(err)
- }
- return n
- }
-}
-
-// getu4 decodes \uXXXX from the beginning of s, returning the hex value,
-// or it returns -1.
-func getu4(s []byte) rune {
- if len(s) < 6 || s[0] != '\\' || s[1] != 'u' {
- return -1
- }
- r, err := strconv.ParseUint(string(s[2:6]), 16, 64)
- if err != nil {
- return -1
- }
- return rune(r)
-}
-
-// unquote converts a quoted JSON string literal s into an actual string t.
-// The rules are different than for Go, so cannot use strconv.Unquote.
-func unquote(s []byte) (t string, ok bool) {
- s, ok = unquoteBytes(s)
- t = string(s)
- return
-}
-
-func unquoteBytes(s []byte) (t []byte, ok bool) {
- if len(s) < 2 || s[0] != '"' || s[len(s)-1] != '"' {
- return
- }
- s = s[1 : len(s)-1]
-
- // Check for unusual characters. If there are none,
- // then no unquoting is needed, so return a slice of the
- // original bytes.
- r := 0
- for r < len(s) {
- c := s[r]
- if c == '\\' || c == '"' || c < ' ' {
- break
- }
- if c < utf8.RuneSelf {
- r++
- continue
- }
- rr, size := utf8.DecodeRune(s[r:])
- if rr == utf8.RuneError && size == 1 {
- break
- }
- r += size
- }
- if r == len(s) {
- return s, true
- }
-
- b := make([]byte, len(s)+2*utf8.UTFMax)
- w := copy(b, s[0:r])
- for r < len(s) {
- // Out of room? Can only happen if s is full of
- // malformed UTF-8 and we're replacing each
- // byte with RuneError.
- if w >= len(b)-2*utf8.UTFMax {
- nb := make([]byte, (len(b)+utf8.UTFMax)*2)
- copy(nb, b[0:w])
- b = nb
- }
- switch c := s[r]; {
- case c == '\\':
- r++
- if r >= len(s) {
- return
- }
- switch s[r] {
- default:
- return
- case '"', '\\', '/', '\'':
- b[w] = s[r]
- r++
- w++
- case 'b':
- b[w] = '\b'
- r++
- w++
- case 'f':
- b[w] = '\f'
- r++
- w++
- case 'n':
- b[w] = '\n'
- r++
- w++
- case 'r':
- b[w] = '\r'
- r++
- w++
- case 't':
- b[w] = '\t'
- r++
- w++
- case 'u':
- r--
- rr := getu4(s[r:])
- if rr < 0 {
- return
- }
- r += 6
- if utf16.IsSurrogate(rr) {
- rr1 := getu4(s[r:])
- if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar {
- // A valid pair; consume.
- r += 6
- w += utf8.EncodeRune(b[w:], dec)
- break
- }
- // Invalid surrogate; fall back to replacement rune.
- rr = unicode.ReplacementChar
- }
- w += utf8.EncodeRune(b[w:], rr)
- }
-
- // Quote, control characters are invalid.
- case c == '"', c < ' ':
- return
-
- // ASCII
- case c < utf8.RuneSelf:
- b[w] = c
- r++
- w++
-
- // Coerce to well-formed UTF-8.
- default:
- rr, size := utf8.DecodeRune(s[r:])
- r += size
- w += utf8.EncodeRune(b[w:], rr)
- }
- }
- return b[0:w], true
-}
diff --git a/vendor/gopkg.in/square/go-jose.v1/json/encode.go b/vendor/gopkg.in/square/go-jose.v1/json/encode.go
deleted file mode 100644
index 1dae8bb7c..000000000
--- a/vendor/gopkg.in/square/go-jose.v1/json/encode.go
+++ /dev/null
@@ -1,1197 +0,0 @@
-// Copyright 2010 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Package json implements encoding and decoding of JSON objects as defined in
-// RFC 4627. The mapping between JSON objects and Go values is described
-// in the documentation for the Marshal and Unmarshal functions.
-//
-// See "JSON and Go" for an introduction to this package:
-// https://golang.org/doc/articles/json_and_go.html
-package json
-
-import (
- "bytes"
- "encoding"
- "encoding/base64"
- "fmt"
- "math"
- "reflect"
- "runtime"
- "sort"
- "strconv"
- "strings"
- "sync"
- "unicode"
- "unicode/utf8"
-)
-
-// Marshal returns the JSON encoding of v.
-//
-// Marshal traverses the value v recursively.
-// If an encountered value implements the Marshaler interface
-// and is not a nil pointer, Marshal calls its MarshalJSON method
-// to produce JSON. If no MarshalJSON method is present but the
-// value implements encoding.TextMarshaler instead, Marshal calls
-// its MarshalText method.
-// The nil pointer exception is not strictly necessary
-// but mimics a similar, necessary exception in the behavior of
-// UnmarshalJSON.
-//
-// Otherwise, Marshal uses the following type-dependent default encodings:
-//
-// Boolean values encode as JSON booleans.
-//
-// Floating point, integer, and Number values encode as JSON numbers.
-//
-// String values encode as JSON strings coerced to valid UTF-8,
-// replacing invalid bytes with the Unicode replacement rune.
-// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e"
-// to keep some browsers from misinterpreting JSON output as HTML.
-// Ampersand "&" is also escaped to "\u0026" for the same reason.
-//
-// Array and slice values encode as JSON arrays, except that
-// []byte encodes as a base64-encoded string, and a nil slice
-// encodes as the null JSON object.
-//
-// Struct values encode as JSON objects. Each exported struct field
-// becomes a member of the object unless
-// - the field's tag is "-", or
-// - the field is empty and its tag specifies the "omitempty" option.
-// The empty values are false, 0, any
-// nil pointer or interface value, and any array, slice, map, or string of
-// length zero. The object's default key string is the struct field name
-// but can be specified in the struct field's tag value. The "json" key in
-// the struct field's tag value is the key name, followed by an optional comma
-// and options. Examples:
-//
-// // Field is ignored by this package.
-// Field int `json:"-"`
-//
-// // Field appears in JSON as key "myName".
-// Field int `json:"myName"`
-//
-// // Field appears in JSON as key "myName" and
-// // the field is omitted from the object if its value is empty,
-// // as defined above.
-// Field int `json:"myName,omitempty"`
-//
-// // Field appears in JSON as key "Field" (the default), but
-// // the field is skipped if empty.
-// // Note the leading comma.
-// Field int `json:",omitempty"`
-//
-// The "string" option signals that a field is stored as JSON inside a
-// JSON-encoded string. It applies only to fields of string, floating point,
-// integer, or boolean types. This extra level of encoding is sometimes used
-// when communicating with JavaScript programs:
-//
-// Int64String int64 `json:",string"`
-//
-// The key name will be used if it's a non-empty string consisting of
-// only Unicode letters, digits, dollar signs, percent signs, hyphens,
-// underscores and slashes.
-//
-// Anonymous struct fields are usually marshaled as if their inner exported fields
-// were fields in the outer struct, subject to the usual Go visibility rules amended
-// as described in the next paragraph.
-// An anonymous struct field with a name given in its JSON tag is treated as
-// having that name, rather than being anonymous.
-// An anonymous struct field of interface type is treated the same as having
-// that type as its name, rather than being anonymous.
-//
-// The Go visibility rules for struct fields are amended for JSON when
-// deciding which field to marshal or unmarshal. If there are
-// multiple fields at the same level, and that level is the least
-// nested (and would therefore be the nesting level selected by the
-// usual Go rules), the following extra rules apply:
-//
-// 1) Of those fields, if any are JSON-tagged, only tagged fields are considered,
-// even if there are multiple untagged fields that would otherwise conflict.
-// 2) If there is exactly one field (tagged or not according to the first rule), that is selected.
-// 3) Otherwise there are multiple fields, and all are ignored; no error occurs.
-//
-// Handling of anonymous struct fields is new in Go 1.1.
-// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of
-// an anonymous struct field in both current and earlier versions, give the field
-// a JSON tag of "-".
-//
-// Map values encode as JSON objects.
-// The map's key type must be string; the map keys are used as JSON object
-// keys, subject to the UTF-8 coercion described for string values above.
-//
-// Pointer values encode as the value pointed to.
-// A nil pointer encodes as the null JSON object.
-//
-// Interface values encode as the value contained in the interface.
-// A nil interface value encodes as the null JSON object.
-//
-// Channel, complex, and function values cannot be encoded in JSON.
-// Attempting to encode such a value causes Marshal to return
-// an UnsupportedTypeError.
-//
-// JSON cannot represent cyclic data structures and Marshal does not
-// handle them. Passing cyclic structures to Marshal will result in
-// an infinite recursion.
-//
-func Marshal(v interface{}) ([]byte, error) {
- e := &encodeState{}
- err := e.marshal(v)
- if err != nil {
- return nil, err
- }
- return e.Bytes(), nil
-}
-
-// MarshalIndent is like Marshal but applies Indent to format the output.
-func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
- b, err := Marshal(v)
- if err != nil {
- return nil, err
- }
- var buf bytes.Buffer
- err = Indent(&buf, b, prefix, indent)
- if err != nil {
- return nil, err
- }
- return buf.Bytes(), nil
-}
-
-// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
-// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
-// so that the JSON will be safe to embed inside HTML