public async Task <ActionResult <IEnumerable <string> > > GetPiSystemSubscriptionList(string resourceUriString)
        {
            try
            {
                if (string.IsNullOrEmpty(resourceUriString))
                {
                    throw new ArgumentNullException("resourceUriString");
                }

                IPiSystem pisystem = graphManager.GetPiSystem(resourceUriString);

                if (pisystem == null)
                {
                    logger?.LogWarning($"Pi-system '{resourceUriString}' is null.");
                }
                else
                {
                    logger?.LogInformation($"Returned pi-system '{resourceUriString}'.");
                }

                IEnumerable <string> list = await pisystem.GetSubscriptionListAsync();

                return(StatusCode(200, list));
            }
            catch (Exception ex)
            {
                logger?.LogError(ex, $"Error getting subscriptions from pi-system.");
                return(StatusCode(500, ex.Message));
            }
        }
示例#2
0
        /// <summary>
        /// Gets a list of subscription URIs subscribed to the resource.
        /// </summary>
        /// <param name="resourceUriString">Unique URI that identifies the resource.</param>
        /// <returns>Array of subscription URIs subscribed to the resource.</returns>
        public async Task <IEnumerable <string> > GetPiSystemSubscriptionListAsync(string resourceUriString)
        {
            IPiSystem resource = GetPiSystem(resourceUriString);

            return(await resource.GetSubscriptionListAsync());
        }