Skip to content

Commit

Permalink
update docs for --account-name-case and --role-name case
Browse files Browse the repository at this point in the history
based on feedback in #48
  • Loading branch information
oshaughnessy committed Jan 14, 2022
1 parent 4503a2c commit 6af75d7
Showing 1 changed file with 21 additions and 23 deletions.
44 changes: 21 additions & 23 deletions docs/configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,27 @@ A useful piece of syntax for this is lookahead/lookbehind assertions.
* `(?<!My)Role` would turn `"AdminRole"` into `"Admin"` and `"UserRole"` into `"User"` but leave `"MyRole"` as is.
* `RoleFor(?=Admin)` and `RoleFor(?!My)` work similarly for suffixes.

### Change the case of account and role names

You can alter the case of your profile names with `--account-name-case` and
`--role-name-case`. Use these to change the generated profile names after
assembly and trimming.

The values for these options are as follows, and correspond to the Python string methods of the same names:

* [`capitalize`](https://docs.python.org/3/library/stdtypes.html#str.capitalize)
* [`casefold`](https://docs.python.org/3/library/stdtypes.html#str.casefold)
* [`lower`](https://docs.python.org/3/library/stdtypes.html#str.lower)
* [`upper`](https://docs.python.org/3/library/stdtypes.html#str.upper)

For example, to lowercase both the account name and role name, add these options:

--account-name-case lower --role-name-case lower

If you want to see what it does, try a dry run:

aws-sso-util configure populate --region $AWS_REGION --dry-run --account-name-case lower --role-name-case lower

### Profile name process

Finally, if you want total control over the generated profile names, you can provide a shell command with `--profile-name-process` and it will be executed with the following positional arguments:
Expand Down Expand Up @@ -304,26 +325,3 @@ region_str = "" if region_index == 0 else sep + short_region_name
print(account_name + sep + role_name + region_str)
```
If this was stored as `profile_formatter.py`, it could be used as `--profile-name-process "python profile_formatter.py"`

### Change the case of profile names

If you don't want to run (and maintain) a process completely outside of the
`--profile-name-process`, an option between trimming account & role names and
executing a separate process is available with `--account-name-case` and
`--role-name-case`. Use these to change the generated profile names after
assembly and trimming.

Case modifications include:

* `capitalize`
* `casefold`
* `lower`
* `upper`

For example, to lowercase both the account name and role name, add these options:

--account-name-case lower --role-name-case lower

If you want to see what it does, try a dry run:

aws-sso-util configure populate --region $AWS_REGION --dry-run --account-name-case lower --role-name-case lower

0 comments on commit 6af75d7

Please sign in to comment.