public async Task <bool> DeleteDnsEntityAsync(DnsEntity entity) { try { TableOperation deleteOperation = TableOperation.Delete(entity); TableResult result = await table.Value.ExecuteAsync(deleteOperation); return(result.HttpStatusCode == (int)HttpStatusCode.NoContent); } catch (StorageException ex) { return(false); } }
public async Task <DnsEntity> GetDnsEntityAsync(string resourceId) { var entity = new DnsEntity(resourceId); var retrieveOperation = TableOperation.Retrieve <DnsEntity>(entity.PartitionKey, entity.RowKey); var result = await table.Value.ExecuteAsync(retrieveOperation); if (result.HttpStatusCode == (int)HttpStatusCode.OK) { return((DnsEntity)result.Result); } return(null); }
private async Task <bool> OrchestrateNetworkInterfaceUpdateAsync(IDurableOrchestrationContext context, NetworkInterface nic, DnsEntity dnsEntity) { // If NIC tags were removed or no longer contains the hostname tag. var remove = nic.Tags == null || !nic.Tags.ContainsKey(hostNameTagName); var replace = !remove && !nic.Tags[hostNameTagName].Equals(dnsEntity.Hostname, StringComparison.OrdinalIgnoreCase); var removed = false; var orchestratorParameters = new OrchestratorParameters { SubscriptionId = ResourceId.FromString(nic.Id).SubscriptionId, ResourceId = nic.Id }; if (remove || replace) { removed = await context.CallSubOrchestratorAsync <bool>(nameof(OrchestrateNetworkInterfaceDeleteAsync), orchestratorParameters); } if (replace && removed) { return(await context.CallSubOrchestratorAsync <bool>(nameof(OrchestrateNetworkInterfaceWriteAsync), orchestratorParameters)); } return(true); }
public async Task <bool> DeleteDnsEntityAsync([ActivityTrigger] DnsEntity dnsEntity, ILogger log) { return(await dnsEntityService.DeleteDnsEntityAsync(dnsEntity)); }
public async Task <bool> CreateDnsEntityAsync([ActivityTrigger] DnsParameters parameters, ILogger log) { var dnsEntity = new DnsEntity(parameters.ResourceId, parameters.Hostname, parameters.DnsZone, RecordType.A, parameters.IpAddress); return(await dnsEntityService.InsertOrUpdateDnsEntityAsync(dnsEntity)); }