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); }
public async Task <HttpResponseData> GetIp([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "testhooks/ipOps/ip")] HttpRequestData req) { _log.Info("Get public nic"); var query = UriExtension.GetQueryComponents(req.Url); var rg = query["rg"]; var name = query["name"]; var ip = await _ipOps.GetIp(rg, name); var resp = req.CreateResponse(HttpStatusCode.OK); await resp.WriteStringAsync(ip.Get().Value.Data.Name); return(resp); }