コード例 #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);
     }
 }
コード例 #2
0
        public async Task TemporaryEnableSuccessStaticResultForAction_WithoutConsumerStaticResult_Success()
        {
            // Arrange
            const string actionName    = "HTTP";
            string       correlationId = $"correlationId-{Guid.NewGuid()}";
            var          headers       = new Dictionary <string, string>
            {
                { "correlationId", correlationId },
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppMockingName, Authentication, Logger))
            {
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Act
                    await using (await logicApp.TemporaryEnableSuccessStaticResultAsync(actionName))
                    {
                        // Assert
                        await logicApp.TriggerAsync(headers);

                        LogicAppAction enabledAction = await PollForLogicAppActionAsync(correlationId, actionName);

                        Assert.Equal(actionName, enabledAction.Name);
                        Assert.Equal("200", enabledAction.Outputs.statusCode.ToString());
                        Assert.Equal(LogicAppActionStatus.Succeeded, enabledAction.Status);
                    }

                    await logicApp.TriggerAsync(headers);

                    LogicAppAction disabledAction = await PollForLogicAppActionAsync(correlationId, actionName);

                    Assert.NotEmpty(disabledAction.Outputs.headers);
                }
            }
        }
コード例 #3
0
        public async Task PollForLogicAppRun_ByCorrelationId_Success()
        {
            // Arrange
            string correlationId = $"correlationId-{Guid.NewGuid()}";
            var    headers       = new Dictionary <string, string>
            {
                { "correlationId", correlationId }
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication, Logger))
                await using (await logicApp.TemporaryEnableAsync())
                {
                    Task postTask = logicApp.TriggerAsync(headers);

                    // Act
                    Task <LogicAppRun> pollingTask =
                        LogicAppsProvider.LocatedAt(ResourceGroup, LogicAppName, Authentication, Logger)
                        .WithCorrelationId(correlationId)
                        .PollForSingleLogicAppRunAsync();

                    await Task.WhenAll(pollingTask, postTask);

                    // Assert
                    Assert.NotNull(pollingTask.Result);
                    Assert.Equal(correlationId, pollingTask.Result.CorrelationId);
                }
        }
コード例 #4
0
        /// <summary>
        /// Executes the get workflow accesskey command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            this.WriteObject(
                LogicAppClient.GetWorkflowAccessKey(this.ResourceGroupName, this.Name, this.AccessKeyName), true);
        }
コード例 #5
0
        public async Task PollForLogicAppRun_ByTrackedProperty_DifferentValues_GetsLatest_Success()
        {
            // Arrange
            const string trackedPropertyName   = "trackedproperty";
            string       correlationId         = $"correlationId-{Guid.NewGuid()}";
            string       trackedPropertyValue1 = $"tracked-{Guid.NewGuid()}";
            string       trackedPropertyValue2 = $"tracked-{Guid.NewGuid()}";

            var headers = new Dictionary <string, string>
            {
                { "correlationId", correlationId },
                { "trackedpropertyheader1", trackedPropertyValue1 },
                { "trackedpropertyheader2", trackedPropertyValue2 }
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication))
                await using (await logicApp.TemporaryEnableAsync())
                {
                    Task postTask = logicApp.TriggerAsync(headers);

                    // Act
                    Task <LogicAppRun> pollingTask =
                        LogicAppsProvider.LocatedAt(ResourceGroup, LogicAppName, Authentication, Logger)
                        .WithTrackedProperty(trackedPropertyName, trackedPropertyValue1)
                        .PollForSingleLogicAppRunAsync();

                    await Task.WhenAll(pollingTask, postTask);

                    // Assert
                    Assert.NotNull(pollingTask.Result);
                    Assert.Contains(pollingTask.Result.TrackedProperties, property => property.Value == trackedPropertyValue2);
                }
        }
