Beispiel #1
0
        public override async Task <IEnumerable <ModuleRuntimeInfo> > GetModules <T>(CancellationToken cancellationToken)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                ModuleList moduleList = await this.Execute(
                    () => edgeletHttpClient.ListModulesAsync(this.Version.Name, cancellationToken),
                    $"List modules");

                return(moduleList.Modules.Select(m => this.GetModuleRuntimeInfo <T>(m)));
            }
        }
Beispiel #2
0
        public override async Task <SystemResources> GetSystemResourcesAsync()
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.SystemResources systemResources = await this.Execute(
                    () => edgeletHttpClient.GetSystemResourcesAsync(this.Version.Name),
                    "Getting System Resources");

                return(new SystemResources(systemResources.Host_uptime, systemResources.Process_uptime, systemResources.Used_cpu, systemResources.Used_ram, systemResources.Total_ram, systemResources.Disks.Select(d => new Disk(d.Name, d.Available_space, d.Total_space, d.File_system, d.File_type)).ToArray(), systemResources.Docker_stats));
            }
        }
Beispiel #3
0
        public override async Task <SystemInfo> GetSystemInfoAsync()
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.SystemInfo systemInfo = await this.Execute(
                    () => edgeletHttpClient.GetSystemInfoAsync(this.Version.Name),
                    "Getting System Info");

                return(new SystemInfo(systemInfo.OsType, systemInfo.Architecture, systemInfo.Version));
            }
        }
Beispiel #4
0
        public override async Task <SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.SystemInfo systemInfo = await this.Execute(
                    () => edgeletHttpClient.GetSystemInfoAsync(this.Version.Name, cancellationToken),
                    "Getting System Info");

                return(new SystemInfo(systemInfo.OsType, systemInfo.Architecture, systemInfo.Version, systemInfo.Server_version, systemInfo.Kernel_version, systemInfo.Operating_system, systemInfo.Cpus ?? 0));
            }
        }
        public override async Task <SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.SystemInfo systemInfo = await this.Execute(
                    () => edgeletHttpClient.GetSystemInfoAsync(this.Version.Name, cancellationToken),
                    "Getting System Info");

                return(new SystemInfo(systemInfo.OsType, systemInfo.Architecture, systemInfo.Version, new ReadOnlyDictionary <string, object>(systemInfo.AdditionalProperties)));
            }
        }
Beispiel #6
0
        public override async Task <SystemInfo> GetSystemInfoAsync(CancellationToken cancellationToken)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.SystemInfo systemInfo = await this.Execute(
                    () => edgeletHttpClient.GetSystemInfoAsync(this.Version.Name, cancellationToken),
                    "Getting System Info");

                var provisioning = new ProvisioningInfo(systemInfo.Provisioning.Type, systemInfo.Provisioning.DynamicReprovisioning, systemInfo.Provisioning.AlwaysReprovisionOnStartup ?? true);
                return(new SystemInfo(systemInfo.OsType, systemInfo.Architecture, systemInfo.Version, provisioning, systemInfo.Server_version, systemInfo.Kernel_version, systemInfo.Operating_system, systemInfo.Cpus ?? 0, systemInfo.Virtualized));
            }
        }
        public override async Task <Identity> CreateIdentityAsync(string name, string managedBy)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.Identity identity = await this.Execute(
                    () => edgeletHttpClient.CreateIdentityAsync(
                        this.Version.Name,
                        new IdentitySpec
                {
                    ModuleId  = name,
                    ManagedBy = managedBy
                }),
                    $"Create identity for {name}");

                return(this.MapFromIdentity(identity));
            }
        }
        public async Task <Identity> UpdateIdentityAsync(string name, string generationId, string managedBy)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.managementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.managementUri)
                };
                Identity identity = await this.Execute(() => edgeletHttpClient.UpdateIdentityAsync(
                                                           Constants.EdgeletManagementApiVersion,
                                                           name,
                                                           new UpdateIdentity
                {
                    GenerationId = generationId,
                    ManagedBy    = managedBy
                }),
                                                       $"Update identity for {name} with generation ID {generationId}");

                return(identity);
            }
        }
        public async Task <Identity> CreateIdentityAsync(string name, string managedBy)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.managementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.managementUri)
                };
                Identity identity = await this.Execute(
                    () => edgeletHttpClient.CreateIdentityAsync(
                        Constants.EdgeletManagementApiVersion,
                        new IdentitySpec
                {
                    ModuleId  = name,
                    ManagedBy = managedBy
                }),
                    $"Create identity for {name}");

                return(identity);
            }
        }
        public override async Task <Identity> UpdateIdentityAsync(string name, string generationId, string managedBy)
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.ManagementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.ManagementUri)
                };
                GeneratedCode.Identity identity = await this.Execute(
                    () => edgeletHttpClient.UpdateIdentityAsync(
                        this.Version.Name,
                        name,
                        new UpdateIdentity
                {
                    GenerationId = generationId,
                    ManagedBy    = managedBy
                }),
                    $"Update identity for {name} with generation ID {generationId}");

                return(this.MapFromIdentity(identity));
            }
        }