public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.SparkPoolObject)) { var resourceIdentifier = new ResourceIdentifier(this.SparkPoolObject.Id); this.WorkspaceName = resourceIdentifier.ParentResource; this.WorkspaceName = this.WorkspaceName.Substring(this.WorkspaceName.LastIndexOf('/') + 1); this.SparkPoolName = resourceIdentifier.ResourceName; } if (this.IsParameterBound(c => c.SparkJobObject)) { this.WorkspaceName = this.SparkJobObject.WorkspaceName; this.SparkPoolName = this.SparkJobObject.SparkPoolName; this.LivyId = this.IsParameterBound(c => c.LivyId) ? this.LivyId : this.SparkJobObject.Id.Value; } ConfirmAction( Force.IsPresent, string.Format(Resources.ConfirmToStopSparkJob, LivyId), string.Format(Resources.StoppingSparkJob, LivyId), LivyId.ToString(), () => { SynapseAnalyticsClient.CancelSparkBatchJob(LivyId, waitForCompletion: false); if (PassThru) { WriteObject(true); } }); }
public override void ExecuteCmdlet() { if (this.IsParameterBound(c => c.SessionObject)) { this.WorkspaceName = this.SessionObject.WorkspaceName; this.SparkPoolName = this.SessionObject.SparkPoolName; this.SessionId = this.SessionObject.Id.Value; } ConfirmAction( Force.IsPresent, string.Format(Resources.ConfirmToStopSparkStatement, LivyId), string.Format(Resources.StoppingSparkStatement, LivyId), LivyId.ToString(), () => { SynapseAnalyticsClient.CancelSparkSessionStatement(WorkspaceName, SparkPoolName, SessionId, LivyId); if (PassThru) { WriteObject(true); } }); }