Delphix Products

 View Only
  • 1.  Get Policies for a VDB through API

    Posted 12-31-2021 08:40:00 AM
    Looking for the API URL to use to get the policies assigned to a VDB/dSource
    OR
    List of VDB/dSources assigned to a Policy

    ------------------------------
    Mahesh Chandran
    Delphix Community Members
    ------------------------------


  • 2.  RE: Get Policies for a VDB through API
    Best Answer

    Posted 01-04-2022 03:19:00 PM
      |   view attached
    Hello Mahesh,
    Good afternoon.
    Here you have attached a sample script that will help you achieve that(it's a python script).

    This is a sample output of its execution:
    laptop > python api_get_policies.py admin *** engine
    Printing Delphix policies assigned to Dataset groups, dSources and vDBs...
     
    dSource/vDB/Group,  Object Reference,  Policy, Policy Reference
    dSources,GROUP-2,None:RefreshPolicy,POLICY_REFRESH-3
    dSources,GROUP-2,Default Retention,POLICY_RETENTION-4
    dSources,GROUP-2,Default Snapshot,POLICY_SNAPSHOT-6
    dSources,GROUP-2,Default SnapSync,POLICY_SYNC-5
    VDBS,GROUP-3,None:RefreshPolicy,POLICY_REFRESH-3
    VDBS,GROUP-3,Default Retention,POLICY_RETENTION-4
    VDBS,GROUP-3,Default Snapshot,POLICY_SNAPSHOT-6
    VDBS,GROUP-3,Default SnapSync,POLICY_SYNC-5
    DBOMSR8A1718,ORACLE_DB_CONTAINER-6,None,POLICY_RETENTION-8
    DBOMSR8A1718,ORACLE_DB_CONTAINER-6,Default SnapSync,POLICY_SYNC-5
    VDB1,ORACLE_DB_CONTAINER-9,None:RefreshPolicy,POLICY_REFRESH-3
    VDB1,ORACLE_DB_CONTAINER-9,Default Retention,POLICY_RETENTION-4
    VDB1,ORACLE_DB_CONTAINER-9,Default Snapshot,POLICY_SNAPSHOT-6
    VDB2,ORACLE_DB_CONTAINER-10,None:RefreshPolicy,POLICY_REFRESH-3
    VDB2,ORACLE_DB_CONTAINER-10,Default Retention,POLICY_RETENTION-4
    VDB2,ORACLE_DB_CONTAINER-10,None:SnapshotPolicy,POLICY_SNAPSHOT-2
    Here to be able to extract these values, you would need to first extract the group, dsources or vdb(these last 2 with the database api) references and based from that you can print out which policies are assigned to each one of them.
    === GET /resources/json/delphix/database
     
    === GET /resources/json/delphix/group
     
    === GET /resources/json/delphix/policy?effective=true&target=ORACLE_DB_CONTAINER-10
     
    === GET /resources/json/delphix/policy?effective=true&target=GROUP-2
    Hope this helps!

    Thanks and regards.


    ------------------------------
    Carlos Cuellar
    Principal Technical Consultant
    Delphix
    ------------------------------

    Attachment(s)

    txt
    api_get_policies.txt   4 KB 1 version