Package: orchester
orchesterThis is a python set of tools to easily manage membership of users to your preferred cloud services.orchesterGetting startedCLIConnectorsTrelloGithubSlackGoogle DriveAPIContributingGetting startedInstall the package withpip install orchesterIf you want on using the command line interface, you must define some configurations.ConfigurationConfiguration is done through a.orchester.jsonconfiguration file.
You can see a documented template here:.orchester-doc.jsonThe values labeled by[CLI]are only required for the CLI.Note: An empty template is available here:.orchester.jsonThe application will attempt to load from this following order:A specific path defined in theORCHESTER_CONFIG_PATHenvironment variable.In the current working directoryIn the user folder (home)CLIOrchester is distributed with a command line tool. Once installed, you can call it withorchest --helpThe following commands are available:orchest -c CONNECTOR_TYPE check IDENTIFIER: Check if the user is registered to the organizationorchest -c CONNECTOR_TYPE add IDENTIFIERAdd a user to the organizationorchest -c CONNECTOR_TYPE rm IDENTIFIER: Remove a user from the organizationorchest generate CONNECTOR_TYPE: Generates the OAuth credentials for connector.If you want to omit theCONNECTOR_TYPEfor each command, you can set a default connector in your configuration file:"default_connector": "trello"The connector_type must beCONNECTORname of a valid connector. The connectors are described in the next section.ConnectorsTrelloCONNECTOR: trelloIDENTIFIER: Use the trello usernameGet your API token and secret fromhttps://trello.com/app-key(Look for the Api Key and OAuth secret)Add the Api Key and OAuth secret in the.orchester.jsonconfiguration file inapi_keyandapi_secret.Runorchest generate trelloscript to get the credentialsSet the OAuth token and OAuth secret in the configuration file intokenandtoken_secretGithubCONNECTOR: githubIDENTIFIER: Use the github usernameTo use the Github service, you need an Personal Token.Go on Github underSettings > Developer settings > Personal access tokensThen, create a new token and save it in your configuration file attoken.SlackCONNECTOR: slackIDENTIFIER: Use the slack emailTo get started with slack, you first need to get a legacy token and a OAuth token.Legacy tokenSimply go to the following url and issue a new legacy token:https://api.slack.com/custom-integrations/legacy-tokensYou can then add the legacy token inlegacy_token.Note: You'll need to be connected to issue a token.OAuth tokenBefore you can actually generate an OAuth token, you'll need to have a Slack application.How to create an app?: Go tohttps://api.slack.com/appsand click onCreate New AppYou must add the following permission scopes:users:readandusers:read.emailYou will also need to set the following Redirect URI:http://localhost:8888/finish_authYou can then store the client id and client secret inclient_idandclient_secretYou are now all setup to generate the final OAuth token.Runorchest generate slackGo to:http://localhost:8888/begin_authClick on "Add to slack"Click AuthorizeIt should show a OAuth token. Save that in the configuration file attokenWarnings: Free Slack users can't use the api to remove a user.Google DriveIDENTIFIER: Use the google emailCONNECTOR: g_driveBefore you begin, you'll need agoogle_drive_credentials.jsonfile at the root of this folder.You can get it by creating credentials in your Google Console APITutorial: Tutorials coming from:https://developers.google.com/drive/api/v3/quickstart/pythonOnce you have thecredentials.jsonfile, you need to define thecredential_pathandtoken_path.After that, you can runorchest generate g_driveto create thegoogle_drive_token.json.APIThe API is pretty straight forward.  Each connectors inherit fromorchester.connectors.AbstractBaseConnectorIf you want to use all the connectors at one time, you can use theorchester.ConnectorManagerThe manager instantiate all the connectors and let you easily interact with the connector one at a time.Here's an example to use the github connector:fromorchester.connectorsimportGithubConnector,RequestFailedErrorconnector=GithubConnector(access_token="my token...",organization_id='myOrg')try:user_exist=connector.is_registered_to_group('popojargo')print('User is registered to myOrg')exceptRequestFailedError:print('The request failed.')try:connector.remove_from_group('popojargo')print('User removed to myOrg')exceptRequestFailedError:print('The request failed.')try:user_exist=connector.add_to_group('popojargo')print('User added to myOrg')exceptRequestFailedError:print('The request failed.')ContributingFor developer documentation, seeREADME-DEV.md