Skip to main content
Glama

Azure MCP Server

Official
MIT License
1,161
  • Linux
  • Apple
AzureManagedLustreService.cs4 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using Azure.ResourceManager.StorageCache; using Azure.ResourceManager.StorageCache.Models; using AzureMcp.AzureManagedLustre.Models; using AzureMcp.Core.Options; using AzureMcp.Core.Services.Azure; using AzureMcp.Core.Services.Azure.ResourceGroup; using AzureMcp.Core.Services.Azure.Subscription; using AzureMcp.Core.Services.Azure.Tenant; namespace AzureMcp.AzureManagedLustre.Services; public sealed class AzureManagedLustreService(ISubscriptionService subscriptionService, IResourceGroupService resourceGroupService, ITenantService tenantService) : BaseAzureService(tenantService), IAzureManagedLustreService { private readonly ISubscriptionService _subscriptionService = subscriptionService ?? throw new ArgumentNullException(nameof(subscriptionService)); private readonly IResourceGroupService _resourceGroupService = resourceGroupService; public async Task<List<LustreFileSystem>> ListFileSystemsAsync(string subscription, string? resourceGroup = null, string? tenant = null, RetryPolicyOptions? retryPolicy = null) { ArgumentException.ThrowIfNullOrWhiteSpace(subscription); var results = new List<LustreFileSystem>(); try { if (!string.IsNullOrWhiteSpace(resourceGroup)) { var rg = await _resourceGroupService.GetResourceGroupResource(subscription, resourceGroup, tenant, retryPolicy) ?? throw new Exception($"Resource group '{resourceGroup}' not found"); foreach (var fs in rg.GetAmlFileSystems()) { results.Add(Map(fs)); } return results; } else { var sub = await _subscriptionService.GetSubscription(subscription, tenant, retryPolicy) ?? throw new Exception($"Subscription '{subscription}' not found"); foreach (var fs in sub.GetAmlFileSystems()) { results.Add(Map(fs)); } } } catch (Exception ex) { throw new Exception($"Error listing AMLFS file systems in subscription '{subscription}': {ex.Message}", ex); } return results; } private static LustreFileSystem Map(AmlFileSystemResource fs) { var data = fs.Data; return new LustreFileSystem( data.Name, fs.Id.ToString(), fs.Id.ResourceGroupName, fs.Id.SubscriptionId, data.Location, data.ProvisioningState?.ToString(), data.Health?.ToString(), data.ClientInfo?.MgsAddress, data.SkuName, data.StorageCapacityTiB.HasValue ? (long?)Convert.ToInt64(Math.Round(data.StorageCapacityTiB.Value)) : null, data.Hsm?.Settings?.Container, data.MaintenanceWindow?.DayOfWeek?.ToString(), data.MaintenanceWindow?.TimeOfDayUTC?.ToString() ); } public async Task<int> GetRequiredAmlFSSubnetsSize(string subscription, string sku, int size, string? tenant = null, RetryPolicyOptions? retryPolicy = null ) { var sub = await _subscriptionService.GetSubscription(subscription, tenant, retryPolicy) ?? throw new Exception($"Subscription '{subscription}' not found"); var fileSystemSizeContent = new RequiredAmlFileSystemSubnetsSizeContent { SkuName = sku, StorageCapacityTiB = size }; try { var sdkResult = sub.GetRequiredAmlFSSubnetsSize(fileSystemSizeContent); var numberOfRequiredIPs = sdkResult.Value.FilesystemSubnetSize ?? throw new Exception($"Failed to retrieve the number of IPs"); return numberOfRequiredIPs; } catch (Exception ex) { throw new Exception($"Error retrieving required subnet size: {ex.Message}", ex); } } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Azure/azure-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server