private static void ParseUpdateInfoEvent(ParseUpdateInfoEventArgs args) { CdnResponse json = JsonConvert.DeserializeObject <CdnResponse>(args.RemoteData); if (json != null) { args.UpdateInfo = new UpdateInfoEventArgs { CurrentVersion = json.Updater.Version, ChangelogURL = json.Updater.Changelog, DownloadURL = json.Updater.Url, Mandatory = json.Updater.Mandatory }; } }
public async Task <CdnCustomDomainResponse[]> GetCustomDomainDetailsAsync(string resourceGroupName, string name, CdnResponse endpoint, CancellationToken cancellationToken) { var httpClient = await _azureHelper.GetAuthenticatedARMClientAsync(cancellationToken); // use REST api, management SDK doesn't have new endpoints yet (fluent SDK not at all, regular mgmt SDK only in preview release) var results = await Task.WhenAll(endpoint.CustomDomains.Select(async domain => { // https://github.com/Azure/azure-rest-api-specs/blob/master/specification/cdn/resource-manager/Microsoft.Cdn/stable/2019-04-15/examples/CustomDomains_EnableCustomHttpsUsingBYOC.json // as per https://stackoverflow.com/a/56147987 var url = "https://management.azure.com" + $"/subscriptions/{_azureHelper.GetSubscriptionId()}/" + $"resourceGroups/{resourceGroupName}/" + $"providers/Microsoft.Cdn/profiles/{name}/" + $"endpoints/{endpoint.Name}/customDomains/" + $"{domain.Name}?api-version=2019-04-15"; var response = await httpClient.GetAsync(url, cancellationToken); response.EnsureSuccessStatusCode(); var responseContent = await response.Content.ReadAsStringAsync(); var cdnResponse = JsonConvert.DeserializeAnonymousType(responseContent, new { name = "", properties = new CdnCustomDomainResponse() }); return(cdnResponse); })); return(results.Select(x => x.properties).ToArray()); }