Exemple #1
0
        public static Task <IEnumerable <string> > GetApiVersionsAsync(this IAzureResourceService azureResourceService, AzureResourceIdentifier azureResourceIdentifier, bool includePreviewVersions = false)
        {
            if (azureResourceService is null)
            {
                throw new ArgumentNullException(nameof(azureResourceService));
            }

            if (azureResourceIdentifier is null)
            {
                throw new ArgumentNullException(nameof(azureResourceIdentifier));
            }

            if (string.IsNullOrEmpty(azureResourceIdentifier.ResourceNamespace))
            {
                return(azureResourceService.GetApiVersionsAsync(azureResourceIdentifier.SubscriptionId, "Microsoft.Resources", "resourceGroups", includePreviewVersions));
            }
            else
            {
                return(azureResourceService.GetApiVersionsAsync(azureResourceIdentifier.SubscriptionId, azureResourceIdentifier.ResourceNamespace, azureResourceIdentifier.ResourceTypeName, includePreviewVersions));
            }
        }