Ejemplo n.º 1
0
        /// <summary>
        /// Get a list of resources that are registered for this subscription
        /// </summary>
        /// <param name="knownResourceTypes">Resource types to query for.</param>
        /// <returns></returns>
        public Task <IEnumerable <ProviderResource> > ListResourcesAsync(IEnumerable <string> knownResourceTypes)
        {
            var path = ProviderRegistrationConstants.ListResourcesPath(subscription.SubscriptionId, knownResourceTypes);

            var request = CreateRequest(HttpMethod.Get, path);

            return(httpClient.SendAsync(request)
                   .ContinueWith(tr => ProcessListResourcesResponse(tr)).Unwrap()
                   .ContinueWith(ts => DeserializeListResourcesResponse(ts)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Unregister the requested resource type
        /// </summary>
        /// <param name="resourceType">Resource type to unregister</param>
        /// <returns>true if successful, false if not registered, throws on other errors.</returns>
        public Task <bool> UnregisterResourceTypeAsync(string resourceType)
        {
            var path = ProviderRegistrationConstants.ActionPath(subscription.SubscriptionId,
                                                                resourceType,
                                                                ProviderRegistrationConstants.Unregister);

            var request = CreateRequest(HttpMethod.Put, path);

            return(httpClient.SendAsync(request)
                   .ContinueWith(tr => ProcessActionResponse(tr)));
        }