pyawsopstoolkit


Namepyawsopstoolkit JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/coldsofttech/pyawsopstoolkit.git
SummaryThis extensive package, AWS Ops Toolkit, offers a wide range of features and enhancements designed to streamline
upload_time2024-05-22 18:46:44
maintainerNone
docs_urlNone
authorcoldsofttech
requires_pythonNone
licenseMIT
keywords aws toolkit operations tools development python validation session-management utilities enhancements integration amazon-web-services models search advance-search filtering security-risks risks vulnerabilities insights hygiene
VCS
bugtrack_url
requirements setuptools boto3 botocore
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyawsopstoolkit

Welcome to pyawsopstoolkit! This Python package is your all-in-one solution for managing Amazon Web Services (AWS)
operations efficiently. Whether you're a seasoned AWS user or just getting started, this toolkit offers a comprehensive
set of features and enhancements to streamline your AWS interactions.

## Features

- **Session Management**: Seamlessly integrate session management classes into your application ecosystem, empowering
  refined control over workflow dynamics.
- **Assume Role Function**: Access a versatile function for assuming roles, augmenting security and flexibility within
  your AWS operations.
- **Validator Functions**: Validate AWS ARNs, IAM policy formats, and more with ease, ensuring the correctness of
  crucial parameters.
- **Advance Search**: Harness advanced search capabilities to efficiently navigate and filter AWS resources,
  streamlining resource discovery and management.
- **Security Risks/Vulnerabilities**: Safeguard your AWS infrastructure by proactively identifying and addressing
  security threats and vulnerabilities. Leverage dedicated tools to detect misconfigurations, insecure permissions, and
  potential entry points for cyberattacks. Stay vigilant with continuous monitoring and auditing to maintain a robust
  security posture and mitigate risks effectively.
- **Insights**: Gain comprehensive insights into various aspects of your AWS infrastructure to maintain optimal hygiene
  and clean up unused or obsolete resources.

## What's Next?

Stay tuned as we continue to evolve this toolkit! We're constantly working on adding new features and enhancements to
make your AWS-related workflows even more efficient and productive. Watch this space for updates and upcoming additions.

## Getting Started

Ready to supercharge your AWS operations? Let's get started with **pyawsopstoolkit**!

### Installation

Install **pyawsopstoolkit** via pip:

```bash
pip install pyawsopstookit
```

### Usage

Import the package in your Python script:

```python
import pyawsopstoolkit
```

Now you're all set to harness the power of **pyawsopstoolkit** in your AWS workflows!

# Documentation

## pyawsopstoolkit

### Credentials

The **Credentials** class represents a set of AWS credentials, including an access key, secret access key, token, and
optional expiry datetime.

#### Methods

- `__init__(self, access_key: str, secret_access_key: str, token: str, expiry: Optional[datetime] = None) -> None`:
  Initializes a **Credentials** object with the provided access key, secret access key, token, and expiry datetime if
  available.
- `__str__(self) -> str`: Returns a string representation of the **Credentials** object.
- `__dict__(self) -> dict`: Returns a dictionary representation of the **Credentials** object.

#### Usage

```python
from pyawsopstoolkit import Credentials

# Create a Credentials object
creds = Credentials(access_key='access_key', secret_access_key='secret_access_key', token='token')

# Access individual attributes
print(creds.access_key)  # Output: access_key
print(creds.secret_access_key)  # Output: secret_access_key
print(creds.token)  # Output: token

# Print the Credentials object
print(
    creds)  # Output: Credentials(access_key="access_key",secret_access_key="secret_access_key",token="token",expiry=None)

# Convert Credentials object to dictionary
print(creds.__dict__())
# Output:
# {
#     "access_key": "access_key",
#     "secret_access_key": "secret_access_key",
#     "token": "token",
#     "expiry": None
# }
```

### Account

The **Account** class represents an AWS account with various attributes. This class implements the **IAccount**
interface, providing basic functionality for managing an AWS account.

#### Methods

- `__init__(self, number: str) -> None`: Initializes an **Account** object with the provided account number.
-
    - `__str__(self) -> str`: Returns a string representation of the **Account** object.
- `__dict__(self) -> dict`: Returns a dictionary representation of the **Account** object.

#### Usage

```python
from pyawsopstoolkit import Account

# Create an Account object
account = Account('123456789012')

# Access the account number attribute
print(account.number)  # Output: 123456789012
```

### Session

