From fd0f491928fb053237a67a442dc1a13bc1b7185c Mon Sep 17 00:00:00 2001 From: Chris Morse <120681681+christhemorse@users.noreply.github.com> Date: Tue, 19 Nov 2024 15:50:26 -0500 Subject: [PATCH] Deprecate Redis-specific fields for new generic versions (#345) --- database.go | 48 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/database.go b/database.go index 1e6b258..5e3bdca 100644 --- a/database.go +++ b/database.go @@ -163,9 +163,11 @@ type Database struct { MySQLSlowQueryLog *bool `json:"mysql_slow_query_log,omitempty"` MySQLLongQueryTime int `json:"mysql_long_query_time,omitempty"` PGAvailableExtensions []PGExtension `json:"pg_available_extensions,omitempty"` - RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` - ClusterTimeZone string `json:"cluster_time_zone,omitempty"` - ReadReplicas []Database `json:"read_replicas,omitempty"` + // Deprecated: RedisEvictionPolicy should no longer be used. Instead, use EvictionPolicy + RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` + EvictionPolicy string `json:"eviction_policy,omitempty"` + ClusterTimeZone string `json:"cluster_time_zone,omitempty"` + ReadReplicas []Database `json:"read_replicas,omitempty"` } // FerretDBCredentials represents connection details and IP address information for FerretDB engine type subscriptions @@ -211,7 +213,9 @@ type DatabaseCreateReq struct { MySQLRequirePrimaryKey *bool `json:"mysql_require_primary_key,omitempty"` MySQLSlowQueryLog *bool `json:"mysql_slow_query_log,omitempty"` MySQLLongQueryTime int `json:"mysql_long_query_time,omitempty"` - RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` + // Deprecated: RedisEvictionPolicy should no longer be used. Instead, use EvictionPolicy + RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` + EvictionPolicy string `json:"eviction_policy,omitempty"` } // DatabaseUpdateReq struct used to update a dataase. @@ -229,7 +233,9 @@ type DatabaseUpdateReq struct { MySQLRequirePrimaryKey *bool `json:"mysql_require_primary_key,omitempty"` MySQLSlowQueryLog *bool `json:"mysql_slow_query_log,omitempty"` MySQLLongQueryTime int `json:"mysql_long_query_time,omitempty"` - RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` + // Deprecated: RedisEvictionPolicy should no longer be used. Instead, use EvictionPolicy + RedisEvictionPolicy string `json:"redis_eviction_policy,omitempty"` + EvictionPolicy string `json:"eviction_policy,omitempty"` } // DatabaseUsage represents disk, memory, and CPU usage for a Managed Database @@ -276,19 +282,35 @@ type DatabaseUser struct { // DatabaseUserACL represents an access control configuration for a user within a Redis Managed Database cluster type DatabaseUserACL struct { - RedisACLCategories []string `json:"redis_acl_categories"` - RedisACLChannels []string `json:"redis_acl_channels"` - RedisACLCommands []string `json:"redis_acl_commands"` - RedisACLKeys []string `json:"redis_acl_keys"` + // Deprecated: RedisACLCategories should no longer be used. Instead, use ACLCategories + RedisACLCategories []string `json:"redis_acl_categories,omitempty"` + // Deprecated: RedisACLChannels should no longer be used. Instead, use ACLChannels + RedisACLChannels []string `json:"redis_acl_channels,omitempty"` + // Deprecated: RedisACLCommands should no longer be used. Instead, use ACLCommands + RedisACLCommands []string `json:"redis_acl_commands,omitempty"` + // Deprecated: RedisACLKeys should no longer be used. Instead, use ACLKeys + RedisACLKeys []string `json:"redis_acl_keys,omitempty"` + ACLCategories []string `json:"acl_categories"` + ACLChannels []string `json:"acl_channels"` + ACLCommands []string `json:"acl_commands"` + ACLKeys []string `json:"acl_keys"` } // DatabaseUserACLReq represents input for updating a user's access control within a Managed Database cluster type DatabaseUserACLReq struct { + // Deprecated: RedisACLCategories should no longer be used. Instead, use ACLCategories RedisACLCategories *[]string `json:"redis_acl_categories,omitempty"` - RedisACLChannels *[]string `json:"redis_acl_channels,omitempty"` - RedisACLCommands *[]string `json:"redis_acl_commands,omitempty"` - RedisACLKeys *[]string `json:"redis_acl_keys,omitempty"` - Permission string `json:"permission,omitempty"` + // Deprecated: RedisACLChannels should no longer be used. Instead, use ACLChannels + RedisACLChannels *[]string `json:"redis_acl_channels,omitempty"` + // Deprecated: RedisACLCommands should no longer be used. Instead, use ACLCommands + RedisACLCommands *[]string `json:"redis_acl_commands,omitempty"` + // Deprecated: RedisACLKeys should no longer be used. Instead, use ACLKeys + RedisACLKeys *[]string `json:"redis_acl_keys,omitempty"` + ACLCategories *[]string `json:"acl_categories,omitempty"` + ACLChannels *[]string `json:"acl_channels,omitempty"` + ACLCommands *[]string `json:"acl_commands,omitempty"` + ACLKeys *[]string `json:"acl_keys,omitempty"` + Permission string `json:"permission,omitempty"` } // databaseUserBase holds the API response for retrieving a single database user within a Managed Database