Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provider rotation #432

Merged
merged 30 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8c4a065
initial rotate verb
nyobe Jan 15, 2025
4010ab8
example
nyobe Jan 15, 2025
a1f4ec9
fn::rotate
nyobe Jan 15, 2025
4fa0993
rotate scoped to specific paths
nyobe Jan 15, 2025
4e22ea2
move patch handling to eval pkg
nyobe Jan 15, 2025
65b0277
separate rotator inputs and state
nyobe Jan 16, 2025
54d9977
need to add RotatorLoaders to Check and Open too
nyobe Jan 16, 2025
889c6f0
license heading
nyobe Jan 16, 2025
e183ea7
fix rotator.Open not getting called when not rotating
nyobe Jan 16, 2025
d17fcda
fix rotator loaders need to be present for opening imports
nyobe Jan 17, 2025
4769a69
initial snapshot test
nyobe Jan 17, 2025
14d609a
test valueToSecretJSON
nyobe Jan 18, 2025
6042f21
lint
nyobe Jan 18, 2025
5910dc7
changelog
nyobe Jan 21, 2025
1922995
re-align rotator and provider interfaces?
nyobe Jan 21, 2025
9648bb6
add rotating flag instead of overloading rotatePaths
nyobe Jan 21, 2025
e3f06d7
fix evaluating state input against correct schema
nyobe Jan 21, 2025
a208a03
drop support for rotating individual paths for now
nyobe Jan 21, 2025
740e999
merge provider and rotator interfaces, pass state param to open
nyobe Jan 22, 2025
5048c2f
Revert "merge provider and rotator interfaces, pass state param to open"
nyobe Jan 22, 2025
dc86285
split provider and rotator interfaces, extend ProviderLoader to load …
nyobe Jan 22, 2025
1a386a8
pass inputs to Rotator.Open
nyobe Jan 22, 2025
53ccc3c
rename fn::rotate provider -> rotator
nyobe Jan 22, 2025
befdf5f
rename ApplyPatches -> ApplyValuePatches
nyobe Jan 22, 2025
53dc66c
do not intermix state and inputs for shortform fn::rotate
nyobe Jan 22, 2025
58732fa
Update eval/eval.go
nyobe Jan 22, 2025
1b0e0dd
Rotator.Rotate should receive execution context
nyobe Jan 22, 2025
38343da
Update eval/eval.go
nyobe Jan 23, 2025
b3fd85d
Revert "rename fn::rotate provider -> rotator"
nyobe Jan 23, 2025
d5f036c
clarify docstring
nyobe Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rotator.Rotate should receive execution context
nyobe committed Jan 22, 2025
commit 1b0e0ddf36aa84ec0afed3be1b91953bc1b755fe
1 change: 1 addition & 0 deletions eval/eval.go
Original file line number Diff line number Diff line change
@@ -1016,6 +1016,7 @@ func (e *evalContext) evaluateBuiltinRotate(x *expr, repr *rotateExpr) *value {
e.ctx,
inputs.export("").Value.(map[string]esc.Value),
state.export("").Value.(map[string]esc.Value),
e.execContext,
)
if err != nil {
e.errorf(repr.syntax(), "rotate: %s", err.Error())
2 changes: 1 addition & 1 deletion eval/eval_test.go
Original file line number Diff line number Diff line change
@@ -156,7 +156,7 @@ func (swapRotator) Open(ctx context.Context, inputs, state map[string]esc.Value,
return esc.NewValue(state), nil
}

func (swapRotator) Rotate(ctx context.Context, inputs, state map[string]esc.Value) (esc.Value, error) {
func (swapRotator) Rotate(ctx context.Context, inputs, state map[string]esc.Value, context esc.EnvExecContext) (esc.Value, error) {
newState := esc.NewValue(map[string]esc.Value{
"a": state["b"],
"b": state["a"],
2 changes: 1 addition & 1 deletion provider.go
Original file line number Diff line number Diff line change
@@ -40,5 +40,5 @@ type Rotator interface {
Open(ctx context.Context, inputs, state map[string]Value, executionContext EnvExecContext) (Value, error)
nyobe marked this conversation as resolved.
Show resolved Hide resolved
nyobe marked this conversation as resolved.
Show resolved Hide resolved

// Rotate rotates the provider's secret, and returns the rotator's new state to be persisted.
Rotate(ctx context.Context, inputs, state map[string]Value) (Value, error)
Rotate(ctx context.Context, inputs, state map[string]Value, executionContext EnvExecContext) (Value, error)
}