Skip to content
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

v2 API draft #86

Closed
wants to merge 11 commits into from
Closed

v2 API draft #86

wants to merge 11 commits into from

Conversation

oxtoacart
Copy link
Contributor

@oxtoacart oxtoacart commented Jul 23, 2024

It's useful to look at the commits individually.

v2/devices.go Outdated
@@ -8,6 +8,14 @@ import (
"time"
)

type Devices struct {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're keeping things in the same package, do we really want to use these simpler names for these services? I suspect we're more likely to run into conflicts with types we want to use for data types within the API. DevicesService or similar?

Copy link
Contributor Author

@oxtoacart oxtoacart Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to qualifying the names somehow, though I don't like Service since our API is explicitly not service oriented by entity-oriented/RESTful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about DevicesResource, since we're modeling REST resources here?

@@ -125,6 +125,7 @@ func TestACL_Unmarshal(t *testing.T) {
Name: "It should handle HuJSON ACLs",
ACLContent: huJSONACL,
UnmarshalFunc: func(b []byte, v interface{}) error {
b = append([]byte{}, b...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fix this in v1 too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,213 @@
package tailscale
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Named this file policyfile to match the api docs section naming?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct.

v2/devices.go Outdated
@@ -17,7 +25,7 @@ type (

// SetDeviceSubnetRoutes sets which subnet routes are enabled to be routed by a device by replacing the existing list
// of subnet routes with the supplied routes. Routes can be enabled without a device advertising them (e.g. for preauth).
func (c *Client) SetDeviceSubnetRoutes(ctx context.Context, deviceID string, routes []string) error {
func (c *Devices) SetDeviceSubnetRoutes(ctx context.Context, deviceID string, routes []string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on making this func (d *Devices)...

And similar for all the others

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It had occurred to me too. Probably makes sense to rename.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. The names might have to change if we don't go with the Resource suffix.

v2/dns.go Outdated
// that changing the list of DNS nameservers may also affect the status of MagicDNS (if MagicDNS is on).
func (c *DNS) SetDNSNameservers(ctx context.Context, dns []string) error {
func (c *DNS) SetNameservers(ctx context.Context, dns []string) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you already did a scan, but would be nice to have these names match our api docs

Copy link
Contributor Author

@oxtoacart oxtoacart Jul 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, I assume you're referring to the operationId? If so, we have two problems:

  1. The operationId is setDnsNameservers, which stutters
  2. The operationId doesn't appear to actually be shown to the user anywhere in the openapi docs (not even in URLs)

@oxtoacart oxtoacart force-pushed the percy/v2-2 branch 2 times, most recently from 17343c4 to 0728d12 Compare July 31, 2024 18:55
Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
One of the unit test modified huJSONACL in place, even while
parallel tests are using the same value.

Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Helps distinguish them from actual data types, for example a 'DevicesResource'
may provide access .

Updates tailscale/corp#21867

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21876

Signed-off-by: Percy Wegmann <percy@tailscale.com>
@oxtoacart oxtoacart changed the base branch from main to unstable July 31, 2024 20:58
 Updates tailscale/corp#21876

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21876

Signed-off-by: Percy Wegmann <percy@tailscale.com>
Updates tailscale/corp#21876

Signed-off-by: Percy Wegmann <percy@tailscale.com>
@oxtoacart oxtoacart changed the base branch from unstable to main August 1, 2024 19:48
Updates tailscale/corp#21876

Signed-off-by: Percy Wegmann <percy@tailscale.com>
@oxtoacart
Copy link
Contributor Author

Closing in favor of #89

@oxtoacart oxtoacart closed this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants