diff --git a/databases.go b/databases.go index 5febdc3a0..ead5317eb 100644 --- a/databases.go +++ b/databases.go @@ -83,13 +83,7 @@ type Database struct { // Members has dynamic keys so it is a map Members map[string]DatabaseMemberType `json:"members"` - // Deprecated: ReplicationType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationType string `json:"replication_type"` - // Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2. - SSLConnection bool `json:"ssl_connection"` - // Deprecated: Encrypted is a deprecated property, as it is no longer supported in DBaaS V2. - Encrypted bool `json:"encrypted"` - + Encrypted bool `json:"encrypted"` AllowList []string `json:"allow_list"` InstanceURI string `json:"instance_uri"` Created *time.Time `json:"-"` @@ -126,9 +120,6 @@ type DatabaseMaintenanceWindow struct { HourOfDay int `json:"hour_of_day"` Pending []DatabaseMaintenanceWindowPending `json:"pending,omitempty"` - - // Deprecated: WeekOfMonth is a deprecated property, as it is no longer supported in DBaaS V2. - WeekOfMonth *int `json:"week_of_month,omitempty"` } type DatabaseMaintenanceWindowPending struct { diff --git a/mysql.go b/mysql.go index ab6c87675..7b334f55e 100644 --- a/mysql.go +++ b/mysql.go @@ -33,15 +33,9 @@ type MySQLDatabase struct { // Members has dynamic keys so it is a map Members map[string]DatabaseMemberType `json:"members"` - // Deprecated: ReplicationType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationType string `json:"replication_type"` - // Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2. - SSLConnection bool `json:"ssl_connection"` - // Deprecated: Encrypted is a deprecated property, as it is no longer supported in DBaaS V2. - Encrypted bool `json:"encrypted"` - + SSLConnection bool `json:"ssl_connection"` + Encrypted bool `json:"encrypted"` AllowList []string `json:"allow_list"` - InstanceURI string `json:"instance_uri"` Created *time.Time `json:"-"` Updated *time.Time `json:"-"` Updates DatabaseMaintenanceWindow `json:"updates"` @@ -406,13 +400,6 @@ type MySQLCreateOptions struct { AllowList []string `json:"allow_list,omitempty"` ClusterSize int `json:"cluster_size,omitempty"` - // Deprecated: ReplicationType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationType string `json:"replication_type,omitempty"` - // Deprecated: Encrypted is a deprecated property, as it is no longer supported in DBaaS V2. - Encrypted bool `json:"encrypted,omitempty"` - // Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2. - SSLConnection bool `json:"ssl_connection,omitempty"` - Fork *DatabaseFork `json:"fork,omitempty"` EngineConfig *MySQLDatabaseEngineConfig `json:"engine_config,omitempty"` PrivateNetwork *DatabasePrivateNetwork `json:"private_network,omitempty"` @@ -430,46 +417,6 @@ type MySQLUpdateOptions struct { PrivateNetwork **DatabasePrivateNetwork `json:"private_network,omitempty"` } -// MySQLDatabaseBackup is information for interacting with a backup for the existing MySQL Database - -// Deprecated: MySQLDatabaseBackup is a deprecated struct, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -type MySQLDatabaseBackup struct { - ID int `json:"id"` - Label string `json:"label"` - Type string `json:"type"` - Created *time.Time `json:"-"` -} - -// MySQLBackupCreateOptions are options used for CreateMySQLDatabaseBackup(...) -// -// Deprecated: MySQLBackupCreateOptions is a deprecated struct, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -type MySQLBackupCreateOptions struct { - Label string `json:"label"` - Target MySQLDatabaseTarget `json:"target"` -} - -func (d *MySQLDatabaseBackup) UnmarshalJSON(b []byte) error { - type Mask MySQLDatabaseBackup - - p := struct { - *Mask - - Created *parseabletime.ParseableTime `json:"created"` - }{ - Mask: (*Mask)(d), - } - - if err := json.Unmarshal(b, &p); err != nil { - return err - } - - d.Created = (*time.Time)(p.Created) - - return nil -} - // MySQLDatabaseCredential is the Root Credentials to access the Linode Managed Database type MySQLDatabaseCredential struct { Username string `json:"username"` @@ -486,14 +433,6 @@ func (c *Client) ListMySQLDatabases(ctx context.Context, opts *ListOptions) ([]M return getPaginatedResults[MySQLDatabase](ctx, c, "databases/mysql/instances", opts) } -// ListMySQLDatabaseBackups lists all MySQL Database Backups associated with the given MySQL Database -// -// Deprecated: ListMySQLDatabaseBackups is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) ListMySQLDatabaseBackups(ctx context.Context, databaseID int, opts *ListOptions) ([]MySQLDatabaseBackup, error) { - return getPaginatedResults[MySQLDatabaseBackup](ctx, c, formatAPIPath("databases/mysql/instances/%d/backups", databaseID), opts) -} - // GetMySQLDatabase returns a single MySQL Database matching the id func (c *Client) GetMySQLDatabase(ctx context.Context, databaseID int) (*MySQLDatabase, error) { e := formatAPIPath("databases/mysql/instances/%d", databaseID) @@ -535,33 +474,6 @@ func (c *Client) ResetMySQLDatabaseCredentials(ctx context.Context, databaseID i return doPOSTRequestNoRequestResponseBody(ctx, c, e) } -// GetMySQLDatabaseBackup returns a specific MySQL Database Backup with the given ids -// -// Deprecated: GetMySQLDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) GetMySQLDatabaseBackup(ctx context.Context, databaseID int, backupID int) (*MySQLDatabaseBackup, error) { - e := formatAPIPath("databases/mysql/instances/%d/backups/%d", databaseID, backupID) - return doGETRequest[MySQLDatabaseBackup](ctx, c, e) -} - -// RestoreMySQLDatabaseBackup returns the given MySQL Database with the given Backup -// -// Deprecated: RestoreMySQLDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) RestoreMySQLDatabaseBackup(ctx context.Context, databaseID int, backupID int) error { - e := formatAPIPath("databases/mysql/instances/%d/backups/%d/restore", databaseID, backupID) - return doPOSTRequestNoRequestResponseBody(ctx, c, e) -} - -// CreateMySQLDatabaseBackup creates a snapshot for the given MySQL database -// -// Deprecated: CreateMySQLDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) CreateMySQLDatabaseBackup(ctx context.Context, databaseID int, opts MySQLBackupCreateOptions) error { - e := formatAPIPath("databases/mysql/instances/%d/backups", databaseID) - return doPOSTRequestNoResponseBody(ctx, c, e, opts) -} - // PatchMySQLDatabase applies security patches and updates to the underlying operating system of the Managed MySQL Database func (c *Client) PatchMySQLDatabase(ctx context.Context, databaseID int) error { e := formatAPIPath("databases/mysql/instances/%d/patch", databaseID) diff --git a/paged_response_structs.go b/paged_response_structs.go index 5c20ed26b..50af24c64 100644 --- a/paged_response_structs.go +++ b/paged_response_structs.go @@ -100,9 +100,6 @@ type LongviewSubscriptionsPagedResponse legacyPagedResponse[LongviewSubscription // Deprecated: MySQLDatabasesPagedResponse exists for historical compatibility and should not be used. type MySQLDatabasesPagedResponse legacyPagedResponse[MySQLDatabase] -// Deprecated: MySQLDatabaseBackupsPagedResponse exists for historical compatibility and should not be used. -type MySQLDatabaseBackupsPagedResponse legacyPagedResponse[MySQLDatabaseBackup] - // Deprecated: NodeBalancersPagedResponse exists for historical compatibility and should not be used. type NodeBalancersPagedResponse legacyPagedResponse[NodeBalancer] @@ -161,9 +158,6 @@ type TicketsPagedResponse legacyPagedResponse[Ticket] // Deprecated: PostgresDatabasesPagedResponse exists for historical compatibility and should not be used. type PostgresDatabasesPagedResponse legacyPagedResponse[PostgresDatabase] -// Deprecated: PostgresDatabaseBackupsPagedResponse exists for historical compatibility and should not be used. -type PostgresDatabaseBackupsPagedResponse legacyPagedResponse[PostgresDatabaseBackup] - // Deprecated: ProfileLoginsPagedResponse exists for historical compatibility and should not be used. type ProfileLoginsPagedResponse legacyPagedResponse[ProfileLogin] diff --git a/postgres.go b/postgres.go index 75bd0f449..ac4a78cf5 100644 --- a/postgres.go +++ b/postgres.go @@ -51,15 +51,8 @@ type PostgresDatabase struct { // Members has dynamic keys so it is a map Members map[string]DatabaseMemberType `json:"members"` - // Deprecated: ReplicationCommitType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationCommitType PostgresCommitType `json:"replication_commit_type"` - // Deprecated: ReplicationType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationType PostgresReplicationType `json:"replication_type"` - // Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2. - SSLConnection bool `json:"ssl_connection"` - // Deprecated: Encrypted is a deprecated property, as it is no longer supported in DBaaS V2. - Encrypted bool `json:"encrypted"` - + SSLConnection bool `json:"ssl_connection"` + Encrypted bool `json:"encrypted"` Hosts DatabaseHost `json:"hosts"` Updates DatabaseMaintenanceWindow `json:"updates"` Created *time.Time `json:"-"` @@ -604,15 +597,6 @@ type PostgresCreateOptions struct { AllowList []string `json:"allow_list,omitempty"` ClusterSize int `json:"cluster_size,omitempty"` - // Deprecated: Encrypted is a deprecated property, as it is no longer supported in DBaaS V2. - Encrypted bool `json:"encrypted,omitempty"` - // Deprecated: SSLConnection is a deprecated property, as it is no longer supported in DBaaS V2. - SSLConnection bool `json:"ssl_connection,omitempty"` - // Deprecated: ReplicationType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationType PostgresReplicationType `json:"replication_type,omitempty"` - // Deprecated: ReplicationCommitType is a deprecated property, as it is no longer supported in DBaaS V2. - ReplicationCommitType PostgresCommitType `json:"replication_commit_type,omitempty"` - Fork *DatabaseFork `json:"fork,omitempty"` EngineConfig *PostgresDatabaseEngineConfig `json:"engine_config,omitempty"` @@ -647,54 +631,6 @@ func (c *Client) ListPostgresDatabases(ctx context.Context, opts *ListOptions) ( return getPaginatedResults[PostgresDatabase](ctx, c, "databases/postgresql/instances", opts) } -// PostgresDatabaseBackup is information for interacting with a backup for the existing Postgres Database -// -// Deprecated: PostgresDatabaseBackup is a deprecated struct, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -type PostgresDatabaseBackup struct { - ID int `json:"id"` - Label string `json:"label"` - Type string `json:"type"` - Created *time.Time `json:"-"` -} - -func (d *PostgresDatabaseBackup) UnmarshalJSON(b []byte) error { - type Mask PostgresDatabaseBackup - - p := struct { - *Mask - - Created *parseabletime.ParseableTime `json:"created"` - }{ - Mask: (*Mask)(d), - } - - if err := json.Unmarshal(b, &p); err != nil { - return err - } - - d.Created = (*time.Time)(p.Created) - - return nil -} - -// PostgresBackupCreateOptions are options used for CreatePostgresDatabaseBackup(...) -// -// Deprecated: PostgresBackupCreateOptions is a deprecated struct, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -type PostgresBackupCreateOptions struct { - Label string `json:"label"` - Target PostgresDatabaseTarget `json:"target"` -} - -// ListPostgresDatabaseBackups lists all Postgres Database Backups associated with the given Postgres Database -// -// Deprecated: ListPostgresDatabaseBackups is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) ListPostgresDatabaseBackups(ctx context.Context, databaseID int, opts *ListOptions) ([]PostgresDatabaseBackup, error) { - return getPaginatedResults[PostgresDatabaseBackup](ctx, c, formatAPIPath("databases/postgresql/instances/%d/backups", databaseID), opts) -} - // GetPostgresDatabase returns a single Postgres Database matching the id func (c *Client) GetPostgresDatabase(ctx context.Context, databaseID int) (*PostgresDatabase, error) { e := formatAPIPath("databases/postgresql/instances/%d", databaseID) @@ -742,33 +678,6 @@ func (c *Client) GetPostgresDatabaseSSL(ctx context.Context, databaseID int) (*P return doGETRequest[PostgresDatabaseSSL](ctx, c, e) } -// GetPostgresDatabaseBackup returns a specific Postgres Database Backup with the given ids -// -// Deprecated: GetPostgresDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) GetPostgresDatabaseBackup(ctx context.Context, databaseID int, backupID int) (*PostgresDatabaseBackup, error) { - e := formatAPIPath("databases/postgresql/instances/%d/backups/%d", databaseID, backupID) - return doGETRequest[PostgresDatabaseBackup](ctx, c, e) -} - -// RestorePostgresDatabaseBackup returns the given Postgres Database with the given Backup -// -// Deprecated: RestorePostgresDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) RestorePostgresDatabaseBackup(ctx context.Context, databaseID int, backupID int) error { - e := formatAPIPath("databases/postgresql/instances/%d/backups/%d/restore", databaseID, backupID) - return doPOSTRequestNoRequestResponseBody(ctx, c, e) -} - -// CreatePostgresDatabaseBackup creates a snapshot for the given Postgres database -// -// Deprecated: CreatePostgresDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (c *Client) CreatePostgresDatabaseBackup(ctx context.Context, databaseID int, opts PostgresBackupCreateOptions) error { - e := formatAPIPath("databases/postgresql/instances/%d/backups", databaseID) - return doPOSTRequestNoResponseBody(ctx, c, e, opts) -} - // SuspendPostgresDatabase suspends a PostgreSQL Managed Database, releasing idle resources and keeping only necessary data. // All service data is lost if there are no backups available. func (c *Client) SuspendPostgresDatabase(ctx context.Context, databaseID int) error { diff --git a/waitfor.go b/waitfor.go index afa998a70..10d057033 100644 --- a/waitfor.go +++ b/waitfor.go @@ -489,66 +489,6 @@ func (client Client) WaitForImageRegionStatus(ctx context.Context, imageID, regi } } -// WaitForMySQLDatabaseBackup waits for the backup with the given label to be available. -// -// Deprecated: WaitForMySQLDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (client Client) WaitForMySQLDatabaseBackup(ctx context.Context, dbID int, label string, timeoutSeconds int) (*MySQLDatabaseBackup, error) { - ctx, cancel := context.WithTimeout(ctx, time.Duration(timeoutSeconds)*time.Second) - defer cancel() - - ticker := time.NewTicker(client.pollInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - backups, err := client.ListMySQLDatabaseBackups(ctx, dbID, nil) - if err != nil { - return nil, err - } - - for _, backup := range backups { - if backup.Label == label { - return &backup, nil - } - } - case <-ctx.Done(): - return nil, fmt.Errorf("failed to wait for backup %s: %w", label, ctx.Err()) - } - } -} - -// WaitForPostgresDatabaseBackup waits for the backup with the given label to be available. -// -// Deprecated: WaitForPostgresDatabaseBackup is a deprecated method, as the backup endpoints are no longer supported in DBaaS V2. -// In DBaaS V2, databases can be backed up via database forking. -func (client Client) WaitForPostgresDatabaseBackup(ctx context.Context, dbID int, label string, timeoutSeconds int) (*PostgresDatabaseBackup, error) { - ctx, cancel := context.WithTimeout(ctx, time.Duration(timeoutSeconds)*time.Second) - defer cancel() - - ticker := time.NewTicker(client.pollInterval) - defer ticker.Stop() - - for { - select { - case <-ticker.C: - backups, err := client.ListPostgresDatabaseBackups(ctx, dbID, nil) - if err != nil { - return nil, err - } - - for _, backup := range backups { - if backup.Label == label { - return &backup, nil - } - } - case <-ctx.Done(): - return nil, fmt.Errorf("failed to wait for backup %s: %w", label, ctx.Err()) - } - } -} - type databaseStatusFunc func(ctx context.Context, client Client, dbID int) (DatabaseStatus, error) var databaseStatusHandlers = map[DatabaseEngineType]databaseStatusFunc{