aws-annoying 0.8.2__py3-none-any.whl → 0.8.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
aws_annoying/cli/app.py CHANGED
@@ -21,7 +21,7 @@ app = typer.Typer(
21
21
  )
22
22
 
23
23
 
24
- def show_version(value: Optional[bool]) -> None:
24
+ def show_version(value: Optional[bool]) -> None: # noqa: FBT001
25
25
  """Show the version of the application."""
26
26
  if not value:
27
27
  return
@@ -38,7 +38,21 @@ def task_definition_lifecycle(
38
38
  help="Delete the task definition after deregistering it.",
39
39
  ),
40
40
  ) -> None:
41
- """Execute ECS task definition lifecycle."""
41
+ r"""Expire and delete ECS task definitions.
42
+
43
+ Expire and delete ECS task definitions for a given family, keeping revisions adhering to
44
+ the given constraint. You can use this command to clean up old task definitions that are no
45
+ longer needed.
46
+
47
+ Example usage:
48
+
49
+ ```shell
50
+ aws-annoying ecs task-definition-lifecycle \
51
+ --family <task-definition-family> \
52
+ --keep-latest 5 \
53
+ --delete
54
+ ```
55
+ """
42
56
  dry_run = ctx.meta["dry_run"]
43
57
  ecs = boto3.client("ecs")
44
58
 
@@ -69,7 +69,42 @@ def wait_for_deployment( # noqa: PLR0913
69
69
  help="Whether to wait for the service to be stable after the deployment.",
70
70
  ),
71
71
  ) -> None:
72
- """Wait for ECS deployment to complete."""
72
+ r"""Wait for ECS deployment for a specific service to start, complete and stabilize.
73
+
74
+ It's designed to be used after triggering a deployment (e.g., updating service, deploying new task definition),
75
+ in conjunction with CI/CD pipelines or deployment scripts.
76
+
77
+ Below is an example of using this command in GitHub Actions workflow:
78
+
79
+ ```yaml
80
+ ...
81
+
82
+ - name: Deploy to ECS service
83
+ id: deploy-ecs
84
+ uses: aws-actions/amazon-ecs-deploy-task-definition@v2
85
+ with:
86
+ task-definition: ${{ steps.render-task-definition.outputs.task-definition }}
87
+ cluster: ${{ vars.AWS_ECS_CLUSTER }}
88
+ service: ${{ vars.AWS_ECS_SERVICE }}
89
+ wait-for-service-stability: false
90
+
91
+ - name: Wait for deployment complete
92
+ run: |
93
+ pipx run aws-annoying \
94
+ --verbose \
95
+ ecs wait-for-deployment \
96
+ --cluster '${{ vars.AWS_ECS_CLUSTER }}' \
97
+ --service '${{ vars.AWS_ECS_SERVICE }}' \
98
+ --wait-for-start \
99
+ --wait-for-stability \
100
+ --timeout-seconds 600 \
101
+ --expected-task-definition '${{ steps.deploy-ecs.outputs.task-definition-arn }}'
102
+
103
+ ...
104
+ ```
105
+
106
+ `--wait-for-start` is necessary because there could be no deployment right after the deploy action.
107
+ """
73
108
  start = datetime.now(tz=timezone.utc)
74
109
  try:
75
110
  with Timeout(timeout_seconds):
@@ -54,7 +54,27 @@ def configure( # noqa: PLR0913
54
54
  help="Persist the MFA configuration.",
55
55
  ),
56
56
  ) -> None:
57
- """Configure AWS profile for MFA."""
57
+ r"""Configure AWS profile for MFA.
58
+
59
+ This command retrieves temporary MFA credentials using the provided source profile (`--mfa-source-profile`)
60
+ and MFA token code then updates the specified AWS profile with these credentials.
61
+
62
+ You can configure it interactively, by omitting the options, or provide them directly via command-line options.
63
+
64
+ ```shell
65
+ aws-annoying mfa configure
66
+ ```
67
+
68
+ If you want to use MFA as primary authentication method for an AWS profile, you can configure
69
+ it to save the credentials to the default profile.
70
+
71
+ ```shell
72
+ aws configure --profile mfa
73
+ aws-annoying mfa configure \
74
+ --mfa-profile default \
75
+ --mfa-source-profile mfa
76
+ ```
77
+ """
58
78
  dry_run = ctx.meta["dry_run"]
59
79
 
60
80
  # Expand user home directory
