public void TestCreateAndSendMetrics()
 {
     ClientAction clientAction = new ClientAction(ConnectString);
     MetricsEnhancement metricsEnhancement = new MetricsEnhancement();
     metricsEnhancement.ClientName = "HCTestClient";
     metricsEnhancement.Domain = "local";
     metricsEnhancement.Environment = "FUT1";
     metricsEnhancement.Type = "General";
     System.Console.WriteLine(clientAction.CreateAndSendMetrics(metricsEnhancement).ToString());
 }
        Core.ServiceResponse ICentralConnectService.SendClientMetrics(CentralConnectServiceRequest centralConnectServiceRequest)
        {
            if (centralConnectServiceRequest.MetricsEnhancement == null)
            {
                return new Core.ServiceResponse() { Code = 400, Message = "MetricsEnhancement should not null" };
            }

            if (string.IsNullOrEmpty(centralConnectServiceRequest.MetricsEnhancement.Environment)
                || string.IsNullOrEmpty(centralConnectServiceRequest.MetricsEnhancement.ClientName)
                || string.IsNullOrEmpty(centralConnectServiceRequest.MetricsEnhancement.Domain)
                || string.IsNullOrEmpty(centralConnectServiceRequest.MetricsEnhancement.Type))
            {
                return new Core.ServiceResponse() { Code = 400, Message = "Environment ClientName Domain Type should not null" };
            }

            if (string.IsNullOrEmpty(centralConnectServiceRequest.Id)
                || string.IsNullOrEmpty(centralConnectServiceRequest.Token)
                || string.IsNullOrEmpty(centralConnectServiceRequest.Type))
            {
                return new Core.ServiceResponse() { Code = 400, Message = "Id Type and Token should not null" };
            }
            string message = string.Empty;
            if (HP.TS.Devops.Security.SecurityCode.Success != HP.TS.Devops.Security.SecurityAction.CheckAccess(this.ConnectString, centralConnectServiceRequest, out message))
            {
                return new Core.ServiceResponse() { Code = 403, Message = centralConnectServiceRequest.Id + " of type " + centralConnectServiceRequest.Type + " have no access of " + message };
            }
            ClientAction clientAction = new ClientAction(this.ConnectString);
            CentralConnectCode clientCode = clientAction.CreateAndSendMetrics(centralConnectServiceRequest.MetricsEnhancement);
            if (CentralConnectCode.Success != clientCode)
            {
                return new Core.ServiceResponse() { Code = 500, Message = "CreateAndSendMetrics Fail of " + Enum.GetName(typeof(CentralConnectCode), clientCode) };
            }
            return new Core.ServiceResponse() { Code = 0, Message = "Success" };
        }