Skip to content

Commit

Permalink
GANDI_V5: allow a DryRun mode
Browse files Browse the repository at this point in the history
  • Loading branch information
llange committed Dec 16, 2023
1 parent 5fdabbb commit bd136ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion documentation/providers/gandi_v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ along with other settings:
endpoint is used (default) ; you can use it to select the Sandbox API Endpoint instead.
* `sharing_id`: (optional, string) let you scope to a specific organization. When empty or absent
calls are not scoped to a specific organization.
* `dryrun`: (optional, string) Set to `"true"` prevents the API from making changes. Only certain API calls
support it. Remove or set to `"false"` so that changes are possible.

When both `token` and `apikey` are defined, the priority is given to `token` which will
be used for API communication (as if `apikey` was not set).
Expand Down Expand Up @@ -46,7 +48,8 @@ Example:
"gandi": {
"TYPE": "GANDI_V5",
"token": "your-gandi-personal-access-token",
"sharing_id": "your-sharing_id"
"sharing_id": "your-sharing_id",
"dryrun": "true"
}
}
```
Expand Down
6 changes: 6 additions & 0 deletions providers/gandiv5/gandi_v5Provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type gandiv5Provider struct {
token string
sharingid string
debug bool
dryrun bool
apiurl string
}

Expand All @@ -94,6 +95,10 @@ func newHelper(m map[string]string, metadata json.RawMessage) (*gandiv5Provider,
}
api.sharingid = m["sharing_id"]
api.apiurl = m["apiurl"]
dryrun, err := strconv.ParseBool(m["dryrun"])
if err == nil {
api.dryrun = dryrun
}
debug, err := strconv.ParseBool(os.Getenv("GANDI_V5_DEBUG"))
if err == nil {
api.debug = debug
Expand All @@ -112,6 +117,7 @@ func NewLiveDNSClient(client *gandiv5Provider) *livedns.LiveDNS {
PersonalAccessToken: client.token,
SharingID: client.sharingid,
Debug: client.debug,
DryRun: client.dryrun,
APIURL: client.apiurl,
})
return g
Expand Down

0 comments on commit bd136ec

Please sign in to comment.