Skip to content

Commit

Permalink
Updates for validation
Browse files Browse the repository at this point in the history
  • Loading branch information
meyertst-aws committed Oct 8, 2024
1 parent 5861f8e commit 7424694
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 17 deletions.
12 changes: 6 additions & 6 deletions .doc_gen/metadata/kms_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ kms_EnableKeyRotation:
- python.example_code.kms.KeyManager
- python.example_code.kms.EnableKeyRotation
services:
kms: {kms_EnableKeyRotation}
kms: {EnableKeyRotation}
kms_Scenario_Basics:
synopsis_list:
- Create a &kms-key;.
Expand Down Expand Up @@ -819,7 +819,7 @@ kms_Scenario_Basics:
- description:
snippet_tags:
- python.example_code.kms.kms_basics
- description: Wrapper class and methods for &kms key management.
- description: Wrapper class and methods for &kms-key; management.
snippet_tags:
- python.example_code.kms.KeyManager
- python.example_code.kms.CreateKey
Expand All @@ -829,29 +829,29 @@ kms_Scenario_Basics:
- python.example_code.kms.TagResource
- python.example_code.kms.ScheduleKeyDeletion
- description: >
Wrapper class and methods for &kms key aliases.
Wrapper class and methods for &kms-key; aliases.
snippet_tags:
- python.example_code.kms.AliasManager
- python.example_code.kms.CreateAlias
- python.example_code.kms.ListAliases
- python.example_code.kms.DeleteAlias
- description: >
Wrapper class and methods for &kms key encryption.
Wrapper class and methods for &kms-key; encryption.
snippet_tags:
- python.example_code.kms.KeyEncrypt
- python.example_code.kms.Encrypt
- python.example_code.kms.Decrypt
- python.example_code.kms.Sign
- python.example_code.kms.Verify
- description: >
Wrapper class and methods for &kms key grants.
Wrapper class and methods for &kms-key; grants.
snippet_tags:
- python.example_code.kms.GrantManager
- python.example_code.kms.CreateGrant
- python.example_code.kms.ListGrants
- python.example_code.kms.RevokeGrant
- description: >
Wrapper class and methods for &kms key policies.
Wrapper class and methods for &kms-key; policies.
snippet_tags:
- python.example_code.kms.KeyPolicy
- python.example_code.kms.set_new_policy
Expand Down
4 changes: 2 additions & 2 deletions javav2/example_code/kms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ For prerequisites, see the [README](../../README.md#Prerequisites) in the `javav

Code examples that show you how to perform the essential operations within a service.

- [Learn KMS key core operations](src/main/java/com/example/kms/scenario/KMSScenario.java)
- [Learn the basics](src/main/java/com/example/kms/scenario/KMSScenario.java)


### Single actions
Expand Down Expand Up @@ -80,7 +80,7 @@ Code excerpts that show you how to call individual service functions.
This example shows you how to get started using KMS key.


#### Learn KMS key core operations
#### Learn the basics

This example shows you how to do the following:

Expand Down
2 changes: 1 addition & 1 deletion python/example_code/kms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Code excerpts that show you how to call individual service functions.
- [DescribeKey](key_management.py#L110)
- [DisableKey](key_management.py#L175)
- [EnableKey](key_management.py#L156)
- [EnableKeyRotation](key_management.py#L216)
- [Encrypt](key_encryption.py#L37)
- [GenerateDataKey](key_management.py#L132)
- [GetKeyPolicy](key_policies.py#L62)
Expand All @@ -69,7 +70,6 @@ Code excerpts that show you how to call individual service functions.
- [TagResource](key_management.py#L235)
- [UpdateAlias](alias_management.py#L143)
- [Verify](key_encryption.py#L147)
- [kms_EnableKeyRotation](key_management.py#L216)


<!--custom.examples.start-->
Expand Down
8 changes: 4 additions & 4 deletions python/example_code/kms/grant_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, kms_client):
@classmethod
def from_client(cls) -> "GrantManager":
"""
Creates an GrantManager instance with a default KMS client.
Creates a GrantManager instance with a default KMS client.
:return: An instance of GrantManager initialized with the default KMS client.
"""
Expand Down Expand Up @@ -73,11 +73,11 @@ def list_grants(self, key_id):
:return: The grants for the key.
"""
try:
paginator = self.kms_client.get_paginator('list_grants')
paginator = self.kms_client.get_paginator("list_grants")
grants = []
page_iterator = paginator.paginate(KeyId=key_id)
for page in page_iterator:
grants.extend(page['Grants'])
grants.extend(page["Grants"])

print(f"Grants for key {key_id}:")
pprint(grants)
Expand Down Expand Up @@ -166,7 +166,7 @@ def grant_management(kms_client):
grant_manager.retire_grant(grant)
elif action == "revoke":
grant_manager.revoke_grant(key_id, grant["GrantId"])
print(f"Grant {grant["GrantId"]} revoked.")
print(f"Grant {grant['GrantId']} revoked.")
else:
print("Skipping grant removal.")

Expand Down
2 changes: 1 addition & 1 deletion python/example_code/kms/key_encryption.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, kms_client):
@classmethod
def from_client(cls) -> "KeyEncrypt":
"""
Creates an KeyEncrypt instance with a default KMS client.
Creates a KeyEncrypt instance with a default KMS client.
:return: An instance of KeyEncrypt initialized with the default KMS client.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/example_code/kms/key_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, kms_client):
@classmethod
def from_client(cls) -> "KeyManager":
"""
Creates an KeyManager instance with a default KMS client.
Creates a KeyManager instance with a default KMS client.
:return: An instance of KeyManager initialized with the default KMS client.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/example_code/kms/key_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, kms_client):
@classmethod
def from_client(cls) -> "KeyPolicy":
"""
Creates an KeyPolicy instance with a default KMS client.
Creates a KeyPolicy instance with a default KMS client.
:return: An instance of KeyPolicy initialized with the default KMS client.
"""
Expand Down
2 changes: 1 addition & 1 deletion python/example_code/kms/kms_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def kms_scenario(self):
"""
Welcome to the AWS Key Management SDK Basics scenario.
This program demonstrates how to interact with AWS Key Management using the AWS SDK for Java (v2).
This program demonstrates how to interact with AWS Key Management using the AWS SDK for Python (Boto3).
The AWS Key Management Service (KMS) is a secure and highly available service that allows you to create
and manage AWS KMS keys and control their use across a wide range of AWS services and applications.
KMS provides a centralized and unified approach to managing encryption keys, making it easier to meet your
Expand Down
5 changes: 5 additions & 0 deletions python/example_code/kms/test/test_kms_scenario.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0

"""
Unit tests for kms_scenario.py.
"""

import json

import pytest
Expand Down

0 comments on commit 7424694

Please sign in to comment.