<commit_before>//snippet-sourcedescription:[CreateGrant.kt demonstrates how to add a grant to a customer master key (CMK).]
//snippet-keyword:[AWS SDK for Kotlin]
//snippet-keyword:[Code Sample]
//snippet-service:[AWS Key Management Service]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[03/03/2021]
//snippet-sourceauthor:[scmacdon-aws]

/*
   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   SPDX-License-Identifier: Apache-2.0
*/

package com.kotlin.kms

// snippet-start:[kms.kotlin_create_grant.import]
import aws.sdk.kotlin.services.kms.KmsClient
import aws.sdk.kotlin.services.kms.model.CreateGrantRequest
import aws.sdk.kotlin.services.kms.model.GrantOperation
import aws.sdk.kotlin.services.kms.model.KmsException
import kotlin.system.exitProcess
// snippet-end:[kms.kotlin_create_grant.import]

/**
To run this Kotlin code example, ensure that you have setup your development environment,
including your credentials.

For information, see this documentation topic:
https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html
 */

suspend fun main(args: Array<String>) {

    val usage = """
        Usage:
            <keyId> <granteePrincipal> <operation>
        Where:
            keyId - the unique identifier for the customer master key (CMK) that the grant applies to (for example, <KEY>).
            granteePrincipal - the principal that is given permission to perform the operations that the grant permits. 
            operation - an operation (for example, Encrypt). <commit_msg>Update CreateGrant.kt<commit_after>//snippet-sourcedescription:[CreateGrant.kt demonstrates how to add a grant to a customer master key (CMK).]
//snippet-keyword:[AWS SDK for Kotlin]
//snippet-keyword:[Code Sample]
//snippet-service:[AWS Key Management Service]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[03/03/2021]
//snippet-sourceauthor:[scmacdon-aws]

/*
   Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
   SPDX-License-Identifier: Apache-2.0
*/

package com.kotlin.kms

// snippet-start:[kms.kotlin_create_grant.import]
import aws.sdk.kotlin.services.kms.KmsClient
import aws.sdk.kotlin.services.kms.model.CreateGrantRequest
import aws.sdk.kotlin.services.kms.model.GrantOperation
import aws.sdk.kotlin.services.kms.model.KmsException
import kotlin.system.exitProcess
// snippet-end:[kms.kotlin_create_grant.import]

/**
To run this Kotlin code example, ensure that you have setup your development environment,
including your credentials.

For information, see this documentation topic:
https://docs.aws.amazon.com/sdk-for-kotlin/latest/developer-guide/setup.html
 */

suspend fun main(args: Array<String>) {

    val usage = """
        Usage:
            <keyId> <granteePrincipal> <operation>
        Where:
            keyId - the unique identifier for the AWS KMS key that the grant applies to (for example, <KEY>).
            granteePrincipal - the principal that is given permission to perform the operations that the grant permits. 
            operation - an operation (for example, Encrypt). 
{'fraction_non_alphanumeric': 0.10827407886231416, 'fraction_numerical': 0.006464124111182934, 'mean_word_length': 3.8817034700315456, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7591513', 'n_tokens_mistral': 996, 'n_tokens_neox': 918, 'n_words': 250}