Further Refactoring
This commit is contained in:
		| @@ -53,12 +53,6 @@ func NewOptions(opts ...Option) Options { | ||||
| type GenerateOptions struct { | ||||
| 	// Expiry for the token | ||||
| 	Expiry time.Duration | ||||
| 	// Metadata associated with the account | ||||
| 	Metadata map[string]string | ||||
| 	// Roles/scopes associated with the account | ||||
| 	Roles []string | ||||
| 	// Namespace the account belongs too | ||||
| 	Namespace string | ||||
| } | ||||
|  | ||||
| type GenerateOption func(o *GenerateOptions) | ||||
| @@ -70,27 +64,6 @@ func WithExpiry(d time.Duration) GenerateOption { | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithMetadata for the token | ||||
| func WithMetadata(md map[string]string) func(o *GenerateOptions) { | ||||
| 	return func(o *GenerateOptions) { | ||||
| 		o.Metadata = md | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithRoles for the token | ||||
| func WithRoles(rs ...string) func(o *GenerateOptions) { | ||||
| 	return func(o *GenerateOptions) { | ||||
| 		o.Roles = rs | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // WithNamespace for the token | ||||
| func WithNamespace(n string) func(o *GenerateOptions) { | ||||
| 	return func(o *GenerateOptions) { | ||||
| 		o.Namespace = n | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // NewGenerateOptions from a slice of options | ||||
| func NewGenerateOptions(opts ...GenerateOption) GenerateOptions { | ||||
| 	var options GenerateOptions | ||||
|   | ||||
		Reference in New Issue
	
	Block a user