수동으로 생성된 gRPC 라이브러리를 사용하여 Cloud Key Management Service를 호출하는 경우 호출의 메타데이터 또는 헤더에 x-google-request-params 값을 지정해야 합니다. x-google-request-params의 적절한 사용은 Cloud KMS 리소스의 적절한 리전으로 호출을 라우팅합니다.
x-google-request-params 값을 다음 표에 표시된 메서드 요청의 필드로 설정합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-04-30(UTC)"],[],[],null,["# Using gRPC with Cloud KMS\n\nIf you are using manually created [gRPC](https://grpc.io/) libraries to make calls to\nCloud Key Management Service, you must specify a `x-google-request-params` value in\nthe metadata, or header, of the call. The proper use of\n`x-google-request-params` will route the call to the appropriate region for\nyour Cloud KMS resources.\n\nSet the `x-google-request-params` value to a field in the method's request as\nshown in the following table.\n\nSetting the request field\n-------------------------\n\nThe following examples show where to specify the resource name in various\nmethods. Replace the text styled as \u003cvar translate=\"no\"\u003eplace-holder\u003c/var\u003e with the\nactual values used in your Cloud KMS resource IDs.\n\n### Decrypt example\n\nIf you are making a call to [Decrypt](/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Decrypt), you need to populate the following\nfields in your request: \n\n```\nname: 'projects/project-id/locations/location/keyRings/key-ring/cryptoKeys/key-name/'\nciphertext: 'iQALWM/r6alAxQm0VQe3...'\n```\n\nThe value assigned to the `name` field is the resource name of your CryptoKey.\nTo properly route the call, you must also include this resource name in the\ncall metadata, in the following form: \n\n```\nx-goog-request-params: 'name=projects/project-id/locations/location/keyRings/key-ring/cryptoKeys/key-name/'\n```\n\n### CreateKeyRing example\n\nIf you are making a call to [CreateKeyRing](/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.CreateKeyRing), you need to populate the\nfollowing fields in your request: \n\n```\nparent: 'projects/project-id/locations/location/'\nkey_ring_id: 'myKeyRing'\n...\n```\n\nThe call metadata also needs to contain the `parent` resource name: \n\n```\nx-goog-request-params: 'parent=projects/project-id/locations/location/'\n```\n\n### UpdateCryptoKey example\n\nIf you are making a call to [UpdateCryptoKey](/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey), you need to populate the\nfollowing fields in your request: \n\n```\nname: 'projects/project-id/locations/location/keyRings/key-ring/cryptoKeys/key-name/'\nfield_mask: ...\n```\n\nThe metadata also needs to contain the `name` resource name. Note the format\nuses `crypto_key.name=`, not `name=`: \n\n```\nx-goog-request-params: 'crypto_key.name=projects/project-id/locations/location/keyRings/key-ring/cryptoKeys/key-name/'\n```\n\nAdding metadata using C++\n-------------------------\n\nIf you are using C++, call `ClientContext::AddMetadata` before making your RPC\ncall to add the appropriate information to the call metadata.\n\nFor example, if you are adding metadata for a call to [Decrypt](/kms/docs/reference/rpc/google.cloud.kms.v1#google.cloud.kms.v1.KeyManagementService.Decrypt): \n\n```\ncontext.AddMetadata(\"x-goog-request-params\",\n \"name=projects/project-id/locations/location/keyRings/key-ring-name/cryptoKeys/key-name/\");\n```\n\nYou can then pass the context to your method call as usual, along with your\nrequest and response protocol buffers."]]