static async Task Main(string[] args) { Console.WriteLine("Ropu Load Balancer"); Console.WriteLine("Copyright (c) Daniel Hughes"); Console.WriteLine(); var settingsReader = new CommandLineSettingsReader(); var settings = settingsReader.ParseArgs(args); if (settings == null) { return; } var credentialsProvider = new CredentialsProvider() { Email = settings.Email, Password = settings.Password }; var webClient = new RopuWebClient("https://192.168.1.9:5001/", credentialsProvider); var groupsClient = new GroupsClient(webClient, new ImageClient(webClient)); var keysClient = new KeysClient(webClient, true, encryptionKey => new CachedEncryptionKey(encryptionKey, key => new AesGcmWrapper(key))); var packetEncryption = new PacketEncryption(keysClient); var loadBalancerProtocol = new LoadBalancerProtocol(new PortFinder(), 5069, packetEncryption, keysClient); var servicesClient = new ServicesClient(webClient, ServiceType.LoadBalancer); var controller = new LoadBalancerRunner(keysClient, loadBalancerProtocol, groupsClient, webClient, settings, servicesClient); await controller.Run(); }
/// <summary> /// /// </summary> /// <param name="token">OAuth 2.0 token obtained from Egnyte</param> /// <param name="domain">Domain on which you connect to egnyte, /// i.e.: domain is 'mydomain', when url looks like: mydomain.egnyte.com</param> /// <param name="httpClient">You can provide your own httpClient. Optional</param> /// <param name="requestTimeout">You can provide timeout for calling Egnyte API, /// by default it's 10 minutes. This parameter is optional</param> /// <param name="host">Full host name on which you connect to egnyte, /// i.e.: host is 'my.custom.host.com', when url looks like: my.custom.host.com</param> public EgnyteClient( string token, string domain = "", HttpClient httpClient = null, TimeSpan?requestTimeout = null, string host = "") { if (string.IsNullOrWhiteSpace(token)) { throw new ArgumentNullException(nameof(token)); } if (string.IsNullOrWhiteSpace(domain) && string.IsNullOrWhiteSpace(host)) { throw new ArgumentNullException("domain", "Domain or host has to specified"); } httpClient = httpClient ?? new HttpClient(); httpClient.Timeout = TimeSpan.FromMinutes(10); if (requestTimeout.HasValue) { httpClient.Timeout = requestTimeout.Value; } httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); Files = new FilesClient(httpClient, domain, host); Users = new UsersClient(httpClient, domain, host); Links = new LinksClient(httpClient, domain, host); Groups = new GroupsClient(httpClient, domain, host); Permissions = new PermissionsClient(httpClient, domain, host); Search = new SearchClient(httpClient, domain, host); Audit = new AuditClient(httpClient, domain, host); }
private static async Task <List <Group> > GetAllowedOrganisationsAsync(string apiBaseUrl, IdServerResourceOwnerClientSettings idServerResourceOwnerClientSettings) { Console.WriteLine("Retrieving allowed organisation list"); var groupsClient = new GroupsClient(apiBaseUrl, idServerResourceOwnerClientSettings); var group = await groupsClient.GetAvailableOrganisationsAsync(); return(group); }
private static async Task <GroupSummary> GetGroupSummary(long organisationGroupId, string apiBaseUrl, IdServerResourceOwnerClientSettings idServerResourceOwnerClientSettings) { Console.WriteLine("Retrieving Organisation details"); var groupsClient = new GroupsClient(apiBaseUrl, idServerResourceOwnerClientSettings); var group = await groupsClient.GetSubGroupsAsync(organisationGroupId); return(group); }
private static async Task <Group> GetFirstAvailableOrganisationsAsync(string apiBaseUrl, IdServerResourceOwnerClientSettings idServerResourceOwnerClientSettings) { Console.WriteLine("Retrieving Organisation details"); var groupsClient = new GroupsClient(apiBaseUrl, idServerResourceOwnerClientSettings); var groups = await groupsClient.GetAvailableOrganisationsAsync(); return(groups?[0]); }
private void SetClients(string groupName) { accounts = new AccountsClient(client); groups = new GroupsClient(client); rules = new RulesClient(client); parameters = new ParametersClient(client); rBObjects = new RBObjectsClient(client); this.groupName = groupName; }
public async Task GetGroupUsersAsync(string realm) { var groups = await GroupsClient.GetGroupHierarchyAsync(realm); string groupId = groups.FirstOrDefault()?.Id; if (groupId != null) { var result = await GroupsClient.GetGroupUsersAsync(realm, groupId); Assert.NotNull(result); } }
public async Task GetGroupClientAuthorizationPermissionsInitializedAsync(string realm) { var groups = await GroupsClient.GetGroupHierarchyAsync(realm); string groupId = groups.FirstOrDefault()?.Id; if (groupId != null) { var result = await GroupsClient.GetGroupClientAuthorizationPermissionsInitializedAsync(realm, groupId); Assert.NotNull(result); } }
public async Task GetEffectiveRealmRoleMappingsForGroupAsync(string realm) { var groups = await GroupsClient.GetGroupHierarchyAsync(realm); string groupId = groups.FirstOrDefault()?.Id; if (groupId != null) { var result = await RoleMapperClient.GetEffectiveRealmRoleMappingsForGroupAsync(realm, groupId); Assert.NotNull(result); } }
static async Task Main(string[] args) { Console.WriteLine("Ropu Serving Node"); Console.WriteLine("Copyright (c) Daniel Hughes"); Console.WriteLine(); var settingsReader = new CommandLineSettingsReader(); var settings = settingsReader.ParseArgs(args); if (settings == null) { return; } var portFinder = new PortFinder(); var credentialsProvider = new CredentialsProvider() { Email = settings.Email, Password = settings.Password }; var webClient = new RopuWebClient("https://192.168.1.9:5001", credentialsProvider); var keysClient = new KeysClient(webClient, true, encryptionKey => new CachedEncryptionKey(encryptionKey, key => new AesGcmWrapper(key))); var packetEncryption = new PacketEncryption(keysClient); var mediaProtocol = new RopuProtocol(portFinder, StartingServingNodePort, packetEncryption, keysClient); var loadBalancerProtocol = new LoadBalancerProtocol(portFinder, StartingLoadBalancerPort, packetEncryption, keysClient); var serviceDiscovery = new ServiceDiscovery(); var groupsClient = new GroupsClient(webClient, new ImageClient(webClient)); var registra = new Registra(groupsClient); var servingNodes = new ServingNodes(100); var groupCallControllerLookup = new GroupCallControllerLookup(); var servicesClient = new ServicesClient(webClient, ServiceType.ServingNode); var servingNodeRunner = new ServingNodeRunner( mediaProtocol, loadBalancerProtocol, serviceDiscovery, registra, servingNodes, groupCallControllerLookup, servicesClient, keysClient); await servingNodeRunner.Run(); }
public async Task GetEffectiveClientRoleMappingsForGroupAsync(string realm, string clientId) { var groups = await GroupsClient.GetGroupHierarchyAsync(realm); string groupId = groups.FirstOrDefault()?.Id; if (groupId != null) { var clients = await ClientsClient.GetClientsAsync(realm); string clientsId = clients.FirstOrDefault(x => x.ClientId == clientId)?.Id; if (clientId != null) { var result = await ClientRoleMappingsClient.GetEffectiveClientRoleMappingsForGroupAsync(realm, groupId, clientsId); Assert.NotNull(result); } } }
private static async Task <GroupSummary> GetFirstAvailableOrganisationsAsync(string apiBaseUrl, IdServerResourceOwnerClientSettings idServerResourceOwnerClientSettings) { Console.WriteLine("Retrieving Organisation details"); var groupsClient = new GroupsClient(apiBaseUrl, idServerResourceOwnerClientSettings); var groups = await groupsClient.GetAvailableOrganisationsAsync(); if (groups.Count > 0) { var organisation = groups[0]; var group = await groupsClient.GetSubGroupsAsync(organisation.GroupId); return(group); } else { Console.WriteLine(""); Console.WriteLine("======================================================================="); Console.WriteLine("No available organisations found."); return(null); } }
public async Task GetGroupHierarchyAsync(string realm) { var result = await GroupsClient.GetGroupHierarchyAsync(realm); Assert.NotNull(result); }
public Group GetAppGroupName(GroupsClient myGroupClient) { _appGroupName = myGroupClient.GetByName(_groupName); return(_appGroupName); }
public ZimbraCommunityApiClient(string baseUrl, string username, string apiKey) { Blogs = new BlogsClient(baseUrl, username, apiKey); Groups = new GroupsClient(baseUrl, username, apiKey); BlogPosts = new BlogPostsClient(baseUrl, username, apiKey); }
static void Main(string[] args) { const ushort controlPortStarting = 5061; var settingsManager = new CommandLineClientSettingsReader(); if (!settingsManager.ParseArgs(args)) { return; } var settings = settingsManager.ClientSettings; var webClient = new RopuWebClient("https://192.168.1.9:5001/", settingsManager); var keysClient = new KeysClient(webClient, false, encryptionKey => new CachedEncryptionKey(encryptionKey, key => new AesGcmWrapper(key))); var packetEncryption = new PacketEncryption(keysClient); var protocolSwitch = new ProtocolSwitch(controlPortStarting, new PortFinder(), packetEncryption, keysClient, settings); var servingNodeClient = new ServingNodeClient(protocolSwitch); IAudioSource audioSource = settings.FileMediaSource != null ? (IAudioSource) new FileAudioSource(settings.FileMediaSource) : (IAudioSource) new PulseAudioSimple(StreamDirection.Record, "RopuInput"); var audioPlayer = new PulseAudioSimple(StreamDirection.Playback, "RopuOutput"); var audioCodec = new OpusCodec(); var jitterBuffer = new AdaptiveJitterBuffer(2, 50); var mediaClient = new MediaClient(protocolSwitch, audioSource, audioPlayer, audioCodec, jitterBuffer, settings); var callManagementProtocol = new LoadBalancerProtocol(new PortFinder(), 5079, packetEncryption, keysClient); var beepPlayer = new BeepPlayer(new PulseAudioSimple(StreamDirection.Playback, "RopuBeeps")); var ropuClient = new RopuClient(protocolSwitch, servingNodeClient, mediaClient, callManagementProtocol, settings, beepPlayer, webClient, keysClient); var application = new RopuApplication(ropuClient); var imageService = new ImageService(); //TODO: get web address from config var imageClient = new ImageClient(webClient); var groupsClient = new GroupsClient(webClient, imageClient); var usersClient = new UsersClient(webClient); //settings.UserId = usersClient.GetCurrentUser().Result.Id; var pttPage = new PttPage(imageService); var navigator = new Navigator(); var colorService = new ColorService(); navigator.Register <LoginViewModel, LoginView>(() => new LoginView(new LoginViewModel(navigator, webClient, settingsManager), imageService)); navigator.Register <SignupViewModel, SignupPage>(() => new SignupPage(new SignupViewModel(navigator, usersClient), imageService)); Action <Func <Task> > invoke = toDo => Application.Instance.Invoke(toDo); var permissionServices = new PermissionServices(); var pttView = new PttView(new PttViewModel <Color>(ropuClient, settingsManager, groupsClient, usersClient, imageClient, colorService, invoke, permissionServices, webClient, navigator), pttPage); navigator.Register <PttViewModel <Color>, PttView>(() => pttView); navigator.RegisterView("HomeRightPanel", "PttView", () => pttView); var homeView = new HomeView(new HomeViewModel(navigator), navigator, colorService); navigator.Register <HomeViewModel, HomeView>(() => homeView); var browseGroupsView = new BrowseGroupsView(new BrowseGroupsViewModel(groupsClient, navigator)); navigator.Register <BrowseGroupsViewModel, BrowseGroupsView>(() => browseGroupsView); Func <Group, BrowseGroupView> browseGroupViewBuilder = group => new BrowseGroupView(new BrowseGroupViewModel(group, groupsClient, settings, navigator), imageService, navigator, colorService); navigator.Register <BrowseGroupViewModel, BrowseGroupView, Group>(group => browseGroupViewBuilder(group)); var selectIdleGroupView = new SelectIdleGroupView(new SelectGroupViewModel(groupsClient, navigator, ropuClient)); navigator.RegisterView("HomeRightPanel", "SelectIdleGroupView", () => selectIdleGroupView); var mainForm = new MainView(navigator, new MainViewModel(settings, navigator)); mainForm.Icon = imageService.Ropu; var ignore = navigator.ShowModal <HomeViewModel>(); ignore = navigator.ShowPttView(); application.Run(mainForm); }
public async Task GetGroupsCountAsync(string realm) { int?result = await GroupsClient.GetGroupsCountAsync(realm); Assert.True(result >= 0); }