private async Task <TpdmExtensionDetails> GetTpdmExtensionDetails()
 {
     return(await InMemoryCache.Instance.GetOrSet(
                "TpdmExtensionVersion", async() =>
                await _inferExtensionDetails.TpdmExtensionVersion(
                    CloudOdsAdminAppSettings.Instance.ProductionApiUrl)));
 }
        private async Task <bool> TpdmEnabled()
        {
            var versionDetails = await InMemoryCache.Instance.GetOrSet(
                "TpdmExtensionVersion", async() =>
                await _inferExtensionDetails.TpdmExtensionVersion(
                    CloudOdsAdminAppSettings.Instance.ProductionApiUrl));

            return(!string.IsNullOrEmpty(versionDetails.TpdmVersion));
        }
        public async Task <ActionResult> OdsVersionMetadata()
        {
            var model = new OdsVersionMetadataViewModel();

            try
            {
                model.OdsApiVersion = await InMemoryCache.Instance
                                      .GetOrSet("OdsApiVersion", async() => await _inferOdsApiVersion.Version(CloudOdsAdminAppSettings.Instance.ProductionApiUrl));

                var tpdmVersionDetails = await InMemoryCache.Instance.GetOrSet(
                    "TpdmExtensionVersion", () =>
                    _inferExtensionDetails.TpdmExtensionVersion(
                        CloudOdsAdminAppSettings.Instance.ProductionApiUrl));

                model.TpdmVersion = tpdmVersionDetails.TpdmVersion;
            }
            catch (Exception exception)
            {
                _logger.Error("Failed to infer the version of the ODS / API and its extension. This can happen when the ODS / API is unreachable.", exception);
            }

            return(PartialView(model));
        }