/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var workflow = LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name); if (this.Definition == null) { workflow.Definition = null; } else if (this.Definition.ToString() != string.Empty) { workflow.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { workflow.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (!string.IsNullOrEmpty(this.IntegrationAccountId)) { workflow.IntegrationAccount = new ResourceReference(this.IntegrationAccountId); } if (this.Parameters == null) { workflow.Parameters = null; } else if (this.Parameters.ToString() != string.Empty) { workflow.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { workflow.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } if (!string.IsNullOrEmpty(this.State)) { workflow.State = this.State; } if (UseConsumptionModel.IsPresent) { workflow.Sku = null; } else if (!string.IsNullOrEmpty(this.AppServicePlan)) { var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan); workflow.Sku = new Sku { Name = servicePlan.Sku.Tier, Plan = new ResourceReference(id: servicePlan.Id) }; } if (workflow.Definition == null) { throw new PSArgumentException(Properties.Resource.DefinitionMissingWarning); } ConfirmAction(Force.IsPresent, string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceWarning, "Microsoft.Logic/workflows", this.Name), string.Format(CultureInfo.InvariantCulture, Properties.Resource.UpdateResourceMessage, "Microsoft.Logic/workflows", this.Name), Name, () => { this.WriteObject(LogicAppClient.UpdateWorkflow(this.ResourceGroupName, this.Name, workflow), true); }, null); }
/// <summary> /// Execute the create new workflow command /// </summary> public override void ExecuteCmdlet() { base.ExecuteCmdlet(); var workflow = LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name); if (this.Definition == null) { workflow.Definition = null; } else if (this.Definition.ToString() != string.Empty) { workflow.Definition = JToken.Parse(this.Definition.ToString()); } if (!string.IsNullOrEmpty(this.DefinitionFilePath)) { workflow.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath)); } if (this.Parameters == null) { workflow.Parameters = null; } else if (this.Parameters.ToString() != string.Empty) { workflow.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters); } if (!string.IsNullOrEmpty(this.ParameterFilePath)) { workflow.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath)); } if (this.DefinitionLinkUri == null) { workflow.DefinitionLink = null; } else if (this.DefinitionLinkUri != string.Empty) { workflow.DefinitionLink = new ContentLink { Uri = this.DefinitionLinkUri, ContentVersion = this.DefinitionLinkContentVersion }; } if (this.ParameterLinkUri == null) { workflow.ParametersLink = null; } else if (this.ParameterLinkUri != string.Empty) { workflow.ParametersLink = new ContentLink { Uri = this.ParameterLinkUri, ContentVersion = this.ParameterLinkContentVersion }; } if (!string.IsNullOrEmpty(this.State)) { workflow.State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State); } if (!string.IsNullOrEmpty(this.AppServicePlan)) { var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan); workflow.Sku = new Sku { Name = (SkuName)Enum.Parse(typeof(SkuName), servicePlan.Sku.Tier), Plan = new ResourceReference { Id = servicePlan.Id } }; } if (workflow.DefinitionLink == null && workflow.Definition == null) { throw new PSArgumentException(Properties.Resource.DefinitionMissingWarning); } this.WriteObject(LogicAppClient.UpdateWorkflow(this.ResourceGroupName, this.Name, workflow), true); }