예제 #1
0
        public async Task <CertificateResponse> CreateServerCertificateAsync(string hostname, DateTime expiration)
        {
            var request = new ServerCertificateRequest
            {
                CommonName = hostname,
                Expiration = expiration
            };

            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.workloadUri))
            {
                var edgeletHttpClient = new HttpWorkloadClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.workloadUri)
                };
                CertificateResponse result = await this.Execute(() => edgeletHttpClient.CreateServerCertificateAsync(this.apiVersion, this.moduleId, this.moduleGenerationId, request), "CreateServerCertificateAsync");

                return(result);
            }
        }
예제 #2
0
        public override async Task <ServerCertificateResponse> CreateServerCertificateAsync(string hostname, DateTime expiration)
        {
            var request = new ServerCertificateRequest
            {
                CommonName = hostname,
                Expiration = expiration
            };

            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.WorkloadUri))
            {
                var edgeletHttpClient = new HttpWorkloadClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.WorkloadUri)
                };
                CertificateResponse result = await this.Execute(() => edgeletHttpClient.CreateServerCertificateAsync(this.Version.Name, this.ModuleId, this.ModuleGenerationId, request), "CreateServerCertificateAsync");

                return(new ServerCertificateResponse()
                {
                    Certificate = result.Certificate,
                    PrivateKey = result.PrivateKey.Bytes
                });
            }
        }