コード例 #6
0
        /// <summary>
        /// Execute the create new workflow command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            if (this.Definition != null)
            {
                this.Definition = JToken.Parse(this.Definition.ToString());
            }

            if (!string.IsNullOrEmpty(this.DefinitionFilePath))
            {
                this.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath));
            }

            if (this.Parameters != null)
            {
                this.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters);
            }

            if (!string.IsNullOrEmpty(this.ParameterFilePath))
            {
                this.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath));
            }

            this.WriteObject(LogicAppClient.CreateWorkflow(this.ResourceGroupName, this.Name, new Workflow
            {
                Location           = this.Location,
                Definition         = this.Definition,
                Parameters         = this.Parameters as Dictionary <string, WorkflowParameter>,
                IntegrationAccount = string.IsNullOrEmpty(this.IntegrationAccountId)
                    ? null
                    : new ResourceReference(this.IntegrationAccountId),
                State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State)
            }), true);
        }
コード例 #7
0
 /// <summary>
 /// Executes the remove workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     ConfirmAction(Force.IsPresent,
                   string.Format(CultureInfo.InvariantCulture, Properties.Resource.RemoveLogicAppWarning, this.Name),
                   Properties.Resource.RemoveLogicAppMessage,
                   Name,
                   () => {
         LogicAppClient.RemoveWorkflow(ResourceGroupName, Name);
     });
 }
コード例 #8
0
 /// <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);
     }
 }
コード例 #9
0
        public async Task TemporaryEnableStaticResultsForAction_WithSuccessStaticResult_Success()
        {
            // Arrange
            const string actionName    = "HTTP";
            string       correlationId = $"correlationId-{Guid.NewGuid()}";
            var          headers       = new Dictionary <string, string>
            {
                { "correlationId", correlationId },
            };

            var definition = new StaticResultDefinition
            {
                Outputs = new Outputs
                {
                    Headers = new Dictionary <string, string> {
                        { "testheader", "testvalue" }
                    },
                    StatusCode = "200",
                    Body       = JToken.Parse("{id : 12345, name : 'test body'}")
                },
                Status = "Succeeded"
            };

            var definitions = new Dictionary <string, StaticResultDefinition> {
                [actionName] = definition
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppMockingName, Authentication, Logger))
            {
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Act
                    await using (await logicApp.TemporaryEnableStaticResultsAsync(definitions))
                    {
                        // Assert
                        await logicApp.TriggerAsync(headers);

                        LogicAppAction enabledAction = await PollForLogicAppActionAsync(correlationId, actionName);

                        Assert.Equal("200", enabledAction.Outputs.statusCode.ToString());
                        Assert.Equal("testvalue", enabledAction.Outputs.headers["testheader"].ToString());
                        Assert.Contains("test body", enabledAction.Outputs.body.ToString());
                    }

                    await logicApp.TriggerAsync(headers);

                    LogicAppAction disabledAction = await PollForLogicAppActionAsync(correlationId, actionName);

                    Assert.DoesNotContain("test body", disabledAction.Outputs.body.ToString());
                }
            }
        }
コード例 #10
0
 /// <summary>
 /// Executes the stop workflow run command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     ConfirmAction(Force.IsPresent,
                   Properties.Resource.CancelLogicAppRunWarning,
                   Properties.Resource.CancelLogicAppRunMessage,
                   Name,
                   () =>
     {
         LogicAppClient.CancelWorkflowRun(this.ResourceGroupName, this.Name, this.RunName);
     },
                   null);
 }
コード例 #11
0
        public async Task GetLogicAppTriggerUrl_ByName_Success()
        {
            // Arrange
            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication))
            {
                // Act
                LogicAppTriggerUrl logicAppTriggerUrl = await logicApp.GetTriggerUrlByNameAsync(triggerName : "manual");

                // Assert
                Assert.NotNull(logicAppTriggerUrl.Url);
                Assert.Equal("POST", logicAppTriggerUrl.Method);
            }
        }
コード例 #12
0
 /// <summary>
 /// Executes the get workflow run history command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     if (string.IsNullOrEmpty(this.RunName))
     {
         var enumerator = LogicAppClient.GetWorkflowRuns(this.ResourceGroupName, this.Name).GetEnumerator();
         this.WriteObject(enumerator.ToIEnumerable <WorkflowRun>(), true);
     }
     else
     {
         this.WriteObject(LogicAppClient.GetWorkflowRun(this.ResourceGroupName, this.Name, this.RunName), true);
     }
 }
