コード例 #1
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            List <string> entities = JsonUtility.DeserializeEntities(request.DataStore.GetValue("Entities"), request.DataStore.GetValue("AdditionalObjects"));

            InformaticaTask task = new InformaticaTask
            {
                BulkApi            = true,
                SourceConnectionId = await InformaticaUtility.GetConnectionId(rc, InformaticaUtility.BPST_SOURCE_NAME),
                TargetConnectionId = await InformaticaUtility.GetConnectionId(rc, InformaticaUtility.BPST_TARGET_NAME),
                Name  = InformaticaUtility.BPST_TASK_NAME,
                OrgId = rc.ID,
                ReplicationObjects = entities.ToArray(),
                ScheduleId         = await CreateSchedule(rc, "PBI_" + Guid.NewGuid().ToString("N"))
            };

            await rc.Post(URL_REPLICATION_TASK, JsonConvert.SerializeObject(task));

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success));
        }
コード例 #2
0
        private async Task DeleteTask(RestClient rc, string taskName)
        {
            string taskId = await InformaticaUtility.GetTaskId(rc, taskName);

            if (taskId != null)
            {
                await rc.Delete(string.Format(CultureInfo.InvariantCulture, URL_REPLICATION_TASK_ID, taskId));
            }
        }
コード例 #3
0
        private async Task DeleteConnection(RestClient rc, string connectionName)
        {
            string connectionId = await InformaticaUtility.GetConnectionId(rc, connectionName);

            if (connectionId != null)
            {
                await rc.Delete(string.Format(CultureInfo.InvariantCulture, URL_CONNECTION, connectionId));
            }
        }
コード例 #4
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success));
        }
コード例 #5
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            string sqlUsername = request.DataStore.GetValue("Username");
            string sqlPassword = request.DataStore.GetValue("Password");

            bool isWindowsAuth = string.IsNullOrEmpty(sqlUsername) || string.IsNullOrEmpty(sqlPassword);

            InformaticaConnectionAzureSql ic = new InformaticaConnectionAzureSql
            {
                Name                 = InformaticaUtility.BPST_TARGET_NAME,
                OrgId                = rc.ID,
                ConnectionType       = "SqlServer2012",
                Codepage             = "UTF-8",
                Schema               = "dbo",
                AuthenticationType   = isWindowsAuth ? "Windows" : "SqlServer",
                RuntimeEnvironmentId = await InformaticaUtility.GetRuntimeEnvironmentId(rc, request.DataStore.GetValue("InformaticaAgentName"))
            };

            string databaseName = request.DataStore.GetValue("Database");
            string serverName   = request.DataStore.GetValue("Server");

            ic.Database = isWindowsAuth ? databaseName : databaseName + ";EncryptionMethod=SSL;ValidateServerCertificate=true";
            string[] serverAndPort = serverName.Split(',', ':');
            if (serverAndPort.Length > 1)
            {
                ic.port = int.Parse(serverAndPort[1].Trim());
                ic.Host = serverAndPort[0].Trim();
            }
            else
            {
                ic.Host = serverName;
                ic.port = 1433;
            }

            if (isWindowsAuth)
            {
                ic.username = ic.password = null;
            }
            else
            {
                ic.password = sqlPassword;
                ic.username = sqlUsername.Contains("@") ? sqlUsername : sqlUsername + "@" + ic.Host;
            }

            await rc.Post(URL_CONNECTIONS, JsonConvert.SerializeObject(ic));

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success));
        }
コード例 #6
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            string response = await rc.Get(URL_AGENT);

            List <InformaticaRuntimeEnvironment> environments = JsonConvert.DeserializeObject <List <InformaticaRuntimeEnvironment> >(response);

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success, JsonUtility.Serialize <List <InformaticaRuntimeEnvironment> >(environments)));
        }
コード例 #7
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            await DeleteTask(rc, InformaticaUtility.BPST_TASK_NAME);
            await DeleteConnection(rc, InformaticaUtility.BPST_SOURCE_NAME);
            await DeleteConnection(rc, InformaticaUtility.BPST_TARGET_NAME);

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success, JsonUtility.GetEmptyJObject()));
        }
