Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
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)
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)
if result:
display(result)
else:
display('{} validated successfully.'.format(settings.api_definition))
type: command
short-summary: Creates a new custom connector from the given directory.
examples:
- name: Create connector
text: paconn create
"""
helps[_UPDATE] = """
type: command
short-summary: Update a given custom connector from the local directory.
examples:
- name: Update connector.
text: paconn update
"""
helps[_VALIDATE] = """
type: command
# Get flow rp
flow_rp = FlowRPBuilder.get_from_settings(
credentials=credentials,
settings=settings)
# If the file names are missing for the download command
# 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
required=False,
help=POWERAPPS_VERSION_HELP)
arg_context.argument(
CLIENT_SECRET,
options_list=CLIENT_SECRET_OPTIONS,
type=str,
required=False,
help=CLIENT_SECRET_HELP)
arg_context.argument(
SETTINGS,
options_list=SETTINGS_OPTIONS,
type=str,
required=False,
help=SETTINGS_HELP)
with ArgumentsContext(self, _VALIDATE) as arg_context:
arg_context.argument(
API_DEFINITION,
options_list=API_DEFINITION_OPTIONS,
type=str,
required=False,
help=API_DEFINITION_HELP)
arg_context.argument(
POWERAPPS_URL,
options_list=POWERAPPS_URL_OPTIONS,
type=str,
required=False,
help=POWERAPPS_URL_HELP)
arg_context.argument(
POWERAPPS_VERSION,
options_list=POWERAPPS_VERSION_OPTIONS,
type=str,