コード例 #1
0
        public IEnumerable <QlikSenseServiceInfo> GetQlikSenseServiceInfos(SenseApiSupport senseApiSupport, SenseEnums senseEnums)
        {
            dynamic serviceStatusJson = senseApiSupport.RequestWithResponse(
                ApiMethod.Get,
                $"https://{senseApiSupport.Host}:4242/qrs/servicestatus/full",
                null,
                null,
                HttpStatusCode.OK,
                JArray.Parse);

            foreach (dynamic serviceStatusStruct in serviceStatusJson)
            {
                int serviceTypeId  = GetInt(serviceStatusStruct, "serviceType");
                int serviceStateId = GetInt(serviceStatusStruct, "serviceState");

                var qlikSenseServiceInfo = new QlikSenseServiceInfo
                {
                    ServiceType      = senseEnums.GetValue("ServiceTypeEnum", serviceTypeId, MISSING_VALUE),
                    HostName         = GetString(serviceStatusStruct, new [] { "serverNodeConfiguration", "hostName" }),
                    ServiceClusterId = GetGuid(serviceStatusStruct, new [] { "serverNodeConfiguration", "serviceCluster", "id" }),
                    ServiceState     = senseEnums.GetValue("ServiceStateEnum", serviceStateId, MISSING_VALUE),
                    ModifiedDate     = GetDate(serviceStatusStruct, "modifiedDate")
                };

                yield return(qlikSenseServiceInfo);
            }
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="senseApiSupport"></param>
        /// <param name="senseEnums"></param>
        /// <returns></returns>
        public IEnumerable <QlikSenseMachineInfo> GetQlikSenseMachineInfos(SenseApiSupport senseApiSupport, SenseEnums senseEnums)
        {
            dynamic serverNodeConfigJson = senseApiSupport.RequestWithResponse(
                ApiMethod.Get,
                $"https://{senseApiSupport.Host}:4242/qrs/servernodeconfiguration/full",
                null,
                null,
                HttpStatusCode.OK,
                JToken.Parse);

            foreach (dynamic serverNodeStruct in serverNodeConfigJson)
            {
                var nodePurposeId = GetInt(serverNodeStruct, "nodePurpose");

                var qlikSenseMachineInfo = new QlikSenseMachineInfo
                {
                    HostName         = GetString(serverNodeStruct, "hostName"),
                    ServiceClusterId = GetGuid(serverNodeStruct, new [] { "serviceCluster", "id" }),
                    Name             = GetString(serverNodeStruct, "name"),
                    IsCentral        = GetBool(serverNodeStruct, "isCentral"),
                    NodePurpose      = senseEnums.GetValue("NodePurposeEnum", nodePurposeId, MISSING_VALUE),
                    ModifiedDate     = GetDate(serverNodeStruct, "modifiedDate")
                };
                _serviceClusterId = qlikSenseMachineInfo.ServiceClusterId;
                yield return(qlikSenseMachineInfo);
            }
        }
コード例 #3
0
        private List <ServiceStatusFullDto> GetServiceStatusFull(SenseEnums senseEnums)
        {
            var dynamicJson = new QmsHelper().GetJArray(_senseApiSupport, "qrs/servicestatus/full");
            var ret         = new  List <ServiceStatusFullDto>();

            foreach (dynamic serviceStatusStruct in dynamicJson)
            {
                ret.Add(new ServiceStatusFullDto
                {
                    ServiceTypeId      = serviceStatusStruct.serviceType,
                    ServiceStateId     = serviceStatusStruct.serviceState,
                    Timestamp          = serviceStatusStruct.timestamp,
                    ServerNodeName     = serviceStatusStruct.serverNodeConfiguration.name,
                    ServerNodeHostName = serviceStatusStruct.serverNodeConfiguration.hostName,
                    ServiceTypeName    = senseEnums.GetValue("ServiceTypeEnum", (int)serviceStatusStruct.serviceType, string.Format(Constants.SENSE_API_MISSING_VALUE, serviceStatusStruct.serviceType)),
                    ServiceStateName   = senseEnums.GetValue("ServiceStateEnum", (int)serviceStatusStruct.serviceState, string.Format(Constants.SENSE_API_MISSING_VALUE, serviceStatusStruct.serviceState)),
                });
            }
            return(ret);
        }
コード例 #4
0
        public IEnumerable <QlikSenseServiceInfo> GetQlikSenseServiceInfos(SenseApiSupport senseApiSupport, SenseEnums senseEnums)
        {
            var serviceStatusJson = GetSenseResponse("4242/qrs/servicestatus/full", senseApiSupport);

            foreach (dynamic serviceStatusStruct in serviceStatusJson)
            {
                int serviceTypeId  = _jsonHelper.GetInt(serviceStatusStruct, "serviceType");
                int serviceStateId = _jsonHelper.GetInt(serviceStatusStruct, "serviceState");

                var qlikSenseServiceInfo = new QlikSenseServiceInfo
                {
                    ServiceType      = senseEnums.GetValue("ServiceTypeEnum", serviceTypeId, MISSING_VALUE),
                    HostName         = _jsonHelper.GetString(serviceStatusStruct, new[] { "serverNodeConfiguration", "hostName" }),
                    ServiceClusterId = _jsonHelper.GetGuid(serviceStatusStruct, new[] { "serverNodeConfiguration", "serviceCluster", "id" }),
                    ServiceState     = senseEnums.GetValue("ServiceStateEnum", serviceStateId, MISSING_VALUE),
                    ModifiedDate     = _jsonHelper.GetDate(serviceStatusStruct, "modifiedDate")
                };

                yield return(qlikSenseServiceInfo);
            }
        }
コード例 #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="senseApiSupport"></param>
        /// <param name="senseEnums"></param>
        /// <returns></returns>
        public IEnumerable <QlikSenseMachineInfo> GetQlikSenseMachineInfos(SenseApiSupport senseApiSupport, SenseEnums senseEnums)
        {
            var serverNodeConfigJson = GetSenseResponse("4242/qrs/servernodeconfiguration/full", senseApiSupport);

            foreach (dynamic serverNodeStruct in serverNodeConfigJson)
            {
                var nodePurposeId = _jsonHelper.GetInt(serverNodeStruct, "nodePurpose");

                var qlikSenseMachineInfo = new QlikSenseMachineInfo
                {
                    HostName         = _jsonHelper.GetString(serverNodeStruct, "hostName"),
                    ServiceClusterId = _jsonHelper.GetGuid(serverNodeStruct, new[] { "serviceCluster", "id" }),
                    Name             = _jsonHelper.GetString(serverNodeStruct, "name"),
                    IsCentral        = _jsonHelper.GetBool(serverNodeStruct, "isCentral"),
                    NodePurpose      = senseEnums.GetValue("NodePurposeEnum", nodePurposeId, MISSING_VALUE),
                    ModifiedDate     = _jsonHelper.GetDate(serverNodeStruct, "modifiedDate")
                };
                _serviceClusterId = qlikSenseMachineInfo.ServiceClusterId;
                yield return(qlikSenseMachineInfo);
            }
        }
コード例 #6
0
        public List <TaskDto> GetAllTasksFullDto(SenseApiSupport senseApiSupport, SenseEnums senseEnums)
        {
            var dynamicJson = new QmsHelper().GetJArray(senseApiSupport, "qrs/task/full");
            var ret         = new List <TaskDto>();

            foreach (dynamic serviceStatusStruct in dynamicJson)
            {
                try
                {
                    var task = new TaskDto
                    {
                        Taskid              = serviceStatusStruct.id,
                        Createddate         = serviceStatusStruct.createdDate,
                        Modifieddate        = serviceStatusStruct.modifiedDate,
                        Modifiedbyusername  = serviceStatusStruct.modifiedByUserName,
                        Ismanuallytriggered = serviceStatusStruct.isManuallyTriggered,
                        Name                 = serviceStatusStruct.name,
                        Tasktype             = serviceStatusStruct.taskType,
                        Enabled              = serviceStatusStruct.enabled,
                        Tasksessiontimeout   = serviceStatusStruct.taskSessionTimeout,
                        Maxretries           = serviceStatusStruct.maxRetries,
                        Impactsecurityaccess = serviceStatusStruct.impactSecurityAccess,
                        Schemapath           = serviceStatusStruct.schemaPath,
                    };
                    if (serviceStatusStruct.app != null)
                    {
                        task.App = new AppDto
                        {
                            AppId                 = serviceStatusStruct.app.id,
                            Name                  = serviceStatusStruct.app.name,
                            Publishtime           = serviceStatusStruct.app.publishTime,
                            Published             = serviceStatusStruct.app.published,
                            Savedinproductversion = serviceStatusStruct.app.savedInProductVersion,
                            Migrationhash         = serviceStatusStruct.app.migrationHash,
                            Availabilitystatus    = serviceStatusStruct.app.availabilityStatus
                        };
                        if (serviceStatusStruct.app.stream != null)
                        {
                            task.App.Stream = new StreamDto
                            {
                                Name     = serviceStatusStruct.app.stream.name,
                                StreamId = serviceStatusStruct.app.stream.id
                            };
                        }
                    }
                    if (serviceStatusStruct.operational != null)
                    {
                        task.Operational = new TaskOperationalDto
                        {
                            NextExecution = serviceStatusStruct.operational.nextExecution,
                            OperationalId = serviceStatusStruct.operational.id,
                            //ExecutionResult = new TaskLastExecutionResultDto
                        };
                        if (serviceStatusStruct.operational.lastExecutionResult != null)
                        {
                            task.Operational.LastExecutionResult = new TaskLastExecutionResultDto
                            {
                                LastexecutionresultId = serviceStatusStruct.operational.lastExecutionResult.id,
                                Executingnodename     = serviceStatusStruct.operational.lastExecutionResult.executingNodeName,
                                Status             = serviceStatusStruct.operational.lastExecutionResult.status,
                                StatusName         = senseEnums.GetValue("StatusEnum", (int)serviceStatusStruct.operational.lastExecutionResult.status, string.Format(Constants.SENSE_API_MISSING_VALUE, serviceStatusStruct.operational.lastExecutionResult.status)),
                                Starttime          = serviceStatusStruct.operational.lastExecutionResult.startTime,
                                Stoptime           = serviceStatusStruct.operational.lastExecutionResult.stopTime,
                                Duration           = serviceStatusStruct.operational.lastExecutionResult.duration,
                                Filereferenceid    = serviceStatusStruct.operational.lastExecutionResult.fileReferenceID,
                                Scriptlogavailable = serviceStatusStruct.operational.lastExecutionResult.scriptLogAvailable
                            };
                            if (serviceStatusStruct.operational.lastExecutionResult.details != null)
                            {
                                task.Operational.LastExecutionResult.LastExecutionResultDetails = new List <TaskLastExecutionResultDetailsDto>();
                                foreach (dynamic details in serviceStatusStruct.operational.lastExecutionResult.details)
                                {
                                    task.Operational.LastExecutionResult.LastExecutionResultDetails.Add(new TaskLastExecutionResultDetailsDto
                                    {
                                        Detailcreateddate = details.detailCreatedDate,
                                        DetailsId         = details.id,
                                        Detailstype       = details.detailsType,
                                        Message           = details.message
                                    });
                                }
                            }
                        }
                    }

                    ret.Add(task);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e);
                }
            }
            return(ret);
        }