internal async Task HandleCreateAgentOperatorRequest(
            CreateAgentOperatorParams parameters,
            RequestContext <AgentOperatorResult> requestContext)
        {
            var result = await ConfigureAgentOperator(
                parameters.OwnerUri,
                parameters.Operator,
                ConfigAction.Create,
                RunType.RunNow);

            await requestContext.SendResult(new AgentOperatorResult()
            {
                Success      = result.Item1,
                ErrorMessage = result.Item2,
                Operator     = parameters.Operator
            });
        }
Exemple #2
0
        internal async Task HandleCreateAgentOperatorRequest(CreateAgentOperatorParams parameters, RequestContext <CreateAgentOperatorResult> requestContext)
        {
            await Task.Run(async() =>
            {
                var result = new CreateAgentOperatorResult();
                ConnectionInfo connInfo;
                ConnectionServiceInstance.TryFindConnection(
                    parameters.OwnerUri,
                    out connInfo);

                AgentOperatorInfo operatorInfo = parameters.Operator;
                CDataContainer dataContainer   = AdminService.CreateDataContainer(connInfo, databaseExists: true);
                STParameters param             = new STParameters(dataContainer.Document);
                param.SetParam("operator", operatorInfo.Name);

                using (AgentOperator agentOperator = new AgentOperator(dataContainer, operatorInfo))
                {
                    agentOperator.CreateOrUpdate();
                }

                await requestContext.SendResult(result);
            });
        }