Skip to content

tailnet_settings: add fields for ACL management #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tailnet_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type TailnetSettingsResource struct {
// TailnetSettings represents the current settings of a tailnet.
// See https://tailscale.com/api#model/tailnetsettings.
type TailnetSettings struct {
ACLsExternallyManagedOn bool `json:"aclsExternallyManagedOn"`
ACLsExternalLink string `json:"aclsExternalLink"`

DevicesApprovalOn bool `json:"devicesApprovalOn"`
DevicesAutoUpdatesOn bool `json:"devicesAutoUpdatesOn"`
DevicesKeyDurationDays int `json:"devicesKeyDurationDays"` // days before device key expiry
Expand All @@ -31,6 +34,9 @@ type TailnetSettings struct {
// UpdateTailnetSettingsRequest is a request to update the settings of a tailnet.
// Nil values indicate that the existing setting should be left unchanged.
type UpdateTailnetSettingsRequest struct {
ACLsExternallyManagedOn *bool `json:"aclsExternallyManagedOn"`
ACLsExternalLink *string `json:"aclsExternalLink"`

DevicesApprovalOn *bool `json:"devicesApprovalOn,omitempty"`
DevicesAutoUpdatesOn *bool `json:"devicesAutoUpdatesOn,omitempty"`
DevicesKeyDurationDays *int `json:"devicesKeyDurationDays,omitempty"` // days before device key expiry
Expand Down
4 changes: 4 additions & 0 deletions tailnet_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ func TestClient_TailnetSettings_Get(t *testing.T) {
server.ResponseCode = http.StatusOK

expected := TailnetSettings{
ACLsExternallyManagedOn: true,
ACLsExternalLink: "https://foo.com",
DevicesApprovalOn: true,
DevicesAutoUpdatesOn: true,
DevicesKeyDurationDays: 5,
Expand All @@ -45,6 +47,8 @@ func TestClient_TailnetSettings_Update(t *testing.T) {
server.ResponseBody = nil

updateRequest := UpdateTailnetSettingsRequest{
ACLsExternallyManagedOn: PointerTo(true),
ACLsExternalLink: PointerTo("https://foo.com"),
DevicesApprovalOn: PointerTo(true),
DevicesAutoUpdatesOn: PointerTo(true),
DevicesKeyDurationDays: PointerTo(5),
Expand Down