protected override void RunCmdlet()
        {
            if (!ShouldProcess(this.Name, @"Updating Azure ML commitment plan."))
            {
                return;
            }

            if (!this.Force.IsPresent && !ShouldContinue(Resources.UpdateServiceWarning.FormatInvariant(this.Name), string.Empty))
            {
                return;
            }

            int skuCapacity = this.SkuCapacity == 0 ? 1 : this.SkuCapacity;
            var sku         = new ResourceSku(skuCapacity, this.SkuName, this.SkuTier);

            var tags = this.Tags.Cast <DictionaryEntry>()
                       .ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value);

            CommitmentPlanPatchPayload patchPayload = new CommitmentPlanPatchPayload
            {
                Sku  = sku,
                Tags = tags
            };

            this.CommitmentPlansClient.PatchAzureMlCommitmentPlan(this.ResourceGroupName, this.Name, patchPayload);
        }
        protected override void RunCmdlet()
        {
            if (!ShouldProcess(this.Name, @"Updating Azure ML commitment plan."))
            {
                return;
            }

            if (!this.Force.IsPresent && !ShouldContinue(Resources.UpdateServiceWarning.FormatInvariant(this.Name), string.Empty))
            {
                return;
            }

            int skuCapacity = this.SkuCapacity == 0 ? 1 : this.SkuCapacity;
            var sku = new ResourceSku(skuCapacity, this.SkuName, this.SkuTier);

            var tags = this.Tags.Cast<DictionaryEntry>()
                .ToDictionary(kvp => (string) kvp.Key, kvp => (string) kvp.Value);

            CommitmentPlanPatchPayload patchPayload = new CommitmentPlanPatchPayload
            {
                Sku = sku,
                Tags = tags
            };

            this.CommitmentPlansClient.PatchAzureMlCommitmentPlan(this.ResourceGroupName, this.Name, patchPayload);
        }
예제 #3
0
 public CommitmentPlan PatchAzureMlCommitmentPlan(
     string resourceGroupName,
     string commitmentPlanName,
     CommitmentPlanPatchPayload patchPayload)
 {
     return(this.apiClient.CommitmentPlans.Patch(
                patchPayload,
                resourceGroupName,
                commitmentPlanName));
 }
 public CommitmentPlan PatchAzureMlCommitmentPlan(
     string resourceGroupName,
     string commitmentPlanName,
     CommitmentPlanPatchPayload patchPayload)
 {
     return this.apiClient.CommitmentPlans.Patch(
         patchPayload,
         resourceGroupName,
         commitmentPlanName);
 }
예제 #5
0
 /// <summary>
 /// Patch an existing Azure ML commitment plan resource.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='patchPayload'>
 /// The payload to patch the Azure ML commitment plan with. Only tags and SKU
 /// may be modified on an existing commitment plan.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name.
 /// </param>
 /// <param name='commitmentPlanName'>
 /// The Azure ML commitment plan name.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task <CommitmentPlan> PatchAsync(this ICommitmentPlansOperations operations, CommitmentPlanPatchPayload patchPayload, string resourceGroupName, string commitmentPlanName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.PatchWithHttpMessagesAsync(patchPayload, resourceGroupName, commitmentPlanName, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
예제 #6
0
 /// <summary>
 /// Patch an existing Azure ML commitment plan resource.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='patchPayload'>
 /// The payload to patch the Azure ML commitment plan with. Only tags and SKU
 /// may be modified on an existing commitment plan.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The resource group name.
 /// </param>
 /// <param name='commitmentPlanName'>
 /// The Azure ML commitment plan name.
 /// </param>
 public static CommitmentPlan Patch(this ICommitmentPlansOperations operations, CommitmentPlanPatchPayload patchPayload, string resourceGroupName, string commitmentPlanName)
 {
     return(System.Threading.Tasks.Task.Factory.StartNew(s => ((ICommitmentPlansOperations)s).PatchAsync(patchPayload, resourceGroupName, commitmentPlanName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult());
 }