eimRemovePolicyAssociation()--Remove EIM Policy Association


  Syntax
 #include <eim.h>

 int eimRemovePolicyAssociation(EimHandle                 * eim,
                                EimPolicyAssociationInfo  * policyAssoc,
                                EimRC                     * eimrc)
  Service Program Name: QSYS/QSYEIM

  Default Public Authority: *USE

  Threadsafe: Yes

The eimRemovePolicyAssociation() function removes the specified policy association from the domain.

EIM version 2 must be supported by the local EIM APIs to use this API (see eimGetVersion()--Get EIM Version).


Authorities and Locks

EIM Data
Access to EIM data is controlled by EIM access groups. LDAP administrators also have access to EIM data. The access groups whose members have authority to the EIM data for this API follow:

Parameters

eim  (Input)
The EIM handle returned by a previous call to eimCreateHandle(). A valid connection is required for this function.

policyAssoc  (Input)
The information about the policy association to be removed.

The EimPolicyAssociationInfo structure contains information about the policy association to remove.

For EIM_CERT_FILTER_POLICY (6) association type, the policyAssociation field must contain an EimCertificateFilterPolicyAssociation structure.

For EIM_DEFAULT_REG_POLICY (7) association type, the policyAssociation field must contain an EimDefaultRegistryPolicyAssociation structure.

For EIM_DEFAULT_DOMAIN_POLICY (8) association type. the policyAssociation field must contain an EimDefaultDomainPolicyAssociation structure.

The structure layouts follow:

   enum EimAssociationType {
       EIM_ALL_ASSOC,                  /* Not supported on this interface*/
       EIM_TARGET,                     /* Not supported on this interface*/
       EIM_SOURCE,                     /* Not supported on this interface*/
       EIM_SOURCE_AND_TARGET,          /* Not supported on this interface*/
       EIM_ADMIN,                      /* Not supported on this interface*/
       EIM_ALL_POLICY_ASSOC,           /* Not supported on this interface*/
       EIM_CERT_FILTER_POLICY,         /* Association is a certificate
                                          filter policy association.     */
       EIM_DEFAULT_REG_POLICY,         /* Association is a default
                                          registry policy association    */
       EIM_DEFAULT_DOMAIN_POLICY       /* Policy is a default policy for
                                          the domain.                    */
   };

   typedef struct EimCertificateFilterPolicyAssociation
   {
       char  * sourceRegistry;         /* The source registry to remove
                                          the policy association from.   */
       char  * filterValue;            /* The filter value of the policy.*/
       char  * targetRegistry;         /* The name of the target registry
                                          that the filter value is mapped
                                          to.                            */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the filter value
                                          is mapped to.                  */
   } EimCertificateFilterPolicyAssociation;

   typedef struct EimDefaultRegistryPolicyAssociation
   {
       char  * sourceRegistry;         /* The source registry to remove
                                          the policy association from.   */
       char  * targetRegistry;         /* The name of the target registry
                                          that the policy association is
                                          mapped to.                     */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the policy
                                          association is mapped to.      */
   } EimDefaultRegistryPolicyAssociation;

   typedef struct EimDefaultDomainPolicyAssociation
   {
       char  * targetRegistry;         /* The name of the target registry
                                          that the policy association is
                                          mapped to.                     */
       char  * targetRegistryUserName; /* The name of the target registry
                                          user name that the policy 
                                          association is mapped to.      */
   } EimDefaultDomainPolicyAssociation;

   typedef struct EimPolicyAssociationInfo
   {
       enum EimAssociationType type;
       union {
           EimCertificateFilterPolicyAssociation   certFilter;
           EimDefaultRegistryPolicyAssociation     defaultRegistry;
           EimDefaultDomainPolicyAssociation       defaultDomain;
       } policyAssociation;
   } EimPolicyAssociationInfo;
eimrc  (Input/Output)
The structure in which to return error code information. If the return value is not 0, eimrc is set with additional information. This parameter may be NULL. For the format of the structure, see EimRC--EIM Return Code Parameter.


Return Value

The return value from the API. Following each return value is the list of possible values for the messageCatalogMessageID field in the eimrc parameter for that value.

0
Request was successful.

EACCES
Access denied. Not enough permissions to access data.

EIMERR_ACCESS (1) Insufficient access to EIM data.

EBADDATA
eimrc is not valid.

EBADNAME
Registry is not valid or insufficient access to EIM data.

EIMERR_NOREG (28) EIM Registry not found or insufficient access to EIM data.
EIMERR_NOPOLICYFILTER (61) Policy filter value not found for the specified EIM Registry.

EBUSY
Unable to allocate internal system object.

EIMERR_NOLOCK (26) Unable to allocate internal system object.

ECONVERT
Data conversion error.

EIMERR_DATA_CONVERSION (13) Error occurred when converting data between code pages.

EINVAL
Input parameter was not valid.

EIMERR_ASSOC_TYPE_INVAL (4) Association type is not valid.
EIMERR_HANDLE_INVAL (17) EimHandle is not valid.
EIMERR_PARM_REQ (34) Missing required parameter. Please check API documentation.
EIMERR_PTR_INVAL (35) Pointer parameter is not valid.
EIMERR_FUNCTION_NOT_ SUPPORTED (70) The specified function is not supported by the EIM version.

ENOMEM
Unable to allocate required space.

EIMERR_NOMEM (27) No memory available. Unable to allocate required space.

ENOTCONN
LDAP connection has not been made.

EIMERR_NOT_CONN (31) Not connected to LDAP. Use eimConnect() API and try the request again.

EROFS
LDAP connection is for read only. Need to connect to master.

EIMERR_READ_ONLY (36) LDAP connection is for read only. Use eimConnectToMaster() to get a write connection.

EUNKNOWN
Unexpected exception.

EIMERR_LDAP_ERR (23) Unexpected LDAP error. %s
EIMERR_UNKNOWN (44) Unknown error or unknown system state.
EIMERR_UNEXP_OBJ_VIOLATION (56) Unexpected object violation.

Related Information


Example

The following example removes a default registry policy association.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <eim.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
    int           rc;
    char          eimerr[100];
    EimRC       * err;
    EimHandle   * handle;
    EimPolicyAssociationInfo assocInfo;

    /* Set up error structure.                  */
    memset(eimerr,0x00,100);
    err = (EimRC *)eimerr;
    err->memoryProvidedByCaller = 100;

    /* Get eim handle from input arg.           */
    /* This handle is already connected to EIM. */
    handle = (EimHandle *)argv[1];

    /* Set up policy association information    */
    assocInfo.type = EIM_DEFAULT_REG_POLICY;
    assocInfo.policyAssociation.defaultRegistry.sourceRegistry = "MySourceRegistry";
    assocInfo.policyAssociation.defaultRegistry.targetRegistry = "localRegistry";
    assocInfo.policyAssociation.defaultRegistry.targetRegistryUserName = "mjjones";
    
    /* Remove the policy                        */
    if (0 != (rc = eimRemovePolicyAssociation(handle,
                                              &assocInfo,
                                              err)))
    {
        printf("Remove EIM Policy Association error = %d", rc);
        return -1;
    }
              
    return 0;
        
}



API introduced: V5R3

[ Back to top | Security APIs | APIs by category ]