Ruleset API Examples - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Create a Filter

This is an example of running a Vantage-as-a-Service (VaaS) system and the user wants to control access to the system with a TASM filter rule using the IP address of the client/user machines. Those that qualify for the rule are denied access to the system.

For this example, assume the client/user machines IP addresses are 55.77.100.224 and 55.77.100.255.

The TASM filter rule attributes are:
  • Rule Type: Filter
  • Rule Name: FILTER_IP_ADDRESS
  • Qualifications:
    • Client IP Address: 55.77.100.224 or 55.77.100.255
    • Use ORing option to enable ClientIPAddrByClient check.
  • Limit: Default: Enabled

The API call sequence:

  1. The desired rules name, MyFirstConfig, is known so the query the TDWM.Configurations table need not be queried.
  2. Create filter rule FILTER_IP_ADDRESS without any classification criteria.
    CALL TDWM.TDWMCreateFilter(
       'MyFirstConfig',                        /* RulesetName */
       'FILTER_IP_ADDRESS',                    /* FilterName */
       'Filter by Client IP Address',          /* Description */
       NULL,                                   /* Attributes */
       'N'                                     /* ReplaceOption */);
  3. Add classification criteria.
    • Add client IP address criterion for client/user machine 55.77.100.224. Set ORing option to enable ClientIPAddrByClient check.

      CALL TDWM.TDWMAddClassificationForRule(
         'MyFirstConfig',                        /* RulesetName */
         'FILTER_IP_ADDRESS',                    /* RuleName */
         'Address classification',               /* Description */
         'CLIENTADDR',                           /* ClassificationType */
         '55.77.100.224',                        /* ClassificationValue */
         'IO',                                   /* ClassificationOperator */
         'N'                                     /* ReplaceOption */);
    • Add client IP address criterion for client/user machine 55.77.100.225. Set ORing option to enable ClientIPAddrByClient check.

      CALL TDWM.TDWMAddClassificationForRule( 
         'MyFirstConfig',                        /* RulesetName */
         'FILTER_IP_ADDRESS’,                    /* RuleName */
         'Address classification',               /* Description */
         'CLIENTADDR',                           /* ClassificationType */
         '55.77.100.225',                        /* ClassificationValue */
         'IO',                                   /* ClassificationOperator */
         'N'                                     /* ReplaceOption */);
  4. Enable the filter in the default state. For a filter, the StateLimit is not applicable.
    CALL TDWM.TDWMAddLimitForRuleState(
       'MyFirstConfig',                       /* RulesetName */
       'FILTER_IP_ADDRESS',                   /* RuleName */
       'DEFAULT',                             /* StateName */
       'Default limit',                       /* Description */
       NULL,                                  /* StateLimit */
       'E',                                   /* Action */
       'N'                                    /* ReplaceAction */);
  5. Enable the filter rule (at the rule level).
    CALL TDWM.TDWMManageRule(
       'MyFirstConfig',                     /* RulesetName */
       'FILTER_IP_ADDRESS',                 /* RuleName */
       'E'                                  /* Operation */);
  6. Activate the MyFirstConfig ruleset with the new filter rule.
    CALL TDWM.TDWMActivateRuleset(
      'MyFirstConfig',                      /* RulesetName */);

Create System Throttle or ARM

In the MyFirstConfig ruleset, create a member system throttle called TableA_FTS to set a concurrency limit of 1 with delay action for each user for requests that perform full table scans on the myDB.TableA table with estimated minimum total processing time of 3600 seconds from the WebApp application. This throttle is cannot be overridden.

The TASM rule attributes are:
  • Ruleset name: MyFirstConfig
  • System throttle name: TableA_FTS
  • Description: Member throttle FTS on myDB.TableA from WebApp
  • Throttle type: Member
  • Qualifications:
    • Application: WebApp
    • Table: myDB.TableA
    • Subcriteria on myDB.TableA: Full Table Scan and minimum total process time of 3600 seconds
  • Limit: 1
