| 1 | package lightsailscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | "github.com/aws/aws-sdk-go-v2/awsscip-go gomod github.com/aws/aws-sdk-go-v2 v1.41.6 `github.com/aws/aws-sdk-go-v2/aws`/" |
| 7 | awsconfigscip-go gomod github.com/aws/aws-sdk-go-v2/config v1.32.16 `github.com/aws/aws-sdk-go-v2/config`/ "github.com/aws/aws-sdk-go-v2/configscip-go gomod github.com/aws/aws-sdk-go-v2/config v1.32.16 `github.com/aws/aws-sdk-go-v2/config`/" |
| 8 | "github.com/aws/aws-sdk-go-v2/service/lightsailscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/" |
| 9 | "github.com/go-acme/lego/v4/providers/dns/internal/ptrscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/ptr`/" |
| 10 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 11 | ) |
| 12 | |
| 13 | func TestLiveTTLscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/TestLiveTTL().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 14 | if !envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/envTest..IsLiveTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#IsLiveTest().() { |
| 15 | t.Skipscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skip().("skipping live test") |
| 16 | } |
| 17 | |
| 18 | envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/envTest..RestoreEnvscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#RestoreEnv().() |
| 19 | |
| 20 | provider, err := NewDNSProviderscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/NewDNSProvider().() |
| 21 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 22 | |
| 23 | domain := envTestscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/envTest..GetDomainscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/platform/tester`/EnvTest#GetDomain().() |
| 24 | |
| 25 | err = provider.Presentscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/DNSProvider#Present().(domain, "foo", "bar") |
| 26 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 27 | |
| 28 | // we need a separate Lightsail client here as the one in the DNS provider is unexported. |
| 29 | fqdn := "_acme-challenge." + domain |
| 30 | |
| 31 | ctx := t.Contextscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Context().() |
| 32 | |
| 33 | cfg, err := awsconfigscip-go gomod github.com/aws/aws-sdk-go-v2/config v1.32.16 `github.com/aws/aws-sdk-go-v2/config`/.LoadDefaultConfigscip-go gomod github.com/aws/aws-sdk-go-v2/config v1.32.16 `github.com/aws/aws-sdk-go-v2/config`/LoadDefaultConfig().(ctx) |
| 34 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 35 | |
| 36 | svc := lightsailscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/.NewFromConfigscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/NewFromConfig().(cfg) |
| 37 | |
| 38 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 39 | |
| 40 | defer func() { |
| 41 | errC := provider.CleanUpscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/lightsail`/DNSProvider#CleanUp().(domain, "foo", "bar") |
| 42 | if errC != nil { |
| 43 | t.Logscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Log().(errC) |
| 44 | } |
| 45 | }() |
| 46 | |
| 47 | params := &lightsailscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/.GetDomainInputscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/GetDomainInput#{ |
| 48 | DomainNamescip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/GetDomainInput#DomainName.: awsscip-go gomod github.com/aws/aws-sdk-go-v2 v1.41.6 `github.com/aws/aws-sdk-go-v2/aws`/.Stringscip-go gomod github.com/aws/aws-sdk-go-v2 v1.41.6 `github.com/aws/aws-sdk-go-v2/aws`/String().(domain), |
| 49 | } |
| 50 | |
| 51 | resp, err := svc.GetDomainscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/Client#GetDomain().(ctx, params) |
| 52 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 53 | |
| 54 | entries := resp.Domainscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail`/GetDomainOutput#Domain..DomainEntriesscip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail/types`/Domain#DomainEntries. |
| 55 | for _, entry := range entries { |
| 56 | if ptrscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/ptr`/.Derefscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/ptr`/Deref().(entry.Typescip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail/types`/DomainEntry#Type.) == "TXT" && ptrscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/ptr`/.Derefscip-go gomod github.com/go-acme/lego/v4 . `github.com/go-acme/lego/v4/providers/dns/internal/ptr`/Deref().(entry.Namescip-go gomod github.com/aws/aws-sdk-go-v2/service/lightsail v1.53.1 `github.com/aws/aws-sdk-go-v2/service/lightsail/types`/DomainEntry#Name.) == fqdn { |
| 57 | return |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("Could not find a TXT record for _acme-challenge.%s", domain) |
| 62 | } |