Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 1.26 KB

README.md

File metadata and controls

56 lines (40 loc) · 1.26 KB

Blob Storage Account SDK for API version 2020-08-04

This package allows you to interact with the Accounts Blob Storage API

Supported Authorizers

  • Azure Active Directory

Example Usage

package main

import (
	"context"
	"fmt"
	"time"
	
	"github.com/tombuildsstuff/giovanni/storage/2020-08-04/blob/accounts"
)

func Example() error {
	accountName := "storageaccount1"
    
    // e.g. https://github.com/tombuildsstuff/giovanni/blob/76f5f686c99ecdcc3fa533a0330d0e1aacb1c327/example/azuread-auth/main.go#L54
    client, err := buildClient()
    if err != nil {
    	return fmt.Errorf("error building client: %s", err)
    }
    
    ctx := context.TODO()
    
    input := StorageServiceProperties{
        StaticWebsite: &StaticWebsite{
            Enabled:              true,
            IndexDocument:        index,
            ErrorDocument404Path: errorDocument,
        },
    }
    
    _, err = client.SetServiceProperties(ctx, accountName, input)
    if err != nil {
        return fmt.Errorf("error setting properties: %s", err)
    }
    
    time.Sleep(2 * time.Second)
    
    _, err = accountsClient.GetServiceProperties(ctx, accountName)
    if err != nil {
        return fmt.Errorf("error getting properties: %s", err)
    }
    
    return nil 
}