-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new account loader plugin with http auth (#32)
The existing account loaders in the awsrun.acctload and their respective CLI-counterparts in awsrun.plugins.accts do not support HTTP auth: - awsrun.acctload.JSONAccountLoader (awsrun.plugins.accts.JSON) - awsrun.acctload.YAMLAccountLoader (awsrun.plugins.accts.YAML) - awsrun.acctload.CSVAccountLoader (awsrun.plugins.accts.CSV) This change introduces a new account loader, which will eventually replace those mentioned above: - awsrun.acctload.URLAccountLoader (awsrun.plugins.accts.URLLoader) The new loader can parse JSON, YAML, and CSV data depending on the parser provided (library usage) or parser specified via the `parser` configuration key (CLI usage). In addition, the new loader supports HTTP basic, digest, ntlm, and oauth2 authentication methods depending on the auth method provided (library usage) or auth method specified via the `auth` configuration key (CLI usage). Sample usage via the library: # Library usage from awsrun.acctload import * # JSON example with basic HTTP auth loader = URLAccountLoader( "https://example.com/data.json", parser=JSONFormatter(), auth=HTTPBasic(user, pw), ) # CSV example with OAuth2 HTTP auth loader = URLAccountLoader( "https://example.com/data.csv", parser=CSVFormatter(delimiter=","), auth=HTTPOAuth2("https://token.example.com", user, pw), ) Sample usage via the CLI configuration file: Accounts: plugin: awsrun.plugins.accts.URLLoader options: url: https://example.com/data.json parser: json auth: oauth2 auth_options: token_url: https://token.example.com
- Loading branch information
Showing
4 changed files
with
574 additions
and
3 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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
print(datetime, value) | ||
""" | ||
|
||
import logging | ||
import math | ||
from collections import defaultdict | ||
|
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
Oops, something went wrong.