-
Notifications
You must be signed in to change notification settings - Fork 613
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
GATE-1703 team rules + accounts + config api #693
GATE-1703 team rules + accounts + config api #693
Conversation
8e4262e
to
f469f4a
Compare
f703fff
to
1f82abf
Compare
teams_accounts.go
Outdated
GatewayID string `json:"gateway_tag"` // Internal teams ID | ||
ProviderName string `json:"provider_name"` // Auth provider | ||
CloudflareID string `json:"id"` // cloudflare account ID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GatewayID string `json:"gateway_tag"` // Internal teams ID | |
ProviderName string `json:"provider_name"` // Auth provider | |
CloudflareID 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 |
is there a reason the struct field is different to the JSON tag? generally we've used a 1:1 for simplicity and reduce confusion between the API and the SDK counterpart.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. I changed the variable names to give a little more readability to the user. The original struct json tags we use in the API are confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree it can be confusing here, but i think we need to go one way or another as right now it's in limbo and hard to grok if you don't know the reasoning. i think we should rename the fields to match the JSON to avoid further confusion especially seeing how the API docs reference the JSON tags.
teams_rules.go
Outdated
BISOAdminControls *TeamsBISOAdminControlSettings `json:"biso_admin_controls"` | ||
} | ||
|
||
// TeamsL4OverrideSettings : only used in l4 filter type rule with action set to override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TeamsL4OverrideSettings : only used in l4 filter type rule with action set to override | |
// TeamsL4OverrideSettings used in l4 filter type rule with action set to override. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved
f92e554
to
5cb6d3e
Compare
@jacobbednarz : i have resolved all the comments. Thanks |
teams_rules.go
Outdated
UUID string `json:"id"` | ||
Name string `json:"name"` | ||
Description string `json:"description"` | ||
Precedence uint64 `json:"precedence"` | ||
Enabled bool `json:"enabled"` | ||
Action TeamsGatewayAction `json:"action"` | ||
Settings TeamsRuleSettings `json:"rule_settings,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UUID string `json:"id"` | |
Name string `json:"name"` | |
Description string `json:"description"` | |
Precedence uint64 `json:"precedence"` | |
Enabled bool `json:"enabled"` | |
Action TeamsGatewayAction `json:"action"` | |
Settings TeamsRuleSettings `json:"rule_settings,omitempty"` | |
ID string `json:"id"` | |
Name string `json:"name"` | |
Description string `json:"description"` | |
Precedence uint64 `json:"precedence"` | |
Enabled bool `json:"enabled"` | |
Action TeamsGatewayAction `json:"action"` | |
RuleSettings TeamsRuleSettings `json:"rule_settings,omitempty"` |
these should also match the JSON tag names
teams_rules.go
Outdated
Traffic string `json:"traffic"` | ||
Identity string `json:"identity"` | ||
Version uint64 `json:"version"` | ||
Settings TeamsRuleSettings `json:"rule_settings,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settings TeamsRuleSettings `json:"rule_settings,omitempty"` | |
RuleSettings TeamsRuleSettings `json:"rule_settings,omitempty"` |
// | ||
// API reference: https://api.cloudflare.com/#teams-rules-properties | ||
func (api *API) TeamsRule(ctx context.Context, accountID string, ruleId string, ) (TeamsRule, error) { | ||
uri := fmt.Sprintf("/accounts/%s/gateway/rules/%s", accountID, ruleId) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking between the API and this PR, we've got a difference in how the rule ID is stored and retrieved.
in the API (the RESTful route), we want a hash style value, however on the resource itself it is a UUIDv4 value. this is very confusing and will make handling this in Terraform/cf-terraforming very painful as the identifier is used as an anchor for subsequent API calls. ideally, we decide on one and continue with it to avoid extra work going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Turns we have new change in api, that accepts uuid with dashes. I have updated the comment. Resolving this.
5cb6d3e
to
cc8a68b
Compare
I have made all the json tags match variable names. |
cc8a68b
to
03129da
Compare
28995eb
to
44b952d
Compare
thanks @rexscaria, this is awesome! when the public documentation links are available we can get those updated. |
The pr has newly publicized Teams api for rules + account config
Description
This is the new teams rules api.
Has your change been tested?
Explain how the change has been tested and what you ran to confirm your
change affects other parts of the code. Automated tests are generally
expected and changes without tests should explain why they aren't
required.
Types of changes
Mew features- Teams rules + accounts api