IsIntegrationAvailable

Returns 'yes' if integration brand is available. Otherwise returns 'no'.

Type
javascript
Pack
CommonScripts

Source

function isIntegrationAvailable(brandName, allInstances) {
    const brandInstances = Object.keys(allInstances).filter(
        instanceName => 
        allInstances[instanceName].brand.toLowerCase() === brandName.toLowerCase() &&
        allInstances[instanceName].state === 'active'
    );
  
    const readableOutput = brandInstances.length > 0 ? 'yes' : 'no';

    return {
        'Type': entryTypes['note'],
        'ContentsFormat': formats['text'],
        'Contents': readableOutput,
        'HumanReadable': readableOutput,
        'EntryContext': {'brandInstances': brandInstances}
    };
}


function main() {
    const brandNames = argToList(args.brandname);
    const allInstances = getModules();

    const results = [];
    for (let brandName of brandNames) {
        const result = isIntegrationAvailable(brandName, allInstances);
        results.push(result);
    }

    return results;
}


try {
    return main();
} catch (error) {
    throw `Failed to execute automation. Error:\n${error}`;
}

README

Returns ‘yes’ if integration brand is available. Otherwise returns ‘no’.

Script Data


Name Description
Script Type python3
Tags infra, Condition
Cortex XSOAR Version 5.0.0

Used In


Sample usage of this script can be found in the following playbooks and scripts.

Inputs


Argument Name Description
brandname Integration’s brand name to query.

Outputs


Path Description Type
brandInstances List of the instances for the given brands. Unknown