def main():
    module = AnsibleModule(
        argument_spec=dict(
            complianceId=dict(required=True),
            name=dict(),
            id=dict(),
            systemDefault=dict(type='bool'),
            details=pc.details_spec(),
            search_type=pc.search_type_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    path = ['compliance', module.params['complianceId'], 'requirement']
    listing = client.get(path)

    results = client.get_facts_from(
        listing,
        'name', ['systemDefault', 'id'],
        ['compliance', 'requirement', 'id'], (2, ),
    )

    module.exit_json(**results)
Exemplo n.º 2
0
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(),
            id=dict(),
            cloudType=dict(choices=['aws', 'azure', 'gcp', 'alibaba_cloud']),
            details=pc.details_spec(),
            search_type=pc.search_type_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    path = ['cloud', 'name']
    listing = client.get(path)

    results = client.get_facts_from(
        listing,
        'name',
        ['cloudType', 'id'],
        ['cloud', 'cloudType', 'id'],
        (1, 2),
    )

    module.exit_json(**results)
Exemplo n.º 3
0
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(),
            id=dict(),
            cloudType=dict(type='list'),
            systemDefault=dict(type='bool'),
            details=pc.details_spec(),
            search_type=pc.search_type_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    path = ['compliance', ]
    listing = client.get(path)

    results = client.get_facts_from(
        listing,
        'name', ['id', 'cloudType', 'systemDefault'],
        ['compliance', 'id'], (1, ),
    )

    module.exit_json(**results)
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(),
            policyId=dict(),
            policyType=dict(choices=['config', 'audit_event', 'network']),
            systemDefault=dict(type='bool'),
            cloudType=dict(),
            severity=dict(choices=['low', 'medium', 'high']),
            details=pc.details_spec(),
            search_type=pc.search_type_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    path = [
        'policy',
    ]
    listing = client.get(path)

    results = client.get_facts_from(
        listing,
        'name',
        ['policyId', 'policyType', 'systemDefault', 'cloudType', 'severity'],
        ['policy', 'policyId'],
        (1, ),
    )

    module.exit_json(**results)
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(),
            details=pc.details_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    name = module.params['name']
    details = module.params['details']

    path = ['cloud', 'group']
    listing = client.get(path)

    ans = []
    for x in listing:
        if name is not None and x['name'] != name:
            continue

        val = None
        if details:
            path = ['cloud', 'group', x['id']]
            val = client.get(path)
        else:
            val = pc.hide_details(x, ['name', 'id'])

        ans.append(val)

    module.exit_json(changed=False, total=len(listing), listing=ans)
def main():
    module = AnsibleModule(
        argument_spec=dict(
            name=dict(),
            cloud_types=dict(type='list'),
            system_default=dict(type='bool'),
            details=pc.details_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    name = module.params['name']
    cloud_types = module.params['cloud_types']
    system_default = module.params['system_default']
    details = module.params['details']

    path = [
        'compliance',
    ]
    listing = client.get(path)

    ans = []
    for x in listing:
        if name is not None and x['name'] != name:
            continue

        if cloud_types is not None and set(cloud_types).isdisjoint(
                set(x['cloudType'])):
            continue

        if system_default is not None and x['systemDefault'] != system_default:
            continue

        val = None
        if details:
            path = ['compliance', x['id']]
            val = client.get(path)
        else:
            val = pc.hide_details(x,
                                  ['name', 'id', 'cloudType', 'systemDefault'])

        ans.append(val)

    module.exit_json(changed=False, total=len(listing), listing=ans)
def main():
    module = AnsibleModule(
        argument_spec=dict(
            cs_id=dict(required=True),
            name=dict(),
            system_default=dict(type='bool'),
            details=pc.details_spec(),
        ),
        supports_check_mode=False,
    )

    client = pc.PrismaCloudRequest(module)

    cs_id = module.params['cs_id']
    name = module.params['name']
    system_default = module.params['system_default']
    details = module.params['details']

    path = ['compliance', cs_id, 'requirement']
    listing = client.get(path)

    ans = []
    for x in listing:
        if name is not None and x['name'] != name:
            continue

        if system_default is not None and x['systemDefault'] != system_default:
            continue

        val = None
        if details:
            path = ['compliance', 'requirement', x['id']]
            val = client.get(path)
        else:
            val = pc.hide_details(x, ['name', 'id', 'systemDefault'])

        ans.append(val)

    module.exit_json(changed=False, total=len(listing), listing=ans)