How to use paconn - 10 common examples

To help you get started, we’ve selected a few paconn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / __main__.py View on Github external
def main():
    """
    The main method
    """

    try:
        from paconn import __CLI_NAME__
        cli_context = ConnectorsCli(
            cli_name=__CLI_NAME__,
            commands_loader_cls=ConnectorsCliCommandsLoader,
            config_dir=get_config_dir())

        exit_code = cli_context.invoke(sys.argv[1:])
        sys.exit(exit_code)
    except KeyboardInterrupt:
        sys.exit(1)
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / update.py View on Github external
def update(
        environment,
        api_properties,
        api_definition,
        icon,
        connector_id,
        powerapps_url,
        powerapps_version,
        client_secret,
        settings_file):
    """
    Update command.
    """
    # Get settings
    settings = SettingsBuilder.get_settings(
        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)

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

    connector_id = upsert(
        powerapps_rp=powerapps_rp,
        settings=settings,
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / create.py View on Github external
def create(
        environment,
        api_properties,
        api_definition,
        icon,
        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,
        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,
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / validate.py View on Github external
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,
        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)
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / download.py View on Github external
def download(
        environment,
        connector_id,
        destination,
        powerapps_url,
        powerapps_version,
        settings_file,
        overwrite):
    """
    Download command.
    """
    # Get settings
    settings = SettingsBuilder.get_settings(
        environment=environment,
        settings_file=settings_file,
        api_properties=None,
        api_definition=None,
        icon=None,
        connector_id=None,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version)

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

    directory = paconn.operations.download.download(
        powerapps_rp=powerapps_rp,
        settings=settings,
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / params.py View on Github external
SETTINGS,
            options_list=SETTINGS_OPTIONS,
            type=str,
            required=False,
            help=SETTINGS_HELP)
        arg_context.argument(
            'force',
            options_list=['--force', '-f'],
            type=bool,
            required=False,
            nargs='?',
            default=False,
            const=True,
            help='Override a previous login, if exists.')

    with ArgumentsContext(self, _DOWNLOAD) as arg_context:
        arg_context.argument(
            ENVIRONMENT,
            options_list=ENVIRONMENT_OPTIONS,
            type=str,
            required=False,
            help=ENVIRONMENT_HELP)
        arg_context.argument(
            CONNECTOR_ID,
            options_list=CONNECTOR_ID_OPTIONS,
            type=str,
            required=False,
            help=CONNECTOR_ID_HELP)
        arg_context.argument(
            'destination',
            options_list=['--dest', '-d'],
            type=str,
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / help.py View on Github external
from paconn import _COMMAND_GROUP, _LOGIN, _DOWNLOAD, _CREATE, _UPDATE, _VALIDATE

helps[_COMMAND_GROUP] = """
    short-summary: Microsoft Power Platform Connectors CLI
"""

helps[_LOGIN] = """
    type: command
    short-summary: Login to Power Platform.
    examples:
        - name: Login
          text: paconn login
"""


helps[_DOWNLOAD] = """
    type: command
    short-summary: Downloads a given custom connector to the local directory.
    examples:
        - name: Download connector
          text: paconn download
"""

helps[_CREATE] = """
    type: command
    short-summary: Creates a new custom connector from the given directory.
    examples:
        - name: Create connector
          text: paconn create
"""

helps[_UPDATE] = """
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / download.py View on Github external
Download command.
    """
    # Get settings
    settings = SettingsBuilder.get_settings(
        environment=environment,
        settings_file=settings_file,
        api_properties=None,
        api_definition=None,
        icon=None,
        connector_id=None,
        powerapps_url=powerapps_url,
        powerapps_version=powerapps_version)

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

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

    display('The connector is downloaded to {}.'.format(directory))
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / commands / commands.py View on Github external
def load_command_table(self, args):
    """
    Loads the command table
    """
    def operation_group(name):
        return '{cli_name}.commands.{name}#{name}'.format(cli_name=__CLI_NAME__, name=name)

    with CommandGroup(self, _COMMAND_GROUP, operation_group(_LOGIN)) as command_group:
        command_group.command(_LOGIN, _LOGIN)

    with CommandGroup(self, _COMMAND_GROUP, operation_group(_DOWNLOAD)) as command_group:
        command_group.command(_DOWNLOAD, _DOWNLOAD)

    with CommandGroup(self, _COMMAND_GROUP, operation_group(_CREATE)) as command_group:
        command_group.command(_CREATE, _CREATE)

    with CommandGroup(self, _COMMAND_GROUP, operation_group(_UPDATE)) as command_group:
        command_group.command(_UPDATE, _UPDATE)

    with CommandGroup(self, _COMMAND_GROUP, operation_group(_VALIDATE)) as command_group:
        command_group.command(_VALIDATE, _VALIDATE)
github microsoft / PowerPlatformConnectors / tools / paconn-cli / paconn / settings / util.py View on Github external
# use default names
    if command_context is _DOWNLOAD:
        settings.api_properties = settings.api_properties or 'apiProperties.json'
        settings.api_definition = settings.api_definition or 'apiDefinition.swagger.json'
        settings.icon = settings.icon or 'icon.png'

    # Prompt for environment for any
    # operation other than `validate`
    if command_context is not _VALIDATE:
        prompt_for_environment(
            settings=settings,
            flow_rp=flow_rp)

    # Prompt for connector id for
    # operation `update` and `download`
    if command_context is _UPDATE or command_context is _DOWNLOAD:
        prompt_for_connector_id(
            settings=settings,
            powerapps_rp=powerapps_rp)

    return powerapps_rp, flow_rp