amazonka-kms-2.0: Amazon Key Management Service SDK.
Copyright(c) 2013-2023 Brendan Hay
LicenseMozilla Public License, v. 2.0.
MaintainerBrendan Hay
Stabilityauto-generated
Portabilitynon-portable (GHC extensions)
Safe HaskellSafe-Inferred
LanguageHaskell2010

Amazonka.KMS.GenerateRandom

Description

Returns a random byte string that is cryptographically secure.

You must use the NumberOfBytes parameter to specify the length of the random byte string. There is no default value for string length.

By default, the random byte string is generated in KMS. To generate the byte string in the CloudHSM cluster associated with an CloudHSM key store, use the CustomKeyStoreId parameter.

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

For more information about entropy and random number generation, see Key Management Service Cryptographic Details.

Cross-account use: Not applicable. GenerateRandom does not use any account-specific resources, such as KMS keys.

Required permissions: kms:GenerateRandom (IAM policy)

Synopsis

Creating a Request

data GenerateRandom Source #

See: newGenerateRandom smart constructor.

Constructors

GenerateRandom' 

Fields

  • customKeyStoreId :: Maybe Text

    Generates the random byte string in the CloudHSM cluster that is associated with the specified CloudHSM key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

    External key store IDs are not valid for this parameter. If you specify the ID of an external key store, GenerateRandom throws an UnsupportedOperationException.

  • numberOfBytes :: Maybe Natural

    The length of the random byte string. This parameter is required.

Instances

Instances details
ToJSON GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

ToHeaders GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

ToPath GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

ToQuery GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

AWSRequest GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

Associated Types

type AWSResponse GenerateRandom #

Generic GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

Associated Types

type Rep GenerateRandom :: Type -> Type #

Read GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

Show GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

NFData GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

Methods

rnf :: GenerateRandom -> () #

Eq GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

Hashable GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

type AWSResponse GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

type Rep GenerateRandom Source # 
Instance details

Defined in Amazonka.KMS.GenerateRandom

type Rep GenerateRandom = D1 ('MetaData "GenerateRandom" "Amazonka.KMS.GenerateRandom" "amazonka-kms-2.0-6YhT3Ymbf9Z5PoaGoz7tbG" 'False) (C1 ('MetaCons "GenerateRandom'" 'PrefixI 'True) (S1 ('MetaSel ('Just "customKeyStoreId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "numberOfBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Maybe Natural))))

newGenerateRandom :: GenerateRandom Source #

Create a value of GenerateRandom with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

GenerateRandom, generateRandom_customKeyStoreId - Generates the random byte string in the CloudHSM cluster that is associated with the specified CloudHSM key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

External key store IDs are not valid for this parameter. If you specify the ID of an external key store, GenerateRandom throws an UnsupportedOperationException.

$sel:numberOfBytes:GenerateRandom', generateRandom_numberOfBytes - The length of the random byte string. This parameter is required.

Request Lenses

generateRandom_customKeyStoreId :: Lens' GenerateRandom (Maybe Text) Source #

Generates the random byte string in the CloudHSM cluster that is associated with the specified CloudHSM key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

External key store IDs are not valid for this parameter. If you specify the ID of an external key store, GenerateRandom throws an UnsupportedOperationException.

generateRandom_numberOfBytes :: Lens' GenerateRandom (Maybe Natural) Source #

The length of the random byte string. This parameter is required.

Destructuring the Response

data GenerateRandomResponse Source #

See: newGenerateRandomResponse smart constructor.

Constructors

GenerateRandomResponse' 

Fields

  • plaintext :: Maybe (Sensitive Base64)

    The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

  • httpStatus :: Int

    The response's http status code.

newGenerateRandomResponse Source #

Create a value of GenerateRandomResponse with all optional fields omitted.

Use generic-lens or optics to modify other optional fields.

The following record fields are available, with the corresponding lenses provided for backwards compatibility:

$sel:plaintext:GenerateRandomResponse', generateRandomResponse_plaintext - The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.-- -- Note: This Lens automatically encodes and decodes Base64 data. -- The underlying isomorphism will encode to Base64 representation during -- serialisation, and decode from Base64 representation during deserialisation. -- This Lens accepts and returns only raw unencoded data.

$sel:httpStatus:GenerateRandomResponse', generateRandomResponse_httpStatus - The response's http status code.

Response Lenses

generateRandomResponse_plaintext :: Lens' GenerateRandomResponse (Maybe ByteString) Source #

The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.-- -- Note: This Lens automatically encodes and decodes Base64 data. -- The underlying isomorphism will encode to Base64 representation during -- serialisation, and decode from Base64 representation during deserialisation. -- This Lens accepts and returns only raw unencoded data.