/// <summary>
 /// Initializes a new <see cref="WorkflowRuntimeContext"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="logger">The service used to perform logging</param>
 /// <param name="expressionEvaluatorProvider">The service used to create provide <see cref="IExpressionEvaluator"/>s</param>
 /// <param name="secretManager">The service used to manage secrets</param>
 /// <param name="managementApi">The service used to interact with the Synapse Public API</param>
 /// <param name="runtimeApi">The service used to interact with the Synapse Runtime API</param>
 public WorkflowRuntimeContext(IServiceProvider serviceProvider, ILogger <WorkflowRuntimeContext> logger, IExpressionEvaluatorProvider expressionEvaluatorProvider,
                               ISecretManager secretManager, ISynapseManagementApi managementApi, ISynapseRuntimeApi runtimeApi)
 {
     this.ServiceProvider             = serviceProvider;
     this.Logger                      = logger;
     this.ExpressionEvaluatorProvider = expressionEvaluatorProvider;
     this.SecretManager               = secretManager;
     this.ManagementApi               = managementApi;
     this.RuntimeApi                  = runtimeApi;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new <see cref="GetWorkflowCommand"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="synapseManagementApi">The service used to interact with the remote Synapse Management API</param>
 public GetWorkflowCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddArgument(new Argument("id", "The id of the workflow to get"));
     this.Handler = CommandHandler.Create <string>(this.HandleAsync);
 }
 /// <inheritdoc/>
 public InstallCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddCommand(ActivatorUtilities.CreateInstance <NativeInstallCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <DockerInstallCommand>(this.ServiceProvider));
 }
Esempio n. 4
0
 /// <inheritdoc/>
 public WorkflowCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddAlias("workflows");
     this.AddAlias("wf");
     this.AddCommand(ActivatorUtilities.CreateInstance <DeployWorkflowCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <RunWorkflowCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <GetWorkflowCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <ListWorkflowsCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <DeleteWorkflowCommand>(this.ServiceProvider));
 }
 /// <summary>
 /// Initializes a new <see cref="DeployWorkflowCommand"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="synapseManagementApi">The service used to interact with the remote Synapse Management API</param>
 /// <param name="workflowReader">The service used to read <see cref="WorkflowDefinition"/>s</param>
 public DeployWorkflowCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, IWorkflowReader workflowReader)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.WorkflowReader = workflowReader;
     this.Add(CommandOptions.File);
     this.Handler = CommandHandler.Create <string>(this.HandleAsync);
 }
Esempio n. 6
0
 /// <inheritdoc/>
 public CancelWorkflowInstanceCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.Add(new Argument <string>("id")
     {
         Description = "The id of the workflow instance to cancel the execution of (ex: myworkflow-XqGg49onskelivig7ND6ig)"
     });
     this.Handler = CommandHandler.Create <string, bool>(this.HandleAsync);
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new <see cref="Command"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="synapseManagementApi">The service used to interact with the remote Synapse Management API</param>
 /// <param name="jsonSerializer">The service used to serialize/deserialize to/from JSON</param>
 public RunWorkflowCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, IJsonSerializer jsonSerializer)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.JsonSerializer = jsonSerializer;
     this.Add(new Argument <string>("id")
     {
         Description = "The id of the workflow to run (ex: myworkflow:1.0). Note that failing to specify the version will run the latest version of the specified workflow"
     });
     this.Add(CommandOptions.Input);
     this.Handler = CommandHandler.Create <string, string>(this.HandleAsync);
 }
Esempio n. 8
0
 /// <summary>
 /// Initializes a new <see cref="Command"/>
 /// </summary>
 /// <param name="serviceProvider">The current <see cref="IServiceProvider"/></param>
 /// <param name="loggerFactory">The service used to create <see cref="ILogger"/>s</param>
 /// <param name="synapseManagementApi">The service used to interact with the remote Synapse Management API</param>
 /// <param name="name">The <see cref="Command"/>'s name</param>
 /// <param name="description">The <see cref="Command"/>'s description</param>
 protected Command(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, string name, string description)
     : base(name, description)
 {
     this.ServiceProvider      = serviceProvider;
     this.Logger               = loggerFactory.CreateLogger(this.GetType());
     this.SynapseManagementApi = synapseManagementApi;
 }
Esempio n. 9
0
 /// <inheritdoc/>
 public DockerInstallCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, IHttpClientFactory httpClientFactory)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.HttpClient = httpClientFactory.CreateClient();
     this.AddOption(CommandOptions.Name);
     this.AddOption(CommandOptions.HostName);
     this.AddOption(CommandOptions.CloudEventSinkUri);
     this.AddOption(CommandOptions.SkipCertificateValidation);
     this.Handler = CommandHandler.Create <string, string, Uri, bool>(this.HandleAsync);
 }
 /// <inheritdoc/>
 public ListCorrelationsCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddAlias("ls");
     this.AddOption(CommandOptions.Filter);
     this.Handler = CommandHandler.Create <string>(this.HandleAsync);
 }
Esempio n. 11
0
 /// <inheritdoc/>
 public WorkflowInstanceCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddAlias("workflow-instances");
     this.AddAlias("instance");
     this.AddAlias("instances");
     this.AddAlias("wfi");
     this.AddCommand(ActivatorUtilities.CreateInstance <GetWorkflowInstanceCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <ListWorkflowInstancesCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <DeleteWorkflowInstanceCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <SuspendWorkflowInstanceCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <ResumeWorkflowInstanceCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <CancelWorkflowInstanceCommand>(this.ServiceProvider));
 }
Esempio n. 12
0
 /// <inheritdoc/>
 public DeleteWorkflowInstanceCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddAlias("del");
     this.Add(new Argument <string>("id")
     {
         Description = "The id of the workflow instance to delete (ex: myworkflow-XqGg49onskelivig7ND6ig). Note that failing to specify the version will delete all version of the specified workflow"
     });
     this.Add(CommandOptions.Confirm);
     this.Handler = CommandHandler.Create <string, bool>(this.HandleAsync);
 }
Esempio n. 13
0
 /// <inheritdoc/>
 public CorrelationCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.AddAlias("correl");
     this.AddAlias("crl");
     this.AddCommand(ActivatorUtilities.CreateInstance <GetCorrelationCommand>(this.ServiceProvider));
     this.AddCommand(ActivatorUtilities.CreateInstance <ListCorrelationsCommand>(this.ServiceProvider));
 }
 /// <inheritdoc/>
 public NativeInstallCommand(IServiceProvider serviceProvider, ILoggerFactory loggerFactory, ISynapseManagementApi synapseManagementApi, IHttpClientFactory httpClientFactory)
     : base(serviceProvider, loggerFactory, synapseManagementApi, CommandName, CommandDescription)
 {
     this.HttpClient = httpClientFactory.CreateClient();
     this.AddOption(CommandOptions.Directory);
     this.Handler = CommandHandler.Create <string>(this.HandleAsync);
 }