/// <summary> /// Get or create new storage in a resource group. /// </summary> /// <param name="service"></param> /// <param name="resourceGroup"></param> /// <param name="name"></param> /// <returns></returns> public static async Task <IStorageResource> GetOrCreateAsync( this IStorageFactory service, IResourceGroupResource resourceGroup, string name) { var resource = await Try.Async(() => service.GetAsync(resourceGroup, name)); if (resource == null) { resource = await service.CreateAsync(resourceGroup, name); } return(resource); }
/// <summary> /// Create a new randomly named storage /// </summary> public static Task <IStorageResource> CreateAsync( this IStorageFactory service, IResourceGroupResource resourceGroup) { return(service.CreateAsync(resourceGroup, null)); }