Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions packages/clients/src/api/rdb/v1/api.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ import type {
PrepareInstanceLogsRequest,
PrepareInstanceLogsResponse,
Privilege,
PromoteReadReplicaRequest,
PurgeInstanceLogsRequest,
ReadReplica,
RenewInstanceCertificateRequest,
Expand Down Expand Up @@ -869,6 +870,30 @@ export class API extends ParentAPI {
unmarshalReadReplica,
)

/**
* Promote a Read Replica. Promote a Read Replica to Database Instance
* automatically.
*
* @param request - The request {@link PromoteReadReplicaRequest}
* @returns A Promise of Instance
*/
promoteReadReplica = (request: Readonly<PromoteReadReplicaRequest>) =>
this.client.fetch<Instance>(
{
body: '{}',
headers: jsonContentHeaders,
method: 'POST',
path: `/rdb/v1/regions/${validatePathParam(
'region',
request.region ?? this.client.settings.defaultRegion,
)}/read-replicas/${validatePathParam(
'readReplicaId',
request.readReplicaId,
)}/promote`,
},
unmarshalInstance,
)

/**
* Create an endpoint for a Read Replica. Create a new endpoint for a Read
* Replica. Read Replicas can have at most one direct access and one Private
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/rdb/v1/content.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const READ_REPLICA_TRANSIENT_STATUSES: ReadReplicaStatus[] = [
'initializing',
'deleting',
'configuring',
'promoting',
]

/** Lists transient statutes of the enum {@link SnapshotStatus}. */
Expand Down
1 change: 1 addition & 0 deletions packages/clients/src/api/rdb/v1/index.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export type {
PrepareInstanceLogsRequest,
PrepareInstanceLogsResponse,
Privilege,
PromoteReadReplicaRequest,
PurgeInstanceLogsRequest,
ReadReplica,
ReadReplicaEndpointSpec,
Expand Down
11 changes: 11 additions & 0 deletions packages/clients/src/api/rdb/v1/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export type ReadReplicaStatus =
| 'error'
| 'locked'
| 'configuring'
| 'promoting'

export type SnapshotStatus =
| 'unknown'
Expand Down Expand Up @@ -1166,6 +1167,16 @@ export type ResetReadReplicaRequest = {
readReplicaId: string
}

export type PromoteReadReplicaRequest = {
/**
* Region to target. If none is passed will use default region from the
* config.
*/
region?: Region
/** UUID of the Read Replica. */
readReplicaId: string
}

export type CreateReadReplicaEndpointRequest = {
/**
* Region to target. If none is passed will use default region from the
Expand Down