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