Skip to content

Commit 537c123

Browse files
committed
sync with master & resolve conflicts.
2 parents 16d970f + ae0d730 commit 537c123

File tree

12 files changed

+542
-329
lines changed

12 files changed

+542
-329
lines changed

client/src/api/DefaultApi.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,10 @@ export default class DefaultApi {
446446
};
447447
let queryParams = {
448448
'dbname': transaction.dbname,
449+
'source_dbname': transaction.source_dbname,
449450
'open_mode': transaction.mode,
450451
'compute_name': transaction.computeName,
451-
'region': transaction.computeRegion
452+
'region': 'us-east' // Hard-coded, currently required by RAICloud
452453
};
453454
let headerParams = {
454455
};

client/src/model/AnyType.js

Lines changed: 0 additions & 102 deletions
This file was deleted.

client/src/sdk/Connection.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ class Connection extends RelAPIMixin(RAICloudAPIMixin(class {})) {
1919
* The default is http://127.0.0.1:8010.
2020
* @param {Number} params.timeout - The default HTTP timeout for all API calls. The default is 60000
2121
* @param {String} params.accessToken - The API access token
22-
* @param {String} params.computeName - The name of a RAICloud compute
23-
* @param {String} params.computeRegion - The region of the RAICloud compute, defaults to 'us-east'
2422
*/
2523
constructor(params = {}) {
2624
super(params);
@@ -44,14 +42,6 @@ class Connection extends RelAPIMixin(RAICloudAPIMixin(class {})) {
4442
} else {
4543
this.accessToken = '';
4644
}
47-
if (params.hasOwnProperty('computeName')) {
48-
this.computeName = params.computeName;
49-
}
50-
if (params.hasOwnProperty('computeRegion')) {
51-
this.computeRegion = params.computeRegion;
52-
} else {
53-
this.computeRegion = 'us-east';
54-
}
5545
}
5646

5747
get isLocalServer() {
@@ -75,20 +65,6 @@ class Connection extends RelAPIMixin(RAICloudAPIMixin(class {})) {
7565
}
7666
}
7767

78-
get computeName() {
79-
return this._computeName;
80-
}
81-
set computeName(computeName) {
82-
this._computeName = computeName;
83-
}
84-
85-
get computeRegion() {
86-
return this._computeRegion;
87-
}
88-
set computeRegion(computeRegion) {
89-
this._computeRegion = computeRegion;
90-
}
91-
9268
get api() {
9369
return this._api;
9470
}

client/src/sdk/RAICloudAPIMixin.js

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import {
2525
* @param {Array.<String>} opts.id - ID of a compute
2626
* @param {Array.<String>} opts.name - Name of a compute
2727
* @param {Array.<String>} opts.size - Size is one of "XS", "S", "M", "L", "XL"
28-
* @param {Array.<String>} opts.state - One of "PROVISIONING", "PROVISIONED", "DELETING", "DELETED"
28+
* @param {Array.<String>} opts.state - One of: "REQUESTED","PROVISIONING", "REGISTERING", "PROVISIONED",
29+
* "PROVISION_FAILED", "DELETE_REQUESTED", "STOPPING", "DELETING", "DELETED", "DELETION_FAILED"
2930
* @returns {Promise} - Resolves to object: {error, result, response} where
3031
* `result` is of type `ListComputesResponseProtocol`
3132
*/
@@ -53,11 +54,10 @@ import {
5354
* @param {String} name - Name of the compute to create
5455
* @param {String} size - Size is one of "XS", "S", "M", "L", "XL"
5556
* @param {String} region - Region where the compute should be created
56-
* @param {Boolean} dryrun - Simulated create
5757
* @returns {Promise} - Resolves to object: {error, result, response} where
5858
* `result` is of type `CreateComputeResponseProtocol`
5959
*/
60-
createCompute(name, size = "xs", region = null, dryrun = false) {
60+
createCompute(name, size = "xs", region = null) {
6161
region = region || 'us-east';
6262

6363
return new Promise((resolve, reject) => {
@@ -68,7 +68,7 @@ import {
6868

6969
try {
7070
const ccrp = CreateComputeRequestProtocol.constructFromObject({
71-
name, size, region, dryrun
71+
name, size, region
7272
});
7373

7474
this.defaultApi.computePut(ccrp, (error, result, response) => {
@@ -84,19 +84,18 @@ import {
8484
/**
8585
*
8686
* @param {String} name - Name of the compute to delete
87-
* @param {Boolean} dryrun - Simulated delete
8887
* @returns {Promise} - Resolves to object: {error, result, response} where
8988
* `result` is of type `DeleteComputeResponseProtocol`
9089
*/
91-
deleteCompute(name, dryrun = false) {
90+
deleteCompute(name) {
9291
return new Promise((resolve, reject) => {
9392
if (this.isLocalServer) {
9493
reject(new Error(this._localServerError('deleteCompute')));
9594
return;
9695
}
9796

9897
try {
99-
const dcp = DeleteComputeRequestProtocol.constructFromObject({name, dryrun});
98+
const dcp = DeleteComputeRequestProtocol.constructFromObject({name});
10099

101100
this.defaultApi.computeDelete(dcp, (error, result, response) => {
102101
resolve({error, result, response});
@@ -109,7 +108,7 @@ import {
109108
}
110109

111110
/**
112-
* Remove the default compute
111+
* Remove the database's association with its current default compute
113112
*
114113
* @param {String} dbname - Database name associated with the default compute
115114
* @returns {Promise} - Resolves to object: {error, result, response} where
@@ -119,6 +118,39 @@ import {
119118
return this.updateDatabase(dbname, null, true, false);
120119
}
121120

121+
/**
122+
* Update the database's association with a default compute.
123+
*
124+
* @param {String} dbname - The name of the database
125+
* @param {String} defaultComputeName - The name of the compute to associate with the database
126+
* @param {Boolean} removeDefaultCompute - If true, remove the default compute association from the database
127+
* @returns {Promise} - Resolves to object: {error, result, response} where
128+
* `result` is an empty object {}`
129+
*/
130+
updateDatabase(dbname, defaultComputeName, removeDefaultCompute) {
131+
return new Promise((resolve, reject) => {
132+
if (this.isLocalServer) {
133+
reject(new Error(this._localServerError('updateDatabase')));
134+
return;
135+
}
136+
137+
try {
138+
const udrp = UpdateDatabaseRequestProtocol.constructFromObject({
139+
name: dbname,
140+
default_compute_name: defaultComputeName,
141+
remove_default_compute: removeDefaultCompute
142+
});
143+
144+
this.defaultApi.databasePost(udrp, (error, result, response) => {
145+
resolve({error, result, response});
146+
});
147+
}
148+
catch(e) {
149+
reject(e);
150+
}
151+
});
152+
}
153+
122154
/**
123155
* List the events associated with a specified compute.
124156
*

0 commit comments

Comments
 (0)