/// <summary> /// Get or create new named resource group /// </summary> /// <param name="service"></param> /// <param name="resourceGroup"></param> /// <param name="deleteOnDispose"></param> /// <param name="subscriptionInfo"></param> /// <returns></returns> public static async Task <IResourceGroupResource> GetOrCreateAsync( this IResourceGroupFactory service, string resourceGroup, bool deleteOnDispose, ISubscriptionInfo subscriptionInfo = null) { var rg = await Try.Async(() => service.GetAsync(resourceGroup, deleteOnDispose, subscriptionInfo)); if (rg == null) { rg = await service.CreateAsync(resourceGroup, deleteOnDispose, subscriptionInfo); } return(rg); }
/// <summary> /// create non auto-delete on dispose randomly named /// resource group /// </summary> /// <param name="service"></param> /// <returns></returns> public static Task <IResourceGroupResource> CreateAsync( this IResourceGroupFactory service) { return(service.CreateAsync(null, false)); }
/// <summary> /// create non auto-delete on dispose resource group /// </summary> /// <param name="service"></param> /// <param name="resourceGroup"></param> /// <returns></returns> public static Task <IResourceGroupResource> CreateAsync( this IResourceGroupFactory service, string resourceGroup) { return(service.CreateAsync(resourceGroup, false)); }
/// <summary> /// create named resource group that is non auto-delete /// on dispose in specified subscription. /// </summary> /// <param name="service"></param> /// <param name="resourceGroup"></param> /// <param name="subscription"></param> /// <returns></returns> public static Task <IResourceGroupResource> CreateAsync( this IResourceGroupFactory service, string resourceGroup, ISubscriptionInfo subscription) { return(service.CreateAsync(resourceGroup, false, subscription)); }
/// <summary> /// create randomly named resource group /// </summary> /// <param name="service"></param> /// <param name="deleteOnDispose"></param> /// <returns></returns> public static Task <IResourceGroupResource> CreateAsync( this IResourceGroupFactory service, bool deleteOnDispose) { return(service.CreateAsync(null, deleteOnDispose)); }
/// <summary> /// create randomly named resource group /// </summary> /// <param name="service"></param> /// <param name="resourceGroup"></param> /// <param name="deleteOnDispose"></param> /// <returns></returns> public static Task <IResourceGroupResource> CreateAsync( this IResourceGroupFactory service, string resourceGroup, bool deleteOnDispose) => service.CreateAsync(resourceGroup, deleteOnDispose, null);