コード例 #13
0
        /// <summary>
        /// Executes the get workflow command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            if (string.IsNullOrEmpty(this.TriggerName))
            {
                this.WriteObject(
                    LogicAppClient.RunWorkflow(this.ResourceGroupName, this.Name,
                                               new RunWorkflowParameters()), true);
            }
            else
            {
                LogicAppClient.RunWorkflowTrigger(this.ResourceGroupName, this.Name, this.TriggerName);
            }
        }
コード例 #14
0
        /// <summary>
        /// Executes the get workflow accesskey command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            ConfirmAction(Force.IsPresent,
                          "Are you sure you want to regenerate LogicApp access keys.",
                          "Updating LogicApp access keys.",
                          Name,
                          () =>
            {
                this.WriteObject(
                    LogicAppClient.RegenerateWorkflowAccessKey(this.ResourceGroupName, this.Name, this.AccessKeyName,
                                                               this.KeyType), true);
            },
                          null);
        }
コード例 #15
0
        public async Task PollForLogicAppRuns_ByTrackedProperty_NumberOfRuns_Success()
        {
            // Arrange
            const string trackedPropertyName = "trackedproperty";
            const int    numberOfRuns        = 2;
            TimeSpan     timeout             = TimeSpan.FromSeconds(40);

            string correlationId        = $"correlationId-{Guid.NewGuid()}";
            var    trackedPropertyValue = Guid.NewGuid().ToString();
            var    headers = new Dictionary <string, string>
            {
                { "correlationId", correlationId },
                { "trackedpropertyheader1", trackedPropertyValue },
                { "trackedpropertyheader2", trackedPropertyValue }
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication))
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Run logic app twice with the same tracked property.
                    Task postTask1 = logicApp.TriggerAsync(headers);
                    Task postTask2 = logicApp.TriggerAsync(headers);

                    // Act
                    // Poll for a specific number of logic app runs with provided tracked property.
                    Task <IEnumerable <LogicAppRun> > pollingTask =
                        LogicAppsProvider.LocatedAt(ResourceGroup, LogicAppName, Authentication, Logger)
                        .WithTrackedProperty(trackedPropertyName, trackedPropertyValue)
                        .WithTimeout(timeout)
                        .PollForLogicAppRunsAsync(numberOfRuns);

                    await Task.WhenAll(pollingTask, postTask1, postTask2);

                    // Assert
                    Assert.NotNull(pollingTask.Result);
                    Assert.Equal(numberOfRuns, pollingTask.Result.Count());
                    Assert.All(pollingTask.Result, logicAppRun =>
                    {
                        Assert.Contains(logicAppRun.TrackedProperties, property => property.Value == trackedPropertyValue);
                    });
                }
        }
コード例 #16
0
 /// <summary>
 /// Executes the get workflow run action command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     if (string.IsNullOrEmpty(this.ActionName))
     {
         var page = new Page <WorkflowRunAction>();
         int i    = 0;
         do
         {
             page = this.LogicAppClient.GetWorkflowRunActions(this.ResourceGroupName, this.Name, this.RunName, page.NextPageLink);
             this.WriteObject(page.GetEnumerator().ToIEnumerable <WorkflowRunAction>(), true);
             i++;
         }while (this.FollowNextPageLink && !string.IsNullOrWhiteSpace(page.NextPageLink) && i <= this.MaximumFollowNextPageLink);
     }
     else
     {
         this.WriteObject(LogicAppClient.GetWorkflowRunAction(
                              this.ResourceGroupName, this.Name, this.RunName, this.ActionName), true);
     }
 }
