@@ -3078,6 +3078,180 @@ async def sample_decrypt():
30783078 # Done; return the response.
30793079 return response
30803080
3081+ async def raw_encrypt (
3082+ self ,
3083+ request : Optional [Union [service .RawEncryptRequest , dict ]] = None ,
3084+ * ,
3085+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
3086+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
3087+ metadata : Sequence [Tuple [str , str ]] = (),
3088+ ) -> service .RawEncryptResponse :
3089+ r"""Encrypts data using portable cryptographic primitives. Most
3090+ users should choose
3091+ [Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt] and
3092+ [Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]
3093+ rather than their raw counterparts. The
3094+ [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must
3095+ be
3096+ [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].
3097+
3098+ .. code-block:: python
3099+
3100+ # This snippet has been automatically generated and should be regarded as a
3101+ # code template only.
3102+ # It will require modifications to work:
3103+ # - It may require correct/in-range values for request initialization.
3104+ # - It may require specifying regional endpoints when creating the service
3105+ # client as shown in:
3106+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3107+ from google.cloud import kms_v1
3108+
3109+ async def sample_raw_encrypt():
3110+ # Create a client
3111+ client = kms_v1.KeyManagementServiceAsyncClient()
3112+
3113+ # Initialize request argument(s)
3114+ request = kms_v1.RawEncryptRequest(
3115+ name="name_value",
3116+ plaintext=b'plaintext_blob',
3117+ )
3118+
3119+ # Make the request
3120+ response = await client.raw_encrypt(request=request)
3121+
3122+ # Handle the response
3123+ print(response)
3124+
3125+ Args:
3126+ request (Optional[Union[google.cloud.kms_v1.types.RawEncryptRequest, dict]]):
3127+ The request object. Request message for
3128+ [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
3129+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3130+ should be retried.
3131+ timeout (float): The timeout for this request.
3132+ metadata (Sequence[Tuple[str, str]]): Strings which should be
3133+ sent along with the request as metadata.
3134+
3135+ Returns:
3136+ google.cloud.kms_v1.types.RawEncryptResponse:
3137+ Response message for
3138+ [KeyManagementService.RawEncrypt][google.cloud.kms.v1.KeyManagementService.RawEncrypt].
3139+
3140+ """
3141+ # Create or coerce a protobuf request object.
3142+ request = service .RawEncryptRequest (request )
3143+
3144+ # Wrap the RPC method; this adds retry and timeout information,
3145+ # and friendly error handling.
3146+ rpc = gapic_v1 .method_async .wrap_method (
3147+ self ._client ._transport .raw_encrypt ,
3148+ default_timeout = None ,
3149+ client_info = DEFAULT_CLIENT_INFO ,
3150+ )
3151+
3152+ # Certain fields should be provided within the metadata header;
3153+ # add these here.
3154+ metadata = tuple (metadata ) + (
3155+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
3156+ )
3157+
3158+ # Send the request.
3159+ response = await rpc (
3160+ request ,
3161+ retry = retry ,
3162+ timeout = timeout ,
3163+ metadata = metadata ,
3164+ )
3165+
3166+ # Done; return the response.
3167+ return response
3168+
3169+ async def raw_decrypt (
3170+ self ,
3171+ request : Optional [Union [service .RawDecryptRequest , dict ]] = None ,
3172+ * ,
3173+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
3174+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
3175+ metadata : Sequence [Tuple [str , str ]] = (),
3176+ ) -> service .RawDecryptResponse :
3177+ r"""Decrypts data that was originally encrypted using a raw
3178+ cryptographic mechanism. The
3179+ [CryptoKey.purpose][google.cloud.kms.v1.CryptoKey.purpose] must
3180+ be
3181+ [RAW_ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.RAW_ENCRYPT_DECRYPT].
3182+
3183+ .. code-block:: python
3184+
3185+ # This snippet has been automatically generated and should be regarded as a
3186+ # code template only.
3187+ # It will require modifications to work:
3188+ # - It may require correct/in-range values for request initialization.
3189+ # - It may require specifying regional endpoints when creating the service
3190+ # client as shown in:
3191+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
3192+ from google.cloud import kms_v1
3193+
3194+ async def sample_raw_decrypt():
3195+ # Create a client
3196+ client = kms_v1.KeyManagementServiceAsyncClient()
3197+
3198+ # Initialize request argument(s)
3199+ request = kms_v1.RawDecryptRequest(
3200+ name="name_value",
3201+ ciphertext=b'ciphertext_blob',
3202+ initialization_vector=b'initialization_vector_blob',
3203+ )
3204+
3205+ # Make the request
3206+ response = await client.raw_decrypt(request=request)
3207+
3208+ # Handle the response
3209+ print(response)
3210+
3211+ Args:
3212+ request (Optional[Union[google.cloud.kms_v1.types.RawDecryptRequest, dict]]):
3213+ The request object. Request message for
3214+ [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
3215+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
3216+ should be retried.
3217+ timeout (float): The timeout for this request.
3218+ metadata (Sequence[Tuple[str, str]]): Strings which should be
3219+ sent along with the request as metadata.
3220+
3221+ Returns:
3222+ google.cloud.kms_v1.types.RawDecryptResponse:
3223+ Response message for
3224+ [KeyManagementService.RawDecrypt][google.cloud.kms.v1.KeyManagementService.RawDecrypt].
3225+
3226+ """
3227+ # Create or coerce a protobuf request object.
3228+ request = service .RawDecryptRequest (request )
3229+
3230+ # Wrap the RPC method; this adds retry and timeout information,
3231+ # and friendly error handling.
3232+ rpc = gapic_v1 .method_async .wrap_method (
3233+ self ._client ._transport .raw_decrypt ,
3234+ default_timeout = None ,
3235+ client_info = DEFAULT_CLIENT_INFO ,
3236+ )
3237+
3238+ # Certain fields should be provided within the metadata header;
3239+ # add these here.
3240+ metadata = tuple (metadata ) + (
3241+ gapic_v1 .routing_header .to_grpc_metadata ((("name" , request .name ),)),
3242+ )
3243+
3244+ # Send the request.
3245+ response = await rpc (
3246+ request ,
3247+ retry = retry ,
3248+ timeout = timeout ,
3249+ metadata = metadata ,
3250+ )
3251+
3252+ # Done; return the response.
3253+ return response
3254+
30813255 async def asymmetric_sign (
30823256 self ,
30833257 request : Optional [Union [service .AsymmetricSignRequest , dict ]] = None ,
0 commit comments