github.com/hashicorp/vault/sdk@v0.13.0/plugin/mock/path_special.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package mock
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/hashicorp/vault/sdk/framework"
    10  	"github.com/hashicorp/vault/sdk/logical"
    11  )
    12  
    13  // pathSpecial is used to test special paths.
    14  func pathSpecial(b *backend) *framework.Path {
    15  	return &framework.Path{
    16  		Pattern: "special",
    17  		Callbacks: map[logical.Operation]framework.OperationFunc{
    18  			logical.ReadOperation: b.pathSpecialRead,
    19  		},
    20  	}
    21  }
    22  
    23  func (b *backend) pathSpecialRead(ctx context.Context, req *logical.Request, data *framework.FieldData) (*logical.Response, error) {
    24  	// Return the secret
    25  	return &logical.Response{
    26  		Data: map[string]interface{}{
    27  			"data": "foo",
    28  		},
    29  	}, nil
    30  }