public RackSpaceCloudServer CreateServer(string serverName, int imageId, RackSpaceCloudServerFlavor flavorId, Dictionary<string, string> metadata = null, List<Personality> personality = null) { var request = new RackSpaceCloudRequest(this._authInfo.ServerManagementUrl, this._authInfo.AuthToken); dynamic data = new ExpandoObject(); data.server = new ExpandoObject(); data.server.name = serverName; data.server.imageId = imageId; data.server.flavorId = flavorId; data.server.metadata = metadata; data.server.personality = personality; dynamic response = request.Request("POST", "/servers", data); return ExpandoToRackSpaceCloudServerObject(response.server); }
public bool DeleteServer(string serverId) { try { var request = new RackSpaceCloudRequest(this._authInfo.ServerManagementUrl, this._authInfo.AuthToken); dynamic response = request.Request("DELETE", "/servers/" + serverId); } catch { return false; } return true; }
public bool UpdateServerPass(string serverId, string newPassword) { try { var request = new RackSpaceCloudRequest(this._authInfo.ServerManagementUrl, this._authInfo.AuthToken); dynamic data = new ExpandoObject(); data.server = new ExpandoObject(); //data.server.name = newServerName; data.server.adminPass = newPassword; dynamic response = request.Request("PUT", "/servers/" + serverId, data); } catch (Exception ex) { return false; } return true; }