File tree 4 files changed +38
-0
lines changed
packages/clients/src/api/rdb/v1
4 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,7 @@ import type {
138
138
PrepareInstanceLogsRequest ,
139
139
PrepareInstanceLogsResponse ,
140
140
Privilege ,
141
+ PromoteReadReplicaRequest ,
141
142
PurgeInstanceLogsRequest ,
142
143
ReadReplica ,
143
144
RenewInstanceCertificateRequest ,
@@ -869,6 +870,30 @@ export class API extends ParentAPI {
869
870
unmarshalReadReplica ,
870
871
)
871
872
873
+ /**
874
+ * Promote a Read Replica. Promote a Read Replica to Database Instance
875
+ * automatically.
876
+ *
877
+ * @param request - The request {@link PromoteReadReplicaRequest}
878
+ * @returns A Promise of Instance
879
+ */
880
+ promoteReadReplica = ( request : Readonly < PromoteReadReplicaRequest > ) =>
881
+ this . client . fetch < Instance > (
882
+ {
883
+ body : '{}' ,
884
+ headers : jsonContentHeaders ,
885
+ method : 'POST' ,
886
+ path : `/rdb/v1/regions/${ validatePathParam (
887
+ 'region' ,
888
+ request . region ?? this . client . settings . defaultRegion ,
889
+ ) } /read-replicas/${ validatePathParam (
890
+ 'readReplicaId' ,
891
+ request . readReplicaId ,
892
+ ) } /promote`,
893
+ } ,
894
+ unmarshalInstance ,
895
+ )
896
+
872
897
/**
873
898
* Create an endpoint for a Read Replica. Create a new endpoint for a Read
874
899
* Replica. Read Replicas can have at most one direct access and one Private
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export const READ_REPLICA_TRANSIENT_STATUSES: ReadReplicaStatus[] = [
41
41
'initializing' ,
42
42
'deleting' ,
43
43
'configuring' ,
44
+ 'promoting' ,
44
45
]
45
46
46
47
/** Lists transient statutes of the enum {@link SnapshotStatus}. */
Original file line number Diff line number Diff line change @@ -107,6 +107,7 @@ export type {
107
107
PrepareInstanceLogsRequest ,
108
108
PrepareInstanceLogsResponse ,
109
109
Privilege ,
110
+ PromoteReadReplicaRequest ,
110
111
PurgeInstanceLogsRequest ,
111
112
ReadReplica ,
112
113
ReadReplicaEndpointSpec ,
Original file line number Diff line number Diff line change @@ -109,6 +109,7 @@ export type ReadReplicaStatus =
109
109
| 'error'
110
110
| 'locked'
111
111
| 'configuring'
112
+ | 'promoting'
112
113
113
114
export type SnapshotStatus =
114
115
| 'unknown'
@@ -1166,6 +1167,16 @@ export type ResetReadReplicaRequest = {
1166
1167
readReplicaId : string
1167
1168
}
1168
1169
1170
+ export type PromoteReadReplicaRequest = {
1171
+ /**
1172
+ * Region to target. If none is passed will use default region from the
1173
+ * config.
1174
+ */
1175
+ region ?: Region
1176
+ /** UUID of the Read Replica. */
1177
+ readReplicaId : string
1178
+ }
1179
+
1169
1180
export type CreateReadReplicaEndpointRequest = {
1170
1181
/**
1171
1182
* Region to target. If none is passed will use default region from the
You can’t perform that action at this time.
0 commit comments