Example #1
0
def ldap_provider_group_rules_configure(handle,
                                        ldap_provider_name,
                                        authorization="enable",
                                        traversal="recursive",
                                        target_attr="memberOf",
                                        use_primary_group="no",
                                        name=None,
                                        descr=None,
                                        **kwargs):
    """
    configures group rules of a ldap provider

    Args:
        handle (UcsHandle)
        ldap_provider_name (string): name of ldap provider
        authorization (string): group authorization
         valid values are "disable", "enable"
        traversal (string): group recursion
         valid values are "non-recursive", "recursive"
        target_attr (string): target atribute
        use_primary_group (string): valid values are "yes", "no"
        name (string): name
        descr (string): description
        **kwargs: Any additional key-value pair of managed object(MO)'s
                  property and value, which are not part of regular args.
                  This should be used for future version compatibility.
    Returns:
        AaaLdapGroupRule : managed object

    Raises:
        UcsOperationError: if AaaLdapProvider is not present

    Example:
        ldap_provider_group_rules_configure( handle,
                                        ldap_provider_name="test_ldap_prov",
                                        authorization="enable")
    """
    from ucsmsdk.mometa.aaa.AaaLdapGroupRule import AaaLdapGroupRule

    obj = ldap_provider_get(handle, ldap_provider_name,
                            "ldap_provider_group_rules_configure")

    mo = AaaLdapGroupRule(parent_mo_or_dn=obj,
                          authorization=authorization,
                          traversal=traversal,
                          target_attr=target_attr,
                          use_primary_group=use_primary_group,
                          name=name,
                          descr=descr)

    mo.set_prop_multiple(**kwargs)
    handle.add_mo(mo, modify_present=True)
    handle.commit()
    return mo