elixir-google-api icon indicating copy to clipboard operation
elixir-google-api copied to clipboard

Google Cloud KMS grpc or rest?

Open akashsethiya opened this issue 5 years ago • 3 comments

Is this using the grpc or the rest apis?

akashsethiya avatar Jul 16 '20 11:07 akashsethiya

These Elixir libraries all use the REST endpoints.

dazuma avatar Jul 16 '20 15:07 dazuma

I was trying on using the grpc. I was able to generate the code from the googele cloud kms protos

{:ok, token} = Goth.Token.for_scope("https://www.googleapis.com/auth/cloudkms") request = Google.Cloud.Kms.V1.ListKeyRingsRequest.new(parent: "project_id") headers = ["x-google-request-params": request.parent, "Authorization": "Bearer #{token.token}"] {:ok, channel} = GRPC.Stub.connect("cloudkms.googleapis.com", "443", headers) reply = channel |> Google.Cloud.Kms.V1.KeyManagementService.Stub.list_key_rings(request)

I keep getting below error {:error, %GRPC.RPCError{ message: "{:connection_error, :protocol_error, :\"Invalid connection preface received. (RFC7540 3.5)\"}", status: 2 }} Can anyone suggest anything on this

akashsethiya avatar Jul 20 '20 08:07 akashsethiya

I don't have much experience with the GRPC library for Elixir. (Are you using https://github.com/elixir-grpc/grpc for GRPC?) I suggest asking in the GRPC library's issues.

dazuma avatar Jul 20 '20 15:07 dazuma