public async Task <ApplyResourceChange.Types.Response> ApplyResourceChange(ApplyResourceChange.Types.Request request) { var prior = DeserializeDynamicValue(request.PriorState); var planned = DeserializeDynamicValue(request.PlannedState); if (planned == null) { // Delete await _resourceProvider.DeleteAsync(prior); return(new ApplyResourceChange.Types.Response()); } else if (prior == null) { // Create var created = await _resourceProvider.CreateAsync(planned); var createdSerialized = SerializeDynamicValue(created); return(new ApplyResourceChange.Types.Response { NewState = createdSerialized, }); } else { // Update var updated = await _resourceProvider.UpdateAsync(prior, planned); var updatedSerialized = SerializeDynamicValue(updated); return(new ApplyResourceChange.Types.Response { NewState = updatedSerialized, }); } }
public async Task DeleteAsync(string resourceKey) { await provider.DeleteAsync(resourceKey); }
protected override Task <IResourceInfo> DeleteAsyncInternal(UriString uri, IImmutableSession metadata) { return(_resourceProvider.DeleteAsync(Combine(uri), metadata)); }
public static async Task <IResourceInfo> DeleteFileAsync(this IResourceProvider resourceProvider, string path, IImmutableSession metadata = default) { return(await resourceProvider.DeleteAsync(CreateUri(path), metadata.ThisOrEmpty().Set(Use <IResourceNamespace> .Namespace, x => x.Format, MimeType.Text))); }