MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / key_policies

Function key_policies

python/example_code/kms/key_policies.py:165–186  ·  view source on GitHub ↗
(kms_client)

Source from the content-addressed store, hash-verified

163
164
165def key_policies(kms_client):
166 logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
167
168 print("-" * 88)
169 print("Welcome to the AWS Key Management Service (AWS KMS) key policies demo.")
170 print("-" * 88)
171
172 key_id = input("Enter a key ID or ARN to start the demo: ")
173 if key_id == "":
174 print("A key is required to run this demo.")
175 return
176
177 key_policy = KeyPolicy(kms_client)
178 key_policy.list_policies(key_id)
179 print("-" * 88)
180 policy = key_policy.get_policy(key_id)
181 print("-" * 88)
182 if policy is not None:
183 key_policy.set_policy(key_id, policy)
184
185 print("\nThanks for watching!")
186 print("-" * 88)
187
188
189if __name__ == "__main__":

Callers 1

key_policies.pyFile · 0.85

Calls 4

list_policiesMethod · 0.95
get_policyMethod · 0.95
set_policyMethod · 0.95
KeyPolicyClass · 0.85

Tested by

no test coverage detected