The **Session** class represents a boto3 Session with various attributes. It implements the **ISession** interface,
offering functionality to manage sessions. Additionally, it provides the option to assume a session.

#### Methods

- `__init__(self, profile_name: Optional[str] = None, credentials: Optional[ICredentials] = None, region_code: Optional[str] = 'eu-west-1') -> None`:
  Initializes a **Session** object for AWS with optional parameters for profile name, credentials, and region code.
- `get_session(self) -> boto3.Session`: Returns the **boto3.Session** object based on the specified parameters within
  the class object. This method prioritizes the profile name, followed by credentials. It verifies the session validity
  by performing a quick S3 list buckets action.
- `get_config(self) -> botocore.config.Config`: Returns the **botocore.config.Config** based on the specified region
  code within the class object.
- `get_account(self) -> IAccount`: Returns the AWS account number based on the **get_session** with specified parameters
  within the class object.
- `get_credentials_for_profile(self) -> ICredentials`: Returns the AWS credentials (access key, secret access key, and
  token) based on the **get_session** with specified parameters within the class object.
- `assume_role(self, role_arn: str, role_session_name: Optional[str] = 'AssumeSession', policy_arns: Optional[list] = None, policy: Optional[Union[str, dict]] = None, duration_seconds: Optional[int] = 3600, tags: Optional[list] = None) -> ISession`:
  Returns the **ISession** object for the assumed role based on the specified parameters.

#### Usage

```python
from pyawsopstoolkit import Session

# Initialize a Session object with a profile name
profile_name = 'default'
session = Session(profile_name=profile_name)

# Get boto3 Session
boto3_session = session.get_session()
print(boto3_session)  # Output: Session(region_name='eu-west-1')

# Get AWS account number
account = session.get_account()
print(account.number)  # Output: 123456789012

# Get botocore config
config = session.get_config()
print(config)  # Output: <botocore.config.Config object at 0x0000022097630040>

# Get credentials for profile
creds = session.get_credentials_for_profile()
print(
    creds)  # Output: Credentials(access_key="access_key",secret_access_key="secret_access_key",token=None,expiry=None)
```

## pyawsopstoolkit.advsearch

For detailed information and usage examples, please refer to [ADVANCE_SEARCH](readme/ADVANCE_SEARCH.md).

## pyawsopstoolkit.exceptions

For detailed information and usage examples, please refer to [EXCEPTIONS](readme/EXCEPTIONS.md).

## pyawsopstoolkit.insights

For detailed information and usage examples, please refer to [INSIGHTS](readme/INSIGHTS.md).

## pyawsopstoolkit.models

For detailed information and usage examples, please refer to [MODELS](readme/MODELS.md).

## pyawsopstoolkit.security

For detailed information and usage examples, please refer to [SECURITY](readme/SECURITY.md).

## pyawsopstoolkit.validators

For detailed information and usage examples, please refer to [VALIDATORS](readme/VALIDATORS.md).

# License

Please refer to the [MIT License](LICENSE) within the project for more information.

# Contributing