コード例 #17
0
        public async Task RunByNameLogicApp_WithoutTrigger_ReturnsCorrelationId()
        {
            // Arrange
            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, TestBaseLogicAppName, Authentication, Logger))
            {
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Act
                    await logicApp.RunByNameAsync(triggerName : "manual");

                    // Assert
                    LogicAppRun run = await LogicAppsProvider
                                      .LocatedAt(ResourceGroup, TestBaseLogicAppName, Authentication, Logger)
                                      .WithStartTime(DateTimeOffset.UtcNow.AddMinutes(-1))
                                      .PollForSingleLogicAppRunAsync();

                    Assert.Contains("Response", run.Actions.Select(action => action.Name));
                }
            }
        }
コード例 #18
0
        public async Task TemporaryEnableLogicApp_Success()
        {
            // Arrange
            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppMockingName, Authentication, Logger))
            {
                // Act
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Assert
                    LogicAppMetadata metadata = await logicApp.GetMetadataAsync();

                    Assert.Equal(LogicAppState.Enabled, metadata.State);
                }
                {
                    LogicAppMetadata metadata = await logicApp.GetMetadataAsync();

                    Assert.Equal(LogicAppState.Disabled, metadata.State);
                }
            }
        }
コード例 #19
0
        public async Task PollForLogicAppRun_NotMatchedCorrelation_Fails()
        {
            // Arrange
            var headers = new Dictionary <string, string>
            {
                { "correlationId", $"correlationId-{Guid.NewGuid()}" }
            };

            // Act
            Task <LogicAppRun> pollingTask =
                LogicAppsProvider.LocatedAt(ResourceGroup, LogicAppName, Authentication, Logger)
                .WithTimeout(TimeSpan.FromSeconds(5))
                .WithCorrelationId("not-matched-correlation-ID")
                .PollForSingleLogicAppRunAsync();

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication, Logger))
            {
                // Assert
                await logicApp.TriggerAsync(headers);

                await Assert.ThrowsAsync <TimeoutException>(() => pollingTask);
            }
        }
コード例 #20
0
        public async Task TemporaryUpdateLogicApp_WithUpdatedResponse_ReturnsUpdatedResponse()
        {
            // Arrange
            const string actionName    = "Response";
            string       correlationId = $"correlation-{Guid.NewGuid()}";
            var          headers       = new Dictionary <string, string>
            {
                { "correlationId", correlationId },
            };

            string definition = Configuration.GetLogicAppTriggerUpdateDefinition();

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, TestBaseLogicAppName, Authentication, Logger))
            {
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Act
                    await using (await logicApp.TemporaryUpdateAsync(definition))
                    {
                        // Assert
                        await logicApp.TriggerAsync(headers);

                        LogicAppAction updatedAction = await PollForLogicAppActionAsync(correlationId, actionName, TestBaseLogicAppName);

                        Assert.Equal("Updated", updatedAction.Outputs.body.response.ToString());
                    }
                    {
                        await logicApp.TriggerAsync(headers);

                        LogicAppAction updatedAction = await PollForLogicAppActionAsync(correlationId, actionName, TestBaseLogicAppName);

                        Assert.Equal("Original", updatedAction.Outputs.body.response.ToString());
                    }
                }
            }
        }
コード例 #21
0
        public async Task PollForLogicAppRuns_ByCorrelationId_NumberOfRuns_Success()
        {
            // Arrange
            const int numberOfRuns = 2;
            TimeSpan  timeout      = TimeSpan.FromSeconds(30);

            string correlationId = $"correlationId-{Guid.NewGuid()}";
            var    headers       = new Dictionary <string, string>
            {
                { "correlationId", correlationId }
            };

            using (var logicApp = await LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, Authentication))
                await using (await logicApp.TemporaryEnableAsync())
                {
                    // Run logic app twice with the same correlation id.
                    Task postTask1 = logicApp.TriggerAsync(headers);
                    Task postTask2 = logicApp.TriggerAsync(headers);

                    // Act
                    Task <IEnumerable <LogicAppRun> > pollingTask =
                        LogicAppsProvider.LocatedAt(ResourceGroup, LogicAppName, Authentication, Logger)
                        .WithCorrelationId(correlationId)
                        .WithTimeout(timeout)
                        .PollForLogicAppRunsAsync(numberOfRuns);

                    await Task.WhenAll(pollingTask, postTask1, postTask2);

                    // Assert
                    Assert.Equal(numberOfRuns, pollingTask.Result.Count());
                    Assert.All(pollingTask.Result, logicAppRun =>
                    {
                        Assert.Equal(correlationId, logicAppRun.CorrelationId);
                    });
                }
        }
