Skip to content

Commit

Permalink
CreateOperation should only be implemented alongside ExistenceCheck (#20
Browse files Browse the repository at this point in the history
)

* CreateOperation should only be implemented alongside ExistenceCheck

See hashicorp/vault#18492

* Remove CreateOperation cases in tests too
  • Loading branch information
maxb committed Jan 19, 2023
1 parent 327fcc4 commit 416e11f
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 24 deletions.
1 change: 0 additions & 1 deletion path_decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ correct version automatically.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathDecryptWrite),
logical.UpdateOperation: withFieldValidator(b.pathDecryptWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_decrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
func TestPathDecrypt_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "decrypt/my-key")
testFieldValidation(t, logical.UpdateOperation, "decrypt/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ limitations by key types.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathEncryptWrite),
logical.UpdateOperation: withFieldValidator(b.pathEncryptWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_encrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import (
func TestPathEncrypt_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "encrypt/my-key")
testFieldValidation(t, logical.UpdateOperation, "encrypt/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_keys_deregister.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ it will be left untouched.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathKeysDeregisterWrite),
logical.UpdateOperation: withFieldValidator(b.pathKeysDeregisterWrite),
logical.DeleteOperation: withFieldValidator(b.pathKeysDeregisterWrite),
},
Expand Down
2 changes: 0 additions & 2 deletions path_keys_deregister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
func TestPathKeysDeregister_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "keys/deregister/my-key")
testFieldValidation(t, logical.UpdateOperation, "keys/deregister/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_keys_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ not exist at creation time.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathKeysRegisterWrite),
logical.UpdateOperation: withFieldValidator(b.pathKeysRegisterWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_keys_register_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
func TestPathKeysRegister_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "keys/register/my-key")
testFieldValidation(t, logical.UpdateOperation, "keys/register/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_keys_rotate.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ point to a valid Google Cloud KMS crypto key.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathKeysRotateWrite),
logical.UpdateOperation: withFieldValidator(b.pathKeysRotateWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_keys_rotate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
func TestPathKeysRotate_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "keys/rotate/my-key")
testFieldValidation(t, logical.UpdateOperation, "keys/rotate/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_keys_verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ Base64-encoded signature to use for verification. This field is required.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathVerifyWrite),
logical.UpdateOperation: withFieldValidator(b.pathVerifyWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_keys_verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
func TestPathVerify_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "verify/my-key")
testFieldValidation(t, logical.UpdateOperation, "verify/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_reencrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ unspecified, this defaults to the latest active crypto key version.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathReencryptWrite),
logical.UpdateOperation: withFieldValidator(b.pathReencryptWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_reencrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
func TestPathReencrypt_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "reencrypt/my-key")
testFieldValidation(t, logical.UpdateOperation, "reencrypt/my-key")
})

Expand Down
1 change: 0 additions & 1 deletion path_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ required.
},

Callbacks: map[logical.Operation]framework.OperationFunc{
logical.CreateOperation: withFieldValidator(b.pathSignWrite),
logical.UpdateOperation: withFieldValidator(b.pathSignWrite),
},
}
Expand Down
2 changes: 0 additions & 2 deletions path_sign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import (
func TestPathSign_Write(t *testing.T) {

t.Run("field_validation", func(t *testing.T) {

testFieldValidation(t, logical.CreateOperation, "sign/my-key")
testFieldValidation(t, logical.UpdateOperation, "sign/my-key")
})

Expand Down

0 comments on commit 416e11f

Please sign in to comment.