def addAgent()

in visualizeConnectData/scripts/mockCTRs/create.py [0:0]


def addAgent(accountId, region):
    agentScheme = {
        'ARN': None,
        'AfterContactWorkDuration': None,
        'AfterContactWorkEndTimestamp': None,
        'AfterContactWorkStartTimestamp': None,
        'AgentInteractionDuration': None,
        'ConnectedToAgentTimestamp': None,
        'CustomerHoldDuration': 0,
        'HierarchyGroups': None,
        'LongestHoldDuration': 0,
        'NumberOfHolds': 0,
        'RoutingProfile': {
          'ARN': None,
          'Name': 'QABot Routing Profile'
        },
        'Username': None
    }
    
    agent = getAgent()
        
    agentScheme['ARN'] = 'arn:aws:connect:{0}:{1}:instance/{2}/agent/{3}'.format(
        region,
        accountId,
        ARN_ID,
        agent['arnID']
    )
    
    agentScheme['Username'] = agent['username']
    
    agentScheme['RoutingProfile']['ARN'] = 'arn:aws:connect:{0}:{1}:instance/{2}/routing-profile/{3}'.format(
        region,
        accountId,
        ARN_ID,
        ARN_ID
    )
    
    if (random.randint(1, 100) > 75):
        numOfHolds = random.randint(1, 5)
        agentScheme['NumberOfHolds'] = numOfHolds
        
        holdDurationMin = random.randint(1, 5) * 60
        agentScheme['LongestHoldDuration'] = holdDurationMin
        agentScheme['CustomerHoldDuration'] = holdDurationMin
        
        if (numOfHolds > 1):
            agentScheme['CustomerHoldDuration'] = holdDurationMin + ((numOfHolds-1) * (random.randint(1, holdDurationMin)))
    
    return agentScheme