示例#1
0
def download(
        environment,
        connector_id,
        destination,
        powerapps_url,
        powerapps_version,
        settings_file,
        overwrite):
    """
    Download command.
    """
    settings, powerapps_rp, _ = load_settings_and_powerapps_rp(
        environment=environment,
        settings_file=settings_file,
        connector_id=connector_id,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version,
        command_context=_DOWNLOAD,
        api_properties=None,
        api_definition=None,
        icon=None)

    directory = paconn.operations.download.download(
        powerapps_rp=powerapps_rp,
        settings=settings,
        destination=destination,
        overwrite=overwrite)

    display('The connector is downloaded to {}.'.format(directory))
示例#2
0
def validate(api_definition, powerapps_url, powerapps_version, settings_file):
    """
    Validate command.
    """
    # Get settings
    settings = SettingsBuilder.get_settings(
        environment=None,
        settings_file=settings_file,
        api_properties=None,
        api_definition=api_definition,
        icon=None,
        script=None,
        connector_id=None,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version)

    powerapps_rp, _ = load_powerapps_and_flow_rp(settings=settings,
                                                 command_context=_VALIDATE)

    result = paconn.operations.validate.validate(powerapps_rp=powerapps_rp,
                                                 settings=settings)

    if result:
        display(result)
    else:
        display('{} validated successfully.'.format(settings.api_definition))
示例#3
0
def login(client_id, tenant, authority_url, resource, settings_file, force):
    """
    Login command.
    """
    # Get settings
    settings = SettingsBuilder.get_authentication_settings(
        settings_file=settings_file,
        client_id=client_id,
        tenant=tenant,
        authority_url=authority_url,
        resource=resource)

    get_authentication(
        settings=settings,
        force_authenticate=force)
    display('Login successful.')
示例#4
0
def update(environment, api_properties, api_definition, icon, connector_id,
           powerapps_url, powerapps_version, client_secret, settings_file):
    """
    Update command.
    """
    settings, powerapps_rp, _ = load_settings_and_powerapps_rp(
        environment=environment,
        settings_file=settings_file,
        api_properties=api_properties,
        api_definition=api_definition,
        icon=icon,
        connector_id=connector_id,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version,
        command_context=_UPDATE)

    connector_id = create_update(powerapps_rp=powerapps_rp,
                                 settings=settings,
                                 client_secret=client_secret,
                                 is_update=True)

    display('{} updated successfully.'.format(connector_id))
示例#5
0
def create(
        environment,
        api_properties,
        api_definition,
        icon,
        script,
        powerapps_url,
        powerapps_version,
        client_secret,
        settings_file,
        overwrite_settings):
    """
    Create command.
    """
    # Get settings
    settings = SettingsBuilder.get_settings(
        environment=environment,
        settings_file=settings_file,
        api_properties=api_properties,
        api_definition=api_definition,
        icon=icon,
        script=script,
        connector_id=None,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version)

    powerapps_rp, _ = load_powerapps_and_flow_rp(
        settings=settings,
        command_context=_CREATE)

    connector_id = upsert(
        powerapps_rp=powerapps_rp,
        settings=settings,
        client_secret=client_secret,
        is_update=False,
        overwrite_settings=overwrite_settings)

    display('{} created successfully.'.format(connector_id))
示例#6
0
def login():
    """
    Login command.
    """
    get_authentication()
    display('Login successful.')
示例#7
0
def logout():
    """
    Logout command.
    """
    remove_authentication()
    display('Logout successful.')