mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-30 18:17:55 +00:00 
			
		
		
		
	VAULT-12144: add openapi responses for /sys/wrapping endpoints (#18627)
* add response structures for /sys/wrapping endpoints Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com> * added changelog * dynamic tests should be nil Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com> --------- Signed-off-by: Daniel Huckins <dhuckins@users.noreply.github.com>
This commit is contained in:
		
							
								
								
									
										3
									
								
								changelog/18627.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								changelog/18627.txt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | ```release-note:improvement | ||||||
|  | openapi: add openapi response definitions to /sys/wrapping endpoints | ||||||
|  | ``` | ||||||
| @@ -3135,8 +3135,17 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path { | |||||||
| 		{ | 		{ | ||||||
| 			Pattern: "wrapping/wrap$", | 			Pattern: "wrapping/wrap$", | ||||||
|  |  | ||||||
| 			Callbacks: map[logical.Operation]framework.OperationFunc{ | 			Operations: map[logical.Operation]framework.OperationHandler{ | ||||||
| 				logical.UpdateOperation: b.handleWrappingWrap, | 				logical.UpdateOperation: &framework.PathOperation{ | ||||||
|  | 					Callback: b.handleWrappingWrap, | ||||||
|  | 					Responses: map[int][]framework.Response{ | ||||||
|  | 						http.StatusOK: {{ | ||||||
|  | 							Description: "OK", | ||||||
|  | 							// dynamic fields | ||||||
|  | 							Fields: nil, | ||||||
|  | 						}}, | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			HelpSynopsis:    strings.TrimSpace(sysHelp["wrap"][0]), | 			HelpSynopsis:    strings.TrimSpace(sysHelp["wrap"][0]), | ||||||
| @@ -3154,8 +3163,20 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path { | |||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			Callbacks: map[logical.Operation]framework.OperationFunc{ | 			Operations: map[logical.Operation]framework.OperationHandler{ | ||||||
| 				logical.UpdateOperation: b.handleWrappingUnwrap, | 				logical.UpdateOperation: &framework.PathOperation{ | ||||||
|  | 					Callback: b.handleWrappingUnwrap, | ||||||
|  | 					Responses: map[int][]framework.Response{ | ||||||
|  | 						http.StatusOK: {{ | ||||||
|  | 							Description: "OK", | ||||||
|  | 							// dynamic fields | ||||||
|  | 							Fields: nil, | ||||||
|  | 						}}, | ||||||
|  | 						http.StatusNoContent: {{ | ||||||
|  | 							Description: "No content", | ||||||
|  | 						}}, | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			HelpSynopsis:    strings.TrimSpace(sysHelp["unwrap"][0]), | 			HelpSynopsis:    strings.TrimSpace(sysHelp["unwrap"][0]), | ||||||
| @@ -3175,10 +3196,48 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path { | |||||||
| 				logical.UpdateOperation: &framework.PathOperation{ | 				logical.UpdateOperation: &framework.PathOperation{ | ||||||
| 					Callback: b.handleWrappingLookup, | 					Callback: b.handleWrappingLookup, | ||||||
| 					Summary:  "Look up wrapping properties for the given token.", | 					Summary:  "Look up wrapping properties for the given token.", | ||||||
|  | 					Responses: map[int][]framework.Response{ | ||||||
|  | 						http.StatusOK: {{ | ||||||
|  | 							Description: "OK", | ||||||
|  | 							Fields: map[string]*framework.FieldSchema{ | ||||||
|  | 								"creation_ttl": { | ||||||
|  | 									Type:     framework.TypeDurationSecond, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 								"creation_time": { | ||||||
|  | 									Type:     framework.TypeTime, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 								"creation_path": { | ||||||
|  | 									Type:     framework.TypeString, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 							}, | ||||||
|  | 						}}, | ||||||
|  | 					}, | ||||||
| 				}, | 				}, | ||||||
| 				logical.ReadOperation: &framework.PathOperation{ | 				logical.ReadOperation: &framework.PathOperation{ | ||||||
| 					Callback: b.handleWrappingLookup, | 					Callback: b.handleWrappingLookup, | ||||||
| 					Summary:  "Look up wrapping properties for the requester's token.", | 					Summary:  "Look up wrapping properties for the requester's token.", | ||||||
|  | 					Responses: map[int][]framework.Response{ | ||||||
|  | 						http.StatusOK: {{ | ||||||
|  | 							Description: "OK", | ||||||
|  | 							Fields: map[string]*framework.FieldSchema{ | ||||||
|  | 								"creation_ttl": { | ||||||
|  | 									Type:     framework.TypeDurationSecond, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 								"creation_time": { | ||||||
|  | 									Type:     framework.TypeTime, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 								"creation_path": { | ||||||
|  | 									Type:     framework.TypeString, | ||||||
|  | 									Required: false, | ||||||
|  | 								}, | ||||||
|  | 							}, | ||||||
|  | 						}}, | ||||||
|  | 					}, | ||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| @@ -3195,8 +3254,17 @@ func (b *SystemBackend) wrappingPaths() []*framework.Path { | |||||||
| 				}, | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			Callbacks: map[logical.Operation]framework.OperationFunc{ | 			Operations: map[logical.Operation]framework.OperationHandler{ | ||||||
| 				logical.UpdateOperation: b.handleWrappingRewrap, | 				logical.UpdateOperation: &framework.PathOperation{ | ||||||
|  | 					Callback: b.handleWrappingRewrap, | ||||||
|  | 					Responses: map[int][]framework.Response{ | ||||||
|  | 						http.StatusOK: {{ | ||||||
|  | 							Description: "OK", | ||||||
|  | 							// dynamic fields | ||||||
|  | 							Fields: nil, | ||||||
|  | 						}}, | ||||||
|  | 					}, | ||||||
|  | 				}, | ||||||
| 			}, | 			}, | ||||||
|  |  | ||||||
| 			HelpSynopsis:    strings.TrimSpace(sysHelp["rewrap"][0]), | 			HelpSynopsis:    strings.TrimSpace(sysHelp["rewrap"][0]), | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Huckins
					Daniel Huckins