@@ -55,6 +55,25 @@ const (
5555 ManagedDatabaseServiceTypeMySQL ManagedDatabaseServiceType = "mysql"
5656 // ManagedDatabaseServiceTypeRedis references a Redis type of database instance
5757 ManagedDatabaseServiceTypeRedis ManagedDatabaseServiceType = "redis"
58+ // ManagedDatabaseServiceTypeOpenSearch references an OpenSearch type of database instance
59+ ManagedDatabaseServiceTypeOpenSearch ManagedDatabaseServiceType = "opensearch"
60+ )
61+
62+ // ManagedDatabaseUserOpenSearchAccessControlRulePermission represents a permission for user access control rule in an
63+ // OpenSearch Managed Database service.
64+ type ManagedDatabaseUserOpenSearchAccessControlRulePermission string
65+
66+ const (
67+ // ManagedDatabaseUserOpenSearchAccessControlRulePermissionAdmin references "admin" permission
68+ ManagedDatabaseUserOpenSearchAccessControlRulePermissionAdmin ManagedDatabaseUserOpenSearchAccessControlRulePermission = "admin"
69+ // ManagedDatabaseUserOpenSearchAccessControlRulePermissionDeny references "deny" permission
70+ ManagedDatabaseUserOpenSearchAccessControlRulePermissionDeny ManagedDatabaseUserOpenSearchAccessControlRulePermission = "deny"
71+ // ManagedDatabaseUserOpenSearchAccessControlRulePermissionReadWrite references "read-write" permission
72+ ManagedDatabaseUserOpenSearchAccessControlRulePermissionReadWrite ManagedDatabaseUserOpenSearchAccessControlRulePermission = "readwrite"
73+ // ManagedDatabaseUserOpenSearchAccessControlRulePermissionRead references "read" permission
74+ ManagedDatabaseUserOpenSearchAccessControlRulePermissionRead ManagedDatabaseUserOpenSearchAccessControlRulePermission = "read"
75+ // ManagedDatabaseUserOpenSearchAccessControlRulePermissionWrite references "write" permission
76+ ManagedDatabaseUserOpenSearchAccessControlRulePermissionWrite ManagedDatabaseUserOpenSearchAccessControlRulePermission = "write"
5877)
5978
6079// ManagedDatabaseMetricPeriod represents the observation period of database metrics
@@ -92,32 +111,35 @@ const (
92111 ManagedDatabasePropertyAutoUtilityIPFilter ManagedDatabasePropertyKey = "automatic_utility_network_ip_filter"
93112 // ManagedDatabasePropertyIPFilter allows adjusting the custom IP filter of a service. The value should
94113 // contain a slice of strings representing individual IP addresses or IP addresses with CIDR mask.
95- // Currently IPv4 addresses or networks are supported.
114+ // Currently, IPv4 addresses or networks are supported.
96115 ManagedDatabasePropertyIPFilter ManagedDatabasePropertyKey = "ip_filter"
97116 // ManagedDatabasePropertyPublicAccess enables public access via internet to the service. A separate public
98117 // endpoint DNS name will be available under Components after enabling.
99118 ManagedDatabasePropertyPublicAccess ManagedDatabasePropertyKey = "public_access"
119+ // Deprecated: ManagedDatabasePropertyMaxIndexCount allows adjusting the maximum number of indices of an OpenSearch
120+ // Managed Database service. Use ManagedDatabaseUserOpenSearchAccessControlRule instead.
121+ ManagedDatabasePropertyMaxIndexCount ManagedDatabasePropertyKey = "max_index_count"
100122
101123 // ManagedDatabaseAllIPv4 property value can be used together with ManagedDatabasePropertyIPFilter to allow access from all
102124 // IPv4 hosts.
103125 ManagedDatabaseAllIPv4 = "0.0.0.0/0"
104126)
105127
106- // ManagedDatabaseUserType represents the type of an internal database user
128+ // ManagedDatabaseUserType represents the type of internal database user
107129type ManagedDatabaseUserType string
108130
109131const (
110132 // ManagedDatabaseUserTypePrimary is a type of the primary user of a managed database service. There can be only
111133 // one primary user per service. The primary user has administrative privileges to manage logical databases and
112- // users thru the database's native API.
134+ // users through the database's native API.
113135 ManagedDatabaseUserTypePrimary ManagedDatabaseUserType = "primary"
114- // ManagedDatabaseUserTypeNormal is a type of a normal database user of a managed database service. There can
115- // be multiple normal users and the primary user can manage the privileges of these users thru the database's
136+ // ManagedDatabaseUserTypeNormal is a type of normal database user of a managed database service. There can
137+ // be multiple normal users and the primary user can manage the privileges of these users through the database's
116138 // native API.
117139 ManagedDatabaseUserTypeNormal ManagedDatabaseUserType = "normal"
118140)
119141
120- // ManagedDatabaseUserAuthenticationType represents the type of an authentication method for an internal database user
142+ // ManagedDatabaseUserAuthenticationType represents the type of authentication method for an internal database user
121143type ManagedDatabaseUserAuthenticationType string
122144
123145const (
@@ -413,7 +435,7 @@ type ManagedDatabaseNodeState struct {
413435 // generation of a node. Certain modifications require re-provisioning of a node.
414436 Name string `json:"name"`
415437 // Role represents the role of a node
416- Role ManagedDatabaseNodeRole `json:"role"`
438+ Role ManagedDatabaseNodeRole `json:"role,omitempty "`
417439 // State represents the current state of a node
418440 State string `json:"state"`
419441}
@@ -501,6 +523,13 @@ func (m *ManagedDatabaseProperties) GetPublicAccess() bool {
501523 return v
502524}
503525
526+ // Deprecated: GetMaxIndexCount returns the maximum index count of the service.
527+ // See upcloud.ManagedDatabasePropertyMaxIndexCount for more information.
528+ func (m * ManagedDatabaseProperties ) GetMaxIndexCount () int {
529+ v , _ := m .GetInt (ManagedDatabasePropertyMaxIndexCount )
530+ return v
531+ }
532+
504533type ManagedDatabaseLogs struct {
505534 // Offset describes the next available offset. Use this to query more logs.
506535 Offset string `json:"offset"`
@@ -542,10 +571,11 @@ type ManagedDatabaseUser struct {
542571 Type ManagedDatabaseUserType `json:"type,omitempty"`
543572 // Password field is only visible when querying an individual user. It is omitted in main service view and in
544573 // get all users view.
545- Password string `json:"password,omitempty"`
546- Username string `json:"username,omitempty"`
547- PGAccessControl * ManagedDatabaseUserPGAccessControl `json:"pg_access_control,omitempty"`
548- RedisAccessControl * ManagedDatabaseUserRedisAccessControl `json:"redis_access_control,omitempty"`
574+ Password string `json:"password,omitempty"`
575+ Username string `json:"username,omitempty"`
576+ PGAccessControl * ManagedDatabaseUserPGAccessControl `json:"pg_access_control,omitempty"`
577+ RedisAccessControl * ManagedDatabaseUserRedisAccessControl `json:"redis_access_control,omitempty"`
578+ OpenSearchAccessControl * ManagedDatabaseUserOpenSearchAccessControl `json:"opensearch_access_control,omitempty"`
549579}
550580
551581type ManagedDatabaseUserPGAccessControl struct {
@@ -559,6 +589,15 @@ type ManagedDatabaseUserRedisAccessControl struct {
559589 Keys []string `json:"keys,omitempty"`
560590}
561591
592+ type ManagedDatabaseUserOpenSearchAccessControl struct {
593+ Rules []ManagedDatabaseUserOpenSearchAccessControlRule `json:"rules"`
594+ }
595+
596+ type ManagedDatabaseUserOpenSearchAccessControlRule struct {
597+ Index string `json:"index"`
598+ Permission ManagedDatabaseUserOpenSearchAccessControlRulePermission `json:"permission"`
599+ }
600+
562601// ManagedDatabaseQueryStatisticsMySQL represents statistics reported by a MySQL server.
563602// Statistics are per Digest which is derived from DigestText
564603type ManagedDatabaseQueryStatisticsMySQL struct {
@@ -635,19 +674,53 @@ type ManagedDatabaseType struct {
635674 Properties map [string ]ManagedDatabaseServiceProperty `json:"properties"`
636675}
637676
638- // ManagedDatabaseType represets details of a database service plan.
677+ // ManagedDatabaseServicePlan represents details of a database service plan.
639678type ManagedDatabaseServicePlan struct {
640- BackupConfig ManagedDatabaseBackupConfig `json:"backup_config"`
641- NodeCount int `json:"node_count"`
642- Plan string `json:"plan"`
643- CoreNumber int `json:"core_number"`
644- StorageSize int `json:"storage_size"`
645- MemoryAmount int `json:"memory_amount"`
646- Zones ManagedDatabaseServicePlanZones `json:"zones"`
679+ BackupConfig ManagedDatabaseBackupConfig `json:"backup_config"`
680+ BackupConfigMySQL * ManagedDatabaseBackupConfigMySQL `json:"backup_config_mysql,omitempty"`
681+ BackupConfigOpenSearch * ManagedDatabaseBackupConfigOpenSearch `json:"backup_config_opensearch,omitempty"`
682+ BackupConfigPostgreSQL * ManagedDatabaseBackupConfigPostgreSQL `json:"backup_config_pg,omitempty"`
683+ BackupConfigRedis * ManagedDatabaseBackupConfigRedis `json:"backup_config_redis,omitempty"`
684+ NodeCount int `json:"node_count"`
685+ Plan string `json:"plan"`
686+ CoreNumber int `json:"core_number"`
687+ StorageSize int `json:"storage_size"`
688+ MemoryAmount int `json:"memory_amount"`
689+ Zones ManagedDatabaseServicePlanZones `json:"zones"`
690+ }
691+
692+ // Deprecated: ManagedDatabaseBackupConfig represents backup configuration of a database service plan.
693+ type ManagedDatabaseBackupConfig struct {
694+ Interval int `json:"interval"`
695+ MaxCount int `json:"max_count"`
696+ RecoveryMode string `json:"recovery_mode"`
647697}
648698
649- // ManagedDatabaseType represets backup configuration of a database service plan
650- type ManagedDatabaseBackupConfig struct {
699+ // ManagedDatabaseBackupConfigMySQL represents backup configuration of a MySQL database service plan
700+ type ManagedDatabaseBackupConfigMySQL struct {
701+ Interval int `json:"interval"`
702+ MaxCount int `json:"max_count"`
703+ RecoveryMode string `json:"recovery_mode"`
704+ }
705+
706+ // ManagedDatabaseBackupConfigOpenSearch represents backup configuration of a OpenSearch database service plan
707+ type ManagedDatabaseBackupConfigOpenSearch struct {
708+ FrequentIntervalMinutes int `json:"frequent_interval_minutes"`
709+ FrequentOldestAgeMinutes int `json:"frequent_oldest_age_minutes"`
710+ InfrequentIntervalMinutes int `json:"infrequent_interval_minutes"`
711+ InfrequentOldestAgeMinutes int `json:"infrequent_oldest_age_minutes"`
712+ RecoveryMode string `json:"recovery_mode"`
713+ }
714+
715+ // ManagedDatabaseBackupConfigPostgreSQL represents backup configuration of a PostgreSQL database service plan
716+ type ManagedDatabaseBackupConfigPostgreSQL struct {
717+ Interval int `json:"interval"`
718+ MaxCount int `json:"max_count"`
719+ RecoveryMode string `json:"recovery_mode"`
720+ }
721+
722+ // ManagedDatabaseBackupConfigRedis represents backup configuration of a Redis database service plan
723+ type ManagedDatabaseBackupConfigRedis struct {
651724 Interval int `json:"interval"`
652725 MaxCount int `json:"max_count"`
653726 RecoveryMode string `json:"recovery_mode"`
@@ -691,10 +764,32 @@ type ManagedDatabaseServiceProperty struct {
691764 UserError string `json:"user_error,omitempty"`
692765}
693766
767+ // ManagedDatabaseMetadata contains additional read-only informational data about the managed database
694768type ManagedDatabaseMetadata struct {
695769 MaxConnections int `json:"max_connections,omitempty"`
696770 PGVersion string `json:"pg_version,omitempty"`
697771 MySQLVersion string `json:"mysql_version,omitempty"`
698772 RedisVersion string `json:"redis_version,omitempty"`
699773 WriteBlockThresholdExceeded * bool `json:"write_block_threshold_exceeded,omitempty"`
774+ OpenSearchVersion string `json:"opensearch_version,omitempty"`
775+ UpgradeVersion string `json:"upgrade_version,omitempty"`
776+ }
777+
778+ // ManagedDatabaseIndex represents an index of an OpenSearch Managed Database
779+ type ManagedDatabaseIndex struct {
780+ CreateTime time.Time `json:"create_time"`
781+ Docs int `json:"docs"`
782+ Health string `json:"health"`
783+ IndexName string `json:"index_name"`
784+ NumberOfReplicas int `json:"number_of_replicas"`
785+ NumberOfShards int `json:"number_of_shards"`
786+ ReadOnlyAllowDelete bool `json:"read_only_allow_delete"`
787+ Size int `json:"size"`
788+ Status string `json:"status"`
789+ }
790+
791+ // ManagedDatabaseAccessControl contains access controls settings for an OpenSearch Managed Database service
792+ type ManagedDatabaseAccessControl struct {
793+ ACLsEnabled * bool `json:"access_control"`
794+ ExtendedACLsEnabled * bool `json:"extended_access_control"`
700795}
0 commit comments