Skip to content

Commit

Permalink
Add support for custom query parameters (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
averche authored May 15, 2023
1 parent 17a3684 commit 02935ed
Show file tree
Hide file tree
Showing 9 changed files with 1,042 additions and 956 deletions.
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,11 @@ should unwrap it first as demonstrated [here](#response-wrapping--unwrapping).
### Using Generic Accessors

The library provides the following generic accessors which let you read, modify,
and delete an arbitrary path within Vault:
list, and delete an arbitrary path within Vault:

```go
client.Read(...)
client.ReadWithParameters(...)
client.ReadRaw(...)
client.ReadRawWithParameters(...)

client.Write(...)
client.WriteFromBytes(...)
Expand All @@ -152,7 +150,6 @@ client.WriteFromReader(...)
client.List(...)

client.Delete(...)
client.DeleteWithParameters(...)
```

For example, `client.Secrets.KvV2Write(...)` from
Expand Down Expand Up @@ -238,6 +235,25 @@ secret, err := client.Secrets.KvV2Read(
)
```

#### Adding Custom Headers and Custom Query Parameters

The library allows adding custom headers and query parameters to all requests:

```go
resp, err := client.Read(
ctx,
"/path/to/my/secret",
vault.WithCustomHeaders(http.Header{
"x-test-header1": {"a", "b"},
"x-test-header2": {"c", "d"},
}),
vault.WithCustomQueryParameters(url.Values{
"param1": {"a"},
"param2": {"b"},
}),
)
```

#### Response Wrapping & Unwrapping

Please refer to the [response-wrapping documentation][doc-response-wrapping] for
Expand Down
556 changes: 278 additions & 278 deletions api_auth.go

Large diffs are not rendered by default.

Loading

0 comments on commit 02935ed

Please sign in to comment.