コード例 #22
0
 public async Task ConstructorWithLogger_WithBlankLogicApp_Fails(string logicApp)
 {
     await Assert.ThrowsAsync <ArgumentException>(
         () => LogicAppClient.CreateAsync(ResourceGroup, logicApp, Authentication, Logger));
 }
 /// <summary>
 /// Executes the get workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     this.WriteObject(LogicAppClient.GetWorkflowUpgradedDefinition(this.ResourceGroupName, this.Name, this.TargetSchemaVersion), false);
 }
コード例 #24
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);
        }
コード例 #25
0
 public async Task ConstructorWithLogger_WithNullAuthentication_Fails()
 {
     await Assert.ThrowsAnyAsync <ArgumentException>(
         () => LogicAppClient.CreateAsync(ResourceGroup, LogicAppName, authentication: null, logger: Logger));
 }
コード例 #26
0
        /// <summary>
        /// Execute the create new workflow command
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            if (this.Definition != null)
            {
                this.Definition = JToken.Parse(this.Definition.ToString());
            }

            if (!string.IsNullOrEmpty(this.DefinitionFilePath))
            {
                this.Definition = CmdletHelper.GetDefinitionFromFile(this.TryResolvePath(this.DefinitionFilePath));
            }

            if (this.Parameters != null)
            {
                this.Parameters = CmdletHelper.ConvertToWorkflowParameterDictionary(this.Parameters);
            }

            if (!string.IsNullOrEmpty(this.ParameterFilePath))
            {
                this.Parameters = CmdletHelper.GetParametersFromFile(this.TryResolvePath(this.ParameterFilePath));
            }

            var servicePlan = WebsitesClient.GetAppServicePlan(this.ResourceGroupName, this.AppServicePlan);

            if (string.IsNullOrEmpty(this.Location))
            {
                this.Location = servicePlan.GeoRegion;
            }

            this.WriteObject(LogicAppClient.CreateWorkflow(this.ResourceGroupName, this.Name, new Workflow
            {
                Location       = this.Location,
                Definition     = this.Definition,
                Parameters     = this.Parameters as Dictionary <string, WorkflowParameter>,
                DefinitionLink = string.IsNullOrEmpty(this.DefinitionLinkUri)
                    ? null
                    : new ContentLink
                {
                    Uri            = this.DefinitionLinkUri,
                    ContentVersion = this.DefinitionLinkContentVersion
                },
                ParametersLink = string.IsNullOrEmpty(this.ParameterLinkUri)
                    ? null
                    : new ContentLink
                {
                    Uri            = this.ParameterLinkUri,
                    ContentVersion = this.ParameterLinkContentVersion
                },
                State = (WorkflowState)Enum.Parse(typeof(WorkflowState), this.State),
                Sku   = new Sku
                {
                    Name = (SkuName)Enum.Parse(typeof(SkuName), servicePlan.Sku.Tier),
                    Plan = new ResourceReference
                    {
                        Id = servicePlan.Id
                    }
                }
            }), true);
        }
コード例 #27
0
 /// <summary>
 /// Executes the get workflow command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     LogicAppClient.RunWorkflowTrigger(this.ResourceGroupName, this.Name, this.TriggerName);
 }
コード例 #28
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 (!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);
        }
コード例 #29
0
 /// <summary>
 /// Executes the get workflow trigger callback url command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     this.WriteObject(
         LogicAppClient.GetWorkflowTriggerCallbackUrl(this.ResourceGroupName, this.Name, this.TriggerName), true);
 }
コード例 #30
0
 /// <summary>
 /// Executes the stop workflow run command
 /// </summary>
 public override void ExecuteCmdlet()
 {
     base.ExecuteCmdlet();
     LogicAppClient.CancelWorkflowRun(this.ResourceGroupName, this.Name, this.RunName);
 }