Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into add-container-reg…
Browse files Browse the repository at this point in the history
…istry
  • Loading branch information
optik-aper committed Nov 9, 2023
2 parents 46808d4 + ef4ca43 commit 75a720b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
14 changes: 14 additions & 0 deletions database.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type DatabaseService interface {
DetachMigration(ctx context.Context, databaseID string) error

AddReadOnlyReplica(ctx context.Context, databaseID string, databaseReplicaReq *DatabaseAddReplicaReq) (*Database, *http.Response, error)
PromoteReadReplica(ctx context.Context, databaseID string) error

GetBackupInformation(ctx context.Context, databaseID string) (*DatabaseBackups, *http.Response, error)
RestoreFromBackup(ctx context.Context, databaseID string, databaseRestoreReq *DatabaseBackupRestoreReq) (*Database, *http.Response, error)
Expand Down Expand Up @@ -872,6 +873,19 @@ func (d *DatabaseServiceHandler) AddReadOnlyReplica(ctx context.Context, databas
return database.Database, resp, nil
}

// PromoteReadReplica will promote a read-only replica to its own standalone Managed Database subscription.
func (d *DatabaseServiceHandler) PromoteReadReplica(ctx context.Context, databaseID string) error {
uri := fmt.Sprintf("%s/%s/promote-read-replica", databasePath, databaseID)

req, err := d.client.NewRequest(ctx, http.MethodPost, uri, nil)
if err != nil {
return err
}

_, err = d.client.DoWithContext(ctx, req, nil)
return err
}

// GetBackupInformation retrieves backup information for your Managed Database.
func (d *DatabaseServiceHandler) GetBackupInformation(ctx context.Context, databaseID string) (*DatabaseBackups, *http.Response, error) {
uri := fmt.Sprintf("%s/%s/backups", databasePath, databaseID)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/google/go-querystring v1.1.0
github.com/hashicorp/go-retryablehttp v0.7.4
github.com/hashicorp/go-retryablehttp v0.7.5
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n
github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-hclog v0.9.2 h1:CG6TE5H9/JXsFWJCfoIVpKFIkFe6ysEuHirp4DxCsHI=
github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-retryablehttp v0.7.4 h1:ZQgVdpTdAL7WpMIwLzCfbalOcSUdkDZnpUv3/+BxzFA=
github.com/hashicorp/go-retryablehttp v0.7.4/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/hashicorp/go-retryablehttp v0.7.5 h1:bJj+Pj19UZMIweq/iie+1u5YCdGrnxCT9yvm0e+Nd5M=
github.com/hashicorp/go-retryablehttp v0.7.5/go.mod h1:Jy/gPYAdjqffZ/yFGCFV2doI5wjtH1ewM9u8iYVjtX8=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
2 changes: 2 additions & 0 deletions kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Cluster struct {
Region string `json:"region"`
Status string `json:"status"`
HAControlPlanes bool `json:"ha_controlplanes"`
FirewallGroupID string `json:"firewall_group_id"`
NodePools []NodePool `json:"node_pools"`
}

Expand Down Expand Up @@ -92,6 +93,7 @@ type ClusterReq struct {
Region string `json:"region"`
Version string `json:"version"`
HAControlPlanes bool `json:"ha_controlplanes,omitempty"`
EnableFirewall bool `json:"enable_firewall,omitempty"`
NodePools []NodePoolReq `json:"node_pools"`
}

Expand Down

0 comments on commit 75a720b

Please sign in to comment.