tyk icon indicating copy to clipboard operation
tyk copied to clipboard

TT-8317 Add KeyID to Protobuf

Open nerdydread opened this issue 5 months ago • 4 comments

User description

Description

Added the keyID to the session state protobuf so that it can be available to gRPC plugins

Related Issue

https://tyktech.atlassian.net/browse/TT-8317

Motivation and Context

How This Has Been Tested

Wrote a gRPC plugin that printed the keyID to stdout.

Screenshots (if appropriate)

image

image

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality)

Checklist

  • [ ] I ensured that the documentation is up to date
  • [ ] I explained why this PR updates go.mod in detail with reasoning why it's required
  • [ ] I would like a code coverage CI quality gate exception and have explained why

PR Type

Enhancement


Description

  • Added a new KeyId field to the SessionState struct in the Go codebase, allowing it to store the ID of the key used for API access.
  • Implemented the GetKeyId method to retrieve the KeyId from a SessionState instance.
  • Updated the ProtoSessionState function to include the KeyId field when converting session states.
  • Modified the Protocol Buffers definition to include a key_id field in the SessionState message, ensuring compatibility with gRPC plugins.

Changes walkthrough 📝

Relevant files
Enhancement
coprocess_session_state.pb.go
Add KeyId field to SessionState struct in Go                         

coprocess/coprocess_session_state.pb.go

  • Added KeyId field to SessionState struct.
  • Implemented GetKeyId method for SessionState.
  • Updated protobuf descriptor to include KeyId.
  • +28/-17 
    coprocess_helpers.go
    Include KeyId in ProtoSessionState function                           

    gateway/coprocess_helpers.go

    • Added KeyId field assignment in ProtoSessionState function.
    +1/-0     
    coprocess_session_state.proto
    Add key_id field to SessionState message in Protobuf         

    coprocess/proto/coprocess_session_state.proto

    • Added key_id field to SessionState message.
    +3/-0     

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    nerdydread avatar Sep 06 '24 21:09 nerdydread