Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matthewhartstonge/sassy
Sassy provides a Go library to generate Azure SAS tokens.
https://github.com/matthewhartstonge/sassy
azure go golang sas tokens
Last synced: 13 days ago
JSON representation
Sassy provides a Go library to generate Azure SAS tokens.
- Host: GitHub
- URL: https://github.com/matthewhartstonge/sassy
- Owner: matthewhartstonge
- License: apache-2.0
- Created: 2021-08-18T06:02:15.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-20T12:18:04.000Z (about 3 years ago)
- Last Synced: 2024-11-03T19:42:26.239Z (2 months ago)
- Topics: azure, go, golang, sas, tokens
- Language: Go
- Homepage:
- Size: 93.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# sassy
> It's SASsy az ...Sassy provides a Go library to generate Azure SAS tokens.
## Examples
### Storage
#### Generating an Account SAS```go
package mainimport (
"fmt"
"log""github.com/matthewhartstonge/sassy/storage"
"github.com/matthewhartstonge/sassy/storage/versions"
)func main() {
// Get SAS~sy with it...
sas, err := storage.NewAccountSAS(
"yourStorageAccountName",
"yourStorageAccountKey",
// signedVersion specifies what API version to use in order to generate
// the storage SAS token - must be set to version 2015-04-05 or later.
// Current valid versions can be found in `storage/versions/versions.go`
versions.Latest.String(),
// signedServices supports:
// Blob = "b"
// Queue = "q"
// Table = "t"
// File = "f"
"bqtf",
// signedResourceTypes supports:
// Service = "s"
// Container = "c"
// Object = "o"
"sco",
// signedPermissions doesn't care what order you specify them in, it
// works out the required order for you, and negates the permissions
// not eligible based on your specified API version :3
//
// Note:
// - There are too many permissions to list here, so instead refer to:
// https://docs.microsoft.com/en-us/rest/api/storageservices/create-service-sas#permissions-for-a-directory-container-or-blob
"rlw",
// signedExpiry aims to be developer and ops friendly by first and
// foremost attempting to parse a given date in your local timezone, so
// you no longer have to worry about converting to UTC - unless you
// want to... Then add a Z!
// Formats supported:
// - YYYY-MM-DD
// - YYYY-MM-DD
// - YYYY-MM-DDThh:mm
// - YYYY-MM-DDThh:mm
// - YYYY-MM-DDThh:mm:ss
// - YYYY-MM-DDThh:mm:ss
"2021-12-12",
)
if err != nil {
// You broke my SAS... :(
log.Fatal(err)
}// Get a signed SAS token:
fmt.Println(sas.Token())
}
```## TODO
* Storage: Service SAS generation
* Storage: User Delegation SAS generation
* CLI tool