APIMaskingSidekickPythonOpen-Source Solutions

 View Only
  • 1.  delphixpy to provision from nondefault namespace

    Posted 05-07-2020 12:34:00 PM
    Hi
    We are trying to provision a  VDB from a replicated dSource. 
    The replicated DSource is under a non-default namespace.
    In the parameter for provisioning, I was playing the below parameters:
    vdb_data.source = OracleVirtualSource() 
    vdb_data.source.name = '<dsource>@<namespace>'
    vdb_data.source.config = '<dsource>@<namespace>'
    vdb_data.source.container = '<dsource>@<namespace>'

    Getting erros as below:
    delphixpy.v1_8_1.exceptions.RequestError: APIError(action='Check your input parameters and try again.', command_output=None, details={'timeflowPointParameters': {'container': {'details': 'The field has to be set.', 'action': None, 'id': 'exception.validation.field.unset', 'commandOutput': None, 'diagnoses': None}}, 'source': {'container': {'details': 'The provided string "<dsource>@<namespace>" is not a valid object reference.', 'action': None, 'id': 'exception.validation.format.object_reference.invalid', 'commandOutput': None, 'diagnoses': None}}}, diagnoses=[], id='exception.validation.bad.input', type='APIError')

    Let me know if anyone has does any automation using delphixpy to provision from a replicated dsource and they could share their knowledge.
    Thank you,

    ------------------------------
    Vijay Bhat
    Community Member
    Fidelity Investments
    ------------------------------


  • 2.  RE: delphixpy to provision from nondefault namespace
    Best Answer

    Posted 05-08-2020 03:48:00 PM

    Hello Vijay,

    The tilmeflowpointparameters require the reference and not the actual name. That's the confusing part about the APIs, but pretty much everything you need to do in the API requires it. You can do a lookup from the database.get_all() method. This method will return all database objects on the engine, but you will only need the reference. Here's an example method we use in delphixpy-examples: https://github.com/delphix/delphixpy-examples/tree/master

    Please let me know if you need anything else.

    def find_obj_by_name(engine, f_class, obj_name, active_branch=False):
    """
    Function to find objects by name and object class, and return object's
    reference as a string
    engine: A Delphix engine session object
    f_class: The objects class. I.E. database or timeflow.
    obj_name: The name of the object
    active_branch: Default = False. If true, return list containing
    the object's reference and active_branch. Otherwise, return
    the reference.
    """

    return_list = []

    try:
    all_objs = f_class.get_all(engine)
    except AttributeError as e:
    raise DlpxException('Could not find reference for object class'
    '{}.\n'.format(e))
    for obj in all_objs:
    if obj.name == obj_name:

    if active_branch is False:
    return(obj)

    #This code is for JS objects only.
    elif active_branch is True:
    return_list.append(obj.reference)
    return_list.append(obj.active_branch)
    return(return_list)

    return obj

    #If the object isn't found, raise an exception.
    raise DlpxException('{} was not found on engine {}.\n'.format(
    obj_name, engine.address))



    ------------------------------
    Corey Brune
    Technical Manager
    Delphix Community Members
    ------------------------------



  • 3.  RE: delphixpy to provision from nondefault namespace

    Posted 05-13-2020 03:33:00 PM
    Hi Brune,
    Thanks for your quick reply.  I think I have what I need  to proceed.

    Thank you
    Vijay Bhat

    ------------------------------
    Vijay Bhat
    Community Member
    Fidelity Investments
    ------------------------------