|
| 1 | +import { TAILNET_SETTINGS_OUTPUT } from '@/tools/tailscale/outputs' |
1 | 2 | import type { |
2 | 3 | TailscaleBaseParams, |
3 | 4 | TailscaleGetTailnetSettingsResponse, |
4 | 5 | TailscaleTailnetSettings, |
5 | 6 | } from '@/tools/tailscale/types' |
6 | | -import { assertTailscaleResponse } from '@/tools/tailscale/utils' |
| 7 | +import { assertTailscaleResponse, mapTailscaleTailnetSettings } from '@/tools/tailscale/utils' |
7 | 8 | import type { ToolConfig } from '@/tools/types' |
8 | 9 | import { safeUrlPathSegment } from '@/tools/url-path' |
9 | 10 |
|
@@ -42,109 +43,9 @@ export const tailscaleGetTailnetSettingsTool: ToolConfig< |
42 | 43 | return { |
43 | 44 | success: true, |
44 | 45 | output: { |
45 | | - settings: { |
46 | | - aclsExternallyManagedOn: data.aclsExternallyManagedOn ?? null, |
47 | | - aclsExternalLink: data.aclsExternalLink ?? null, |
48 | | - adminConsoleSessionTimeoutMinutes: data.adminConsoleSessionTimeoutMinutes ?? null, |
49 | | - devicesApprovalOn: data.devicesApprovalOn ?? null, |
50 | | - devicesAutoUpdatesOn: data.devicesAutoUpdatesOn ?? null, |
51 | | - devicesKeyDurationDays: data.devicesKeyDurationDays ?? null, |
52 | | - usersApprovalOn: data.usersApprovalOn ?? null, |
53 | | - usersRoleAllowedToJoinExternalTailnets: |
54 | | - data.usersRoleAllowedToJoinExternalTailnets ?? null, |
55 | | - networkFlowLoggingOn: data.networkFlowLoggingOn ?? null, |
56 | | - regionalRoutingOn: data.regionalRoutingOn ?? null, |
57 | | - routeSelection: data.routeSelection ?? null, |
58 | | - postureIdentityCollectionOn: data.postureIdentityCollectionOn ?? null, |
59 | | - httpsEnabled: data.httpsEnabled ?? null, |
60 | | - }, |
| 46 | + settings: mapTailscaleTailnetSettings(data), |
61 | 47 | }, |
62 | 48 | } |
63 | 49 | }, |
64 | | - outputs: { |
65 | | - settings: { |
66 | | - type: 'json', |
67 | | - description: 'Settings for a tailnet', |
68 | | - properties: { |
69 | | - aclsExternallyManagedOn: { |
70 | | - type: 'boolean', |
71 | | - description: |
72 | | - 'Prevents users from editing policies in the admin console to avoid conflicts with external management workflows like GitOps or Terraform', |
73 | | - nullable: true, |
74 | | - }, |
75 | | - aclsExternalLink: { |
76 | | - type: 'string', |
77 | | - description: |
78 | | - 'Link to the external tailnet policy definition or management solution for this tailnet', |
79 | | - nullable: true, |
80 | | - }, |
81 | | - adminConsoleSessionTimeoutMinutes: { |
82 | | - type: 'number', |
83 | | - description: |
84 | | - 'The [admin console session timeout](/docs/account/admin-console-session-timeout) for members of this tailnet', |
85 | | - nullable: true, |
86 | | - }, |
87 | | - devicesApprovalOn: { |
88 | | - type: 'boolean', |
89 | | - description: |
90 | | - 'Whether [device approval](/docs/features/access-control/device-management/device-approval) is enabled for the tailnet', |
91 | | - nullable: true, |
92 | | - }, |
93 | | - devicesAutoUpdatesOn: { |
94 | | - type: 'boolean', |
95 | | - description: |
96 | | - 'Whether [auto updates](/docs/features/client/update#auto-updates) are enabled for devices that belong to this tailnet', |
97 | | - nullable: true, |
98 | | - }, |
99 | | - devicesKeyDurationDays: { |
100 | | - type: 'number', |
101 | | - description: |
102 | | - 'The [key expiry](/docs/features/access-control/key-expiry) duration for devices on this tailnet', |
103 | | - nullable: true, |
104 | | - }, |
105 | | - usersApprovalOn: { |
106 | | - type: 'boolean', |
107 | | - description: |
108 | | - 'Whether [user approval](/docs/features/access-control/user-approval) is enabled for this tailnet', |
109 | | - nullable: true, |
110 | | - }, |
111 | | - usersRoleAllowedToJoinExternalTailnets: { |
112 | | - type: 'string', |
113 | | - description: |
114 | | - 'Which user roles are allowed to [join external tailnets](/docs/features/sharing/how-to/invite-any-user)', |
115 | | - nullable: true, |
116 | | - }, |
117 | | - networkFlowLoggingOn: { |
118 | | - type: 'boolean', |
119 | | - description: |
120 | | - 'Whether [network flow logs](/docs/features/logging/network-flow-logs) are enabled for the tailnet', |
121 | | - nullable: true, |
122 | | - }, |
123 | | - regionalRoutingOn: { |
124 | | - type: 'boolean', |
125 | | - description: |
126 | | - 'Whether [regional routing](/docs/features/route-selection#regional-routing) is enabled for the tailnet', |
127 | | - nullable: true, |
128 | | - }, |
129 | | - routeSelection: { |
130 | | - type: 'string', |
131 | | - description: |
132 | | - 'The [route selection](/docs/features/route-selection) algorithm used by the tailnet: * `active-passive-failover` - Active-passive failover (formerly known as "Failover") * `regional-routing` - Regional routing * `regional-routing-failover` - Regional routing with in-region failover * `magicroute` - MagicRoute A PATCH request must not specify both the `regionalRoutingOn` and `routeSelection` fields', |
133 | | - nullable: true, |
134 | | - }, |
135 | | - postureIdentityCollectionOn: { |
136 | | - type: 'boolean', |
137 | | - description: |
138 | | - 'Whether [identity collection](/docs/features/access-control/device-management/how-to/manage-identity) is enabled for [device posture](/docs/features/device-posture) integrations for the tailnet', |
139 | | - nullable: true, |
140 | | - }, |
141 | | - httpsEnabled: { |
142 | | - type: 'boolean', |
143 | | - description: |
144 | | - 'Whether provisioning of [HTTPS certificates](/docs/how-to/set-up-https-certificates) is enabled for this tailnet', |
145 | | - nullable: true, |
146 | | - }, |
147 | | - }, |
148 | | - }, |
149 | | - }, |
| 50 | + outputs: TAILNET_SETTINGS_OUTPUT, |
150 | 51 | } |
0 commit comments