Gandi 0.0.0-alpha2
dotnet add package Gandi --version 0.0.0-alpha2
NuGet\Install-Package Gandi -Version 0.0.0-alpha2
<PackageReference Include="Gandi" Version="0.0.0-alpha2" />
paket add Gandi --version 0.0.0-alpha2
#r "nuget: Gandi, 0.0.0-alpha2"
// Install Gandi as a Cake Addin #addin nuget:?package=Gandi&version=0.0.0-alpha2&prerelease // Install Gandi as a Cake Tool #tool nuget:?package=Gandi&version=0.0.0-alpha2&prerelease
Gandi
.NET REST client for the Gandi v5 API
This library allows you to create, read, update, and delete LiveDNS records in your Gandi domains.
It's similar to G6.GandiLiveDns, but it's compatible with both Personal Access Token and API Key authentication, public types have interfaces so you can mock and actually test your dependent code, and it's compatible with a wider variety of runtimes.
Prerequisites
- .NET runtime compatible with .NET Standard 2.0
- .NET 5 or later
- .NET Core 2 or later
- .NET Framework 4.6.2 or later
- Gandi domain name
- ✅ Domain must be using LiveDNS, the default for new domains (
ns-*-*.gandi.net
) - ❌ Classic DNS (
*.dns.gandi.net
) is incompatible; you will need to migrate to LiveDNS - ❌ External nameservers (with glue records) are incompatible; you will need to update the record on the external nameserver instead of on Gandi's nameservers
- ✅ Domain must be using LiveDNS, the default for new domains (
Installation
This library is available in the Gandi
package on NuGet Gallery.
dotnet add package Gandi
Configuration
- Construct a new instance of
GandiClient
.using Gandi; using var gandi = new GandiClient();
- Get a Gandi authentication token to pass to this client.
- If you already have a Gandi API Key, you can use it to authenticate this client to your Gandi account.
- If your Gandi account doesn't already have an API Key, it's too late, you can't make one anymore.
- If you don't remember your API Key, you can regenerate it using Account › Authentication options › Developer access › API key.
- Pass the API Key to the
ApiKey
property of yourGandiClient
instance.
gandi.ApiKey = apiKey;
- If you don't already have an API key, you can create a Personal Access Token.
- Go to either User Settings or Organizations › ⚙ Manage.
- Click Create a token.
- If prompted, choose the organization which owns the domain whose DNS records you want to manage, then click Next.
- Choose a name and expiration period for the token.
- Choose whether the token will be allowed to access all domains in the organization, or just a subset of them.
- Allow permission to "Manage domain name technical configurations."
- Click Create.
- Copy the token text. Keep it somewhere safe, because Gandi won't show it to you again.
- Set a calendar reminder to notify you before this token expires. There is no way for Gandi to notify you or for clients to refresh or renew tokens, so you will have to repeat all of these steps when your token eventually expires.
- Click Done.
- If you already have a Gandi API Key, you can use it to authenticate this client to your Gandi account.
Advanced configuration
- You can access the
HttpClient
andHttpMessageHandler
instances used byGandiClient
if you want to configure timeouts, extra request headers, or add requests or response filters. - If you want to provide your own
HttpClient
andHttpMessageHandler
instances, you can subclassGandiClient
and call its protected constructorGandiClient(UnfuckedHttpHandler, UnfuckedHttpClient)
, which take wrappers aroundHttpMessageHandler
andHttpClient
to provide filtering, serialization, and builders.
Usage
LiveDNS
Find DNS records in domain
Return a list of all DNS records in the domain, optionally filtered by name or type (A, CNAME, etc).
var liveDns = gandi.LiveDns("mydomain.com");
IEnumerable<DnsRecord> allRecords = await liveDns.List();
IEnumerable<DnsRecord> cnames = await liveDns.List(RecordType.CNAME);
Get a DNS record
Return one DNS record in the domain with the given name and type, or null
if it was not found.
DnsRecord? wwwRecord = await liveDns.Get(RecordType.A, "www");
Create or update a DNS record
Set a DNS record's value, automatically creating it if it didn't already exist, or modifying it if it already existed (upserting).
await liveDns.Set(new DnsRecord(RecordType.A, "www", TimeToLive.FromHours(1), "1.2.3.4"));
Delete a record
Remove a record with the given name and optionally the given type. If the type is not specified, all record types with the given name are deleted. This method returns successfully even if the record did not exist, because either way it doesn't exist after the method completes, so it's in the desired state.
await liveDns.Delete(RecordTytpe.CNAME, "www");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Unfucked.HTTP (>= 0.0.0-beta4)
-
net6.0
- Unfucked.HTTP (>= 0.0.0-beta4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.0-alpha2 | 0 | 3/6/2025 |
0.0.0-alpha1 | 0 | 3/6/2025 |
0.0.0-alpha0 | 22 | 3/5/2025 |