Skip to content

Commit

Permalink
feat: sync teams gateway docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rex Scaria committed Dec 17, 2024
1 parent 8d86952 commit 7005664
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .changelog/3743.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
teams: sync latest doc changes
```
14 changes: 11 additions & 3 deletions teams_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
)

type TeamsAccount struct {
GatewayTag string `json:"gateway_tag"` // Internal teams ID
ProviderName string `json:"provider_name"` // Auth provider
ID string `json:"id"` // cloudflare account ID
GatewayTag string `json:"gateway_tag"` // Internal teams ID
ProviderName string `json:"provider_name"` // Auth provider
ID string `json:"id"` // cloudflare account ID
TenantAccountID string `json:"tenant_account_id,omitempty"` // cloudflare Tenant account ID, if a tenant account
TenantID string `json:"tenant_id,omitempty"` // cloudflare Tenant ID, if a tenant account id
}

// TeamsAccountResponse is the API response, containing information on teams
Expand Down Expand Up @@ -48,6 +50,12 @@ type TeamsAccountSettings struct {
ExtendedEmailMatching *TeamsExtendedEmailMatching `json:"extended_email_matching,omitempty"`
CustomCertificate *TeamsCustomCertificate `json:"custom_certificate,omitempty"`
Certificate *TeamsCertificateSetting `json:"certificate,omitempty"`
Sandbox *SandboxAccountSetting `json:"sandbox,omitempty"`
}

type SandboxAccountSetting struct {
Enabled *bool `db:"enabled" json:"enabled" validate:"required"`
FallbackAction string `db:"fallback_action" json:"fallback_action" validate:"omitempty,oneof=allow block"`
}

type BrowserIsolation struct {
Expand Down
9 changes: 5 additions & 4 deletions teams_audit_ssh_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import (

// TeamsList represents a Teams List.
type AuditSSHSettings struct {
PublicKey string `json:"public_key"`
SeedUUID string `json:"seed_id"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
PublicKey string `json:"public_key"`
SeedUUID string `json:"seed_id"`
IsPublicKeyValid bool `json:"is_public_key_valid,omitempty"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}

type AuditSSHSettingsResponse struct {
Expand Down
34 changes: 33 additions & 1 deletion teams_locations.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type TeamsLocation struct {
ID string `json:"id"`
Name string `json:"name"`
Networks []TeamsLocationNetwork `json:"networks"`
PolicyIDs []string `json:"policy_ids"`
Ip string `json:"ip,omitempty"`
Subdomain string `json:"doh_subdomain"`
AnonymizedLogsEnabled bool `json:"anonymized_logs_enabled"`
Expand All @@ -39,11 +38,44 @@ type TeamsLocation struct {
DNSDestinationIPv6BlockID string `json:"dns_destination_ipv6_block_id"`
ClientDefault bool `json:"client_default"`
ECSSupport *bool `json:"ecs_support,omitempty"`
Endpoints *LocationEndpoints `json:"endpoints,omitempty"`

CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}

type LocationEndpoints struct {
IPv4Endpoint IPv4EndpointFields `json:"ipv4"`
IPv6Endpoint IPv6EndpointFields `json:"ipv6"`
DotEndpoint DotEndpointFields `json:"dot"`
DohEndpoint DohEndpointFields `json:"doh"`
}

type IPv4EndpointFields struct {
Enabled bool `json:"enabled"`
AuthenticationEnabled bool `json:"authentication_enabled,omitempty"`
}

type IPv6EndpointFields struct {
EndpointFields
}

type DotEndpointFields struct {
RequireToken bool `json:"require_token"`
EndpointFields
}

type DohEndpointFields struct {
RequireToken bool `json:"require_token"`
EndpointFields
}

type EndpointFields struct {
Enabled bool `json:"enabled"`
AuthenticationEnabledUIHelper bool `json:"authentication_enabled,omitempty"`
Networks []TeamsLocationNetwork `json:"networks,omitempty"`
}

// TeamsLocations returns all locations within an account.
//
// API reference: https://api.cloudflare.com/#teams-locations-list-teams-locations
Expand Down
4 changes: 0 additions & 4 deletions teams_locations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func TestTeamsLocations(t *testing.T) {
ID: "0f8185414dec4a5e9034f3d917c17890",
Name: "home",
Networks: []TeamsLocationNetwork{{ID: "8e4c7835436345f0ab395429b187a076", Network: "198.51.100.1/32"}},
PolicyIDs: []string{},
Ip: "2a06:98c1:54::2419",
Subdomain: "q15l7x2lbw",
AnonymizedLogsEnabled: false,
Expand Down Expand Up @@ -121,7 +120,6 @@ func TestTeamsLocation(t *testing.T) {
ID: id,
Name: "home",
Networks: []TeamsLocationNetwork{{ID: "8e4c7835436345f0ab395429b187a076", Network: "198.51.100.1/32"}},
PolicyIDs: []string{},
Ip: "2a06:98c1:54::2419",
Subdomain: "q15l7x2lbw",
AnonymizedLogsEnabled: false,
Expand Down Expand Up @@ -181,7 +179,6 @@ func TestCreateTeamsLocation(t *testing.T) {
ID: id,
Name: "test",
Networks: []TeamsLocationNetwork{{ID: "8e4c7835436345f0ab395429b187a076", Network: "198.51.100.1/32"}},
PolicyIDs: []string{},
Ip: "2a06:98c1:54::2419",
Subdomain: "q15l7x2lbw",
AnonymizedLogsEnabled: false,
Expand Down Expand Up @@ -245,7 +242,6 @@ func TestUpdateTeamsLocation(t *testing.T) {
ID: id,
Name: "new",
Networks: []TeamsLocationNetwork{{ID: "8e4c7835436345f0ab395429b187a076", Network: "198.51.100.1/32"}},
PolicyIDs: []string{},
Ip: "2a06:98c1:54::2419",
Subdomain: "q15l7x2lbw",
AnonymizedLogsEnabled: false,
Expand Down
34 changes: 34 additions & 0 deletions teams_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,20 @@ type TeamsRuleSettings struct {
DnsResolverSettings *TeamsDnsResolverSettings `json:"dns_resolvers,omitempty"`

NotificationSettings *TeamsNotificationSettings `json:"notification_settings"`
Quarantine *Quarantine `json:"quarantine,omitempty"`
ForensicCopySettings *ForensicCopySettings `json:"forensic_copy,omitempty"`
}

type ForensicCopySettings struct {
Enabled bool `json:"enabled"`
}

type Quarantine struct {
FileTypes []FileType `json:"file_types"`
}

type FileType = string

type TeamsGatewayUntrustedCertAction string

const (
Expand Down Expand Up @@ -219,6 +231,28 @@ type TeamsRule struct {
DevicePosture string `json:"device_posture"`
Version uint64 `json:"version"`
RuleSettings TeamsRuleSettings `json:"rule_settings,omitempty"`
Schedule *RuleSchedule `json:"schedule,omitempty"` // only available at DNS rules
Expiration *RuleExpiration `json:"expiration,omitempty"` // only available at DNS rules
}

type RuleExpiration struct {
ExpiresAt *time.Time `json:"expires_at"`
Duration *uint64 `json:"duration,omitempty"` // read only
Expired bool `json:"expired"` // read only
}

// format HH:MM,HH:MM,....,HH:MM
type ScheduleTimes string

type RuleSchedule struct {
Monday ScheduleTimes `json:"mon,omitempty"`
Tuesday ScheduleTimes `json:"tue,omitempty"`
Wednesday ScheduleTimes `json:"wed,omitempty"`
Thursday ScheduleTimes `json:"thu,omitempty"`
Friday ScheduleTimes `json:"fri,omitempty"`
Saturday ScheduleTimes `json:"sat,omitempty"`
Sunday ScheduleTimes `json:"sun,omitempty"`
TimeZone string `json:"time_zone,omitempty"` // default to user TZ based on the user IP location, fall backs to colo TZ
}

// TeamsRuleResponse is the API response, containing a single rule.
Expand Down

0 comments on commit 7005664

Please sign in to comment.