@@ -59,7 +59,14 @@ def port_forward( # noqa: PLR0913
59
59
  help="The path to the log file to store the output of the session manager plugin.",
60
60
  ),
61
61
  ) -> None:
62
- """Start a port forwarding session using AWS Session Manager."""
62
+ """Start a port forwarding session using AWS Session Manager.
63
+
64
+ This command allows starting a port forwarding session through an EC2 instance identified by its name or ID.
65
+ If there are more than one instance with the same name, the first one found will be used.
66
+
67
+ Also, it manages a PID file to keep track of the session manager plugin process running in background,
68
+ allowing to terminate any existing process before starting a new one.
69
+ """
63
70
  dry_run = ctx.meta["dry_run"]
64
71
  session_manager = SessionManager()
65
72
 
@@ -30,7 +30,11 @@ def start(
30
30
  help="The reason for starting the session.",
31
31
  ),
32
32
  ) -> None:
33
- """Start new session."""
33
+ """Start new session to your instance.
34
+
35
+ You can use your EC2 instance identified by its name or ID. If there are
36
+ more than one instance with the same name, the first one found will be used.
37
+ """
34
38
  dry_run = ctx.meta["dry_run"]
35
39
  session_manager = SessionManager()
36
40
 
@@ -265,7 +265,7 @@ class SessionManager:
265
265
  Returns:
266
266
  The command to start the session.
