예제 #1
0
 /// <summary>
 /// Executes the get workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     if (!string.IsNullOrWhiteSpace(Version))
     {
         this.WriteObject(LogicAppClient.GetWorkflowVersion(this.ResourceGroupName, this.Name, this.Version), true);
     }
     else if (string.IsNullOrEmpty(ResourceGroupName))
     {
         var allWorkflows = LogicAppClient.ListWorkFlowBySubscription();
         if (string.IsNullOrEmpty(Name))
         {
             this.WriteObject(allWorkflows.ToArray(), true);
         }
         else
         {
             this.WriteObject(allWorkflows.Where(a => a.Name.Equals(Name, StringComparison.CurrentCultureIgnoreCase)).ToArray(), true);
         }
     }
     else if (string.IsNullOrEmpty(Name))
     {
         this.WriteObject(LogicAppClient.ListWorkFlowByResourceGroupName(ResourceGroupName).ToArray());
     }
     else
     {
         this.WriteObject(LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name), true);
     }
 }
 /// <summary>
 /// Executes the get workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     if (string.IsNullOrWhiteSpace(this.Version))
     {
         this.WriteObject(LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name), true);
     }
     else
     {
         this.WriteObject(LogicAppClient.GetWorkflowVersion(this.ResourceGroupName, this.Name, this.Version), true);
     }
 }
        /// <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);
        }
예제 #4
0
        /// <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);
        }
 /// <summary>
 /// Executes the get workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     this.WriteObject(LogicAppClient.GetWorkflow(this.ResourceGroupName, this.Name), true);
 }