Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create Local User in Azure SFTP

  2. Provisioning SFTP container

  3. Configure SFTP connections in Iguana File Channel or Translator

Sample Code

Code Block
-- SFTP Example -- START ---
   local fileName = 'filterSFTPData.hl7'
   local sftpConfigs = configs.sftpConfigs
   local SftpConn = net.sftp.init{server=sftpConfigs.host, username=sftpConfigs.username, password=sftpConfigs.password}

   -- Pust file to Remote SFTP
   local isSuccess = SftpConn:put{remote_path=fileName, data=Data, overwrite=true}
   trace(isSuccess)

   -- Read file from Remote SFTP
   local fileData = SftpConn:get{remote_path=fileName}
   trace(fileData)

Azure FileREST API Integration Design

...

  1. Provisioning SFTP container

  2. Configure Access Control (IAM) in SFTP container (ex. Reader Role)

  3. Build net.http API calls in Iguana translator

Sample Code

Code Block
-- SFTP REST API Example -- START ---
   -- Use Azure AD APP API to access Azure Blob
   local appConfigs = configs.appConfigs
   --1) Get Access token
   local resp = net.http.post{
      url=appConfigs.url,
      headers={['Content-Type'] = "application/x-www-form-urlencoded"},
      parameters = {
         ['grant_type'] = 'client_credentials',
         ['client_id'] = appConfigs.clientID,
         ['client_secret'] = appConfigs.clientSecret,
         ['resource']= "https://storage.azure.com"
      },
      cache_time=60,
      live = true
   }
   local token = json.parse{data=resp}.access_token
   trace(token)

   --2) Read file
   local resp2 = net.http.get{
      url=configs.fileConfigs.baseUrl.."/"..fileName,
      headers={
         ['Authorization'] = "Bearer "..token,
         ['x-ms-version'] = configs.fileConfigs.storageVersion
      },
      cache_time=60,
      live = true
   }
   trace(resp2)
   -- SFTP REST API Example -- END ---

Demo

...

Reference