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

Add Rules field to create Databases with Firewall Rules #758

Merged

Conversation

dvigueras
Copy link
Contributor

According to the Create a New Database Cluster I've noticed the rules field was missing.

I've added this field to the DatabaseCreateRequest struct. And a new DatabaseCreateFirewallRule struct.

// DatabaseCreateFirewallRule is a rule describing an inbound source to a database
type DatabaseCreateFirewallRule struct {
	UUID  string `json:"uuid"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

I didn't use the already existing DatabaseFirewallRule because of the following:

  • The CreatedAt field is not present in the API Create Request. Only when you get the list of firewall rules for a Database.
  • The ClusterUUID field in the documentation seems to be a bug. This field is ignored when creating a Database / doesn't make sense to be present. The Database Cluster ID is the same ID the database will have after being created.

Also I've added a test which creates a Database with two firewall rules.

This comment was marked as resolved.

Copy link
Member

@andrewsomething andrewsomething left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me!

Thanks for the contribution and all the feedback!

@andrewsomething andrewsomething merged commit 22a5562 into digitalocean:main Nov 19, 2024
8 checks passed
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.

2 participants