コード例 #8
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string company   = request.DataStore.GetValue("InformaticaCompany");
            string nameFirst = request.DataStore.GetValue("InformaticaNameFirst");
            string nameLast  = request.DataStore.GetValue("InformaticaNameLast");
            string password  = request.DataStore.GetValue("InformaticaPassword");
            string username  = request.DataStore.GetValue("InformaticaUsername");

            RestClient rc = await InformaticaUtility.Initialize(username, password, true);

            InformaticaRegistration registration = new InformaticaRegistration(company, nameFirst, nameLast, password, username);

            await rc.Post(URL_REGISTER, JsonConvert.SerializeObject(registration));

            return(new ActionResponse(ActionStatus.Success));
        }
コード例 #9
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            InformaticaJob job = new InformaticaJob
            {
                TaskId   = await InformaticaUtility.GetTaskId(rc, InformaticaUtility.BPST_TASK_NAME),
                TaskName = InformaticaUtility.BPST_TASK_NAME,
                TaskType = "DRS"
            };
            await rc.Post(URL_JOB, JsonConvert.SerializeObject(job));

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success, JsonUtility.GetEmptyJObject()));
        }
コード例 #10
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            string response = await rc.Get(URL_ACTIVITY);

            List <InformaticaActivityLog> tasks = JsonConvert.DeserializeObject <List <InformaticaActivityLog> >(response);
            string taskId = await InformaticaUtility.GetTaskId(rc, InformaticaUtility.BPST_TASK_NAME);

            ActionResponse result = null;

            for (var i = 0; i < tasks.Count && result == null; i++)
            {
                if (tasks[i].TaskId.EqualsIgnoreCase(taskId))
                {
                    if (tasks[i].State.EqualsIgnoreCase("1") || tasks[i].State.EqualsIgnoreCase("2"))
                    {
                        result = new ActionResponse(ActionStatus.Success);
                    }
                    else if (tasks[i].ExecutionState.EqualsIgnoreCase("3"))
                    {
                        result = new ActionResponse(ActionStatus.Failure, JsonUtility.GetJObjectFromStringValue(tasks[i].ErrorMsg));
                    }
                    else
                    {
                        result = new ActionResponse(ActionStatus.InProgress);
                    }
                }
            }

            if (result == null)
            {
                result = new ActionResponse(ActionStatus.InProgress);
            }

            await InformaticaUtility.Logout(rc, username, password);

            return(result);
        }
コード例 #11
0
        public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
        {
            string     username = request.DataStore.GetValue("InformaticaUsername");
            string     password = request.DataStore.GetValue("InformaticaPassword");
            RestClient rc       = await InformaticaUtility.Initialize(username, password);

            InformaticaConnection ic = new InformaticaConnection
            {
                username             = request.DataStore.GetValue("SalesforceUser"),
                password             = request.DataStore.GetValue("SalesforcePassword"),
                securityToken        = request.DataStore.GetValue("SalesforceToken"),
                serviceUrl           = $"https://{request.DataStore.GetValue("SalesforceUrl")}/services/Soap/u/34.0",
                Name                 = InformaticaUtility.BPST_SOURCE_NAME,
                OrgId                = rc.ID,
                ConnectionType       = "Salesforce",
                RuntimeEnvironmentId = await InformaticaUtility.GetRuntimeEnvironmentId(rc, request.DataStore.GetValue("InformaticaAgentName"))
            };

            await rc.Post(URL_CONNECTIONS, JsonConvert.SerializeObject(ic));

            await InformaticaUtility.Logout(rc, username, password);

            return(new ActionResponse(ActionStatus.Success, JsonUtility.GetEmptyJObject()));
        }
 public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
 {
     return(new ActionResponse(ActionStatus.Success, InformaticaUtility.GetAgentDownloadLocation()));
 }
コード例 #13
0
 public override async Task <ActionResponse> ExecuteActionAsync(ActionRequest request)
 {
     return(new ActionResponse(ActionStatus.Success, JsonUtility.GetJObjectFromStringValue(JsonConvert.SerializeObject(InformaticaUtility.GetAgentDownloadLocation()))));
 }