267
267
  """
268
- is_installed, binary_path, version = self.verify_installation()
268
+ is_installed, binary_path, _version = self.verify_installation()
269
269
  if not is_installed:
270
270
  msg = "Session Manager plugin is not installed."
271
271
  raise PluginNotInstalledError(msg)
@@ -1,4 +1,3 @@
1
- # flake8: noqa: B008
2
1
  from __future__ import annotations
3
2
 
4
3
  import json
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aws-annoying
3
- Version: 0.8.2
3
+ Version: 0.8.3
4
4
  Summary: Utils to handle some annoying AWS tasks.
5
- Project-URL: Homepage, https://github.com/lasuillard/aws-annoying
6
- Project-URL: Repository, https://github.com/lasuillard/aws-annoying.git
7
- Project-URL: Issues, https://github.com/lasuillard/aws-annoying/issues
5
+ Project-URL: Homepage, https://github.com/lasuillard-s/aws-annoying
6
+ Project-URL: Repository, https://github.com/lasuillard-s/aws-annoying.git
7
+ Project-URL: Issues, https://github.com/lasuillard-s/aws-annoying/issues
8
8
  Author-email: Yuchan Lee <lasuillard@gmail.com>
9
9
  License-Expression: MIT
10
10
  License-File: LICENSE
@@ -33,6 +33,7 @@ Major directories of the project:
33
33
  - **aws_annoying** Python package containing CLI and utility functions.
34
34
  - **console** Utilities to help working with AWS Console.
35
35
  - **examples** Examples of how to use the package.
36
+ - **devcontainer-features** Devcontainer features to help set up development environment.
36
37
 
37
38
  ## 🚀 Installation
38
39
 
@@ -51,39 +52,7 @@ As the package also provides some utility functions, you can install `aws-annoyi
51
52
 
52
53
  ## 💡 Usage
53
54
 
54
- Below are brief explanation of available commands. For more detailed information about commands, please refer to the CLI help.
55
-
56
- ### `ecs task-definition-lifecycle`
57
-
58
- Expire and delete ECS task definitions based on criteria.
59
-
60
- ### `ecs wait-for-deployment`
61
-
62
- Wait for ECS deployment to start, complete or fail, and stabilize.
63
-
64
- ### `load-variables`
65
-
66
- Wrapper command to run command with variables from various AWS resources (SSM Parameter Store, Secrets Manager, etc.) injected as environment variables.
67
-
68
- ### `mfa configure`
69
-
70
- Configure AWS profile or refresh session for MFA.
71
-
72
- ### `session-manager install`
73
-
74
- Install AWS Session Manager plugin.
75
-
76
- ### `session-manager port-forward`
77
-
78
- Start a port forwarding session using AWS Session Manager.
79
-
80
- ### `session-manager start`
81
-
82
- Start new session via Session Manager.
83
-
84
- ### `session-manager stop`
85
-
86
- Stop running port forwarding session for PID file.
55
+ Refer to the CLI help or documentation for detailed information on how to use each command.
87
56
 
88
57
  ## 💖 Contributing
89
58
 
@@ -1,24 +1,24 @@
1
1
  aws_annoying/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  aws_annoying/mfa_config.py,sha256=z0GpRhLHEWaaXbECV4Ei4oNM1WCFoEZAxCIPbpY4Ymc,2200
3
- aws_annoying/variable_loader.py,sha256=N9qPPHG6mzSIIHrWJnJ_FV5kKZxssOaTHoAQEwiDE3s,4569
3
+ aws_annoying/variable_loader.py,sha256=8QhQVc8SZOIdI7_uxp7NSyN2Pu8NT3TQl0HJl6pfTPk,4548
4
4
  aws_annoying/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- aws_annoying/cli/app.py,sha256=W0FPz0N7okjENwaGpdoWRhcei5Xs-uxSMRaYldaza3M,3295
5
+ aws_annoying/cli/app.py,sha256=uriIEx7tei1UVOcasCKqRM1jFdggvV1N4Ys_wPCKMVk,3311
6
6
  aws_annoying/cli/load_variables.py,sha256=n5CIci_uAoGaOZ4EKIKEEfcyMq81Hjy9AFOXq1-Hbh0,4896
7
7
  aws_annoying/cli/logging_handler.py,sha256=z2fBHChHiyzQeKtKjykX-JvuWm57gARB3VDmpQSdu6U,1409
8
8
  aws_annoying/cli/main.py,sha256=bU4Gxic5_3qrrd8l9eN709-D4o_OHgrdH91FS9Xs8zI,477
9
9
  aws_annoying/cli/ecs/__init__.py,sha256=IxfaMXcGU6WTHE_RXj-aitXtSg25j5m3HGTG9O02GjI,125
10
10
  aws_annoying/cli/ecs/_app.py,sha256=izD0VL55i7oG-2CtWCV21bSoAeE-DZbxyJ5pi6VXhjU,200
11
- aws_annoying/cli/ecs/task_definition_lifecycle.py,sha256=COGYy5o9N6J7tv6aA7qhT-4WsAoxbyPC1UMPtKKrPpg,2704
12
- aws_annoying/cli/ecs/wait_for_deployment.py,sha256=yBl-KMOya8ZSgpZLcEB0UqtsZfK5ezKPJWNaOdMRRcY,5234
11
+ aws_annoying/cli/ecs/task_definition_lifecycle.py,sha256=dZc20CmzVcKjRJNev0AgzN3dPLUts1UjFNF7lW3Ax40,3098
12
+ aws_annoying/cli/ecs/wait_for_deployment.py,sha256=o62qsjeFM5ZWaZyT8vav-a5r8-sS0NQlJfJnP9q7kpY,6518
13
13
  aws_annoying/cli/mfa/__init__.py,sha256=rbEGhw5lOQZV_XAc3nSbo56JVhsSPpeOgEtiAy9qzEA,50
14
14
  aws_annoying/cli/mfa/_app.py,sha256=Ub7gxb6kGF3Ve1ucQSOjHmc4jAu8mxgegcXsIbOzLLQ,189
15
- aws_annoying/cli/mfa/configure.py,sha256=Lfmc4VKkUGngbrbxLRrgcEv-vyPM_-1ne_G4U-Vh7Mg,4092
15
+ aws_annoying/cli/mfa/configure.py,sha256=p91dkhlJzcYkjAKJnhZ7MlB9LatfLfJOe_d2qJ3fJbU,4773
16
16
  aws_annoying/cli/session_manager/__init__.py,sha256=FkT6jT6OXduOURN61d-U6hgd-XluQbvuVtKXXiXgSEk,105
17
17
  aws_annoying/cli/session_manager/_app.py,sha256=OVOHW0iyKzunvaqLhjoseHw1-WxJ1gGb7QmiyAEezyY,221
18
18
  aws_annoying/cli/session_manager/_common.py,sha256=Uj-MF7z8Qntd24Z03xxE-jSKcgrsd8xl41E6db4qCtY,711
19
19
  aws_annoying/cli/session_manager/install.py,sha256=QA88qIu7aYTlBN0tqU-lEN5nMGpshXF3jddBBCZixV8,1550
20
- aws_annoying/cli/session_manager/port_forward.py,sha256=7tSaGlcoSpJ9G2NYHvcC-PpmVqz-I4B4T8e4Xe45BE8,4495
21
- aws_annoying/cli/session_manager/start.py,sha256=p4vGUIT4IivJp_Sr7yYljRuYTDHBWULt2Av6AzAjL1I,1536
20
+ aws_annoying/cli/session_manager/port_forward.py,sha256=PYRSeYg2RLH3rB3mO5RwYNZmnL95E-Z2RJXuvdOddlY,4890
21
+ aws_annoying/cli/session_manager/start.py,sha256=27sTKMrdgG8UeQF1hz7l_1uWh2oOz06XYX-XhY_ab84,1717
22
22
  aws_annoying/cli/session_manager/stop.py,sha256=SrjGJdodTmcGK1OPyFX61vWzJTqgfsuBRFvScIdYJCU,1641
23
23
  aws_annoying/ecs/__init__.py,sha256=G9vVNkbDg-fY3G0Qc7yOGZOnsVp4VtiwzzEgjr6S5Kw,666
24
24
  aws_annoying/ecs/check.py,sha256=mxkW8MWCJYng60VKwq3Ws9PEvI1u0aVPdbs4p6SY2j4,1233
@@ -27,7 +27,7 @@ aws_annoying/ecs/errors.py,sha256=n9j_h1MDUV6IVabKgwbCVAiPZQNJDJ5rVRHA82Je5QQ,42
27
27
  aws_annoying/ecs/wait_for.py,sha256=Oj1u1uPp074-Pf-cvVNHxs-S6RLk8lh5EGsVFqi1iH0,6123
28
28
  aws_annoying/session_manager/__init__.py,sha256=IENviL3ux2LF7o9xFGYEiqaGw03hxnyNX2btbB1xyEU,318
29
29
  aws_annoying/session_manager/errors.py,sha256=YioKlRtZ-GUP0F_ts_ebw7-HYkxe8mTes6HK821Kuiw,353
30
- aws_annoying/session_manager/session_manager.py,sha256=pUsyJ_w9UzdIfHA2Z8kU6UcZxOqypFXH1rl6pDytdqo,12046
30
+ aws_annoying/session_manager/session_manager.py,sha256=FmJEGdbsjYzt5CbE5CiNF5UyliGnzVzLq0ipfXusNyY,12047
31
31
  aws_annoying/session_manager/shortcuts.py,sha256=Yn4wCl43lfttrZ7GbzfGua2jZHe5Fe6ClEy4ikg-Q_s,2143
32
32
  aws_annoying/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
33
  aws_annoying/utils/debugger.py,sha256=UFllDCGI2gPtwo1XS5vqw0qyR6bYr7XknmBwSxalKIc,754
@@ -35,8 +35,8 @@ aws_annoying/utils/downloader.py,sha256=bAh8Hu55L3F8Fyd1s4NBsyB_L0U-lk7SfKsS00Rp
35
35
  aws_annoying/utils/ec2.py,sha256=VsOrnFQDSNplWQ_s-uT11IfiD2mi-74uLbSVoaeXynI,1055
36
36
  aws_annoying/utils/platform.py,sha256=TBIzCzYiFj36HmndZedegvFlxPSNtBQyAxzuwelvxNg,985
37
37
  aws_annoying/utils/timeout.py,sha256=9eCSqhkEp7f7wBoLzkyqfyUKAgY9irwL6LIWBvIvmFI,2394
38
- aws_annoying-0.8.2.dist-info/METADATA,sha256=x4OS2Uc2ZaDB73aBVmzfSUdqvyp790bhte-ael05HAc,2770
39
- aws_annoying-0.8.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
40
- aws_annoying-0.8.2.dist-info/entry_points.txt,sha256=DcKE5V0WvVJ8wUOHxyUz1yLAJOuuJUgRPlMcQ4O7jEs,66
41
- aws_annoying-0.8.2.dist-info/licenses/LICENSE,sha256=Q5GkvYijQ2KTQ-QWhv43ilzCno4ZrzrEuATEQZd9rYo,1067
42
- aws_annoying-0.8.2.dist-info/RECORD,,
38
+ aws_annoying-0.8.3.dist-info/METADATA,sha256=OOSSpm2II-lNufjCR_ETHdsRpSMBxwWZ-VxyoOekUh8,2075
39
+ aws_annoying-0.8.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
40
+ aws_annoying-0.8.3.dist-info/entry_points.txt,sha256=DcKE5V0WvVJ8wUOHxyUz1yLAJOuuJUgRPlMcQ4O7jEs,66
41
+ aws_annoying-0.8.3.dist-info/licenses/LICENSE,sha256=Q5GkvYijQ2KTQ-QWhv43ilzCno4ZrzrEuATEQZd9rYo,1067
42
+ aws_annoying-0.8.3.dist-info/RECORD,,