From 18286139a81c866b178b086ffa31833dad447e64 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Mon, 13 Jun 2022 17:25:33 -0700 Subject: [PATCH 1/2] Add snake_cased return key,values and a deprecation message --- plugins/modules/route53_info.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugins/modules/route53_info.py b/plugins/modules/route53_info.py index 7622113c25e..5e40efa4aad 100644 --- a/plugins/modules/route53_info.py +++ b/plugins/modules/route53_info.py @@ -213,6 +213,7 @@ from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule from ansible_collections.amazon.aws.plugins.module_utils.ec2 import AWSRetry +from ansible_collections.amazon.aws.plugins.module_utils.ec2 import camel_dict_to_snake_dict # Split out paginator to allow for the backoff decorator to function @@ -270,10 +271,17 @@ def list_hosted_zones(): params['DelegationSetId'] = module.params.get('delegation_set_id') zones = _paginated_result('list_hosted_zones', **params)['HostedZones'] + snaked_zones = [camel_dict_to_snake_dict(zone) for zone in zones] + + module.deprecate("The 'CamelCase' return values with key 'HostedZones' and 'list' are deprecated and \ + will be replaced by 'snake_case' return values with key 'hosted_zones'. \ + Both case values are returned for now.", + date='2025-01-01', collection_name='community.aws') return { "HostedZones": zones, "list": zones, + "hosted_zones": snaked_zones, } @@ -367,10 +375,17 @@ def list_health_checks(): ) health_checks = _paginated_result('list_health_checks', **params)['HealthChecks'] + snaked_health_checks = [camel_dict_to_snake_dict(health_check) for health_check in health_checks] + + module.deprecate("The 'CamelCase' return values with key 'HealthChecks' and 'list' are deprecated and \ + will be replaced by 'snake_case' return values with key 'health_checks'. \ + Both case values are returned for now.", + date='2025-01-01', collection_name='community.aws') return { "HealthChecks": health_checks, "list": health_checks, + "health_checks": snaked_health_checks, } @@ -399,10 +414,17 @@ def record_sets_details(): ) record_sets = _paginated_result('list_resource_record_sets', **params)['ResourceRecordSets'] + snaked_record_sets = [camel_dict_to_snake_dict(record_set) for record_set in record_sets] + + module.deprecate("The 'CamelCase' return values with key 'ResourceRecordSets' and 'list' are deprecated and \ + will be replaced by 'snake_case' return values with key 'resource_record_sets'. \ + Both case values are returned for now.", + date='2025-01-01', collection_name='community.aws') return { "ResourceRecordSets": record_sets, "list": record_sets, + "resource_record_sets": snaked_record_sets, } From b3258f34b05fe6e887959cfd8119bc88ac679a03 Mon Sep 17 00:00:00 2001 From: mandar242 Date: Mon, 13 Jun 2022 17:42:09 -0700 Subject: [PATCH 2/2] Add changelogs fragment --- .../1236-route53_info-add-snake_case-return-values.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/1236-route53_info-add-snake_case-return-values.yml diff --git a/changelogs/fragments/1236-route53_info-add-snake_case-return-values.yml b/changelogs/fragments/1236-route53_info-add-snake_case-return-values.yml new file mode 100644 index 00000000000..647fe2f7bfc --- /dev/null +++ b/changelogs/fragments/1236-route53_info-add-snake_case-return-values.yml @@ -0,0 +1,4 @@ +deprecated_features: + - route53_info - The CamelCase return values for ```HostedZones```, ```ResourceRecordSets```, and ```HealthChecks``` + have been deprecated, in the future release you must use snake_case return values ```hosted_zones```, ```resource_record_sets```, + and ```health_checks``` instead respectively". \ No newline at end of file