From ba918e1b5689b4c3b3cb8f70247bdd3377855383 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 21:05:24 +0530 Subject: [PATCH 01/10] Doctl Changes for MySQL Log Output and other missing configs --- commands/displayers/database.go | 62 +++++++ go.mod | 6 +- go.sum | 12 +- .../github.com/digitalocean/godo/CHANGELOG.md | 12 ++ vendor/github.com/digitalocean/godo/apps.go | 27 +++ .../github.com/digitalocean/godo/databases.go | 10 + .../digitalocean/godo/droplet_actions.go | 38 ++++ .../github.com/digitalocean/godo/droplets.go | 172 +++++++++++++++--- vendor/github.com/digitalocean/godo/godo.go | 4 +- .../github.com/digitalocean/godo/registry.go | 120 ++++++++++++ .../github.com/digitalocean/godo/strings.go | 24 +++ vendor/golang.org/x/oauth2/README.md | 15 +- vendor/golang.org/x/time/rate/rate.go | 17 +- vendor/modules.txt | 6 +- 14 files changed, 461 insertions(+), 64 deletions(-) diff --git a/commands/displayers/database.go b/commands/displayers/database.go index 169d8a47c..604e33a40 100644 --- a/commands/displayers/database.go +++ b/commands/displayers/database.go @@ -1191,6 +1191,48 @@ func (dc *MySQLConfiguration) KV() []map[string]any { "value": *c.BinlogRetentionPeriod, }) } + if c.InnodbChangeBufferMaxSize != nil { + o = append(o, map[string]any{ + "key": "InnodbChangeBufferMaxSize", + "value": *c.InnodbChangeBufferMaxSize, + }) + } + if c.InnodbFlushNeighbors != nil { + o = append(o, map[string]any{ + "key": "InnodbFlushNeighbors", + "value": *c.InnodbFlushNeighbors, + }) + } + if c.InnodbReadIoThreads != nil { + o = append(o, map[string]any{ + "key": "InnodbReadIoThreads", + "value": *c.InnodbReadIoThreads, + }) + } + if c.InnodbThreadConcurrency != nil { + o = append(o, map[string]any{ + "key": "InnodbThreadConcurrency", + "value": *c.InnodbThreadConcurrency, + }) + } + if c.InnodbWriteIoThreads != nil { + o = append(o, map[string]any{ + "key": "InnodbWriteIoThreads", + "value": *c.InnodbWriteIoThreads, + }) + } + if c.NetBufferLength != nil { + o = append(o, map[string]any{ + "key": "NetBufferLength", + "value": *c.NetBufferLength, + }) + } + if c.LogOutput != nil { + o = append(o, map[string]any{ + "key": "LogOutput", + "value": *c.LogOutput, + }) + } return o } @@ -1578,6 +1620,26 @@ func (dc *PostgreSQLConfiguration) KV() []map[string]any { "value": *c.TimeScaleDB.MaxBackgroundWorkers, }) } + + if c.SynchronousReplication != nil { + o = append(o, map[string]any{ + "key": "SynchronousReplication", + "value": *c.SynchronousReplication, + }) + } + if c.StatMonitorEnable != nil { + o = append(o, map[string]any{ + "key": "StatMonitorEnable", + "value": *c.StatMonitorEnable, + }) + } + if c.MaxFailoverReplicationTimeLag != nil { + o = append(o, map[string]any{ + "key": "MaxFailoverReplicationTimeLag", + "value": *c.MaxFailoverReplicationTimeLag, + }) + } + return o } diff --git a/go.mod b/go.mod index 91b3ac287..d0fd0752b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.22 require ( github.com/blang/semver v3.5.1+incompatible github.com/creack/pty v1.1.21 - github.com/digitalocean/godo v1.128.1-0.20241025145008-2654a9d1e887 + github.com/digitalocean/godo v1.130.0 github.com/docker/cli v24.0.5+incompatible github.com/docker/docker v25.0.6+incompatible github.com/docker/docker-credential-helpers v0.7.0 // indirect @@ -30,7 +30,7 @@ require ( github.com/stretchr/testify v1.8.4 golang.org/x/crypto v0.22.0 golang.org/x/net v0.24.0 // indirect - golang.org/x/oauth2 v0.23.0 + golang.org/x/oauth2 v0.24.0 golang.org/x/sys v0.25.0 // indirect gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.26.2 @@ -121,7 +121,7 @@ require ( go.opentelemetry.io/otel/trace v1.19.0 // indirect golang.org/x/mod v0.11.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/time v0.6.0 // indirect + golang.org/x/time v0.8.0 // indirect golang.org/x/tools v0.10.0 // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect diff --git a/go.sum b/go.sum index 04b75b62f..ad87a3917 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/digitalocean/godo v1.128.1-0.20241025145008-2654a9d1e887 h1:kdXNbMfHEDbQilcqllKkNrJ85ftyJSvSDpsQvzrhHbg= -github.com/digitalocean/godo v1.128.1-0.20241025145008-2654a9d1e887/go.mod h1:PU8JB6I1XYkQIdHFop8lLAY9ojp6M0XcU0TWaQSxbrc= +github.com/digitalocean/godo v1.130.0 h1:DbJg0wvBxTkYjY5Q9S1mwzAZLd5Wht3r57yFH4yeMCk= +github.com/digitalocean/godo v1.130.0/go.mod h1:PU8JB6I1XYkQIdHFop8lLAY9ojp6M0XcU0TWaQSxbrc= github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk= github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/cli v24.0.5+incompatible h1:WeBimjvS0eKdH4Ygx+ihVq1Q++xg36M/rMi4aXAvodc= @@ -517,8 +517,8 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -599,8 +599,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U= -golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= diff --git a/vendor/github.com/digitalocean/godo/CHANGELOG.md b/vendor/github.com/digitalocean/godo/CHANGELOG.md index 667255b2a..68e7d48f5 100644 --- a/vendor/github.com/digitalocean/godo/CHANGELOG.md +++ b/vendor/github.com/digitalocean/godo/CHANGELOG.md @@ -1,5 +1,17 @@ # Change Log +## [v1.130.0] - 2024-11-14 + +- #755 - @vsharma6855 - Add Missing Database Configs for Postgresql and MYSQL +- #754 - @blesswinsamuel - APPS-9858 Add method to obtain websocket URL to get console access into components + +## [v1.129.0] - 2024-11-06 + +- #752 - @andrewsomething - Support maps in Stringify +- #749 - @loosla - [droplets]: add droplet backup policies +- #730 - @rak16 - DOCR-1201: Add new RegistriesService to support methods for multiple-registry open beta +- #748 - @andrewsomething - Support Droplet GPU information + ## [v1.128.0] - 2024-10-24 - #746 - @blesswinsamuel - Add archive field to AppSpec to archive/restore apps diff --git a/vendor/github.com/digitalocean/godo/apps.go b/vendor/github.com/digitalocean/godo/apps.go index ac792658e..24fe738e4 100644 --- a/vendor/github.com/digitalocean/godo/apps.go +++ b/vendor/github.com/digitalocean/godo/apps.go @@ -40,6 +40,7 @@ type AppsService interface { CreateDeployment(ctx context.Context, appID string, create ...*DeploymentCreateRequest) (*Deployment, *Response, error) GetLogs(ctx context.Context, appID, deploymentID, component string, logType AppLogType, follow bool, tailLines int) (*AppLogs, *Response, error) + GetExec(ctx context.Context, appID, deploymentID, component string) (*AppExec, *Response, error) ListRegions(ctx context.Context) ([]*AppRegion, *Response, error) @@ -77,6 +78,11 @@ type AppLogs struct { HistoricURLs []string `json:"historic_urls"` } +// AppExec represents the websocket URL used for sending/receiving console input and output. +type AppExec struct { + URL string `json:"url"` +} + // AppUpdateRequest represents a request to update an app. type AppUpdateRequest struct { Spec *AppSpec `json:"spec"` @@ -368,6 +374,27 @@ func (s *AppsServiceOp) GetLogs(ctx context.Context, appID, deploymentID, compon return logs, resp, nil } +// GetExec retrieves the websocket URL used for sending/receiving console input and output. +func (s *AppsServiceOp) GetExec(ctx context.Context, appID, deploymentID, component string) (*AppExec, *Response, error) { + var url string + if deploymentID == "" { + url = fmt.Sprintf("%s/%s/components/%s/exec", appsBasePath, appID, component) + } else { + url = fmt.Sprintf("%s/%s/deployments/%s/components/%s/exec", appsBasePath, appID, deploymentID, component) + } + + req, err := s.client.NewRequest(ctx, http.MethodGet, url, nil) + if err != nil { + return nil, nil, err + } + logs := new(AppExec) + resp, err := s.client.Do(ctx, req, logs) + if err != nil { + return nil, resp, err + } + return logs, resp, nil +} + // ListRegions lists all regions supported by App Platform. func (s *AppsServiceOp) ListRegions(ctx context.Context) ([]*AppRegion, *Response, error) { path := fmt.Sprintf("%s/regions", appsBasePath) diff --git a/vendor/github.com/digitalocean/godo/databases.go b/vendor/github.com/digitalocean/godo/databases.go index 276fb4a6b..e2a7d567c 100644 --- a/vendor/github.com/digitalocean/godo/databases.go +++ b/vendor/github.com/digitalocean/godo/databases.go @@ -589,6 +589,9 @@ type PostgreSQLConfig struct { BackupMinute *int `json:"backup_minute,omitempty"` WorkMem *int `json:"work_mem,omitempty"` TimeScaleDB *PostgreSQLTimeScaleDBConfig `json:"timescaledb,omitempty"` + SynchronousReplication *string `json:"synchronous_replication,omitempty"` + StatMonitorEnable *bool `json:"stat_monitor_enable,omitempty"` + MaxFailoverReplicationTimeLag *int64 `json:"max_failover_replication_time_lag,omitempty"` } // PostgreSQLBouncerConfig configuration @@ -653,6 +656,13 @@ type MySQLConfig struct { BackupHour *int `json:"backup_hour,omitempty"` BackupMinute *int `json:"backup_minute,omitempty"` BinlogRetentionPeriod *int `json:"binlog_retention_period,omitempty"` + InnodbChangeBufferMaxSize *int `json:"innodb_change_buffer_max_size,omitempty"` + InnodbFlushNeighbors *int `json:"innodb_flush_neighbors,omitempty"` + InnodbReadIoThreads *int `json:"innodb_read_io_threads,omitempty"` + InnodbThreadConcurrency *int `json:"innodb_thread_concurrency,omitempty"` + InnodbWriteIoThreads *int `json:"innodb_write_io_threads,omitempty"` + NetBufferLength *int `json:"net_buffer_length,omitempty"` + LogOutput *string `json:"log_output,omitempty"` } // MongoDBConfig holds advanced configurations for MongoDB database clusters. diff --git a/vendor/github.com/digitalocean/godo/droplet_actions.go b/vendor/github.com/digitalocean/godo/droplet_actions.go index 2e09d0c59..ed0f583c9 100644 --- a/vendor/github.com/digitalocean/godo/droplet_actions.go +++ b/vendor/github.com/digitalocean/godo/droplet_actions.go @@ -30,6 +30,8 @@ type DropletActionsService interface { SnapshotByTag(context.Context, string, string) ([]Action, *Response, error) EnableBackups(context.Context, int) (*Action, *Response, error) EnableBackupsByTag(context.Context, string) ([]Action, *Response, error) + EnableBackupsWithPolicy(context.Context, int, *DropletBackupPolicyRequest) (*Action, *Response, error) + ChangeBackupPolicy(context.Context, int, *DropletBackupPolicyRequest) (*Action, *Response, error) DisableBackups(context.Context, int) (*Action, *Response, error) DisableBackupsByTag(context.Context, string) ([]Action, *Response, error) PasswordReset(context.Context, int) (*Action, *Response, error) @@ -169,6 +171,42 @@ func (s *DropletActionsServiceOp) EnableBackupsByTag(ctx context.Context, tag st return s.doActionByTag(ctx, tag, request) } +// EnableBackupsWithPolicy enables droplet's backup with a backup policy applied. +func (s *DropletActionsServiceOp) EnableBackupsWithPolicy(ctx context.Context, id int, policy *DropletBackupPolicyRequest) (*Action, *Response, error) { + if policy == nil { + return nil, nil, NewArgError("policy", "policy can't be nil") + } + + policyMap := map[string]interface{}{ + "plan": policy.Plan, + "weekday": policy.Weekday, + } + if policy.Hour != nil { + policyMap["hour"] = policy.Hour + } + + request := &ActionRequest{"type": "enable_backups", "backup_policy": policyMap} + return s.doAction(ctx, id, request) +} + +// ChangeBackupPolicy updates a backup policy when backups are enabled. +func (s *DropletActionsServiceOp) ChangeBackupPolicy(ctx context.Context, id int, policy *DropletBackupPolicyRequest) (*Action, *Response, error) { + if policy == nil { + return nil, nil, NewArgError("policy", "policy can't be nil") + } + + policyMap := map[string]interface{}{ + "plan": policy.Plan, + "weekday": policy.Weekday, + } + if policy.Hour != nil { + policyMap["hour"] = policy.Hour + } + + request := &ActionRequest{"type": "change_backup_policy", "backup_policy": policyMap} + return s.doAction(ctx, id, request) +} + // DisableBackups disables backups for a Droplet. func (s *DropletActionsServiceOp) DisableBackups(ctx context.Context, id int) (*Action, *Response, error) { request := &ActionRequest{"type": "disable_backups"} diff --git a/vendor/github.com/digitalocean/godo/droplets.go b/vendor/github.com/digitalocean/godo/droplets.go index 1ed09ec8c..2ddd7d6b7 100644 --- a/vendor/github.com/digitalocean/godo/droplets.go +++ b/vendor/github.com/digitalocean/godo/droplets.go @@ -30,6 +30,9 @@ type DropletsService interface { Backups(context.Context, int, *ListOptions) ([]Image, *Response, error) Actions(context.Context, int, *ListOptions) ([]Action, *Response, error) Neighbors(context.Context, int) ([]Droplet, *Response, error) + GetBackupPolicy(context.Context, int) (*DropletBackupPolicy, *Response, error) + ListBackupPolicies(context.Context, *ListOptions) (map[int]*DropletBackupPolicy, *Response, error) + ListSupportedBackupPolicies(context.Context) ([]*SupportedBackupPolicy, *Response, error) } // DropletsServiceOp handles communication with the Droplet related methods of the @@ -218,37 +221,46 @@ func (d DropletCreateSSHKey) MarshalJSON() ([]byte, error) { // DropletCreateRequest represents a request to create a Droplet. type DropletCreateRequest struct { - Name string `json:"name"` - Region string `json:"region"` - Size string `json:"size"` - Image DropletCreateImage `json:"image"` - SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` - Backups bool `json:"backups"` - IPv6 bool `json:"ipv6"` - PrivateNetworking bool `json:"private_networking"` - Monitoring bool `json:"monitoring"` - UserData string `json:"user_data,omitempty"` - Volumes []DropletCreateVolume `json:"volumes,omitempty"` - Tags []string `json:"tags"` - VPCUUID string `json:"vpc_uuid,omitempty"` - WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + Name string `json:"name"` + Region string `json:"region"` + Size string `json:"size"` + Image DropletCreateImage `json:"image"` + SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` + Backups bool `json:"backups"` + IPv6 bool `json:"ipv6"` + PrivateNetworking bool `json:"private_networking"` + Monitoring bool `json:"monitoring"` + UserData string `json:"user_data,omitempty"` + Volumes []DropletCreateVolume `json:"volumes,omitempty"` + Tags []string `json:"tags"` + VPCUUID string `json:"vpc_uuid,omitempty"` + WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + BackupPolicy *DropletBackupPolicyRequest `json:"backup_policy,omitempty"` } // DropletMultiCreateRequest is a request to create multiple Droplets. type DropletMultiCreateRequest struct { - Names []string `json:"names"` - Region string `json:"region"` - Size string `json:"size"` - Image DropletCreateImage `json:"image"` - SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` - Backups bool `json:"backups"` - IPv6 bool `json:"ipv6"` - PrivateNetworking bool `json:"private_networking"` - Monitoring bool `json:"monitoring"` - UserData string `json:"user_data,omitempty"` - Tags []string `json:"tags"` - VPCUUID string `json:"vpc_uuid,omitempty"` - WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + Names []string `json:"names"` + Region string `json:"region"` + Size string `json:"size"` + Image DropletCreateImage `json:"image"` + SSHKeys []DropletCreateSSHKey `json:"ssh_keys"` + Backups bool `json:"backups"` + IPv6 bool `json:"ipv6"` + PrivateNetworking bool `json:"private_networking"` + Monitoring bool `json:"monitoring"` + UserData string `json:"user_data,omitempty"` + Tags []string `json:"tags"` + VPCUUID string `json:"vpc_uuid,omitempty"` + WithDropletAgent *bool `json:"with_droplet_agent,omitempty"` + BackupPolicy *DropletBackupPolicyRequest `json:"backup_policy,omitempty"` +} + +// DropletBackupPolicyRequest defines the backup policy when creating a Droplet. +type DropletBackupPolicyRequest struct { + Plan string `json:"plan,omitempty"` + Weekday string `json:"weekday,omitempty"` + Hour *int `json:"hour,omitempty"` } func (d DropletCreateRequest) String() string { @@ -618,3 +630,109 @@ func (s *DropletsServiceOp) dropletActionStatus(ctx context.Context, uri string) return action.Status, nil } + +// DropletBackupPolicy defines the information about a droplet's backup policy. +type DropletBackupPolicy struct { + DropletID int `json:"droplet_id,omitempty"` + BackupEnabled bool `json:"backup_enabled,omitempty"` + BackupPolicy *DropletBackupPolicyConfig `json:"backup_policy,omitempty"` + NextBackupWindow *BackupWindow `json:"next_backup_window,omitempty"` +} + +// DropletBackupPolicyConfig defines the backup policy for a Droplet. +type DropletBackupPolicyConfig struct { + Plan string `json:"plan,omitempty"` + Weekday string `json:"weekday,omitempty"` + Hour int `json:"hour,omitempty"` + WindowLengthHours int `json:"window_length_hours,omitempty"` + RetentionPeriodDays int `json:"retention_period_days,omitempty"` +} + +// dropletBackupPolicyRoot represents a DropletBackupPolicy root +type dropletBackupPolicyRoot struct { + DropletBackupPolicy *DropletBackupPolicy `json:"policy,omitempty"` +} + +type dropletBackupPoliciesRoot struct { + DropletBackupPolicies map[int]*DropletBackupPolicy `json:"policies,omitempty"` + Links *Links `json:"links,omitempty"` + Meta *Meta `json:"meta"` +} + +// Get individual droplet backup policy. +func (s *DropletsServiceOp) GetBackupPolicy(ctx context.Context, dropletID int) (*DropletBackupPolicy, *Response, error) { + if dropletID < 1 { + return nil, nil, NewArgError("dropletID", "cannot be less than 1") + } + + path := fmt.Sprintf("%s/%d/backups/policy", dropletBasePath, dropletID) + + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(dropletBackupPolicyRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.DropletBackupPolicy, resp, err +} + +// List all droplet backup policies. +func (s *DropletsServiceOp) ListBackupPolicies(ctx context.Context, opt *ListOptions) (map[int]*DropletBackupPolicy, *Response, error) { + path := fmt.Sprintf("%s/backups/policies", dropletBasePath) + path, err := addOptions(path, opt) + if err != nil { + return nil, nil, err + } + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(dropletBackupPoliciesRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + if l := root.Links; l != nil { + resp.Links = l + } + if m := root.Meta; m != nil { + resp.Meta = m + } + + return root.DropletBackupPolicies, resp, nil +} + +type SupportedBackupPolicy struct { + Name string `json:"name,omitempty"` + PossibleWindowStarts []int `json:"possible_window_starts,omitempty"` + WindowLengthHours int `json:"window_length_hours,omitempty"` + RetentionPeriodDays int `json:"retention_period_days,omitempty"` + PossibleDays []string `json:"possible_days,omitempty"` +} + +type dropletSupportedBackupPoliciesRoot struct { + SupportedBackupPolicies []*SupportedBackupPolicy `json:"supported_policies,omitempty"` +} + +// List supported droplet backup policies. +func (s *DropletsServiceOp) ListSupportedBackupPolicies(ctx context.Context) ([]*SupportedBackupPolicy, *Response, error) { + path := fmt.Sprintf("%s/backups/supported_policies", dropletBasePath) + req, err := s.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + root := new(dropletSupportedBackupPoliciesRoot) + resp, err := s.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + + return root.SupportedBackupPolicies, resp, nil +} diff --git a/vendor/github.com/digitalocean/godo/godo.go b/vendor/github.com/digitalocean/godo/godo.go index edf0f6d46..4b9ad6b61 100644 --- a/vendor/github.com/digitalocean/godo/godo.go +++ b/vendor/github.com/digitalocean/godo/godo.go @@ -21,7 +21,7 @@ import ( ) const ( - libraryVersion = "1.128.0" + libraryVersion = "1.130.0" defaultBaseURL = "https://api.digitalocean.com/" userAgent = "godo/" + libraryVersion mediaType = "application/json" @@ -81,6 +81,7 @@ type Client struct { Projects ProjectsService Regions RegionsService Registry RegistryService + Registries RegistriesService ReservedIPs ReservedIPsService ReservedIPActions ReservedIPActionsService Sizes SizesService @@ -292,6 +293,7 @@ func NewClient(httpClient *http.Client) *Client { c.Projects = &ProjectsServiceOp{client: c} c.Regions = &RegionsServiceOp{client: c} c.Registry = &RegistryServiceOp{client: c} + c.Registries = &RegistriesServiceOp{client: c} c.ReservedIPs = &ReservedIPsServiceOp{client: c} c.ReservedIPActions = &ReservedIPActionsServiceOp{client: c} c.Sizes = &SizesServiceOp{client: c} diff --git a/vendor/github.com/digitalocean/godo/registry.go b/vendor/github.com/digitalocean/godo/registry.go index b0c243281..e64822682 100644 --- a/vendor/github.com/digitalocean/godo/registry.go +++ b/vendor/github.com/digitalocean/godo/registry.go @@ -14,6 +14,9 @@ const ( registryPath = "/v2/registry" // RegistryServer is the hostname of the DigitalOcean registry service RegistryServer = "registry.digitalocean.com" + + // Multi-registry Open Beta API constants + registriesPath = "/v2/registries" ) // RegistryService is an interface for interfacing with the Registry endpoints @@ -240,6 +243,19 @@ type RegistryValidateNameRequest struct { Name string `json:"name"` } +// Multi-registry Open Beta API structs + +type registriesRoot struct { + Registries []*Registry `json:"registries,omitempty"` + TotalStorageUsageBytes uint64 `json:"total_storage_usage_bytes,omitempty"` +} + +// RegistriesCreateRequest represents a request to create a secondary registry. +type RegistriesCreateRequest struct { + Name string `json:"name,omitempty"` + Region string `json:"region,omitempty"` +} + // Get retrieves the details of a Registry. func (svc *RegistryServiceOp) Get(ctx context.Context) (*Registry, *Response, error) { req, err := svc.client.NewRequest(ctx, http.MethodGet, registryPath, nil) @@ -610,3 +626,107 @@ func (svc *RegistryServiceOp) ValidateName(ctx context.Context, request *Registr } return resp, nil } + +// RegistriesService is an interface for interfacing with the new multiple-registry beta endpoints +// of the DigitalOcean API. +// +// We are creating a separate Service in alignment with the new /v2/registries endpoints. +type RegistriesService interface { + Get(context.Context, string) (*Registry, *Response, error) + List(context.Context) ([]*Registry, *Response, error) + Create(context.Context, *RegistriesCreateRequest) (*Registry, *Response, error) + Delete(context.Context, string) (*Response, error) + DockerCredentials(context.Context, string, *RegistryDockerCredentialsRequest) (*DockerCredentials, *Response, error) +} + +var _ RegistriesService = &RegistriesServiceOp{} + +// RegistriesServiceOp handles communication with the multiple-registry beta methods. +type RegistriesServiceOp struct { + client *Client +} + +// Get returns the details of a named Registry. +func (svc *RegistriesServiceOp) Get(ctx context.Context, registry string) (*Registry, *Response, error) { + path := fmt.Sprintf("%s/%s", registriesPath, registry) + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + root := new(registryRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Registry, resp, nil +} + +// List returns a list of the named Registries. +func (svc *RegistriesServiceOp) List(ctx context.Context) ([]*Registry, *Response, error) { + req, err := svc.client.NewRequest(ctx, http.MethodGet, registriesPath, nil) + if err != nil { + return nil, nil, err + } + root := new(registriesRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Registries, resp, nil +} + +// Create creates a named Registry. +func (svc *RegistriesServiceOp) Create(ctx context.Context, create *RegistriesCreateRequest) (*Registry, *Response, error) { + req, err := svc.client.NewRequest(ctx, http.MethodPost, registriesPath, create) + if err != nil { + return nil, nil, err + } + root := new(registryRoot) + resp, err := svc.client.Do(ctx, req, root) + if err != nil { + return nil, resp, err + } + return root.Registry, resp, nil +} + +// Delete deletes a named Registry. There is no way to recover a Registry once it has +// been destroyed. +func (svc *RegistriesServiceOp) Delete(ctx context.Context, registry string) (*Response, error) { + path := fmt.Sprintf("%s/%s", registriesPath, registry) + req, err := svc.client.NewRequest(ctx, http.MethodDelete, path, nil) + if err != nil { + return nil, err + } + resp, err := svc.client.Do(ctx, req, nil) + if err != nil { + return resp, err + } + return resp, nil +} + +// DockerCredentials retrieves a Docker config file containing named Registry's credentials. +func (svc *RegistriesServiceOp) DockerCredentials(ctx context.Context, registry string, request *RegistryDockerCredentialsRequest) (*DockerCredentials, *Response, error) { + path := fmt.Sprintf("%s/%s/%s", registriesPath, registry, "docker-credentials") + req, err := svc.client.NewRequest(ctx, http.MethodGet, path, nil) + if err != nil { + return nil, nil, err + } + + q := req.URL.Query() + q.Add("read_write", strconv.FormatBool(request.ReadWrite)) + if request.ExpirySeconds != nil { + q.Add("expiry_seconds", strconv.Itoa(*request.ExpirySeconds)) + } + req.URL.RawQuery = q.Encode() + + var buf bytes.Buffer + resp, err := svc.client.Do(ctx, req, &buf) + if err != nil { + return nil, resp, err + } + + dc := &DockerCredentials{ + DockerConfigJSON: buf.Bytes(), + } + return dc, resp, nil +} diff --git a/vendor/github.com/digitalocean/godo/strings.go b/vendor/github.com/digitalocean/godo/strings.go index f92893ed2..5a258131e 100644 --- a/vendor/github.com/digitalocean/godo/strings.go +++ b/vendor/github.com/digitalocean/godo/strings.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "reflect" + "sort" "strings" ) @@ -46,6 +47,8 @@ func stringifyValue(w io.Writer, val reflect.Value) { return case reflect.Struct: stringifyStruct(w, v) + case reflect.Map: + stringifyMap(w, v) default: if v.CanInterface() { fmt.Fprint(w, v.Interface()) @@ -66,6 +69,27 @@ func stringifySlice(w io.Writer, v reflect.Value) { _, _ = w.Write([]byte{']'}) } +func stringifyMap(w io.Writer, v reflect.Value) { + _, _ = w.Write([]byte("map[")) + + // Sort the keys so that the output is stable + keys := v.MapKeys() + sort.Slice(keys, func(i, j int) bool { + return fmt.Sprintf("%v", keys[i]) < fmt.Sprintf("%v", keys[j]) + }) + + for i, key := range keys { + stringifyValue(w, key) + _, _ = w.Write([]byte{':'}) + stringifyValue(w, v.MapIndex(key)) + if i < len(keys)-1 { + _, _ = w.Write([]byte(", ")) + } + } + + _, _ = w.Write([]byte("]")) +} + func stringifyStruct(w io.Writer, v reflect.Value) { if v.Type().Name() != "" { _, _ = w.Write([]byte(v.Type().String())) diff --git a/vendor/golang.org/x/oauth2/README.md b/vendor/golang.org/x/oauth2/README.md index 781770c20..48dbb9d84 100644 --- a/vendor/golang.org/x/oauth2/README.md +++ b/vendor/golang.org/x/oauth2/README.md @@ -5,15 +5,6 @@ oauth2 package contains a client implementation for OAuth 2.0 spec. -## Installation - -~~~~ -go get golang.org/x/oauth2 -~~~~ - -Or you can manually git clone the repository to -`$(go env GOPATH)/src/golang.org/x/oauth2`. - See pkg.go.dev for further documentation and examples. * [pkg.go.dev/golang.org/x/oauth2](https://pkg.go.dev/golang.org/x/oauth2) @@ -33,7 +24,11 @@ The main issue tracker for the oauth2 repository is located at https://github.com/golang/oauth2/issues. This repository uses Gerrit for code changes. To learn how to submit changes to -this repository, see https://golang.org/doc/contribute.html. In particular: +this repository, see https://go.dev/doc/contribute. + +The git repository is https://go.googlesource.com/oauth2. + +Note: * Excluding trivial changes, all contributions should be connected to an existing issue. * API changes must go through the [change proposal process](https://go.dev/s/proposal-process) before they can be accepted. diff --git a/vendor/golang.org/x/time/rate/rate.go b/vendor/golang.org/x/time/rate/rate.go index 8f6c7f493..93a798ab6 100644 --- a/vendor/golang.org/x/time/rate/rate.go +++ b/vendor/golang.org/x/time/rate/rate.go @@ -99,8 +99,9 @@ func (lim *Limiter) Tokens() float64 { // bursts of at most b tokens. func NewLimiter(r Limit, b int) *Limiter { return &Limiter{ - limit: r, - burst: b, + limit: r, + burst: b, + tokens: float64(b), } } @@ -344,18 +345,6 @@ func (lim *Limiter) reserveN(t time.Time, n int, maxFutureReserve time.Duration) tokens: n, timeToAct: t, } - } else if lim.limit == 0 { - var ok bool - if lim.burst >= n { - ok = true - lim.burst -= n - } - return Reservation{ - ok: ok, - lim: lim, - tokens: lim.burst, - timeToAct: t, - } } t, tokens := lim.advance(t) diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ee0dde8a..f3be68f60 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/creack/pty # github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc ## explicit github.com/davecgh/go-spew/spew -# github.com/digitalocean/godo v1.128.1-0.20241025145008-2654a9d1e887 +# github.com/digitalocean/godo v1.130.0 ## explicit; go 1.22 github.com/digitalocean/godo github.com/digitalocean/godo/metrics @@ -439,7 +439,7 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/internal/socks golang.org/x/net/proxy -# golang.org/x/oauth2 v0.23.0 +# golang.org/x/oauth2 v0.24.0 ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal @@ -459,7 +459,7 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/time v0.6.0 +# golang.org/x/time v0.8.0 ## explicit; go 1.18 golang.org/x/time/rate # golang.org/x/tools v0.10.0 From 93208a59f7569c82b9dc81105fac34f90c900c6b Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 21:43:29 +0530 Subject: [PATCH 02/10] change tab to space --- integration/database_config_get_test.go | 32 +++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 75e2c42a2..acb9d2505 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -177,6 +177,14 @@ SlowQueryLog false LongQueryTime 10 BackupHour 18 BackupMinute 3 +BinlogRetentionPeriod 600 +InnodbChangeBufferMaxSize 25 +InnodbFlushNeighbors 0 +InnodbReadIoThreads 16 +InnodbThreadConcurrency 1000 +InnodbWriteIoThreads 16 +NetBufferLength 4096 +LogOutput NONE ` databaseConfigMySQLGetResponse = ` @@ -199,7 +207,15 @@ BackupMinute 3 "slow_query_log": false, "long_query_time": 10, "backup_hour": 18, - "backup_minute": 3 + "backup_minute": 3, + "binlog_retention_period": 600, + "innodb_change_buffer_max_size": 25, + "innodb_flush_neighbors": 0, + "innodb_read_io_threads": 16, + "innodb_thread_concurrency": 1000, + "innodb_write_io_threads": 16, + "net_buffer_length": 4096, + "log_output": "NONE" } }` @@ -231,7 +247,12 @@ PgBouncer.AutodbPoolSize 0 PgBouncer.AutodbMaxDbConnections 0 PgBouncer.AutodbIdleTimeout 0 BackupHour 18 -BackupMinute 26` +BackupMinute 26 +WorkMem 4 +TimeScaleDB off +SynchronousReplication off +StatMonitorEnable false +MaxFailoverReplicationTimeLag NONE` databaseConfigPGGetResponse = `{ "config": { @@ -264,8 +285,11 @@ BackupMinute 26` }, "backup_hour": 18, "backup_minute": 26, - "timescaledb": {}, - "stat_monitor_enable": false + "timescaledb": "NONE", + "stat_monitor_enable": false, + "work_mem": 4, + "synchronous_replication": "off, + "max_failover_replication_time_lag": "NONE } }` From 5584922b24d6f90c92700218e1d799ded262bc2d Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 21:47:16 +0530 Subject: [PATCH 03/10] change tab to space --- integration/database_config_get_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index acb9d2505..5b1f6703e 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -248,11 +248,11 @@ PgBouncer.AutodbMaxDbConnections 0 PgBouncer.AutodbIdleTimeout 0 BackupHour 18 BackupMinute 26 -WorkMem 4 -TimeScaleDB off -SynchronousReplication off -StatMonitorEnable false -MaxFailoverReplicationTimeLag NONE` +WorkMem 4 +TimeScaleDB off +SynchronousReplication off +StatMonitorEnable false +MaxFailoverReplicationTimeLag NONE` databaseConfigPGGetResponse = `{ "config": { From 7e23005f763f4be2b8dc689854d0447ad01ee060 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 21:56:03 +0530 Subject: [PATCH 04/10] fix indentation for whole file --- integration/database_config_get_test.go | 214 ++++++++++++------------ 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 5b1f6703e..0abf4b2c4 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -255,42 +255,42 @@ StatMonitorEnable false MaxFailoverReplicationTimeLag NONE` databaseConfigPGGetResponse = `{ -"config": { - "autovacuum_naptime": 60, - "autovacuum_vacuum_threshold": 50, - "autovacuum_analyze_threshold": 50, - "autovacuum_vacuum_scale_factor": 0.2, - "autovacuum_analyze_scale_factor": 0.2, - "autovacuum_vacuum_cost_delay": 20, - "autovacuum_vacuum_cost_limit": -1, - "bgwriter_flush_after": 512, - "bgwriter_lru_maxpages": 100, - "bgwriter_lru_multiplier": 2, - "idle_in_transaction_session_timeout": 0, - "jit": true, - "log_autovacuum_min_duration": -1, - "log_min_duration_statement": -1, - "max_prepared_transactions": 0, - "max_parallel_workers": 8, - "max_parallel_workers_per_gather": 2, - "temp_file_limit": -1, - "wal_sender_timeout": 60000, - "pgbouncer": { - "server_reset_query_always": false, - "min_pool_size": 0, - "server_idle_timeout": 0, - "autodb_pool_size": 0, - "autodb_max_db_connections": 0, - "autodb_idle_timeout": 0 - }, - "backup_hour": 18, - "backup_minute": 26, - "timescaledb": "NONE", - "stat_monitor_enable": false, - "work_mem": 4, - "synchronous_replication": "off, - "max_failover_replication_time_lag": "NONE -} + "config": { + "autovacuum_naptime": 60, + "autovacuum_vacuum_threshold": 50, + "autovacuum_analyze_threshold": 50, + "autovacuum_vacuum_scale_factor": 0.2, + "autovacuum_analyze_scale_factor": 0.2, + "autovacuum_vacuum_cost_delay": 20, + "autovacuum_vacuum_cost_limit": -1, + "bgwriter_flush_after": 512, + "bgwriter_lru_maxpages": 100, + "bgwriter_lru_multiplier": 2, + "idle_in_transaction_session_timeout": 0, + "jit": true, + "log_autovacuum_min_duration": -1, + "log_min_duration_statement": -1, + "max_prepared_transactions": 0, + "max_parallel_workers": 8, + "max_parallel_workers_per_gather": 2, + "temp_file_limit": -1, + "wal_sender_timeout": 60000, + "pgbouncer": { + "server_reset_query_always": false, + "min_pool_size": 0, + "server_idle_timeout": 0, + "autodb_pool_size": 0, + "autodb_max_db_connections": 0, + "autodb_idle_timeout": 0 + }, + "backup_hour": 18, + "backup_minute": 26, + "timescaledb": "NONE", + "stat_monitor_enable": false, + "work_mem": 4, + "synchronous_replication": "off", + "max_failover_replication_time_lag": "NONE" + } }` databaseConfigRedisGetOutput = ` @@ -307,88 +307,88 @@ RedisACLChannelsDefault allchannels databaseConfigRedisGetResponse = `{ "config": { - "redis_maxmemory_policy": "volatile-lru", - "redis_lfu_log_factor": 10, - "redis_lfu_decay_time": 1, - "redis_ssl": true, - "redis_timeout": 600, - "redis_notify_keyspace_events": "", - "redis_persistence": "rdb", - "redis_acl_channels_default": "allchannels" + "redis_maxmemory_policy": "volatile-lru", + "redis_lfu_log_factor": 10, + "redis_lfu_decay_time": 1, + "redis_ssl": true, + "redis_timeout": 600, + "redis_notify_keyspace_events": "", + "redis_persistence": "rdb", + "redis_acl_channels_default": "allchannels" } - }` +}` databaseConfigMongoDBGetResponse = `{ "config": { - "default_read_concern": "local", - "default_write_concern": "majority", - "slow_op_threshold_ms": 100, - "transaction_lifetime_limit_seconds": 60, - "verbosity": 1 + "default_read_concern": "local", + "default_write_concern": "majority", + "slow_op_threshold_ms": 100, + "transaction_lifetime_limit_seconds": 60, + "verbosity": 1 } - }` +}` databaseConfigKafkaGetResponse = `{ "config": { - "group_initial_rebalance_delay_ms": 3000, - "group_min_session_timeout_ms": 6000, - "group_max_session_timeout_ms": 1800000, - "message_max_bytes": 1048588, - "log_cleaner_delete_retention_ms": 86400000, - "log_cleaner_min_compaction_lag_ms": 0, - "log_flush_interval_ms": 9223372036854776000, - "log_index_interval_bytes": 4096, - "log_message_downconversion_enable": true, - "log_message_timestamp_difference_max_ms": 9223372036854776000, - "log_preallocate": false, - "log_retention_bytes": -1, - "log_retention_hours": 168, - "log_retention_ms": 604800000, - "log_roll_jitter_ms": 0, - "log_segment_delete_delay_ms": 60000, - "auto_create_topics_enable": true + "group_initial_rebalance_delay_ms": 3000, + "group_min_session_timeout_ms": 6000, + "group_max_session_timeout_ms": 1800000, + "message_max_bytes": 1048588, + "log_cleaner_delete_retention_ms": 86400000, + "log_cleaner_min_compaction_lag_ms": 0, + "log_flush_interval_ms": 9223372036854776000, + "log_index_interval_bytes": 4096, + "log_message_downconversion_enable": true, + "log_message_timestamp_difference_max_ms": 9223372036854776000, + "log_preallocate": false, + "log_retention_bytes": -1, + "log_retention_hours": 168, + "log_retention_ms": 604800000, + "log_roll_jitter_ms": 0, + "log_segment_delete_delay_ms": 60000, + "auto_create_topics_enable": true } - }` +}` databaseConfigOpensearchGetResponse = `{ "config": { - "ism_enabled": true, - "ism_history_enabled": true, - "ism_history_max_age_hours": 24, - "ism_history_max_docs": 2500000, - "ism_history_rollover_check_period_hours": 8, - "ism_history_rollover_retention_period_days": 30, - "http_max_content_length_bytes": 100000000, - "http_max_header_size_bytes": 8192, - "http_max_initial_line_length_bytes": 4096, - "indices_query_bool_max_clause_count": 1024, - "search_max_buckets": 10000, - "indices_fielddata_cache_size_percentage": 0, - "indices_memory_index_buffer_size_percentage": 10, - "indices_memory_min_index_buffer_size_mb": 48, - "indices_memory_max_index_buffer_size_mb": 0, - "indices_queries_cache_size_percentage": 10, - "indices_recovery_max_mb_per_sec": 40, - "indices_recovery_max_concurrent_file_chunks": 2, - "action_auto_create_index_enabled": true, - "action_destructive_requires_name": false, - "plugins_alerting_filter_by_backend_roles_enabled": false, - "enable_security_audit": false, - "thread_pool_search_size": 0, - "thread_pool_search_throttled_size": 0, - "thread_pool_search_throttled_queue_size": 0, - "thread_pool_search_queue_size": 0, - "thread_pool_get_size": 0, - "thread_pool_get_queue_size": 0, - "thread_pool_analyze_size": 0, - "thread_pool_analyze_queue_size": 0, - "thread_pool_write_size": 0, - "thread_pool_write_queue_size": 0, - "thread_pool_force_merge_size": 0, - "override_main_response_version": false, - "script_max_compilations_rate": "use-context", - "cluster_max_shards_per_node": 0, - "cluster_routing_allocation_node_concurrent_recoveries": 2 + "ism_enabled": true, + "ism_history_enabled": true, + "ism_history_max_age_hours": 24, + "ism_history_max_docs": 2500000, + "ism_history_rollover_check_period_hours": 8, + "ism_history_rollover_retention_period_days": 30, + "http_max_content_length_bytes": 100000000, + "http_max_header_size_bytes": 8192, + "http_max_initial_line_length_bytes": 4096, + "indices_query_bool_max_clause_count": 1024, + "search_max_buckets": 10000, + "indices_fielddata_cache_size_percentage": 0, + "indices_memory_index_buffer_size_percentage": 10, + "indices_memory_min_index_buffer_size_mb": 48, + "indices_memory_max_index_buffer_size_mb": 0, + "indices_queries_cache_size_percentage": 10, + "indices_recovery_max_mb_per_sec": 40, + "indices_recovery_max_concurrent_file_chunks": 2, + "action_auto_create_index_enabled": true, + "action_destructive_requires_name": false, + "plugins_alerting_filter_by_backend_roles_enabled": false, + "enable_security_audit": false, + "thread_pool_search_size": 0, + "thread_pool_search_throttled_size": 0, + "thread_pool_search_throttled_queue_size": 0, + "thread_pool_search_queue_size": 0, + "thread_pool_get_size": 0, + "thread_pool_get_queue_size": 0, + "thread_pool_analyze_size": 0, + "thread_pool_analyze_queue_size": 0, + "thread_pool_write_size": 0, + "thread_pool_write_queue_size": 0, + "thread_pool_force_merge_size": 0, + "override_main_response_version": false, + "script_max_compilations_rate": "use-context", + "cluster_max_shards_per_node": 0, + "cluster_routing_allocation_node_concurrent_recoveries": 2 } - }` +}` ) From f786518474a2993039a210c08d8a84599fcd0e37 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 22:01:42 +0530 Subject: [PATCH 05/10] convert tab to whitespace --- integration/database_config_get_test.go | 278 ++++++++++++------------ 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 0abf4b2c4..7cf8b31d2 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -189,34 +189,34 @@ LogOutput NONE databaseConfigMySQLGetResponse = ` { - "config": { - "default_time_zone": "UTC", - "max_allowed_packet": 67108864, - "sql_mode": "ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES", - "sql_require_primary_key": true, - "innodb_change_buffer_max_size": 25, - "innodb_flush_neighbors": 1, - "innodb_ft_min_token_size": 3, - "innodb_ft_server_stopword_table": "", - "innodb_print_all_deadlocks": false, - "innodb_read_io_threads": 4, - "innodb_rollback_on_timeout": false, - "innodb_thread_concurrency": 0, - "innodb_write_io_threads": 4, - "net_buffer_length": 16384, - "slow_query_log": false, - "long_query_time": 10, - "backup_hour": 18, - "backup_minute": 3, - "binlog_retention_period": 600, - "innodb_change_buffer_max_size": 25, - "innodb_flush_neighbors": 0, - "innodb_read_io_threads": 16, - "innodb_thread_concurrency": 1000, - "innodb_write_io_threads": 16, - "net_buffer_length": 4096, - "log_output": "NONE" - } + "config": { + "default_time_zone": "UTC", + "max_allowed_packet": 67108864, + "sql_mode": "ANSI,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,STRICT_ALL_TABLES", + "sql_require_primary_key": true, + "innodb_change_buffer_max_size": 25, + "innodb_flush_neighbors": 1, + "innodb_ft_min_token_size": 3, + "innodb_ft_server_stopword_table": "", + "innodb_print_all_deadlocks": false, + "innodb_read_io_threads": 4, + "innodb_rollback_on_timeout": false, + "innodb_thread_concurrency": 0, + "innodb_write_io_threads": 4, + "net_buffer_length": 16384, + "slow_query_log": false, + "long_query_time": 10, + "backup_hour": 18, + "backup_minute": 3, + "binlog_retention_period": 600, + "innodb_change_buffer_max_size": 25, + "innodb_flush_neighbors": 0, + "innodb_read_io_threads": 16, + "innodb_thread_concurrency": 1000, + "innodb_write_io_threads": 16, + "net_buffer_length": 4096, + "log_output": "NONE" + } }` databaseConfigPGGetOutput = ` @@ -255,42 +255,42 @@ StatMonitorEnable false MaxFailoverReplicationTimeLag NONE` databaseConfigPGGetResponse = `{ - "config": { - "autovacuum_naptime": 60, - "autovacuum_vacuum_threshold": 50, - "autovacuum_analyze_threshold": 50, - "autovacuum_vacuum_scale_factor": 0.2, - "autovacuum_analyze_scale_factor": 0.2, - "autovacuum_vacuum_cost_delay": 20, - "autovacuum_vacuum_cost_limit": -1, - "bgwriter_flush_after": 512, - "bgwriter_lru_maxpages": 100, - "bgwriter_lru_multiplier": 2, - "idle_in_transaction_session_timeout": 0, - "jit": true, - "log_autovacuum_min_duration": -1, - "log_min_duration_statement": -1, - "max_prepared_transactions": 0, - "max_parallel_workers": 8, - "max_parallel_workers_per_gather": 2, - "temp_file_limit": -1, - "wal_sender_timeout": 60000, - "pgbouncer": { - "server_reset_query_always": false, - "min_pool_size": 0, - "server_idle_timeout": 0, - "autodb_pool_size": 0, - "autodb_max_db_connections": 0, - "autodb_idle_timeout": 0 - }, - "backup_hour": 18, - "backup_minute": 26, - "timescaledb": "NONE", - "stat_monitor_enable": false, - "work_mem": 4, - "synchronous_replication": "off", - "max_failover_replication_time_lag": "NONE" - } + "config": { + "autovacuum_naptime": 60, + "autovacuum_vacuum_threshold": 50, + "autovacuum_analyze_threshold": 50, + "autovacuum_vacuum_scale_factor": 0.2, + "autovacuum_analyze_scale_factor": 0.2, + "autovacuum_vacuum_cost_delay": 20, + "autovacuum_vacuum_cost_limit": -1, + "bgwriter_flush_after": 512, + "bgwriter_lru_maxpages": 100, + "bgwriter_lru_multiplier": 2, + "idle_in_transaction_session_timeout": 0, + "jit": true, + "log_autovacuum_min_duration": -1, + "log_min_duration_statement": -1, + "max_prepared_transactions": 0, + "max_parallel_workers": 8, + "max_parallel_workers_per_gather": 2, + "temp_file_limit": -1, + "wal_sender_timeout": 60000, + "pgbouncer": { + "server_reset_query_always": false, + "min_pool_size": 0, + "server_idle_timeout": 0, + "autodb_pool_size": 0, + "autodb_max_db_connections": 0, + "autodb_idle_timeout": 0 + }, + "backup_hour": 18, + "backup_minute": 26, + "timescaledb": "NONE", + "stat_monitor_enable": false, + "work_mem": 4, + "synchronous_replication": "off", + "max_failover_replication_time_lag": "NONE" + } }` databaseConfigRedisGetOutput = ` @@ -306,89 +306,89 @@ RedisACLChannelsDefault allchannels ` databaseConfigRedisGetResponse = `{ - "config": { - "redis_maxmemory_policy": "volatile-lru", - "redis_lfu_log_factor": 10, - "redis_lfu_decay_time": 1, - "redis_ssl": true, - "redis_timeout": 600, - "redis_notify_keyspace_events": "", - "redis_persistence": "rdb", - "redis_acl_channels_default": "allchannels" - } + "config": { + "redis_maxmemory_policy": "volatile-lru", + "redis_lfu_log_factor": 10, + "redis_lfu_decay_time": 1, + "redis_ssl": true, + "redis_timeout": 600, + "redis_notify_keyspace_events": "", + "redis_persistence": "rdb", + "redis_acl_channels_default": "allchannels" + } }` databaseConfigMongoDBGetResponse = `{ - "config": { - "default_read_concern": "local", - "default_write_concern": "majority", - "slow_op_threshold_ms": 100, - "transaction_lifetime_limit_seconds": 60, - "verbosity": 1 - } + "config": { + "default_read_concern": "local", + "default_write_concern": "majority", + "slow_op_threshold_ms": 100, + "transaction_lifetime_limit_seconds": 60, + "verbosity": 1 + } }` databaseConfigKafkaGetResponse = `{ - "config": { - "group_initial_rebalance_delay_ms": 3000, - "group_min_session_timeout_ms": 6000, - "group_max_session_timeout_ms": 1800000, - "message_max_bytes": 1048588, - "log_cleaner_delete_retention_ms": 86400000, - "log_cleaner_min_compaction_lag_ms": 0, - "log_flush_interval_ms": 9223372036854776000, - "log_index_interval_bytes": 4096, - "log_message_downconversion_enable": true, - "log_message_timestamp_difference_max_ms": 9223372036854776000, - "log_preallocate": false, - "log_retention_bytes": -1, - "log_retention_hours": 168, - "log_retention_ms": 604800000, - "log_roll_jitter_ms": 0, - "log_segment_delete_delay_ms": 60000, - "auto_create_topics_enable": true - } + "config": { + "group_initial_rebalance_delay_ms": 3000, + "group_min_session_timeout_ms": 6000, + "group_max_session_timeout_ms": 1800000, + "message_max_bytes": 1048588, + "log_cleaner_delete_retention_ms": 86400000, + "log_cleaner_min_compaction_lag_ms": 0, + "log_flush_interval_ms": 9223372036854776000, + "log_index_interval_bytes": 4096, + "log_message_downconversion_enable": true, + "log_message_timestamp_difference_max_ms": 9223372036854776000, + "log_preallocate": false, + "log_retention_bytes": -1, + "log_retention_hours": 168, + "log_retention_ms": 604800000, + "log_roll_jitter_ms": 0, + "log_segment_delete_delay_ms": 60000, + "auto_create_topics_enable": true + } }` databaseConfigOpensearchGetResponse = `{ - "config": { - "ism_enabled": true, - "ism_history_enabled": true, - "ism_history_max_age_hours": 24, - "ism_history_max_docs": 2500000, - "ism_history_rollover_check_period_hours": 8, - "ism_history_rollover_retention_period_days": 30, - "http_max_content_length_bytes": 100000000, - "http_max_header_size_bytes": 8192, - "http_max_initial_line_length_bytes": 4096, - "indices_query_bool_max_clause_count": 1024, - "search_max_buckets": 10000, - "indices_fielddata_cache_size_percentage": 0, - "indices_memory_index_buffer_size_percentage": 10, - "indices_memory_min_index_buffer_size_mb": 48, - "indices_memory_max_index_buffer_size_mb": 0, - "indices_queries_cache_size_percentage": 10, - "indices_recovery_max_mb_per_sec": 40, - "indices_recovery_max_concurrent_file_chunks": 2, - "action_auto_create_index_enabled": true, - "action_destructive_requires_name": false, - "plugins_alerting_filter_by_backend_roles_enabled": false, - "enable_security_audit": false, - "thread_pool_search_size": 0, - "thread_pool_search_throttled_size": 0, - "thread_pool_search_throttled_queue_size": 0, - "thread_pool_search_queue_size": 0, - "thread_pool_get_size": 0, - "thread_pool_get_queue_size": 0, - "thread_pool_analyze_size": 0, - "thread_pool_analyze_queue_size": 0, - "thread_pool_write_size": 0, - "thread_pool_write_queue_size": 0, - "thread_pool_force_merge_size": 0, - "override_main_response_version": false, - "script_max_compilations_rate": "use-context", - "cluster_max_shards_per_node": 0, - "cluster_routing_allocation_node_concurrent_recoveries": 2 - } + "config": { + "ism_enabled": true, + "ism_history_enabled": true, + "ism_history_max_age_hours": 24, + "ism_history_max_docs": 2500000, + "ism_history_rollover_check_period_hours": 8, + "ism_history_rollover_retention_period_days": 30, + "http_max_content_length_bytes": 100000000, + "http_max_header_size_bytes": 8192, + "http_max_initial_line_length_bytes": 4096, + "indices_query_bool_max_clause_count": 1024, + "search_max_buckets": 10000, + "indices_fielddata_cache_size_percentage": 0, + "indices_memory_index_buffer_size_percentage": 10, + "indices_memory_min_index_buffer_size_mb": 48, + "indices_memory_max_index_buffer_size_mb": 0, + "indices_queries_cache_size_percentage": 10, + "indices_recovery_max_mb_per_sec": 40, + "indices_recovery_max_concurrent_file_chunks": 2, + "action_auto_create_index_enabled": true, + "action_destructive_requires_name": false, + "plugins_alerting_filter_by_backend_roles_enabled": false, + "enable_security_audit": false, + "thread_pool_search_size": 0, + "thread_pool_search_throttled_size": 0, + "thread_pool_search_throttled_queue_size": 0, + "thread_pool_search_queue_size": 0, + "thread_pool_get_size": 0, + "thread_pool_get_queue_size": 0, + "thread_pool_analyze_size": 0, + "thread_pool_analyze_queue_size": 0, + "thread_pool_write_size": 0, + "thread_pool_write_queue_size": 0, + "thread_pool_force_merge_size": 0, + "override_main_response_version": false, + "script_max_compilations_rate": "use-context", + "cluster_max_shards_per_node": 0, + "cluster_routing_allocation_node_concurrent_recoveries": 2 + } }` ) From 6d6003c970eab3435d73a2f803967919f7f57687 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Thu, 14 Nov 2024 22:07:28 +0530 Subject: [PATCH 06/10] change the value of timescaledb --- integration/database_config_get_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 7cf8b31d2..ac21155b6 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -249,7 +249,7 @@ PgBouncer.AutodbIdleTimeout 0 BackupHour 18 BackupMinute 26 WorkMem 4 -TimeScaleDB off +TimeScaleDB {} SynchronousReplication off StatMonitorEnable false MaxFailoverReplicationTimeLag NONE` @@ -285,7 +285,7 @@ MaxFailoverReplicationTimeLag NONE` }, "backup_hour": 18, "backup_minute": 26, - "timescaledb": "NONE", + "timescaledb": {}, "stat_monitor_enable": false, "work_mem": 4, "synchronous_replication": "off", From 50bae3e909a0a7d3b29168a3838837537defaf08 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Tue, 19 Nov 2024 18:57:34 +0530 Subject: [PATCH 07/10] changed max_failover_replication_time_lag --- integration/database_config_get_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index ac21155b6..3dde81bf1 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -252,7 +252,7 @@ WorkMem 4 TimeScaleDB {} SynchronousReplication off StatMonitorEnable false -MaxFailoverReplicationTimeLag NONE` +MaxFailoverReplicationTimeLag 10` databaseConfigPGGetResponse = `{ "config": { @@ -289,7 +289,7 @@ MaxFailoverReplicationTimeLag NONE` "stat_monitor_enable": false, "work_mem": 4, "synchronous_replication": "off", - "max_failover_replication_time_lag": "NONE" + "max_failover_replication_time_lag": 10 } }` From 44a8ebd8569aad7c9b93f6c2830a8af526be61eb Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Tue, 19 Nov 2024 19:03:29 +0530 Subject: [PATCH 08/10] Merge branch 'main' into feature/add-database-missing-configs --- vendor/github.com/digitalocean/godo/godo.go | 2 +- vendor/modules.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/vendor/github.com/digitalocean/godo/godo.go b/vendor/github.com/digitalocean/godo/godo.go index a399bc3eb..4b9ad6b61 100644 --- a/vendor/github.com/digitalocean/godo/godo.go +++ b/vendor/github.com/digitalocean/godo/godo.go @@ -21,7 +21,7 @@ import ( ) const ( - libraryVersion = "1.129.0" + libraryVersion = "1.130.0" defaultBaseURL = "https://api.digitalocean.com/" userAgent = "godo/" + libraryVersion mediaType = "application/json" diff --git a/vendor/modules.txt b/vendor/modules.txt index f3be68f60..73832a0dd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -443,6 +443,9 @@ golang.org/x/net/proxy ## explicit; go 1.18 golang.org/x/oauth2 golang.org/x/oauth2/internal +# golang.org/x/sync v0.3.0 +## explicit; go 1.17 +golang.org/x/sync/errgroup # golang.org/x/sys v0.25.0 ## explicit; go 1.18 golang.org/x/sys/cpu From 2d26307fd178758c0343ae329d61fd9f41205d28 Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Tue, 19 Nov 2024 19:04:53 +0530 Subject: [PATCH 09/10] changed max_failover_replication_time_lag --- integration/database_config_get_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 3dde81bf1..171aad975 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -252,7 +252,7 @@ WorkMem 4 TimeScaleDB {} SynchronousReplication off StatMonitorEnable false -MaxFailoverReplicationTimeLag 10` +MaxFailoverReplicationTimeLag 12` databaseConfigPGGetResponse = `{ "config": { @@ -289,7 +289,7 @@ MaxFailoverReplicationTimeLag 10` "stat_monitor_enable": false, "work_mem": 4, "synchronous_replication": "off", - "max_failover_replication_time_lag": 10 + "max_failover_replication_time_lag": 12 } }` From 34b0c253e7bfc8e9878963dd9f0d9f89c7f3445f Mon Sep 17 00:00:00 2001 From: "v.sharma" Date: Tue, 19 Nov 2024 19:11:21 +0530 Subject: [PATCH 10/10] removed timescaledb --- integration/database_config_get_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/integration/database_config_get_test.go b/integration/database_config_get_test.go index 171aad975..71d18f330 100644 --- a/integration/database_config_get_test.go +++ b/integration/database_config_get_test.go @@ -249,7 +249,6 @@ PgBouncer.AutodbIdleTimeout 0 BackupHour 18 BackupMinute 26 WorkMem 4 -TimeScaleDB {} SynchronousReplication off StatMonitorEnable false MaxFailoverReplicationTimeLag 12`