コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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));
 }
コード例 #3
0
 /// <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));
 }
コード例 #4
0
 /// <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));
 }
コード例 #5
0
 /// <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));
 }
コード例 #6
0
 /// <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);