The API call sequence:
  1. The desired ruleset name, MyFirstConfig, is known, so the TDWM.Configurations table need not be queried.
  2. Create a system throttle called TableA_FTS without any classification criteria.
    CALL TDWM.TDWMCreateSystemThrottle(
      'MyFirstConfig',    /* ruleset name */
      'TableA_FTS',       /* throttle name */
      'Member throttle FTS on myDB.TableA from WebApp' /* description */,
      'DM',               /* 'D': disable override, 'M': member type */
      'N'                 /* not replace */);
  3. Add classification criteria.
    • Add application criterion:
      CALL TDWM.TDWMAddClassificationForRule(
        'MyFirstConfig',               /* ruleset name */
        'TableA_FTS',                  /* rule name */
        'Application classification',  /* description */
        'APPL',                        /* application criterion type */
        'WebApp',                      /* APPL = WebApp */
        'I',                           /* Inclusion criterion APPL = WebApp */
        'N'                            /* Not a replace */);
    • Add table type criterion:
      CALL TDWM.TDWMAddClassificationForRule(
        'MyFirstConfig',              /* ruleset name */
        'TableA_FTS',                 /* rule name */
        'Table classification',       /* description */
        'TABLE',                      /* table criterion type */
        'myDB.TableA',                /* TABLE = myDB.TableA */
        'I',                          /* Inclusion criterion */
        'N'                           /* Not a replace */);
  4. Add sub-criteria for table criterion.
    • Add full table scan sub-criterion for target myDB.TableA:
      CALL TDWM.TDWMAddClassificationForTarget( 
        'MyFirstConfig',              /* ruleset name */
        'TableA_FTS',                 /* rule name */
        'TABLE',                      /* Target: TABLE criterion type */
        'myDB.TableA',                /* Target: TABLE = myDB.TableA */
        'FTSCAN sub-criterion',       /* description */
        'FTSCAN',                     /* full table scan type */
        NULL,                         /* TargetValue not needed */ 
        'I',                          /* Inclusion criterion FTSCAN */
        'N'                           /* Not a replace */);
    • Add minimum step time sub-criterion for target myDB.TableA:
      CALL TDWM.TDWMAddClassificationForTarget( 
        'MyFirstConfig',               /* ruleset name */
        'TableA_FTS',                  /* rule name */
        'TABLE',                       /* Target: TABLE criterion type */
        'myDB.TableA',                 /* Target: TABLE = myDB.TableA */
        'Min step time sub-criterion', /* description */
        'MINSTEPTIME',                 /* minimum step time */
        '3600',                        /* min >= 3600 seconds */
        'I',                           /* Inclusion criterion */
        'N'                            /* Not a replace */);
  5. Set the default limit for the system throttle:
    CALL TDWM.TDWMAddLimitForRuleState(
      'MyFirstConfig',               /* ruleset name */
      'TableA_FTS',                  /* rule name */
      'Default’,                     /* state name */
      'Default limit',               /* description */
      '1',                           /* limit */
      'D'                            /* delay */
      'N'                            /* Not a replace */);
  6. Enable the system throttle:
    CALL TDWM.TDWMManageRule(
      'MyFirstConfig',               /* ruleset name */
      'TableA_FTS',                  /* rule name */
      'E'                            /* enable throttle */);
  7. Call TDWM.TDWMActivateRuleset to activate the MyFirstConfig ruleset with the new throttle.
    CALL TDWM.TDWMActivateRuleset(
      'MyFirstConfig'      /* ruleset name */);

Delete System Throttle, Arrival Rate Meter, or Filter

  1. If you want to delete a system throttle, arrival rate meter, or filter in a specific ruleset, retrieve the desired ruleset name from the TDWM.Configurations table.
  2. Call the XSP TDWM.TDWMDeleteRule to delete a system throttle, arrival rate meter, or filter by specifying its name.
    CALL TDWM.TDWMDeleteRule(
      'MyFirstConfig',         /* ruleset name */
      'Throttle_AcctDDL'       /* throttle name */);
  3. Call the XSP TDWM.TDWMActivateRuleset to activate the updated MyFirstConfig ruleset, which no longer has the system throttle, arrival rate meter, or filter.
    CALL TDWM.TDWMActivateRuleset(
      'MyFirstConfig'          /* ruleset name */);