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

Add dynamodb table class support #880

Conversation

marknet15
Copy link
Contributor

@marknet15 marknet15 commented Jan 22, 2022

SUMMARY

Add support for defining a TableClass on DynamoDB tables.

TableClass was introduced as part of botocore version 1.23.18
https://github.com/boto/botocore/blob/develop/CHANGELOG.rst#12318

Fixes: #829

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

dynamodb_table

ADDITIONAL INFORMATION

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.create_table
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.update_table

@marknet15 marknet15 changed the title [WIP] Add dynamodb table class support Add dynamodb table class support Jan 22, 2022
@ansibullbot
Copy link

@ansibullbot ansibullbot added community_review feature This issue/PR relates to a feature request integration tests/integration module module needs_triage plugins plugin (any type) tests tests labels Jan 28, 2022
Copy link
Contributor

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only some suggestions! May I ask you to update the RETURN statement please?

plugins/modules/dynamodb_table.py Outdated Show resolved Hide resolved
plugins/modules/dynamodb_table.py Outdated Show resolved Hide resolved
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (third-party-check pipeline).

description: The current table class.
returned: when state present
type: str
sample: STANDARD_INFREQUENT_ACCESS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the actual RETURN statement, I guess it should reflect this.

changed: [testhost] => {
    "billing_mode": "PROVISIONED",
    "changed": true,
    "hash_key_name": "id",
    "hash_key_type": "NUMBER",
    "indexes": [],
    "invocation": {},
    "range_key_name": null,
    "range_key_type": null,
    "read_capacity": 1,
    "region": "us-east-1",
    "resource_actions": [
        "dynamodb:ListTagsOfResource",
        "dynamodb:DescribeTable",
        "dynamodb:CreateTable"
    ],
    "table": {
        "arn": "arn:aws:dynamodb:us-east-1:721066863947:table/ansible-test-table",
        "attribute_definitions": [
            {
                "attribute_name": "id",
                "attribute_type": "N"
            }
        ],
        "billing_mode": "PROVISIONED",
        "creation_date_time": "2022-02-04T13:36:01.578000+00:00",
        "id": "533b45fe-0870-4b66-9b00-d2afcfe96f19",
        "item_count": 0,
        "key_schema": [
            {
                "attribute_name": "id",
                "key_type": "HASH"
            }
        ],
        "name": "ansible-test-14482047-alinas-mbp",
        "provisioned_throughput": {
            "number_of_decreases_today": 0,
            "read_capacity_units": 1,
            "write_capacity_units": 1
        },
        "size": 0,
        "status": "ACTIVE",
        "table_arn": "arn:aws:dynamodb:us-east-1:721066863947:table/ansible-test-table",
        "table_id": "533b45fe-0870-4b66-9b00-d2afcfe96f19",
        "table_name": "ansible-test-table",
        "table_size_bytes": 0,
        "table_status": "ACTIVE",
        "tags": {}
    },
    "table_class": null,
    "table_name": "ansible-test-table",
    "table_status": "ACTIVE",
    "tags": {},
    "write_capacity": 1
}

Copy link
Contributor Author

@marknet15 marknet15 Feb 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alinabuzachis I am wondering if everything bar the actual table object and maybe table_status should be deprecated and future dropped as the table object contains all actual fields from the AWS describe call whereas the rest is basically a mirror of the inputted params.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe if I doc just table for now ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do something like this in RETURN:

...
table:
    description: Add description
    type: complex
    sample: {
        "arn": "arn:aws:dynamodb:us-east-1:721066863947:table/ansible-test-table",
        "attribute_definitions": [
            {
                "attribute_name": "id",
                "attribute_type": "N"
            }
        ],
        "billing_mode": "PROVISIONED",
        "creation_date_time": "2022-02-04T13:36:01.578000+00:00",
        "id": "533b45fe-0870-4b66-9b00-d2afcfe96f19",
        "item_count": 0,
        "key_schema": [
            {
                "attribute_name": "id",
                "key_type": "HASH"
            }
        ],
        "name": "ansible-test-14482047-alinas-mbp",
        "provisioned_throughput": {
            "number_of_decreases_today": 0,
            "read_capacity_units": 1,
            "write_capacity_units": 1
        },
        "size": 0,
        "status": "ACTIVE",
        "table_arn": "arn:aws:dynamodb:us-east-1:721066863947:table/ansible-test-table",
        "table_id": "533b45fe-0870-4b66-9b00-d2afcfe96f19",
        "table_name": "ansible-test-table",
        "table_size_bytes": 0,
        "table_status": "ACTIVE",
        "tags": {}
    }
....

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (third-party-check pipeline).

Copy link
Contributor

@alinabuzachis alinabuzachis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marknet15 Thank you. LGTM!

@jillr jillr added the mergeit Merge the PR (SoftwareFactory) label Feb 7, 2022
@markuman markuman added backport-3 PR should be backported to the stable-3 branch mergeit Merge the PR (SoftwareFactory) and removed mergeit Merge the PR (SoftwareFactory) labels Feb 7, 2022
@softwarefactory-project-zuul
Copy link
Contributor

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 15d69c9 into ansible-collections:main Feb 7, 2022
@patchback
Copy link

patchback bot commented Feb 7, 2022

Backport to stable-3: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-3/15d69c91b1d40b0dfb1c98f11302f4f960864111/pr-880

Backported as #930

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Feb 7, 2022
Add dynamodb table class support

SUMMARY
Add support for defining a TableClass on DynamoDB tables.
TableClass was introduced as part of botocore version 1.23.18
https://github.com/boto/botocore/blob/develop/CHANGELOG.rst#12318
Fixes: #829
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
dynamodb_table
ADDITIONAL INFORMATION
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.create_table
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.update_table

Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mark Woolley <mw@marknet15.com>
Reviewed-by: Jill R <None>
(cherry picked from commit 15d69c9)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Feb 7, 2022
[PR #880/15d69c91 backport][stable-3] Add dynamodb table class support

This is a backport of PR #880 as merged into main (15d69c9).
SUMMARY
Add support for defining a TableClass on DynamoDB tables.
TableClass was introduced as part of botocore version 1.23.18
https://github.com/boto/botocore/blob/develop/CHANGELOG.rst#12318
Fixes: #829
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
dynamodb_table
ADDITIONAL INFORMATION
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.create_table
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Client.update_table
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
Minor tweaks to dev guidelines

SUMMARY
I was looking through the guidelines and noticed a few quirks.
ISSUE TYPE

Docs Pull Request

COMPONENT NAME
docs/docsite/rst/dev_guidelines.rst
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3 PR should be backported to the stable-3 branch community_review feature This issue/PR relates to a feature request integration tests/integration mergeit Merge the PR (SoftwareFactory) module module plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DynamoDB support for TableClass
5 participants