forked from microsoft/PowerPlatformConnectors
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
2,276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
# Microsoft Power Platform Connectors CLI | ||
|
||
**NOTE** | ||
|
||
**These release notes describe functionality that may not have been released yet.** To see when this functionality is planned to release, please review [What's new and planned for Common Data Model and Data Integration](https://docs.microsoft.com/en-us/business-applications-release-notes/April19/cdm-data-integration/planned-features). Delivery timelines and projected functionality may change or may not ship (see [Microsoft policy](https://go.microsoft.com/fwlink/p/?linkid=2007332)). | ||
|
||
|
||
The `paconn` command line tool is designed to aid Microsoft Power Platform custom connectors development. | ||
|
||
## Installing | ||
|
||
1. Install Python 3.5+ from https://www.python.org/downloads. Click the 'Download' link on any version of Python greater than Python 3.5. For Linux and Mac OS X please follow the appropriate link on the page. You can also install using an OS specific package manager of your choice. | ||
|
||
2. Run the installer to begin installation and be sure to check the box 'Add Python X.X to PATH'. | ||
|
||
3. Make sure the installation path is in the PATH variable by running: | ||
|
||
`python --version` | ||
|
||
4. After python is installed, install `paconn` by running: | ||
|
||
`pip install paconn` | ||
|
||
## Command Line Operations | ||
|
||
### Login | ||
|
||
Login to Power Platform by running: | ||
|
||
`paconn login` | ||
|
||
This will ask you to login using device code login process. Please follow the prompt for the login. | ||
|
||
### Custom Connector Directory and Files | ||
|
||
A custom connector consists of three files. An icon for the connector, an Open API swagger definition, and an API properties file. The properties file that contains connection parameters, brand color and few other information that aren't part of the Open API definition. The files are ideally located into a directory with the connector ID as the name of the directory. | ||
|
||
Sometimes, the custom connector directory may include a settings.json file. Although this file is not part of the connector definition, it can be used as an arguments store for the CLI. | ||
|
||
### Download Custom Connector Files | ||
|
||
The connector files are always downloaded into a sub-directory with the connector ID as the directory name. When a destination directory is specified, the sub-directory will be created in the specified one. Otherwise, it will be created in the current directory. In addition to the three connector files, the download operation will also write a fourth file called settings.json containing the parameters used to download the files. | ||
|
||
Download the custom connector files by running: | ||
|
||
`paconn download` | ||
|
||
or | ||
|
||
`paconn download -e [Power Platform Environment GUID] -c [Connector ID]` | ||
|
||
or | ||
|
||
`paconn download -s [Path to settings.json]` | ||
|
||
When environment or connector ID is not specified the command will prompt for the missing argument(s). The command will print the download location for the connector on successful completion. | ||
|
||
All the arguments can be also specified using a settings.json file. More information on the settings.json is provided later in this documentation. | ||
|
||
``` | ||
Arguments | ||
--cid -c : The custom connector ID. | ||
--dest -d : Destination directory. | ||
--env -e : Power Platform environment GUID. | ||
--pau -u : Power Platform URL. | ||
--pav -v : Power Platform API version. | ||
--settings -s : A settings file containing required parameters. | ||
When a settings file is specified some command | ||
line parameters are ignored. | ||
``` | ||
### Create a New Custom Connector | ||
|
||
A new custom connector can be created from the three files introduced earlier. Create a connector by running: | ||
|
||
`paconn create --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png]` | ||
|
||
or | ||
|
||
`paconn create -e [Power Platform Environment GUID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]` | ||
|
||
or | ||
|
||
`paconn create -s [Path to settings.json] --secret [The OAuth2 client secret for the connector]` | ||
|
||
When environment is not specified the command will prompt for it. However, the API definition, API properties, and icon file must be provided as part of the command line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the connector ID for the newly created custom connector on successful completion. If you are using a settings.json for the create command, please make sure to update it with the new connector ID before you update the newly created connector. | ||
|
||
All the arguments can be also specified using a settings.json file. More information on the settings.json is provided later in this documentation. | ||
|
||
|
||
``` | ||
Arguments | ||
--api-def : Location for the Open API definition JSON document. | ||
--api-prop : Location for the API properties JSON document. | ||
--env -e : Power Platform environment GUID. | ||
--icon : Location for the icon file. | ||
--pau -u : Power Platform URL. | ||
--pav -v : Power Platform API version. | ||
--secret -r : The OAuth2 client secret for the connector. | ||
--settings -s : A settings file containing required parameters. | ||
When a settings file is specified some command | ||
line parameters are ignored. | ||
``` | ||
### Update an Existing Custom Connector | ||
|
||
Like the `create` operation, an existing custom connector can be updated from the three files introduced earlier. Update a connector by running: | ||
|
||
`paconn update --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png]` | ||
|
||
or | ||
|
||
`paconn update -e [Power Platform Environment GUID] -c [Connector ID] --api-prop [Path to apiProperties.json] --api-def [Path to apiDefinition.swagger.json] --icon [Path to icon.png] --secret [The OAuth2 client secret for the connector]` | ||
|
||
or | ||
|
||
`paconn create -s [Path to settings.json] --secret [The OAuth2 client secret for the connector]` | ||
|
||
When environment or connector ID is not specified the command will prompt for the missing argument(s). However, the API definition, API properties, and icon file must be provided as part of the command line argument or a settings file. The OAuth2 secret must be provided for a connector using OAuth2. The command will print the updated connector ID on successful completion. If you are using a settings.json for the update command, please make sure correct environment and connector ID are specified. | ||
|
||
All the arguments can be also specified using a settings.json file. More information on the settings.json is provided later in this documentation. | ||
|
||
``` | ||
Arguments | ||
--api-def : Location for the Open API definition JSON document. | ||
--api-prop : Location for the API properties JSON document. | ||
--cid -c : The custom connector ID. | ||
--env -e : Power Platform environment GUID. | ||
--icon : Location for the icon file. | ||
--pau -u : Power Platform URL. | ||
--pav -v : Power Platform API version. | ||
--secret -r : The OAuth2 client secret for the connector. | ||
--settings -s : A settings file containing required parameters. | ||
When a settings file is specified some command | ||
line parameters are ignored. | ||
``` | ||
### Settings File | ||
|
||
Instead of providing the arguments in the command line, a `settings.json` file can be used to specify them. A typical `settings.json` file looks like the following: | ||
```json | ||
{ | ||
"connectorId": "CONNECTOR-ID", | ||
"environment": "ENVIRONMENT-GUID", | ||
"apiProperties": "apiProperties.json", | ||
"apiDefinition": "apiDefinition.swagger.json", | ||
"icon": "icon.png", | ||
"powerAppsApiVersion": "2016-11-01", | ||
"powerAppsUrl": "https://preview.api.powerapps.com" | ||
} | ||
``` | ||
### Best Practice | ||
|
||
Download all the custom connectors and use git or any other source code management system to save the files. In case of an incorrect update, redeploy the connector by rerunning the update command with the correct set of files from the source code management system. | ||
|
||
Please test the custom connector and the settings file in a test environment before deploying in the production environment. Always double check that the environment and connector id are correct. | ||
|
||
## Limitations | ||
|
||
The project is limited to creation, update, and download of custom connector in flow and powerapps environment. When an environment is not specified only the flow envrionments are listed to choose from. For non-custom connector the swagger file is not returned. | ||
|
||
|
||
## Reporting issues and feedback | ||
|
||
If you encounter any bugs with the tool please file an issue in the [Issues](https://github.com/Microsoft/PowerPlatformConnectors/issues) section of our GitHub repo. | ||
|
||
If you believe you have found a security vulnerability that meets [Microsoft's definition of a security vulnerability](https://docs.microsoft.com/en-us/previous-versions/tn-archive/cc751383%28v=technet.10%29), please submit the [report to MSRC](https://msrc.microsoft.com/create-report). More information can be found at [MSRC frequently asked questions on reporting](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue). | ||
|
||
|
||
## Contributing | ||
|
||
This project welcomes contributions and suggestions. Most contributions require you to agree to a | ||
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us | ||
the rights to use your contribution. For details, visit https://cla.microsoft.com. | ||
|
||
When you submit a pull request, a CLA-bot will automatically determine whether you need to provide | ||
a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions | ||
provided by the bot. You will only need to do this once across all repos using our CLA. | ||
|
||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). | ||
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or | ||
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. | ||
|
||
## Legal Notices | ||
|
||
Microsoft and any contributors grant you a license to the Microsoft documentation and other content | ||
in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode), | ||
see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the | ||
[LICENSE-CODE](LICENSE-CODE) file. | ||
|
||
Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation | ||
may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. | ||
The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. | ||
Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653. | ||
|
||
Privacy information can be found at https://privacy.microsoft.com/en-us/ | ||
|
||
Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, | ||
or trademarks, whether by implication, estoppel or otherwise. | ||
|
||
## License | ||
|
||
``` | ||
Microsoft Power Platform Connectors CLI (paconn) | ||
Copyright (c) Microsoft Corporation | ||
All rights reserved. | ||
MIT License | ||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{6285073d-e427-48c1-9783-abddf33fa22c}</ProjectGuid> | ||
<ProjectHome /> | ||
<StartupFile>paconn\__main__.py</StartupFile> | ||
<SearchPath /> | ||
<WorkingDirectory> | ||
</WorkingDirectory> | ||
<OutputPath>.</OutputPath> | ||
<ProjectTypeGuids>{888888a0-9f3d-457c-b088-3a5042f75d52}</ProjectTypeGuids> | ||
<LaunchProvider>Standard Python launcher</LaunchProvider> | ||
<InterpreterId>Global|PythonCore|3.7</InterpreterId> | ||
<CommandLineArguments>login</CommandLineArguments> | ||
<EnableNativeCodeDebugging>False</EnableNativeCodeDebugging> | ||
<Name>paconn</Name> | ||
<IsWindowsApplication>False</IsWindowsApplication> | ||
<PublishUrl> | ||
</PublishUrl> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="paconn\apimanager\__init__.py" /> | ||
<Compile Include="paconn\authentication\auth.py" /> | ||
<Compile Include="paconn\authentication\profile.py" /> | ||
<Compile Include="paconn\authentication\tokenmanager.py" /> | ||
<Compile Include="paconn\authentication\__init__.py" /> | ||
<Compile Include="paconn\commands.py" /> | ||
<Compile Include="paconn\operations\json_keys.py" /> | ||
<Compile Include="paconn\common\settings_serializer.py" /> | ||
<Compile Include="paconn\common\util.py" /> | ||
<Compile Include="paconn\common\__init__.py" /> | ||
<Compile Include="paconn\completer.py" /> | ||
<Compile Include="paconn\config\__init__.py" /> | ||
<Compile Include="paconn\help.py" /> | ||
<Compile Include="paconn\apimanager\apimanager.py" /> | ||
<Compile Include="paconn\operations\download.py" /> | ||
<Compile Include="paconn\operations\login.py" /> | ||
<Compile Include="paconn\operations\create_update.py" /> | ||
<Compile Include="paconn\common\settings.py" /> | ||
<Compile Include="paconn\apimanager\flowmanager.py" /> | ||
<Compile Include="paconn\apimanager\iconuploader.py" /> | ||
<Compile Include="paconn\apimanager\powerappsrp.py" /> | ||
<Compile Include="paconn\common\prompts.py" /> | ||
<Compile Include="paconn\operations\update.py" /> | ||
<Compile Include="paconn\operations\create.py" /> | ||
<Compile Include="paconn\operations\save.py" /> | ||
<Compile Include="paconn\common\settings_util.py" /> | ||
<Compile Include="paconn\operations\__init__.py" /> | ||
<Compile Include="paconn\params.py" /> | ||
<Compile Include="paconn\__init__.py" /> | ||
<Compile Include="paconn\__main__.py" /> | ||
<Compile Include="setup.py" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Folder Include="paconn\" /> | ||
<Folder Include="paconn\config\" /> | ||
<Folder Include="paconn\apimanager\" /> | ||
<Folder Include="paconn\operations\" /> | ||
<Folder Include="paconn\authentication\" /> | ||
<Folder Include="paconn\common\" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="paconn\config\cli.flake8" /> | ||
<Content Include="paconn\config\cli_pylintrc" /> | ||
<Content Include="paconn\paconn.completion.sh" /> | ||
<Content Include="README.md" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<InterpreterReference Include="Global|PythonCore|3.7" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.28010.2016 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "paconn", "paconn.pyproj", "{6285073D-E427-48C1-9783-ABDDF33FA22C}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6285073D-E427-48C1-9783-ABDDF33FA22C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6285073D-E427-48C1-9783-ABDDF33FA22C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {B538A664-C4F4-40F0-9BE6-321562C2AA09} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# ----------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for | ||
# license information. | ||
# ----------------------------------------------------------------------------- | ||
|
||
""" | ||
Initializer | ||
""" | ||
|
||
__VERSION__ = '0.0.8' | ||
__CLI_NAME__ = 'paconn' | ||
|
||
# Commands | ||
_COMMAND_GROUP = '' | ||
_LOGIN = 'login' | ||
_DOWNLOAD = 'download' | ||
_CREATE = 'create' | ||
_UPDATE = 'update' |
Oops, something went wrong.