Exemple #1
0
    public async Async.Task <bool> HasComponents(string name)
    {
        var resourceGroup = _creds.GetBaseResourceGroup();

        if (await GetVm(name) != null)
        {
            return(true);
        }

        if (await _ipOperations.GetPublicNic(resourceGroup, name) != null)
        {
            return(true);
        }

        if (await _ipOperations.GetIp(resourceGroup, name) != null)
        {
            return(true);
        }

        var disks = await _diskOperations.ListDisks(resourceGroup)
                    .ToAsyncEnumerable()
                    .Where(disk => disk.Data.Name.StartsWith(name))
                    .AnyAsync();

        if (disks)
        {
            return(true);
        }

        return(false);
    }
Exemple #2
0
        public async Task <HttpResponseData> GetSubscription([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "testhooks/disks")] HttpRequestData req)
        {
            _log.Info("Get disk names");
            var resp      = req.CreateResponse(HttpStatusCode.OK);
            var diskNames = _diskOps.ListDisks(_creds.GetBaseResourceGroup()).ToList().Select(x => x.Data.Name);
            await resp.WriteAsJsonAsync(diskNames);

            return(resp);
        }