| 1 |
## File Storage Files SDK for API version 2018-11-09 |
| 2 |
|
| 3 |
This package allows you to interact with the Files File Storage API |
| 4 |
|
| 5 |
### Supported Authorizers |
| 6 |
|
| 7 |
* Azure Active Directory (for the Resource Endpoint `https://storage.azure.com`) |
| 8 |
* SharedKeyLite (Blob, File & Queue) |
| 9 |
|
| 10 |
### Example Usage |
| 11 |
|
| 12 |
```go |
| 13 |
package main |
| 14 |
|
| 15 |
import ( |
| 16 |
"context" |
| 17 |
"fmt" |
| 18 |
"time" |
| 19 |
|
| 20 |
"github.com/Azure/go-autorest/autorest" |
| 21 |
"github.com/tombuildsstuff/giovanni/storage/2018-11-09/file/files" |
| 22 |
) |
| 23 |
|
| 24 |
func Example() error { |
| 25 |
accountName := "storageaccount1" |
| 26 |
storageAccountKey := "ABC123...." |
| 27 |
shareName := "myshare" |
| 28 |
directoryName := "myfiles" |
| 29 |
fileName := "example.txt" |
| 30 |
|
| 31 |
storageAuth := autorest.NewSharedKeyLiteAuthorizer(accountName, storageAccountKey) |
| 32 |
filesClient := files.New() |
| 33 |
filesClient.Client.Authorizer = storageAuth |
| 34 |
|
| 35 |
ctx := context.TODO() |
| 36 |
input := files.CreateInput{} |
| 37 |
if _, err := filesClient.Create(ctx, accountName, shareName, directoryName, fileName, input); err != nil { |
| 38 |
return fmt.Errorf("Error creating File: %s", err) |
| 39 |
} |
| 40 |
|
| 41 |
return nil |
| 42 |
} |
| 43 |
``` |