shares

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

README

File Storage Shares SDK for API version 2018-03-28

This package allows you to interact with the Shares File Storage API

Supported Authorizers

  • Azure Active Directory (for the Resource Endpoint https://storage.azure.com)
  • SharedKeyLite (Blob, File & Queue)

Example Usage

package main

import (
	"context"
	"fmt"
	"time"
	
	"github.com/Azure/go-autorest/autorest"
	"github.com/tombuildsstuff/giovanni/storage/2018-03-28/file/shares"
)

func Example() error {
	accountName := "storageaccount1"
    storageAccountKey := "ABC123...."
    shareName := "myshare"
    
    storageAuth := autorest.NewSharedKeyLiteAuthorizer(accountName, storageAccountKey)
    sharesClient := shares.New()
    sharesClient.Client.Authorizer = storageAuth
    
    ctx := context.TODO()
    input := shares.CreateInput{
    	QuotaInGB: 2,
    }
    if _, err := sharesClient.Create(ctx, accountName, shareName, input); err != nil {
        return fmt.Errorf("Error creating Share: %s", err)
    }
    
    return nil 
}

Documentation

Index

Constants

View Source
const APIVersion = "2018-03-28"

APIVersion is the version of the API used for all Storage API Operations

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

Types

type AccessPolicy

type AccessPolicy struct {
	Start      string `xml:"Start"`
	Expiry     string `xml:"Expiry"`
	Permission string `xml:"Permission"`
}

type Client

type Client struct {
	autorest.Client
	BaseURI string
}

Client is the base client for File Storage Shares.

func New

func New() Client

New creates an instance of the Client client.

func NewWithEnvironment

func NewWithEnvironment(environment azure.Environment) Client

NewWithEnvironment creates an instance of the Client client.

func (Client) Create

func (client Client) Create(ctx context.Context, accountName, shareName string, input CreateInput) (result autorest.Response, err error)

Create creates the specified Storage Share within the specified Storage Account

func (Client) CreatePreparer

func (client Client) CreatePreparer(ctx context.Context, accountName, shareName string, input CreateInput) (*http.Request, error)

CreatePreparer prepares the Create request.

func (Client) CreateResponder

func (client Client) CreateResponder(resp *http.Response) (result autorest.Response, err error)

CreateResponder handles the response to the Create request. The method always closes the http.Response Body.

func (Client) CreateSender

func (client Client) CreateSender(req *http.Request) (*http.Response, error)

CreateSender sends the Create request. The method will close the http.Response Body if it receives an error.

func (Client) CreateSnapshot

func (client Client) CreateSnapshot(ctx context.Context, accountName, shareName string, input CreateSnapshotInput) (result CreateSnapshotResult, err error)

CreateSnapshot creates a read-only snapshot of the share A share can support creation of 200 share snapshots. Attempting to create more than 200 share snapshots fails with 409 (Conflict). Attempting to create a share snapshot while a previous Snapshot Share operation is in progress fails with 409 (Conflict).

func (Client) CreateSnapshotPreparer

func (client Client) CreateSnapshotPreparer(ctx context.Context, accountName, shareName string, input CreateSnapshotInput) (*http.Request, error)

CreateSnapshotPreparer prepares the CreateSnapshot request.

func (Client) CreateSnapshotResponder

func (client Client) CreateSnapshotResponder(resp *http.Response) (result CreateSnapshotResult, err error)

CreateSnapshotResponder handles the response to the CreateSnapshot request. The method always closes the http.Response Body.

func (Client) CreateSnapshotSender

func (client Client) CreateSnapshotSender(req *http.Request) (*http.Response, error)

CreateSnapshotSender sends the CreateSnapshot request. The method will close the http.Response Body if it receives an error.

func (Client) Delete

func (client Client) Delete(ctx context.Context, accountName, shareName string, deleteSnapshots bool) (result autorest.Response, err error)

Delete deletes the specified Storage Share from within a Storage Account

func (Client) DeletePreparer

func (client Client) DeletePreparer(ctx context.Context, accountName, shareName string, deleteSnapshots bool) (*http.Request, error)

DeletePreparer prepares the Delete request.

func (Client) DeleteResponder

func (client Client) DeleteResponder(resp *http.Response) (result autorest.Response, err error)

DeleteResponder handles the response to the Delete request. The method always closes the http.Response Body.

func (Client) DeleteSender

func (client Client) DeleteSender(req *http.Request) (*http.Response, error)

DeleteSender sends the Delete request. The method will close the http.Response Body if it receives an error.

func (Client) DeleteSnapshot

func (client Client) DeleteSnapshot(ctx context.Context, accountName, shareName string, shareSnapshot string) (result autorest.Response, err error)

DeleteSnapshot deletes the specified Snapshot of a Storage Share

func (Client) DeleteSnapshotPreparer

func (client Client) DeleteSnapshotPreparer(ctx context.Context, accountName, shareName string, shareSnapshot string) (*http.Request, error)

DeleteSnapshotPreparer prepares the DeleteSnapshot request.

func (Client) DeleteSnapshotResponder

func (client Client) DeleteSnapshotResponder(resp *http.Response) (result autorest.Response, err error)

DeleteSnapshotResponder handles the response to the DeleteSnapshot request. The method always closes the http.Response Body.

func (Client) DeleteSnapshotSender

func (client Client) DeleteSnapshotSender(req *http.Request) (*http.Response, error)

DeleteSnapshotSender sends the DeleteSnapshot request. The method will close the http.Response Body if it receives an error.

func (Client) GetACL

func (client Client) GetACL(ctx context.Context, accountName, shareName string) (result GetACLResult, err error)

GetACL get the Access Control List for the specified Storage Share

func (Client) GetACLPreparer

func (client Client) GetACLPreparer(ctx context.Context, accountName, shareName string) (*http.Request, error)

GetACLPreparer prepares the GetACL request.

func (Client) GetACLResponder

func (client Client) GetACLResponder(resp *http.Response) (result GetACLResult, err error)

GetACLResponder handles the response to the GetACL request. The method always closes the http.Response Body.

func (Client) GetACLSender

func (client Client) GetACLSender(req *http.Request) (*http.Response, error)

GetACLSender sends the GetACL request. The method will close the http.Response Body if it receives an error.

func (Client) GetMetaData

func (client Client) GetMetaData(ctx context.Context, accountName, shareName string) (result GetMetaDataResult, err error)

GetMetaData returns the MetaData associated with the specified Storage Share

func (Client) GetMetaDataPreparer

func (client Client) GetMetaDataPreparer(ctx context.Context, accountName, shareName string) (*http.Request, error)

GetMetaDataPreparer prepares the GetMetaData request.

func (Client) GetMetaDataResponder

func (client Client) GetMetaDataResponder(resp *http.Response) (result GetMetaDataResult, err error)

GetMetaDataResponder handles the response to the GetMetaData request. The method always closes the http.Response Body.

func (Client) GetMetaDataSender

func (client Client) GetMetaDataSender(req *http.Request) (*http.Response, error)

GetMetaDataSender sends the GetMetaData request. The method will close the http.Response Body if it receives an error.

func (Client) GetProperties

func (client Client) GetProperties(ctx context.Context, accountName, shareName string) (result GetPropertiesResult, err error)

GetProperties returns the properties about the specified Storage Share

func (Client) GetPropertiesPreparer

func (client Client) GetPropertiesPreparer(ctx context.Context, accountName, shareName string) (*http.Request, error)

GetPropertiesPreparer prepares the GetProperties request.

func (Client) GetPropertiesResponder

func (client Client) GetPropertiesResponder(resp *http.Response) (result GetPropertiesResult, err error)

GetPropertiesResponder handles the response to the GetProperties request. The method always closes the http.Response Body.

func (Client) GetPropertiesSender

func (client Client) GetPropertiesSender(req *http.Request) (*http.Response, error)

GetPropertiesSender sends the GetProperties request. The method will close the http.Response Body if it receives an error.

func (Client) GetResourceID

func (client Client) GetResourceID(accountName, shareName string) string

GetResourceID returns the Resource ID for the given File Share This can be useful when, for example, you're using this as a unique identifier

func (Client) GetSnapshot

func (client Client) GetSnapshot(ctx context.Context, accountName, shareName, snapshotShare string) (result GetSnapshotPropertiesResult, err error)

GetSnapshot gets information about the specified Snapshot of the specified Storage Share

func (Client) GetSnapshotPreparer

func (client Client) GetSnapshotPreparer(ctx context.Context, accountName, shareName, snapshotShare string) (*http.Request, error)

GetSnapshotPreparer prepares the GetSnapshot request.

func (Client) GetSnapshotResponder

func (client Client) GetSnapshotResponder(resp *http.Response) (result GetSnapshotPropertiesResult, err error)

GetSnapshotResponder handles the response to the GetSnapshot request. The method always closes the http.Response Body.

func (Client) GetSnapshotSender

func (client Client) GetSnapshotSender(req *http.Request) (*http.Response, error)

GetSnapshotSender sends the GetSnapshot request. The method will close the http.Response Body if it receives an error.

func (Client) GetStats

func (client Client) GetStats(ctx context.Context, accountName, shareName string) (result GetStatsResult, err error)

GetStats returns information about the specified Storage Share

func (Client) GetStatsPreparer

func (client Client) GetStatsPreparer(ctx context.Context, accountName, shareName string) (*http.Request, error)

GetStatsPreparer prepares the GetStats request.

func (Client) GetStatsResponder

func (client Client) GetStatsResponder(resp *http.Response) (result GetStatsResult, err error)

GetStatsResponder handles the response to the GetStats request. The method always closes the http.Response Body.

func (Client) GetStatsSender

func (client Client) GetStatsSender(req *http.Request) (*http.Response, error)

GetStatsSender sends the GetStats request. The method will close the http.Response Body if it receives an error.

func (Client) SetACL

func (client Client) SetACL(ctx context.Context, accountName, shareName string, acls []SignedIdentifier) (result autorest.Response, err error)

SetACL sets the specified Access Control List on the specified Storage Share

func (Client) SetACLPreparer

func (client Client) SetACLPreparer(ctx context.Context, accountName, shareName string, acls []SignedIdentifier) (*http.Request, error)

SetACLPreparer prepares the SetACL request.

func (Client) SetACLResponder

func (client Client) SetACLResponder(resp *http.Response) (result autorest.Response, err error)

SetACLResponder handles the response to the SetACL request. The method always closes the http.Response Body.

func (Client) SetACLSender

func (client Client) SetACLSender(req *http.Request) (*http.Response, error)

SetACLSender sends the SetACL request. The method will close the http.Response Body if it receives an error.

func (Client) SetMetaData

func (client Client) SetMetaData(ctx context.Context, accountName, shareName string, metaData map[string]string) (result autorest.Response, err error)

SetMetaData sets the MetaData on the specified Storage Share

func (Client) SetMetaDataPreparer

func (client Client) SetMetaDataPreparer(ctx context.Context, accountName, shareName string, metaData map[string]string) (*http.Request, error)

SetMetaDataPreparer prepares the SetMetaData request.

func (Client) SetMetaDataResponder

func (client Client) SetMetaDataResponder(resp *http.Response) (result autorest.Response, err error)

SetMetaDataResponder handles the response to the SetMetaData request. The method always closes the http.Response Body.

func (Client) SetMetaDataSender

func (client Client) SetMetaDataSender(req *http.Request) (*http.Response, error)

SetPropertiesSetMetaDataSender sends the SetMetaData request. The method will close the http.Response Body if it receives an error.

func (Client) SetProperties

func (client Client) SetProperties(ctx context.Context, accountName, shareName string, newQuotaGB int) (result autorest.Response, err error)

SetProperties lets you update the Quota for the specified Storage Share

func (Client) SetPropertiesPreparer

func (client Client) SetPropertiesPreparer(ctx context.Context, accountName, shareName string, quotaGB int) (*http.Request, error)

SetPropertiesPreparer prepares the SetProperties request.

func (Client) SetPropertiesResponder

func (client Client) SetPropertiesResponder(resp *http.Response) (result autorest.Response, err error)

SetPropertiesResponder handles the response to the SetProperties request. The method always closes the http.Response Body.

func (Client) SetPropertiesSender

func (client Client) SetPropertiesSender(req *http.Request) (*http.Response, error)

SetPropertiesSender sends the SetProperties request. The method will close the http.Response Body if it receives an error.

type CreateInput

type CreateInput struct {
	// Specifies the maximum size of the share, in gigabytes.
	// Must be greater than 0, and less than or equal to 5TB (5120).
	QuotaInGB int

	MetaData map[string]string
}

type CreateSnapshotInput

type CreateSnapshotInput struct {
	MetaData map[string]string
}

type CreateSnapshotResult

type CreateSnapshotResult struct {
	autorest.Response

	// This header is a DateTime value that uniquely identifies the share snapshot.
	// The value of this header may be used in subsequent requests to access the share snapshot.
	// This value is opaque.
	SnapshotDateTime string
}

type GetACLResult

type GetACLResult struct {
	autorest.Response

	SignedIdentifiers []SignedIdentifier `xml:"SignedIdentifier"`
}

type GetMetaDataResult

type GetMetaDataResult struct {
	autorest.Response

	MetaData map[string]string
}

type GetPropertiesResult

type GetPropertiesResult struct {
	autorest.Response

	MetaData   map[string]string
	ShareQuota int
}

type GetSnapshotPropertiesResult

type GetSnapshotPropertiesResult struct {
	autorest.Response

	MetaData map[string]string
}

type GetStatsResult

type GetStatsResult struct {
	autorest.Response

	// The approximate size of the data stored on the share.
	// Note that this value may not include all recently created or recently resized files.
	ShareUsageBytes int64 `xml:"ShareUsageBytes"`
}

type ResourceID

type ResourceID struct {
	AccountName string
	ShareName   string
}

func ParseResourceID added in v0.2.0

func ParseResourceID(id string) (*ResourceID, error)

ParseResourceID parses the specified Resource ID and returns an object which can be used to interact with the Storage Shares SDK

type SignedIdentifier

type SignedIdentifier struct {
	Id           string       `xml:"Id"`
	AccessPolicy AccessPolicy `xml:"AccessPolicy"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL