github.com/hashicorp/vault/sdk@v0.13.0/logical/secret.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  package logical
     5  
     6  import "fmt"
     7  
     8  // Secret represents the secret part of a response.
     9  type Secret struct {
    10  	LeaseOptions
    11  
    12  	// InternalData is JSON-encodable data that is stored with the secret.
    13  	// This will be sent back during a Renew/Revoke for storing internal data
    14  	// used for those operations.
    15  	InternalData map[string]interface{} `json:"internal_data" sentinel:""`
    16  
    17  	// LeaseID is the ID returned to the user to manage this secret.
    18  	// This is generated by Vault core. Any set value will be ignored.
    19  	// For requests, this will always be blank.
    20  	LeaseID string `sentinel:""`
    21  }
    22  
    23  func (s *Secret) Validate() error {
    24  	if s.TTL < 0 {
    25  		return fmt.Errorf("ttl duration must not be less than zero")
    26  	}
    27  
    28  	return nil
    29  }
    30  
    31  func (s *Secret) GoString() string {
    32  	return fmt.Sprintf("*%#v", *s)
    33  }