We welcome contributions from the community! Whether you have ideas for new features, bug fixes, or enhancements, feel
free to open an issue or submit a pull request on [GitHub](https://github.com/coldsofttech/pyawsopstoolkit).


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/coldsofttech/pyawsopstoolkit.git",
    "name": "pyawsopstoolkit",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "aws, toolkit, operations, tools, development, python, validation, session-management, utilities, enhancements, integration, amazon-web-services, models, search, advance-search, filtering, security-risks, risks, vulnerabilities, insights, hygiene",
    "author": "coldsofttech",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# pyawsopstoolkit\n\nWelcome to pyawsopstoolkit! This Python package is your all-in-one solution for managing Amazon Web Services (AWS)\noperations efficiently. Whether you're a seasoned AWS user or just getting started, this toolkit offers a comprehensive\nset of features and enhancements to streamline your AWS interactions.\n\n## Features\n\n- **Session Management**: Seamlessly integrate session management classes into your application ecosystem, empowering\n  refined control over workflow dynamics.\n- **Assume Role Function**: Access a versatile function for assuming roles, augmenting security and flexibility within\n  your AWS operations.\n- **Validator Functions**: Validate AWS ARNs, IAM policy formats, and more with ease, ensuring the correctness of\n  crucial parameters.\n- **Advance Search**: Harness advanced search capabilities to efficiently navigate and filter AWS resources,\n  streamlining resource discovery and management.\n- **Security Risks/Vulnerabilities**: Safeguard your AWS infrastructure by proactively identifying and addressing\n  security threats and vulnerabilities. Leverage dedicated tools to detect misconfigurations, insecure permissions, and\n  potential entry points for cyberattacks. Stay vigilant with continuous monitoring and auditing to maintain a robust\n  security posture and mitigate risks effectively.\n- **Insights**: Gain comprehensive insights into various aspects of your AWS infrastructure to maintain optimal hygiene\n  and clean up unused or obsolete resources.\n\n## What's Next?\n\nStay tuned as we continue to evolve this toolkit! We're constantly working on adding new features and enhancements to\nmake your AWS-related workflows even more efficient and productive. Watch this space for updates and upcoming additions.\n\n## Getting Started\n\nReady to supercharge your AWS operations? Let's get started with **pyawsopstoolkit**!\n\n### Installation\n\nInstall **pyawsopstoolkit** via pip:\n\n```bash\npip install pyawsopstookit\n```\n\n### Usage\n\nImport the package in your Python script:\n\n```python\nimport pyawsopstoolkit\n```\n\nNow you're all set to harness the power of **pyawsopstoolkit** in your AWS workflows!\n\n# Documentation\n\n## pyawsopstoolkit\n\n### Credentials\n\nThe **Credentials** class represents a set of AWS credentials, including an access key, secret access key, token, and\noptional expiry datetime.\n\n#### Methods\n\n- `__init__(self, access_key: str, secret_access_key: str, token: str, expiry: Optional[datetime] = None) -> None`:\n  Initializes a **Credentials** object with the provided access key, secret access key, token, and expiry datetime if\n  available.\n- `__str__(self) -> str`: Returns a string representation of the **Credentials** object.\n- `__dict__(self) -> dict`: Returns a dictionary representation of the **Credentials** object.\n\n#### Usage\n\n```python\nfrom pyawsopstoolkit import Credentials\n\n# Create a Credentials object\ncreds = Credentials(access_key='access_key', secret_access_key='secret_access_key', token='token')\n\n# Access individual attributes\nprint(creds.access_key)  # Output: access_key\nprint(creds.secret_access_key)  # Output: secret_access_key\nprint(creds.token)  # Output: token\n\n# Print the Credentials object\nprint(\n    creds)  # Output: Credentials(access_key=\"access_key\",secret_access_key=\"secret_access_key\",token=\"token\",expiry=None)\n\n# Convert Credentials object to dictionary\nprint(creds.__dict__())\n# Output:\n# {\n#     \"access_key\": \"access_key\",\n#     \"secret_access_key\": \"secret_access_key\",\n#     \"token\": \"token\",\n#     \"expiry\": None\n# }\n```\n\n### Account\n\nThe **Account** class represents an AWS account with various attributes. This class implements the **IAccount**\ninterface, providing basic functionality for managing an AWS account.\n\n#### Methods\n\n- `__init__(self, number: str) -> None`: Initializes an **Account** object with the provided account number.\n-\n    - `__str__(self) -> str`: Returns a string representation of the **Account** object.\n- `__dict__(self) -> dict`: Returns a dictionary representation of the **Account** object.\n\n#### Usage\n\n```python\nfrom pyawsopstoolkit import Account\n\n# Create an Account object\naccount = Account('123456789012')\n\n# Access the account number attribute\nprint(account.number)  # Output: 123456789012\n```\n\n### Session\n\nThe **Session** class represents a boto3 Session with various attributes. It implements the **ISession** interface,\noffering functionality to manage sessions. Additionally, it provides the option to assume a session.\n\n#### Methods\n\n- `__init__(self, profile_name: Optional[str] = None, credentials: Optional[ICredentials] = None, region_code: Optional[str] = 'eu-west-1') -> None`:\n  Initializes a **Session** object for AWS with optional parameters for profile name, credentials, and region code.\n- `get_session(self) -> boto3.Session`: Returns the **boto3.Session** object based on the specified parameters within\n  the class object. This method prioritizes the profile name, followed by credentials. It verifies the session validity\n  by performing a quick S3 list buckets action.\n- `get_config(self) -> botocore.config.Config`: Returns the **botocore.config.Config** based on the specified region\n  code within the class object.\n- `get_account(self) -> IAccount`: Returns the AWS account number based on the **get_session** with specified parameters\n  within the class object.\n- `get_credentials_for_profile(self) -> ICredentials`: Returns the AWS credentials (access key, secret access key, and\n  token) based on the **get_session** with specified parameters within the class object.\n- `assume_role(self, role_arn: str, role_session_name: Optional[str] = 'AssumeSession', policy_arns: Optional[list] = None, policy: Optional[Union[str, dict]] = None, duration_seconds: Optional[int] = 3600, tags: Optional[list] = None) -> ISession`:\n  Returns the **ISession** object for the assumed role based on the specified parameters.\n\n#### Usage\n\n```python\nfrom pyawsopstoolkit import Session\n\n# Initialize a Session object with a profile name\nprofile_name = 'default'\nsession = Session(profile_name=profile_name)\n\n# Get boto3 Session\nboto3_session = session.get_session()\nprint(boto3_session)  # Output: Session(region_name='eu-west-1')\n\n# Get AWS account number\naccount = session.get_account()\nprint(account.number)  # Output: 123456789012\n\n# Get botocore config\nconfig = session.get_config()\nprint(config)  # Output: <botocore.config.Config object at 0x0000022097630040>\n\n# Get credentials for profile\ncreds = session.get_credentials_for_profile()\nprint(\n    creds)  # Output: Credentials(access_key=\"access_key\",secret_access_key=\"secret_access_key\",token=None,expiry=None)\n```\n\n## pyawsopstoolkit.advsearch\n\nFor detailed information and usage examples, please refer to [ADVANCE_SEARCH](readme/ADVANCE_SEARCH.md).\n\n## pyawsopstoolkit.exceptions\n\nFor detailed information and usage examples, please refer to [EXCEPTIONS](readme/EXCEPTIONS.md).\n\n## pyawsopstoolkit.insights\n\nFor detailed information and usage examples, please refer to [INSIGHTS](readme/INSIGHTS.md).\n\n## pyawsopstoolkit.models\n\nFor detailed information and usage examples, please refer to [MODELS](readme/MODELS.md).\n\n## pyawsopstoolkit.security\n\nFor detailed information and usage examples, please refer to [SECURITY](readme/SECURITY.md).\n\n## pyawsopstoolkit.validators\n\nFor detailed information and usage examples, please refer to [VALIDATORS](readme/VALIDATORS.md).\n\n# License\n\nPlease refer to the [MIT License](LICENSE) within the project for more information.\n\n# Contributing\n\nWe welcome contributions from the community! Whether you have ideas for new features, bug fixes, or enhancements, feel\nfree to open an issue or submit a pull request on [GitHub](https://github.com/coldsofttech/pyawsopstoolkit).\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "This extensive package, AWS Ops Toolkit, offers a wide range of features and enhancements designed to streamline",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/coldsofttech/pyawsopstoolkit.git"
    },
    "split_keywords": [
        "aws",
        " toolkit",
        " operations",
        " tools",
        " development",
        " python",
        " validation",
        " session-management",
        " utilities",
        " enhancements",
        " integration",
        " amazon-web-services",
        " models",
        " search",
        " advance-search",
        " filtering",
        " security-risks",
        " risks",
        " vulnerabilities",
        " insights",
        " hygiene"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4875c396d532673d251c373f22250256cfe8fdc9d9024c1face9512b819e2f4d",
                "md5": "9d80803e96063ff5dbdba327b01ad90e",
                "sha256": "c8b628cfabfb215856d742d73517e6ca8da7abe3112bc99eb270196ca5be5229"
            },
            "downloads": -1,
            "filename": "pyawsopstoolkit-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9d80803e96063ff5dbdba327b01ad90e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 28290,
            "upload_time": "2024-05-22T18:46:44",
            "upload_time_iso_8601": "2024-05-22T18:46:44.307656Z",
            "url": "https://files.pythonhosted.org/packages/48/75/c396d532673d251c373f22250256cfe8fdc9d9024c1face9512b819e2f4d/pyawsopstoolkit-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-22 18:46:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "coldsofttech",
    "github_project": "pyawsopstoolkit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "69.2.0"
                ]
            ]
        },
        {
            "name": "boto3",
            "specs": [
                [
                    "~=",
                    "1.34.98"
                ]
            ]
        },
        {
            "name": "botocore",
            "specs": [
                [
                    "~=",
                    "1.34.98"
                ]
            ]
        }
    ],
    "lcname": "pyawsopstoolkit"
}
        
Elapsed time: 0.44235s