Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new account loader plugin with http auth #32

Merged
merged 4 commits into from
Jul 3, 2024

Commits on Jun 12, 2024

  1. feat: new account loader plugin w/ HTTP auth support

    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
    pkazmier committed Jun 12, 2024
    Configuration menu
    Copy the full SHA
    db0d4e6 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2024

  1. fix: delay prompting user in URLLoader plug-in

    At the time the URLLoader plug-in is instantiated, we don't know if
    the URLAccountLoader will even need to make an HTTP call as it may
    have cached data. So, if the user has not specified a password via
    CLI args, env vars, or config file, we don't want to prematurely
    prompt them unless URLAccountLoader really needs to make an HTTP
    request.
    pkazmier committed Jun 13, 2024
    Configuration menu
    Copy the full SHA
    d8a09e7 View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2024

  1. style: make black happy

    pkazmier committed Jul 3, 2024
    Configuration menu
    Copy the full SHA
    9971780 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3438955 View commit details
    Browse the repository at this point in the history