Documentation ¶
Overview ¶
Package azfile allows you to manipulate Azure Storage shares, directories and files objects.
URL Types ¶
The most common types you'll work with are the XxxURL types. The methods of these types make requests against the Azure Storage Service.
- ServiceURL's methods perform operations on a storage account.
- ShareURL's methods perform operations on an account's share. -DirectoryURL's methods perform operations on a share's directory. -FileURL's methods perform operations on a directory's file.
Internally, each XxxURL object contains a URL and a request pipeline. The URL indicates the endpoint where each HTTP request is sent and the pipeline indicates how the outgoing HTTP request and incoming HTTP response is processed. The pipeline specifies things like retry policies, logging, deserialization of HTTP response payloads, and more.
Pipelines are thread-safe and may be shared by multiple XxxURL objects. When you create a ServiceURL, you pass an initial pipeline. When you call ServiceURL's NewShareURL method, the new ShareURL object has its own URL but it shares the same pipeline as the parent ServiceURL object.
To work with a directory, call ShareURL or DirectoryURL's NewDirectoryURL method to get a new DirectoryURL object. The new DirectoryURL object has its own URL but it shares the same pipeline as the parent XxxURL object.
To work with a file, call DirectoryURL's NewFileURL method. When you call DirectoryURL's NewFileURL, the new FileURL object has its own URL but it shares the same pipeline as the parent DirectoryURL object.
If you'd like to use a different pipeline with a ServiceURL, ShareURL, DirectoryURL or FileURL object, then call the XxxURL object's WithPipeline method passing in the desired pipeline. The WithPipeline methods create a new XxxURL object with the same URL as the original but with the specified pipeline.
Note that XxxURL objects use little memory, are goroutine-safe, and many objects share the same pipeline. This means that XxxURL objects share a lot of system resources making them very efficient.
All of XxxURL's methods that make HTTP requests return rich error handling information so you can discern network failures, transient failures, timeout failures, service failures, etc. See the StorageError interface for more information and an example of how to do deal with errors.
URL and Shared Access Signature Manipulation ¶
The library includes a FileURLParts type for deconstructing and reconstructing URLs. And you can use the following there types for generating and parsing Shared Access Signature (SAS)
- Use the AccountSASSignatureValues type to create a SAS for a storage account.
- Use the FileSASSignatureValues type to create a SAS for a share or file.
- Use the SASQueryParameters type to turn signature values in to query parameres or to parse query parameters.
To generate a SAS, you must use the SharedKeyCredential type.
Credentials ¶
When creating a request pipeline, you must specify one of this package's credential types.
- Call the NewAnonymousCredential function for requests that contain a Shared Access Signature (SAS).
- Call the NewSharedKeyCredential function (with an account name & key) to access any account resources. You must also use this to generate Shared Access Signatures.
HTTP Request Policy Factories ¶
This package defines several request policy factories for use with the pipeline package. Most applications will not use these factories directly; instead, the NewPipeline function creates these factories, initializes them (via the PipelineOptions type) and returns a pipeline object for use by the XxxURL objects.
However, for advanced scenarios, developers can access these policy factories directly and even create their own and then construct their own pipeline in order to affect HTTP requests and responses performed by the XxxURL objects. For example, developers can introduce their own logging, random failures, request recording & playback for fast testing, HTTP request pacing, alternate retry mechanisms, metering, metrics, etc. The possibilities are endless!
Below are the request pipeline policy factory functions that are provided with this package:
- NewRetryPolicyFactory Enables rich retry semantics for failed HTTP requests.
- NewRequestLogPolicyFactory Enables rich logging support for HTTP requests/responses & failures.
- NewTelemetryPolicyFactory Enables simple modification of the HTTP request's User-Agent header so each request reports the SDK version & language/runtime making the requests.
- NewUniqueRequestIDPolicyFactory Adds a x-ms-client-request-id header with a unique UUID value to an HTTP request to help with diagnosing failures.
Also, note that all the NewXxxCredential functions return request policy factory objects which get injected into the pipeline.
Example ¶
This example shows how to get started using the Azure Storage File SDK for Go.
package main import ( "bytes" "context" "fmt" "log" "net/url" "os" "strings" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account's name and account key. accountName, accountKey := accountInfo() // Use your Storage account's name and key to create a credential object; this is used to access your account. credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a request pipeline that is used to process HTTP(S) requests and responses. It requires // your account credentials. In more advanced scenarios, you can configure telemetry, retry policies, // logging, and other options. Also, you can configure multiple request pipelines for different scenarios. p := azfile.NewPipeline(credential, azfile.PipelineOptions{}) // From the Azure portal, get your Storage account file service URL endpoint. // The URL typically looks like this: u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net", accountName)) // Create an ServiceURL object that wraps the service URL and a request pipeline. serviceURL := azfile.NewServiceURL(*u, p) // Now, you can use the serviceURL to perform various share and file operations. // All HTTP operations allow you to specify a Go context.Context object to control cancellation/timeout. ctx := context.Background() // This example uses a never-expiring context. // This example shows several common operations just to get you started. // Create a URL that references a to-be-created share in your Azure Storage account. // This returns a ShareURL object that wraps the share's URL and a request pipeline (inherited from serviceURL) shareURL := serviceURL.NewShareURL("mysharehelloworld") // Share names require lowercase // Create the share on the service (with no metadata and default quota size) _, err = shareURL.Create(ctx, azfile.Metadata{}, 0) if err != nil && err.(azfile.StorageError) != nil && err.(azfile.StorageError).ServiceCode() != azfile.ServiceCodeShareAlreadyExists { log.Fatal(err) } // Create a URL that references to root directory in your Azure Storage account's share. // This returns a DirectoryURL object that wraps the directory's URL and a request pipeline (inherited from shareURL) directoryURL := shareURL.NewRootDirectoryURL() // Create a URL that references a to-be-created file in your Azure Storage account's directory. // This returns a FileURL object that wraps the file's URL and a request pipeline (inherited from directoryURL) fileURL := directoryURL.NewFileURL("HelloWorld.txt") // File names can be mixed case and is case insensitive // Create the file with string (plain text) content. data := "Hello World!" length := int64(len(data)) _, err = fileURL.Create(ctx, length, azfile.FileHTTPHeaders{ContentType: "text/plain"}, azfile.Metadata{}) if err != nil { log.Fatal(err) } _, err = fileURL.UploadRange(ctx, 0, strings.NewReader(data), nil) if err != nil { log.Fatal(err) } // Download the file's contents and verify that it worked correctly. // User can specify 0 as offset and azfile.CountToEnd(-1) as count to indiciate downloading the entire file. get, err := fileURL.Download(ctx, 0, azfile.CountToEnd, false) if err != nil { log.Fatal(err) } downloadedData := &bytes.Buffer{} retryReader := get.Body(azfile.RetryReaderOptions{}) defer retryReader.Close() // The client must close the response body when finished with it downloadedData.ReadFrom(retryReader) fmt.Println("File content: " + downloadedData.String()) // New a reference to a directory with name DemoDir in share, and create the directory. directoryDemoURL := shareURL.NewDirectoryURL("DemoDir") _, err = directoryDemoURL.Create(ctx, azfile.Metadata{}, azfile.SMBProperties{}) if err != nil && err.(azfile.StorageError) != nil && err.(azfile.StorageError).ServiceCode() != azfile.ServiceCodeResourceAlreadyExists { log.Fatal(err) } // List the file(s) and directory(s) in our share's root directory; since a directory may hold millions of files and directories, this is done 1 segment at a time. for marker := (azfile.Marker{}); marker.NotDone(); { // The parentheses around azfile.Marker{} are required to avoid compiler error. // Get a result segment starting with the file indicated by the current Marker. listResponse, err := directoryURL.ListFilesAndDirectoriesSegment(ctx, marker, azfile.ListFilesAndDirectoriesOptions{}) if err != nil { log.Fatal(err) } // IMPORTANT: ListFilesAndDirectoriesSegment returns the start of the next segment; you MUST use this to get // the next segment (after processing the current result segment). marker = listResponse.NextMarker // Process the files returned in this result segment (if the segment is empty, the loop body won't execute) for _, fileEntry := range listResponse.FileItems { fmt.Println("File name: " + fileEntry.Name) } // Process the directories returned in this result segment (if the segment is empty, the loop body won't execute) for _, directoryEntry := range listResponse.DirectoryItems { fmt.Println("Directory name: " + directoryEntry.Name) } } // Delete the file we created earlier. _, err = fileURL.Delete(ctx) if err != nil { log.Fatal(err) } // Delete the share we created earlier (with azfile.DeleteSnapshotsOptionNone as no snapshot exists and needs to be deleted). _, err = shareURL.Delete(ctx, azfile.DeleteSnapshotsOptionNone) if err != nil { log.Fatal(err) } }
Output: File content: Hello World! File name: HelloWorld.txt Directory name: DemoDir
Index ¶
- Constants
- Variables
- func FormatTimesForSASSigning(startTime, expiryTime time.Time) (string, string)
- func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline
- func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory
- func NewResponseError(cause error, response *http.Response, description string) error
- func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory
- func NewRetryReader(ctx context.Context, initialResponse *http.Response, info HTTPGetterInfo, ...) io.ReadCloser
- func NewTelemetryPolicyFactory(o TelemetryOptions) pipeline.Factory
- func NewUniqueRequestIDPolicyFactory() pipeline.Factory
- func RedactSigQueryParam(rawQuery string) (bool, string)
- func UploadBufferToAzureFile(ctx context.Context, b []byte, fileURL FileURL, o UploadToAzureFileOptions) error
- func UploadFileToAzureFile(ctx context.Context, file *os.File, fileURL FileURL, ...) error
- func UserAgent() string
- func Version() string
- type AccessPolicy
- type AccessPolicyPermission
- type AccountSASPermissions
- type AccountSASResourceTypes
- type AccountSASServices
- type AccountSASSignatureValues
- type CopyStatusType
- type CorsRule
- type Credential
- type DeleteSnapshotsOptionType
- type DirectoryCreateResponse
- func (dcr DirectoryCreateResponse) Date() time.Time
- func (dcr DirectoryCreateResponse) ETag() ETag
- func (dcr DirectoryCreateResponse) ErrorCode() string
- func (dcr DirectoryCreateResponse) FileAttributes() string
- func (dcr DirectoryCreateResponse) FileChangeTime() string
- func (dcr DirectoryCreateResponse) FileCreationTime() string
- func (dcr DirectoryCreateResponse) FileID() string
- func (dcr DirectoryCreateResponse) FileLastWriteTime() string
- func (dcr DirectoryCreateResponse) FileParentID() string
- func (dcr DirectoryCreateResponse) FilePermissionKey() string
- func (dcr DirectoryCreateResponse) IsServerEncrypted() string
- func (dcr DirectoryCreateResponse) LastModified() time.Time
- func (dcr DirectoryCreateResponse) RequestID() string
- func (dcr DirectoryCreateResponse) Response() *http.Response
- func (dcr DirectoryCreateResponse) Status() string
- func (dcr DirectoryCreateResponse) StatusCode() int
- func (dcr DirectoryCreateResponse) Version() string
- type DirectoryDeleteResponse
- func (ddr DirectoryDeleteResponse) Date() time.Time
- func (ddr DirectoryDeleteResponse) ErrorCode() string
- func (ddr DirectoryDeleteResponse) RequestID() string
- func (ddr DirectoryDeleteResponse) Response() *http.Response
- func (ddr DirectoryDeleteResponse) Status() string
- func (ddr DirectoryDeleteResponse) StatusCode() int
- func (ddr DirectoryDeleteResponse) Version() string
- type DirectoryForceCloseHandlesResponse
- func (dfchr DirectoryForceCloseHandlesResponse) Date() time.Time
- func (dfchr DirectoryForceCloseHandlesResponse) ErrorCode() string
- func (dfchr DirectoryForceCloseHandlesResponse) Marker() string
- func (dfchr DirectoryForceCloseHandlesResponse) NumberOfHandlesClosed() int32
- func (dfchr DirectoryForceCloseHandlesResponse) RequestID() string
- func (dfchr DirectoryForceCloseHandlesResponse) Response() *http.Response
- func (dfchr DirectoryForceCloseHandlesResponse) Status() string
- func (dfchr DirectoryForceCloseHandlesResponse) StatusCode() int
- func (dfchr DirectoryForceCloseHandlesResponse) Version() string
- type DirectoryGetPropertiesResponse
- func (dgpr DirectoryGetPropertiesResponse) Date() time.Time
- func (dgpr DirectoryGetPropertiesResponse) ETag() ETag
- func (dgpr DirectoryGetPropertiesResponse) ErrorCode() string
- func (dgpr DirectoryGetPropertiesResponse) FileAttributes() string
- func (dgpr DirectoryGetPropertiesResponse) FileChangeTime() string
- func (dgpr DirectoryGetPropertiesResponse) FileCreationTime() string
- func (dgpr DirectoryGetPropertiesResponse) FileID() string
- func (dgpr DirectoryGetPropertiesResponse) FileLastWriteTime() string
- func (dgpr DirectoryGetPropertiesResponse) FileParentID() string
- func (dgpr DirectoryGetPropertiesResponse) FilePermissionKey() string
- func (dgpr DirectoryGetPropertiesResponse) IsServerEncrypted() string
- func (dgpr DirectoryGetPropertiesResponse) LastModified() time.Time
- func (dgpr DirectoryGetPropertiesResponse) NewMetadata() Metadata
- func (dgpr DirectoryGetPropertiesResponse) RequestID() string
- func (dgpr DirectoryGetPropertiesResponse) Response() *http.Response
- func (dgpr DirectoryGetPropertiesResponse) Status() string
- func (dgpr DirectoryGetPropertiesResponse) StatusCode() int
- func (dgpr DirectoryGetPropertiesResponse) Version() string
- type DirectoryItem
- type DirectorySetMetadataResponse
- func (dsmr DirectorySetMetadataResponse) Date() time.Time
- func (dsmr DirectorySetMetadataResponse) ETag() ETag
- func (dsmr DirectorySetMetadataResponse) ErrorCode() string
- func (dsmr DirectorySetMetadataResponse) IsServerEncrypted() string
- func (dsmr DirectorySetMetadataResponse) RequestID() string
- func (dsmr DirectorySetMetadataResponse) Response() *http.Response
- func (dsmr DirectorySetMetadataResponse) Status() string
- func (dsmr DirectorySetMetadataResponse) StatusCode() int
- func (dsmr DirectorySetMetadataResponse) Version() string
- type DirectorySetPropertiesResponse
- func (dspr DirectorySetPropertiesResponse) Date() time.Time
- func (dspr DirectorySetPropertiesResponse) ETag() ETag
- func (dspr DirectorySetPropertiesResponse) ErrorCode() string
- func (dspr DirectorySetPropertiesResponse) FileAttributes() string
- func (dspr DirectorySetPropertiesResponse) FileChangeTime() string
- func (dspr DirectorySetPropertiesResponse) FileCreationTime() string
- func (dspr DirectorySetPropertiesResponse) FileID() string
- func (dspr DirectorySetPropertiesResponse) FileLastWriteTime() string
- func (dspr DirectorySetPropertiesResponse) FileParentID() string
- func (dspr DirectorySetPropertiesResponse) FilePermissionKey() string
- func (dspr DirectorySetPropertiesResponse) IsServerEncrypted() string
- func (dspr DirectorySetPropertiesResponse) LastModified() time.Time
- func (dspr DirectorySetPropertiesResponse) RequestID() string
- func (dspr DirectorySetPropertiesResponse) Response() *http.Response
- func (dspr DirectorySetPropertiesResponse) Status() string
- func (dspr DirectorySetPropertiesResponse) StatusCode() int
- func (dspr DirectorySetPropertiesResponse) Version() string
- type DirectoryURL
- func (d DirectoryURL) Create(ctx context.Context, metadata Metadata, properties SMBProperties) (*DirectoryCreateResponse, error)
- func (d DirectoryURL) Delete(ctx context.Context) (*DirectoryDeleteResponse, error)
- func (d DirectoryURL) GetProperties(ctx context.Context) (*DirectoryGetPropertiesResponse, error)
- func (d DirectoryURL) ListFilesAndDirectoriesSegment(ctx context.Context, marker Marker, o ListFilesAndDirectoriesOptions) (*ListFilesAndDirectoriesSegmentResponse, error)
- func (d DirectoryURL) NewDirectoryURL(directoryName string) DirectoryURL
- func (d DirectoryURL) NewFileURL(fileName string) FileURL
- func (d DirectoryURL) SetMetadata(ctx context.Context, metadata Metadata) (*DirectorySetMetadataResponse, error)
- func (d DirectoryURL) SetProperties(ctx context.Context, properties SMBProperties) (*DirectorySetPropertiesResponse, error)
- func (d DirectoryURL) String() string
- func (d DirectoryURL) URL() url.URL
- func (d DirectoryURL) WithPipeline(p pipeline.Pipeline) DirectoryURL
- type DownloadFromAzureFileOptions
- type DownloadResponse
- func (dr DownloadResponse) AcceptRanges() string
- func (dr DownloadResponse) Body() io.ReadCloser
- func (dr DownloadResponse) CacheControl() string
- func (dr DownloadResponse) ContentDisposition() string
- func (dr DownloadResponse) ContentEncoding() string
- func (dr DownloadResponse) ContentLanguage() string
- func (dr DownloadResponse) ContentLength() int64
- func (dr DownloadResponse) ContentMD5() []byte
- func (dr DownloadResponse) ContentRange() string
- func (dr DownloadResponse) ContentType() string
- func (dr DownloadResponse) CopyCompletionTime() time.Time
- func (dr DownloadResponse) CopyID() string
- func (dr DownloadResponse) CopyProgress() string
- func (dr DownloadResponse) CopySource() string
- func (dr DownloadResponse) CopyStatus() CopyStatusType
- func (dr DownloadResponse) CopyStatusDescription() string
- func (dr DownloadResponse) Date() time.Time
- func (dr DownloadResponse) ETag() ETag
- func (dr DownloadResponse) ErrorCode() string
- func (dr DownloadResponse) FileAttributes() string
- func (dr DownloadResponse) FileChangeTime() string
- func (dr DownloadResponse) FileContentMD5() []byte
- func (dr DownloadResponse) FileCreationTime() string
- func (dr DownloadResponse) FileID() string
- func (dr DownloadResponse) FileLastWriteTime() string
- func (dr DownloadResponse) FileParentID() string
- func (dr DownloadResponse) FilePermissionKey() string
- func (dr DownloadResponse) IsServerEncrypted() string
- func (dr DownloadResponse) LastModified() time.Time
- func (dr DownloadResponse) NewMetadata() Metadata
- func (dr DownloadResponse) RequestID() string
- func (dr DownloadResponse) Response() *http.Response
- func (dr DownloadResponse) Status() string
- func (dr DownloadResponse) StatusCode() int
- func (dr DownloadResponse) Version() string
- type ETag
- type FailedReadNotifier
- type FileAbortCopyResponse
- func (facr FileAbortCopyResponse) Date() time.Time
- func (facr FileAbortCopyResponse) ErrorCode() string
- func (facr FileAbortCopyResponse) RequestID() string
- func (facr FileAbortCopyResponse) Response() *http.Response
- func (facr FileAbortCopyResponse) Status() string
- func (facr FileAbortCopyResponse) StatusCode() int
- func (facr FileAbortCopyResponse) Version() string
- type FileAttributeFlags
- type FileCreateResponse
- func (fcr FileCreateResponse) Date() time.Time
- func (fcr FileCreateResponse) ETag() ETag
- func (fcr FileCreateResponse) ErrorCode() string
- func (fcr FileCreateResponse) FileAttributes() string
- func (fcr FileCreateResponse) FileChangeTime() string
- func (fcr FileCreateResponse) FileCreationTime() string
- func (fcr FileCreateResponse) FileID() string
- func (fcr FileCreateResponse) FileLastWriteTime() string
- func (fcr FileCreateResponse) FileParentID() string
- func (fcr FileCreateResponse) FilePermissionKey() string
- func (fcr FileCreateResponse) IsServerEncrypted() string
- func (fcr FileCreateResponse) LastModified() time.Time
- func (fcr FileCreateResponse) RequestID() string
- func (fcr FileCreateResponse) Response() *http.Response
- func (fcr FileCreateResponse) Status() string
- func (fcr FileCreateResponse) StatusCode() int
- func (fcr FileCreateResponse) Version() string
- type FileDeleteResponse
- func (fdr FileDeleteResponse) Date() time.Time
- func (fdr FileDeleteResponse) ErrorCode() string
- func (fdr FileDeleteResponse) RequestID() string
- func (fdr FileDeleteResponse) Response() *http.Response
- func (fdr FileDeleteResponse) Status() string
- func (fdr FileDeleteResponse) StatusCode() int
- func (fdr FileDeleteResponse) Version() string
- type FileForceCloseHandlesResponse
- func (ffchr FileForceCloseHandlesResponse) Date() time.Time
- func (ffchr FileForceCloseHandlesResponse) ErrorCode() string
- func (ffchr FileForceCloseHandlesResponse) Marker() string
- func (ffchr FileForceCloseHandlesResponse) NumberOfHandlesClosed() int32
- func (ffchr FileForceCloseHandlesResponse) RequestID() string
- func (ffchr FileForceCloseHandlesResponse) Response() *http.Response
- func (ffchr FileForceCloseHandlesResponse) Status() string
- func (ffchr FileForceCloseHandlesResponse) StatusCode() int
- func (ffchr FileForceCloseHandlesResponse) Version() string
- type FileGetPropertiesResponse
- func (fgpr FileGetPropertiesResponse) CacheControl() string
- func (fgpr FileGetPropertiesResponse) ContentDisposition() string
- func (fgpr FileGetPropertiesResponse) ContentEncoding() string
- func (fgpr FileGetPropertiesResponse) ContentLanguage() string
- func (fgpr FileGetPropertiesResponse) ContentLength() int64
- func (fgpr FileGetPropertiesResponse) ContentMD5() []byte
- func (fgpr FileGetPropertiesResponse) ContentType() string
- func (fgpr FileGetPropertiesResponse) CopyCompletionTime() time.Time
- func (fgpr FileGetPropertiesResponse) CopyID() string
- func (fgpr FileGetPropertiesResponse) CopyProgress() string
- func (fgpr FileGetPropertiesResponse) CopySource() string
- func (fgpr FileGetPropertiesResponse) CopyStatus() CopyStatusType
- func (fgpr FileGetPropertiesResponse) CopyStatusDescription() string
- func (fgpr FileGetPropertiesResponse) Date() time.Time
- func (fgpr FileGetPropertiesResponse) ETag() ETag
- func (fgpr FileGetPropertiesResponse) ErrorCode() string
- func (fgpr FileGetPropertiesResponse) FileAttributes() string
- func (fgpr FileGetPropertiesResponse) FileChangeTime() string
- func (fgpr FileGetPropertiesResponse) FileCreationTime() string
- func (fgpr FileGetPropertiesResponse) FileID() string
- func (fgpr FileGetPropertiesResponse) FileLastWriteTime() string
- func (fgpr FileGetPropertiesResponse) FileParentID() string
- func (fgpr FileGetPropertiesResponse) FilePermissionKey() string
- func (fgpr FileGetPropertiesResponse) FileType() string
- func (fgpr FileGetPropertiesResponse) IsServerEncrypted() string
- func (fgpr FileGetPropertiesResponse) LastModified() time.Time
- func (fgpr FileGetPropertiesResponse) NewHTTPHeaders() FileHTTPHeaders
- func (fgpr FileGetPropertiesResponse) NewMetadata() Metadata
- func (fgpr FileGetPropertiesResponse) RequestID() string
- func (fgpr FileGetPropertiesResponse) Response() *http.Response
- func (fgpr FileGetPropertiesResponse) Status() string
- func (fgpr FileGetPropertiesResponse) StatusCode() int
- func (fgpr FileGetPropertiesResponse) Version() string
- type FileHTTPHeaders
- type FileItem
- type FileProperty
- type FileRangeWriteType
- type FileSASPermissions
- type FileSASSignatureValues
- type FileServiceProperties
- type FileSetHTTPHeadersResponse
- func (fshhr FileSetHTTPHeadersResponse) Date() time.Time
- func (fshhr FileSetHTTPHeadersResponse) ETag() ETag
- func (fshhr FileSetHTTPHeadersResponse) ErrorCode() string
- func (fshhr FileSetHTTPHeadersResponse) FileAttributes() string
- func (fshhr FileSetHTTPHeadersResponse) FileChangeTime() string
- func (fshhr FileSetHTTPHeadersResponse) FileCreationTime() string
- func (fshhr FileSetHTTPHeadersResponse) FileID() string
- func (fshhr FileSetHTTPHeadersResponse) FileLastWriteTime() string
- func (fshhr FileSetHTTPHeadersResponse) FileParentID() string
- func (fshhr FileSetHTTPHeadersResponse) FilePermissionKey() string
- func (fshhr FileSetHTTPHeadersResponse) IsServerEncrypted() string
- func (fshhr FileSetHTTPHeadersResponse) LastModified() time.Time
- func (fshhr FileSetHTTPHeadersResponse) RequestID() string
- func (fshhr FileSetHTTPHeadersResponse) Response() *http.Response
- func (fshhr FileSetHTTPHeadersResponse) Status() string
- func (fshhr FileSetHTTPHeadersResponse) StatusCode() int
- func (fshhr FileSetHTTPHeadersResponse) Version() string
- type FileSetMetadataResponse
- func (fsmr FileSetMetadataResponse) Date() time.Time
- func (fsmr FileSetMetadataResponse) ETag() ETag
- func (fsmr FileSetMetadataResponse) ErrorCode() string
- func (fsmr FileSetMetadataResponse) IsServerEncrypted() string
- func (fsmr FileSetMetadataResponse) RequestID() string
- func (fsmr FileSetMetadataResponse) Response() *http.Response
- func (fsmr FileSetMetadataResponse) Status() string
- func (fsmr FileSetMetadataResponse) StatusCode() int
- func (fsmr FileSetMetadataResponse) Version() string
- type FileStartCopyResponse
- func (fscr FileStartCopyResponse) CopyID() string
- func (fscr FileStartCopyResponse) CopyStatus() CopyStatusType
- func (fscr FileStartCopyResponse) Date() time.Time
- func (fscr FileStartCopyResponse) ETag() ETag
- func (fscr FileStartCopyResponse) ErrorCode() string
- func (fscr FileStartCopyResponse) LastModified() time.Time
- func (fscr FileStartCopyResponse) RequestID() string
- func (fscr FileStartCopyResponse) Response() *http.Response
- func (fscr FileStartCopyResponse) Status() string
- func (fscr FileStartCopyResponse) StatusCode() int
- func (fscr FileStartCopyResponse) Version() string
- type FileURL
- func (f FileURL) AbortCopy(ctx context.Context, copyID string) (*FileAbortCopyResponse, error)
- func (f FileURL) ClearRange(ctx context.Context, offset int64, count int64) (*FileUploadRangeResponse, error)
- func (f FileURL) Create(ctx context.Context, size int64, h FileHTTPHeaders, metadata Metadata) (*FileCreateResponse, error)
- func (f FileURL) Delete(ctx context.Context) (*FileDeleteResponse, error)
- func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeGetContentMD5 bool) (*RetryableDownloadResponse, error)
- func (f FileURL) GetProperties(ctx context.Context) (*FileGetPropertiesResponse, error)
- func (f FileURL) GetRangeList(ctx context.Context, offset int64, count int64) (*Ranges, error)
- func (f FileURL) Resize(ctx context.Context, length int64) (*FileSetHTTPHeadersResponse, error)
- func (f FileURL) SetHTTPHeaders(ctx context.Context, h FileHTTPHeaders) (*FileSetHTTPHeadersResponse, error)
- func (f FileURL) SetMetadata(ctx context.Context, metadata Metadata) (*FileSetMetadataResponse, error)
- func (f FileURL) StartCopy(ctx context.Context, source url.URL, metadata Metadata) (*FileStartCopyResponse, error)
- func (f FileURL) String() string
- func (f FileURL) URL() url.URL
- func (f FileURL) UploadRange(ctx context.Context, offset int64, body io.ReadSeeker, transactionalMD5 []byte) (*FileUploadRangeResponse, error)
- func (f FileURL) UploadRangeFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, ...) (*FileUploadRangeFromURLResponse, error)
- func (f FileURL) WithPipeline(p pipeline.Pipeline) FileURL
- func (f FileURL) WithSnapshot(shareSnapshot string) FileURL
- type FileURLParts
- type FileUploadRangeFromURLResponse
- func (furfur FileUploadRangeFromURLResponse) Date() time.Time
- func (furfur FileUploadRangeFromURLResponse) ETag() ETag
- func (furfur FileUploadRangeFromURLResponse) ErrorCode() string
- func (furfur FileUploadRangeFromURLResponse) IsServerEncrypted() string
- func (furfur FileUploadRangeFromURLResponse) LastModified() time.Time
- func (furfur FileUploadRangeFromURLResponse) RequestID() string
- func (furfur FileUploadRangeFromURLResponse) Response() *http.Response
- func (furfur FileUploadRangeFromURLResponse) Status() string
- func (furfur FileUploadRangeFromURLResponse) StatusCode() int
- func (furfur FileUploadRangeFromURLResponse) Version() string
- func (furfur FileUploadRangeFromURLResponse) XMsContentCrc64() []byte
- type FileUploadRangeResponse
- func (furr FileUploadRangeResponse) ContentMD5() []byte
- func (furr FileUploadRangeResponse) Date() time.Time
- func (furr FileUploadRangeResponse) ETag() ETag
- func (furr FileUploadRangeResponse) ErrorCode() string
- func (furr FileUploadRangeResponse) IsServerEncrypted() string
- func (furr FileUploadRangeResponse) LastModified() time.Time
- func (furr FileUploadRangeResponse) RequestID() string
- func (furr FileUploadRangeResponse) Response() *http.Response
- func (furr FileUploadRangeResponse) Status() string
- func (furr FileUploadRangeResponse) StatusCode() int
- func (furr FileUploadRangeResponse) Version() string
- type FilesAndDirectoriesListSegment
- type HTTPGetter
- type HTTPGetterInfo
- type HandleItem
- type IPEndpointStyleInfo
- type IPRange
- type ListFilesAndDirectoriesOptions
- type ListFilesAndDirectoriesSegmentResponse
- func (ldafr ListFilesAndDirectoriesSegmentResponse) ContentType() string
- func (ldafr ListFilesAndDirectoriesSegmentResponse) Date() time.Time
- func (ldafr ListFilesAndDirectoriesSegmentResponse) ErrorCode() string
- func (ldafr ListFilesAndDirectoriesSegmentResponse) RequestID() string
- func (ldafr ListFilesAndDirectoriesSegmentResponse) Response() *http.Response
- func (ldafr ListFilesAndDirectoriesSegmentResponse) Status() string
- func (ldafr ListFilesAndDirectoriesSegmentResponse) StatusCode() int
- func (ldafr ListFilesAndDirectoriesSegmentResponse) Version() string
- type ListHandlesResponse
- func (lhr ListHandlesResponse) ContentType() string
- func (lhr ListHandlesResponse) Date() time.Time
- func (lhr ListHandlesResponse) ErrorCode() string
- func (lhr ListHandlesResponse) RequestID() string
- func (lhr ListHandlesResponse) Response() *http.Response
- func (lhr ListHandlesResponse) Status() string
- func (lhr ListHandlesResponse) StatusCode() int
- func (lhr ListHandlesResponse) Version() string
- type ListSharesDetail
- type ListSharesIncludeType
- type ListSharesOptions
- type ListSharesResponse
- type Marker
- type Metadata
- type MetricProperties
- type Metrics
- type PipelineOptions
- type Range
- type Ranges
- func (r Ranges) Date() time.Time
- func (r Ranges) ETag() ETag
- func (r Ranges) ErrorCode() string
- func (r Ranges) FileContentLength() int64
- func (r Ranges) LastModified() time.Time
- func (r Ranges) RequestID() string
- func (r Ranges) Response() *http.Response
- func (r Ranges) Status() string
- func (r Ranges) StatusCode() int
- func (r Ranges) Version() string
- type RequestLogOptions
- type ResponseError
- type RetentionPolicy
- type RetryOptions
- type RetryPolicy
- type RetryReaderOptions
- type RetryableDownloadResponse
- func (dr RetryableDownloadResponse) AcceptRanges() string
- func (dr *RetryableDownloadResponse) Body(o RetryReaderOptions) io.ReadCloser
- func (dr RetryableDownloadResponse) CacheControl() string
- func (dr RetryableDownloadResponse) ContentDisposition() string
- func (dr RetryableDownloadResponse) ContentEncoding() string
- func (dr RetryableDownloadResponse) ContentLanguage() string
- func (dr RetryableDownloadResponse) ContentLength() int64
- func (dr RetryableDownloadResponse) ContentMD5() []byte
- func (dr RetryableDownloadResponse) ContentRange() string
- func (dr RetryableDownloadResponse) ContentType() string
- func (dr RetryableDownloadResponse) CopyCompletionTime() time.Time
- func (dr RetryableDownloadResponse) CopyID() string
- func (dr RetryableDownloadResponse) CopyProgress() string
- func (dr RetryableDownloadResponse) CopySource() string
- func (dr RetryableDownloadResponse) CopyStatus() CopyStatusType
- func (dr RetryableDownloadResponse) CopyStatusDescription() string
- func (dr RetryableDownloadResponse) Date() time.Time
- func (dr RetryableDownloadResponse) ETag() ETag
- func (dr RetryableDownloadResponse) FileContentMD5() []byte
- func (dr RetryableDownloadResponse) IsServerEncrypted() string
- func (dr RetryableDownloadResponse) LastModified() time.Time
- func (dr RetryableDownloadResponse) NewHTTPHeaders() FileHTTPHeaders
- func (dr RetryableDownloadResponse) NewMetadata() Metadata
- func (dr RetryableDownloadResponse) RequestID() string
- func (dr RetryableDownloadResponse) Response() *http.Response
- func (dr RetryableDownloadResponse) Status() string
- func (dr RetryableDownloadResponse) StatusCode() int
- func (dr RetryableDownloadResponse) Version() string
- type SASProtocol
- type SASQueryParameters
- func (p *SASQueryParameters) CacheControl() string
- func (p *SASQueryParameters) ContentDisposition() string
- func (p *SASQueryParameters) ContentEncoding() string
- func (p *SASQueryParameters) ContentLanguage() string
- func (p *SASQueryParameters) ContentType() string
- func (p *SASQueryParameters) Encode() string
- func (p *SASQueryParameters) ExpiryTime() time.Time
- func (p *SASQueryParameters) IPRange() IPRange
- func (p *SASQueryParameters) Identifier() string
- func (p *SASQueryParameters) Permissions() string
- func (p *SASQueryParameters) Protocol() SASProtocol
- func (p *SASQueryParameters) Resource() string
- func (p *SASQueryParameters) ResourceTypes() string
- func (p *SASQueryParameters) Services() string
- func (p *SASQueryParameters) Signature() string
- func (p *SASQueryParameters) StartTime() time.Time
- func (p *SASQueryParameters) Version() string
- type SMBProperties
- type SMBPropertyAdapter
- type SMBPropertyHolder
- type ServiceCodeType
- type ServiceSetPropertiesResponse
- func (sspr ServiceSetPropertiesResponse) ErrorCode() string
- func (sspr ServiceSetPropertiesResponse) RequestID() string
- func (sspr ServiceSetPropertiesResponse) Response() *http.Response
- func (sspr ServiceSetPropertiesResponse) Status() string
- func (sspr ServiceSetPropertiesResponse) StatusCode() int
- func (sspr ServiceSetPropertiesResponse) Version() string
- type ServiceURL
- func (s ServiceURL) GetProperties(ctx context.Context) (*FileServiceProperties, error)
- func (s ServiceURL) ListSharesSegment(ctx context.Context, marker Marker, o ListSharesOptions) (*ListSharesResponse, error)
- func (s ServiceURL) NewShareURL(shareName string) ShareURL
- func (s ServiceURL) SetProperties(ctx context.Context, properties FileServiceProperties) (*ServiceSetPropertiesResponse, error)
- func (s ServiceURL) String() string
- func (s ServiceURL) URL() url.URL
- func (s ServiceURL) WithPipeline(p pipeline.Pipeline) ServiceURL
- type ShareCreatePermissionResponse
- func (scpr ShareCreatePermissionResponse) Date() time.Time
- func (scpr ShareCreatePermissionResponse) ErrorCode() string
- func (scpr ShareCreatePermissionResponse) FilePermissionKey() string
- func (scpr ShareCreatePermissionResponse) RequestID() string
- func (scpr ShareCreatePermissionResponse) Response() *http.Response
- func (scpr ShareCreatePermissionResponse) Status() string
- func (scpr ShareCreatePermissionResponse) StatusCode() int
- func (scpr ShareCreatePermissionResponse) Version() string
- type ShareCreateResponse
- func (scr ShareCreateResponse) Date() time.Time
- func (scr ShareCreateResponse) ETag() ETag
- func (scr ShareCreateResponse) ErrorCode() string
- func (scr ShareCreateResponse) LastModified() time.Time
- func (scr ShareCreateResponse) RequestID() string
- func (scr ShareCreateResponse) Response() *http.Response
- func (scr ShareCreateResponse) Status() string
- func (scr ShareCreateResponse) StatusCode() int
- func (scr ShareCreateResponse) Version() string
- type ShareCreateSnapshotResponse
- func (scsr ShareCreateSnapshotResponse) Date() time.Time
- func (scsr ShareCreateSnapshotResponse) ETag() ETag
- func (scsr ShareCreateSnapshotResponse) ErrorCode() string
- func (scsr ShareCreateSnapshotResponse) LastModified() time.Time
- func (scsr ShareCreateSnapshotResponse) RequestID() string
- func (scsr ShareCreateSnapshotResponse) Response() *http.Response
- func (scsr ShareCreateSnapshotResponse) Snapshot() string
- func (scsr ShareCreateSnapshotResponse) Status() string
- func (scsr ShareCreateSnapshotResponse) StatusCode() int
- func (scsr ShareCreateSnapshotResponse) Version() string
- type ShareDeleteResponse
- func (sdr ShareDeleteResponse) Date() time.Time
- func (sdr ShareDeleteResponse) ErrorCode() string
- func (sdr ShareDeleteResponse) RequestID() string
- func (sdr ShareDeleteResponse) Response() *http.Response
- func (sdr ShareDeleteResponse) Status() string
- func (sdr ShareDeleteResponse) StatusCode() int
- func (sdr ShareDeleteResponse) Version() string
- type ShareGetPropertiesResponse
- func (sgpr ShareGetPropertiesResponse) Date() time.Time
- func (sgpr ShareGetPropertiesResponse) ETag() ETag
- func (sgpr ShareGetPropertiesResponse) ErrorCode() string
- func (sgpr ShareGetPropertiesResponse) LastModified() time.Time
- func (sgpr ShareGetPropertiesResponse) NewMetadata() Metadata
- func (sgpr ShareGetPropertiesResponse) Quota() int32
- func (sgpr ShareGetPropertiesResponse) RequestID() string
- func (sgpr ShareGetPropertiesResponse) Response() *http.Response
- func (sgpr ShareGetPropertiesResponse) Status() string
- func (sgpr ShareGetPropertiesResponse) StatusCode() int
- func (sgpr ShareGetPropertiesResponse) Version() string
- type ShareItem
- type SharePermission
- func (sp SharePermission) Date() time.Time
- func (sp SharePermission) ErrorCode() string
- func (sp SharePermission) RequestID() string
- func (sp SharePermission) Response() *http.Response
- func (sp SharePermission) Status() string
- func (sp SharePermission) StatusCode() int
- func (sp SharePermission) Version() string
- type ShareProperties
- type ShareSASPermissions
- type ShareSetAccessPolicyResponse
- func (ssapr ShareSetAccessPolicyResponse) Date() time.Time
- func (ssapr ShareSetAccessPolicyResponse) ETag() ETag
- func (ssapr ShareSetAccessPolicyResponse) ErrorCode() string
- func (ssapr ShareSetAccessPolicyResponse) LastModified() time.Time
- func (ssapr ShareSetAccessPolicyResponse) RequestID() string
- func (ssapr ShareSetAccessPolicyResponse) Response() *http.Response
- func (ssapr ShareSetAccessPolicyResponse) Status() string
- func (ssapr ShareSetAccessPolicyResponse) StatusCode() int
- func (ssapr ShareSetAccessPolicyResponse) Version() string
- type ShareSetMetadataResponse
- func (ssmr ShareSetMetadataResponse) Date() time.Time
- func (ssmr ShareSetMetadataResponse) ETag() ETag
- func (ssmr ShareSetMetadataResponse) ErrorCode() string
- func (ssmr ShareSetMetadataResponse) LastModified() time.Time
- func (ssmr ShareSetMetadataResponse) RequestID() string
- func (ssmr ShareSetMetadataResponse) Response() *http.Response
- func (ssmr ShareSetMetadataResponse) Status() string
- func (ssmr ShareSetMetadataResponse) StatusCode() int
- func (ssmr ShareSetMetadataResponse) Version() string
- type ShareSetQuotaResponse
- func (ssqr ShareSetQuotaResponse) Date() time.Time
- func (ssqr ShareSetQuotaResponse) ETag() ETag
- func (ssqr ShareSetQuotaResponse) ErrorCode() string
- func (ssqr ShareSetQuotaResponse) LastModified() time.Time
- func (ssqr ShareSetQuotaResponse) RequestID() string
- func (ssqr ShareSetQuotaResponse) Response() *http.Response
- func (ssqr ShareSetQuotaResponse) Status() string
- func (ssqr ShareSetQuotaResponse) StatusCode() int
- func (ssqr ShareSetQuotaResponse) Version() string
- type ShareStats
- func (ss ShareStats) Date() time.Time
- func (ss ShareStats) ETag() ETag
- func (ss ShareStats) ErrorCode() string
- func (ss ShareStats) LastModified() time.Time
- func (ss ShareStats) RequestID() string
- func (ss ShareStats) Response() *http.Response
- func (ss ShareStats) Status() string
- func (ss ShareStats) StatusCode() int
- func (ss ShareStats) Version() string
- type ShareURL
- func (s ShareURL) Create(ctx context.Context, metadata Metadata, quotaInGB int32) (*ShareCreateResponse, error)
- func (s ShareURL) CreatePermission(ctx context.Context, permission string) (*ShareCreatePermissionResponse, error)
- func (s ShareURL) CreateSnapshot(ctx context.Context, metadata Metadata) (*ShareCreateSnapshotResponse, error)
- func (s ShareURL) Delete(ctx context.Context, deleteSnapshotsOption DeleteSnapshotsOptionType) (*ShareDeleteResponse, error)
- func (s ShareURL) GetPermission(ctx context.Context, permissionKey string) (*SharePermission, error)
- func (s ShareURL) GetPermissions(ctx context.Context) (*SignedIdentifiers, error)
- func (s ShareURL) GetProperties(ctx context.Context) (*ShareGetPropertiesResponse, error)
- func (s ShareURL) GetStatistics(ctx context.Context) (*ShareStats, error)
- func (s ShareURL) NewDirectoryURL(directoryName string) DirectoryURL
- func (s ShareURL) NewRootDirectoryURL() DirectoryURL
- func (s ShareURL) SetMetadata(ctx context.Context, metadata Metadata) (*ShareSetMetadataResponse, error)
- func (s ShareURL) SetPermissions(ctx context.Context, permissions []SignedIdentifier) (*ShareSetAccessPolicyResponse, error)
- func (s ShareURL) SetQuota(ctx context.Context, quotaInGB int32) (*ShareSetQuotaResponse, error)
- func (s ShareURL) String() string
- func (s ShareURL) URL() url.URL
- func (s ShareURL) WithPipeline(p pipeline.Pipeline) ShareURL
- func (s ShareURL) WithSnapshot(snapshot string) ShareURL
- type SharedKeyCredential
- type SignedIdentifier
- type SignedIdentifiers
- func (si SignedIdentifiers) Date() time.Time
- func (si SignedIdentifiers) ETag() ETag
- func (si SignedIdentifiers) ErrorCode() string
- func (si SignedIdentifiers) LastModified() time.Time
- func (si SignedIdentifiers) RequestID() string
- func (si SignedIdentifiers) Response() *http.Response
- func (si SignedIdentifiers) Status() string
- func (si SignedIdentifiers) StatusCode() int
- func (si SignedIdentifiers) Version() string
- type StorageError
- type StorageErrorCodeType
- type StorageServiceProperties
- func (ssp StorageServiceProperties) ErrorCode() string
- func (ssp StorageServiceProperties) RequestID() string
- func (ssp StorageServiceProperties) Response() *http.Response
- func (ssp StorageServiceProperties) Status() string
- func (ssp StorageServiceProperties) StatusCode() int
- func (ssp StorageServiceProperties) Version() string
- type TelemetryOptions
- type UploadToAzureFileOptions
Examples ¶
- Package
- AccountSASSignatureValues
- DownloadAzureFileToFile
- FileSASSignatureValues
- FileURL
- FileURL (ProgressUploadDownload)
- FileURL.Download
- FileURL.GetProperties
- FileURL.SetHTTPHeaders
- FileURL.StartCopy
- FileURLParts
- NewPipeline
- ShareURL
- ShareURL.CreateSnapshot
- ShareURL.SetQuota
- StorageError
- UploadFileToAzureFile
Constants ¶
const ( // FileMaxUploadRangeBytes indicates the maximum number of bytes that can be sent in a call to UploadRange. FileMaxUploadRangeBytes = 4 * 1024 * 1024 // 4MB // FileMaxSizeInBytes indicates the maxiumum file size, in bytes. FileMaxSizeInBytes int64 = 1 * 1024 * 1024 * 1024 * 1024 // 1TB )
const ( // CountToEnd indiciates a flag for count parameter. It means the count of bytes // from start offset to the end of file. CountToEnd = 0 )
const ISO8601 = "2006-01-02T15:04:05.0000000Z" // must have 0's for fractional seconds, because Files Service requires fixed width
FileCreationTime and FileLastWriteTime are handled by the Azure Files service with high-precision ISO-8601 timestamps. Use this format to parse these fields and format them.
const ReadOnClosedBodyMessage = "read on closed response body"
const SASTimeFormat = "2006-01-02T15:04:05Z"
const SASVersion = ServiceVersion
SASVersion indicates the SAS version.
const (
// ServiceVersion specifies the version of the operations used in this package.
ServiceVersion = "2019-02-02"
)
Variables ¶
var SASTimeFormats = []string{"2006-01-02T15:04:05.0000000Z", SASTimeFormat, "2006-01-02T15:04Z", "2006-01-02"} // ISO 8601 formats, please refer to https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas for more details.
SASTimeFormats represents the format of a SAS start or expiry time. Use it when formatting/parsing a time.Time.
Functions ¶
func FormatTimesForSASSigning ¶
FormatTimesForSASSigning converts a time.Time to a snapshotTimeFormat string suitable for a SASField's StartTime or ExpiryTime fields. Returns "" if value.IsZero().
func NewPipeline ¶
func NewPipeline(c Credential, o PipelineOptions) pipeline.Pipeline
NewPipeline creates a Pipeline using the specified credentials and options. Note: c can't be nil.
Example ¶
This example shows how you can configure a pipeline for making HTTP requests to the Azure Storage File Service.
package main import ( "log" "net/url" "os" "time" "github.com/Azure/azure-pipeline-go/pipeline" "github.com/Azure/azure-storage-file-go/azfile" ) func main() { // This example shows how to wire in your own logging mechanism (this example uses // Go's standard logger to write log information to standard error) logger := log.New(os.Stderr, "", log.Ldate|log.Lmicroseconds) // Create/configure a request pipeline options object. // All PipelineOptions' fields are optional; reasonable defaults are set for anything you do not specify po := azfile.PipelineOptions{ // Set RetryOptions to control how HTTP request are retried when retryable failures occur Retry: azfile.RetryOptions{ Policy: azfile.RetryPolicyExponential, // Use exponential backoff as opposed to linear MaxTries: 3, // Try at most 3 times to perform the operation (set to 1 to disable retries) TryTimeout: time.Second * 3, // Maximum time allowed for any single try RetryDelay: time.Second * 1, // Backoff amount for each retry (exponential or linear) MaxRetryDelay: time.Second * 3, // Max delay between retries }, // Set RequestLogOptions to control how each HTTP request & its response is logged RequestLog: azfile.RequestLogOptions{ LogWarningIfTryOverThreshold: time.Millisecond * 200, // A successful response taking more than this time to arrive is logged as a warning }, // Set LogOptions to control what & where all pipeline log events go Log: pipeline.LogOptions{ Log: func(s pipeline.LogLevel, m string) { // This func is called to log each event // This method is not called for filtered-out severities. logger.Output(2, m) // This example uses Go's standard logger }, ShouldLog: func(level pipeline.LogLevel) bool { return level <= pipeline.LogInfo // Log all events from informational to more severe }, }, } // Create a request pipeline object configured with credentials and with pipeline options. Once created, // a pipeline object is goroutine-safe and can be safely used with many XxxURL objects simultaneously. p := azfile.NewPipeline(azfile.NewAnonymousCredential(), po) // A pipeline always requires some credential object // Once you've created a pipeline object, associate it with an XxxURL object so that you can perform HTTP requests with it. u, _ := url.Parse("https://myaccount.file.core.windows.net") serviceURL := azfile.NewServiceURL(*u, p) // Use the serviceURL as desired... // NOTE: When you use an XxxURL object to create another XxxURL object, the new XxxURL object inherits the // same pipeline object as its parent. For example, the shareURL and fileURL objects (created below) // all share the same pipeline. Any HTTP operations you perform with these objects share the behavior (retry, logging, etc.) shareURL := serviceURL.NewShareURL("myshare") directoryURL := shareURL.NewDirectoryURL("mydirectory") fileURL := directoryURL.NewFileURL("ReadMe.txt") // If you'd like to perform some operations with different behavior, create a new pipeline object and // associate it with a new XxxURL object by passing the new pipeline to the XxxURL object's WithPipeline method. // In this example, I reconfigure the retry policies, create a new pipeline, and then create a new // ShareURL object that has the same URL as its parent. po.Retry = azfile.RetryOptions{ Policy: azfile.RetryPolicyFixed, // Use linear backoff MaxTries: 4, // Try at most 3 times to perform the operation (set to 1 to disable retries) TryTimeout: time.Minute * 1, // Maximum time allowed for any single try RetryDelay: time.Second * 5, // Backoff amount for each retry (exponential or linear) MaxRetryDelay: time.Second * 10, // Max delay between retries } newShareURL := shareURL.WithPipeline(azfile.NewPipeline(azfile.NewAnonymousCredential(), po)) // Now, any XxxDirectoryURL object created using newShareURL inherits the pipeline with the new retry policy. newDirectoryURL := newShareURL.NewDirectoryURL("mynewdirectory") _, _, _ = fileURL, directoryURL, newDirectoryURL // Avoid compiler's "declared and not used" error }
Output:
func NewRequestLogPolicyFactory ¶
func NewRequestLogPolicyFactory(o RequestLogOptions) pipeline.Factory
NewRequestLogPolicyFactory creates a RequestLogPolicyFactory object configured using the specified options.
func NewResponseError ¶
NewResponseError creates an error object that implements the error interface.
func NewRetryPolicyFactory ¶
func NewRetryPolicyFactory(o RetryOptions) pipeline.Factory
NewRetryPolicyFactory creates a RetryPolicyFactory object configured using the specified options.
func NewRetryReader ¶
func NewRetryReader(ctx context.Context, initialResponse *http.Response, info HTTPGetterInfo, o RetryReaderOptions, getter HTTPGetter) io.ReadCloser
NewRetryReader creates a retry reader.
func NewTelemetryPolicyFactory ¶
func NewTelemetryPolicyFactory(o TelemetryOptions) pipeline.Factory
NewTelemetryPolicyFactory creates a factory that can create telemetry policy objects which add telemetry information to outgoing HTTP requests.
func NewUniqueRequestIDPolicyFactory ¶
NewUniqueRequestIDPolicyFactory creates a UniqueRequestIDPolicyFactory object that sets the request's x-ms-client-request-id header if it doesn't already exist.
func RedactSigQueryParam ¶
RedactSigQueryParam redacts the 'sig' query parameter in URL's raw query to protect secret.
func UploadBufferToAzureFile ¶
func UploadBufferToAzureFile(ctx context.Context, b []byte, fileURL FileURL, o UploadToAzureFileOptions) error
UploadBufferToAzureFile uploads a buffer to an Azure file. Note: o.RangeSize must be >= 0 and <= FileMaxUploadRangeBytes, and if not specified, method will use FileMaxUploadRangeBytes by default. The total size to be uploaded should be <= FileMaxSizeInBytes.
func UploadFileToAzureFile ¶
func UploadFileToAzureFile(ctx context.Context, file *os.File, fileURL FileURL, o UploadToAzureFileOptions) error
UploadFileToAzureFile uploads a local file to an Azure file.
Example ¶
This example shows how to upload a large local file to Azure file with parallel support.
package main import ( "context" "fmt" "log" "net/url" "os" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { file, err := os.Open("BigFile.bin") // Open the file we want to upload (we assume the file already exists). if err != nil { log.Fatal(err) } defer file.Close() fileSize, err := file.Stat() // Get the size of the file (stream) if err != nil { log.Fatal(err) } // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a FileURL object to a file in the share (we assume the share already exists). u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/BigFile.bin", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) ctx := context.Background() // This example uses a never-expiring context // Trigger parallel upload with Parallelism set to 3. Note if there is an Azure file // with same name exists, UploadFileToAzureFile will overwrite the existing Azure file with new content, // and set specified azfile.FileHTTPHeaders and Metadata. err = azfile.UploadFileToAzureFile(ctx, file, fileURL, azfile.UploadToAzureFileOptions{ Parallelism: 3, FileHTTPHeaders: azfile.FileHTTPHeaders{ CacheControl: "no-transform", }, Metadata: azfile.Metadata{ "createdby": "Jeffrey&Jiachen", }, // If Progress is non-nil, this function is called periodically as bytes are uploaded. Progress: func(bytesTransferred int64) { fmt.Printf("Uploaded %d of %d bytes.\n", bytesTransferred, fileSize.Size()) }, }) if err != nil { log.Fatal(err) } }
Output:
func UserAgent ¶
func UserAgent() string
UserAgent returns the UserAgent string to use when sending http.Requests.
func Version ¶
func Version() string
Version returns the semantic version (see http://semver.org) of the client.
Types ¶
type AccessPolicy ¶
type AccessPolicy struct { // Start - The date-time the policy is active. Start *time.Time `xml:"Start"` // Expiry - The date-time the policy expires. Expiry *time.Time `xml:"Expiry"` // Permission - The permissions for the ACL policy. Permission *string `xml:"Permission"` }
AccessPolicy - An Access policy.
func (AccessPolicy) MarshalXML ¶
func (ap AccessPolicy) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for AccessPolicy.
func (*AccessPolicy) UnmarshalXML ¶
func (ap *AccessPolicy) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for AccessPolicy.
type AccessPolicyPermission ¶
type AccessPolicyPermission struct {
Read, Create, Write, Delete, List bool
}
The AccessPolicyPermission type simplifies creating the permissions string for a share's access policy. Initialize an instance of this type and then call its String method to set AccessPolicy's Permission field.
func (*AccessPolicyPermission) Parse ¶
func (p *AccessPolicyPermission) Parse(s string)
Parse initializes the AccessPolicyPermission's fields from a string.
func (AccessPolicyPermission) String ¶
func (p AccessPolicyPermission) String() string
String produces the access policy permission string for an Azure Storage share. Call this method to set AccessPolicy's Permission field.
type AccountSASPermissions ¶
type AccountSASPermissions struct {
Read, Write, Delete, List, Add, Create, Update, Process bool
}
The AccountSASPermissions type simplifies creating the permissions string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Permissions field.
func (*AccountSASPermissions) Parse ¶
func (p *AccountSASPermissions) Parse(s string) error
Parse initializes the AccountSASPermissions's fields from a string.
func (AccountSASPermissions) String ¶
func (p AccountSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage account. Call this method to set AccountSASSignatureValues's Permissions field.
type AccountSASResourceTypes ¶
type AccountSASResourceTypes struct {
Service, Container, Object bool
}
The AccountSASResourceTypes type simplifies creating the resource types string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's ResourceTypes field.
func (*AccountSASResourceTypes) Parse ¶
func (rt *AccountSASResourceTypes) Parse(s string) error
Parse initializes the AccountSASResourceType's fields from a string.
func (AccountSASResourceTypes) String ¶
func (rt AccountSASResourceTypes) String() string
String produces the SAS resource types string for an Azure Storage account. Call this method to set AccountSASSignatureValues's ResourceTypes field.
type AccountSASServices ¶
type AccountSASServices struct {
Blob, Queue, File bool
}
The AccountSASServices type simplifies creating the services string for an Azure Storage Account SAS. Initialize an instance of this type and then call its String method to set AccountSASSignatureValues's Services field.
func (*AccountSASServices) Parse ¶
func (a *AccountSASServices) Parse(s string) error
Parse initializes the AccountSASServices' fields from a string.
func (AccountSASServices) String ¶
func (s AccountSASServices) String() string
String produces the SAS services string for an Azure Storage account. Call this method to set AccountSASSignatureValues's Services field.
type AccountSASSignatureValues ¶
type AccountSASSignatureValues struct { Version string `param:"sv"` // If not specified, this defaults to SASVersion Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants StartTime time.Time `param:"st"` // Not specified if IsZero ExpiryTime time.Time `param:"se"` // Not specified if IsZero Permissions string `param:"sp"` // Create by initializing a AccountSASPermissions and then call String() IPRange IPRange `param:"sip"` Services string `param:"ss"` // Create by initializing AccountSASServices and then call String() ResourceTypes string `param:"srt"` // Create by initializing AccountSASResourceTypes and then call String() }
AccountSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage account. For more information, see https://docs.microsoft.com/rest/api/storageservices/constructing-an-account-sas
Example ¶
This example shows how to create and use an Azure Storage account Shared Access Signature (SAS).
package main import ( "fmt" "log" "net/url" "os" "time" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account's name and account key. accountName, accountKey := accountInfo() // Use your Storage account's name and key to create a credential object; this is required to sign a SAS. credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Set the desired SAS signature values and sign them with the shared key credentials to get the SAS query parameters. sasQueryParams, err := azfile.AccountSASSignatureValues{ Protocol: azfile.SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP) ExpiryTime: time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration Permissions: azfile.AccountSASPermissions{Read: true, List: true}.String(), Services: azfile.AccountSASServices{File: true}.String(), ResourceTypes: azfile.AccountSASResourceTypes{Container: true, Object: true}.String(), }.NewSASQueryParameters(credential) if err != nil { log.Fatal(err) } qp := sasQueryParams.Encode() urlToSendToSomeone := fmt.Sprintf("https://%s.file.core.windows.net?%s", accountName, qp) // At this point, you can send the urlToSendToSomeone to someone via email or any other mechanism you choose. // ************************************************************************************************ // When someone receives the URL, they access the SAS-protected resource with code like this: u, _ := url.Parse(urlToSendToSomeone) // Create an ServiceURL object that wraps the service URL (and its SAS) and a pipeline. // When using a SAS URLs, anonymous credentials are required. serviceURL := azfile.NewServiceURL(*u, azfile.NewPipeline(azfile.NewAnonymousCredential(), azfile.PipelineOptions{})) // Now, you can use this serviceURL just like any other to make requests of the resource. // You can parse a URL into its constituent parts: fileURLParts := azfile.NewFileURLParts(serviceURL.URL()) fmt.Printf("SAS Protocol=%v\n", fileURLParts.SAS.Protocol()) fmt.Printf("SAS Permissions=%v\n", fileURLParts.SAS.Permissions()) fmt.Printf("SAS Services=%v\n", fileURLParts.SAS.Services()) fmt.Printf("SAS ResourceTypes=%v\n", fileURLParts.SAS.ResourceTypes()) _ = serviceURL // Avoid compiler's "declared and not used" error }
Output: SAS Protocol=https SAS Permissions=rl SAS Services=f SAS ResourceTypes=co
func (AccountSASSignatureValues) NewSASQueryParameters ¶
func (v AccountSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error)
NewSASQueryParameters uses an account's shared key credential to sign this signature values to produce the proper SAS query parameters.
type CopyStatusType ¶
type CopyStatusType string
CopyStatusType enumerates the values for copy status type.
const ( // CopyStatusAborted ... CopyStatusAborted CopyStatusType = "aborted" // CopyStatusFailed ... CopyStatusFailed CopyStatusType = "failed" // CopyStatusNone represents an empty CopyStatusType. CopyStatusNone CopyStatusType = "" // CopyStatusPending ... CopyStatusPending CopyStatusType = "pending" // CopyStatusSuccess ... CopyStatusSuccess CopyStatusType = "success" )
func PossibleCopyStatusTypeValues ¶
func PossibleCopyStatusTypeValues() []CopyStatusType
PossibleCopyStatusTypeValues returns an array of possible values for the CopyStatusType const type.
type CorsRule ¶
type CorsRule struct { // AllowedOrigins - The origin domains that are permitted to make a request against the storage service via CORS. The origin domain is the domain from which the request originates. Note that the origin must be an exact case-sensitive match with the origin that the user age sends to the service. You can also use the wildcard character '*' to allow all origin domains to make requests via CORS. AllowedOrigins string `xml:"AllowedOrigins"` // AllowedMethods - The methods (HTTP request verbs) that the origin domain may use for a CORS request. (comma separated) AllowedMethods string `xml:"AllowedMethods"` // AllowedHeaders - The request headers that the origin domain may specify on the CORS request. AllowedHeaders string `xml:"AllowedHeaders"` // ExposedHeaders - The response headers that may be sent in the response to the CORS request and exposed by the browser to the request issuer. ExposedHeaders string `xml:"ExposedHeaders"` // MaxAgeInSeconds - The maximum amount time that a browser should cache the preflight OPTIONS request. MaxAgeInSeconds int32 `xml:"MaxAgeInSeconds"` }
CorsRule - CORS is an HTTP feature that enables a web application running under one domain to access resources in another domain. Web browsers implement a security restriction known as same-origin policy that prevents a web page from calling APIs in a different domain; CORS provides a secure way to allow one domain (the origin domain) to call APIs in another domain.
type Credential ¶
Credential represent any credential type; it is used to create a credential policy Factory.
func NewAnonymousCredential ¶
func NewAnonymousCredential() Credential
NewAnonymousCredential creates an anonymous credential for use with HTTP(S) requests that read public resource or for use with Shared Access Signatures (SAS).
type DeleteSnapshotsOptionType ¶
type DeleteSnapshotsOptionType string
DeleteSnapshotsOptionType enumerates the values for delete snapshots option type.
const ( // DeleteSnapshotsOptionInclude ... DeleteSnapshotsOptionInclude DeleteSnapshotsOptionType = "include" // DeleteSnapshotsOptionNone represents an empty DeleteSnapshotsOptionType. DeleteSnapshotsOptionNone DeleteSnapshotsOptionType = "" )
func PossibleDeleteSnapshotsOptionTypeValues ¶
func PossibleDeleteSnapshotsOptionTypeValues() []DeleteSnapshotsOptionType
PossibleDeleteSnapshotsOptionTypeValues returns an array of possible values for the DeleteSnapshotsOptionType const type.
type DirectoryCreateResponse ¶
type DirectoryCreateResponse struct {
// contains filtered or unexported fields
}
DirectoryCreateResponse ...
func (DirectoryCreateResponse) Date ¶
func (dcr DirectoryCreateResponse) Date() time.Time
Date returns the value for header Date.
func (DirectoryCreateResponse) ETag ¶
func (dcr DirectoryCreateResponse) ETag() ETag
ETag returns the value for header ETag.
func (DirectoryCreateResponse) ErrorCode ¶
func (dcr DirectoryCreateResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectoryCreateResponse) FileAttributes ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (DirectoryCreateResponse) FileChangeTime ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (DirectoryCreateResponse) FileCreationTime ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (DirectoryCreateResponse) FileID ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (DirectoryCreateResponse) FileLastWriteTime ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (DirectoryCreateResponse) FileParentID ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (DirectoryCreateResponse) FilePermissionKey ¶ added in v0.6.0
func (dcr DirectoryCreateResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (DirectoryCreateResponse) IsServerEncrypted ¶
func (dcr DirectoryCreateResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (DirectoryCreateResponse) LastModified ¶
func (dcr DirectoryCreateResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (DirectoryCreateResponse) RequestID ¶
func (dcr DirectoryCreateResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectoryCreateResponse) Response ¶
func (dcr DirectoryCreateResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectoryCreateResponse) Status ¶
func (dcr DirectoryCreateResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectoryCreateResponse) StatusCode ¶
func (dcr DirectoryCreateResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectoryCreateResponse) Version ¶
func (dcr DirectoryCreateResponse) Version() string
Version returns the value for header x-ms-version.
type DirectoryDeleteResponse ¶
type DirectoryDeleteResponse struct {
// contains filtered or unexported fields
}
DirectoryDeleteResponse ...
func (DirectoryDeleteResponse) Date ¶
func (ddr DirectoryDeleteResponse) Date() time.Time
Date returns the value for header Date.
func (DirectoryDeleteResponse) ErrorCode ¶
func (ddr DirectoryDeleteResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectoryDeleteResponse) RequestID ¶
func (ddr DirectoryDeleteResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectoryDeleteResponse) Response ¶
func (ddr DirectoryDeleteResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectoryDeleteResponse) Status ¶
func (ddr DirectoryDeleteResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectoryDeleteResponse) StatusCode ¶
func (ddr DirectoryDeleteResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectoryDeleteResponse) Version ¶
func (ddr DirectoryDeleteResponse) Version() string
Version returns the value for header x-ms-version.
type DirectoryForceCloseHandlesResponse ¶ added in v0.6.0
type DirectoryForceCloseHandlesResponse struct {
// contains filtered or unexported fields
}
DirectoryForceCloseHandlesResponse ...
func (DirectoryForceCloseHandlesResponse) Date ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) Date() time.Time
Date returns the value for header Date.
func (DirectoryForceCloseHandlesResponse) ErrorCode ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectoryForceCloseHandlesResponse) Marker ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) Marker() string
Marker returns the value for header x-ms-marker.
func (DirectoryForceCloseHandlesResponse) NumberOfHandlesClosed ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) NumberOfHandlesClosed() int32
NumberOfHandlesClosed returns the value for header x-ms-number-of-handles-closed.
func (DirectoryForceCloseHandlesResponse) RequestID ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectoryForceCloseHandlesResponse) Response ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectoryForceCloseHandlesResponse) Status ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectoryForceCloseHandlesResponse) StatusCode ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectoryForceCloseHandlesResponse) Version ¶ added in v0.6.0
func (dfchr DirectoryForceCloseHandlesResponse) Version() string
Version returns the value for header x-ms-version.
type DirectoryGetPropertiesResponse ¶
type DirectoryGetPropertiesResponse struct {
// contains filtered or unexported fields
}
DirectoryGetPropertiesResponse ...
func (DirectoryGetPropertiesResponse) Date ¶
func (dgpr DirectoryGetPropertiesResponse) Date() time.Time
Date returns the value for header Date.
func (DirectoryGetPropertiesResponse) ETag ¶
func (dgpr DirectoryGetPropertiesResponse) ETag() ETag
ETag returns the value for header ETag.
func (DirectoryGetPropertiesResponse) ErrorCode ¶
func (dgpr DirectoryGetPropertiesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectoryGetPropertiesResponse) FileAttributes ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (DirectoryGetPropertiesResponse) FileChangeTime ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (DirectoryGetPropertiesResponse) FileCreationTime ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (DirectoryGetPropertiesResponse) FileID ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (DirectoryGetPropertiesResponse) FileLastWriteTime ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (DirectoryGetPropertiesResponse) FileParentID ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (DirectoryGetPropertiesResponse) FilePermissionKey ¶ added in v0.6.0
func (dgpr DirectoryGetPropertiesResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (DirectoryGetPropertiesResponse) IsServerEncrypted ¶
func (dgpr DirectoryGetPropertiesResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-server-encrypted.
func (DirectoryGetPropertiesResponse) LastModified ¶
func (dgpr DirectoryGetPropertiesResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (DirectoryGetPropertiesResponse) NewMetadata ¶
func (dgpr DirectoryGetPropertiesResponse) NewMetadata() Metadata
NewMetadata returns user-defined key/value pairs.
func (DirectoryGetPropertiesResponse) RequestID ¶
func (dgpr DirectoryGetPropertiesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectoryGetPropertiesResponse) Response ¶
func (dgpr DirectoryGetPropertiesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectoryGetPropertiesResponse) Status ¶
func (dgpr DirectoryGetPropertiesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectoryGetPropertiesResponse) StatusCode ¶
func (dgpr DirectoryGetPropertiesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectoryGetPropertiesResponse) Version ¶
func (dgpr DirectoryGetPropertiesResponse) Version() string
Version returns the value for header x-ms-version.
type DirectoryItem ¶
type DirectoryItem struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"Directory"` // Name - Name of the entry. Name string `xml:"Name"` }
DirectoryItem - Listed directory item.
type DirectorySetMetadataResponse ¶
type DirectorySetMetadataResponse struct {
// contains filtered or unexported fields
}
DirectorySetMetadataResponse ...
func (DirectorySetMetadataResponse) Date ¶
func (dsmr DirectorySetMetadataResponse) Date() time.Time
Date returns the value for header Date.
func (DirectorySetMetadataResponse) ETag ¶
func (dsmr DirectorySetMetadataResponse) ETag() ETag
ETag returns the value for header ETag.
func (DirectorySetMetadataResponse) ErrorCode ¶
func (dsmr DirectorySetMetadataResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectorySetMetadataResponse) IsServerEncrypted ¶
func (dsmr DirectorySetMetadataResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (DirectorySetMetadataResponse) RequestID ¶
func (dsmr DirectorySetMetadataResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectorySetMetadataResponse) Response ¶
func (dsmr DirectorySetMetadataResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectorySetMetadataResponse) Status ¶
func (dsmr DirectorySetMetadataResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectorySetMetadataResponse) StatusCode ¶
func (dsmr DirectorySetMetadataResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectorySetMetadataResponse) Version ¶
func (dsmr DirectorySetMetadataResponse) Version() string
Version returns the value for header x-ms-version.
type DirectorySetPropertiesResponse ¶ added in v0.6.0
type DirectorySetPropertiesResponse struct {
// contains filtered or unexported fields
}
DirectorySetPropertiesResponse ...
func (DirectorySetPropertiesResponse) Date ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) Date() time.Time
Date returns the value for header Date.
func (DirectorySetPropertiesResponse) ETag ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) ETag() ETag
ETag returns the value for header ETag.
func (DirectorySetPropertiesResponse) ErrorCode ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DirectorySetPropertiesResponse) FileAttributes ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (DirectorySetPropertiesResponse) FileChangeTime ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (DirectorySetPropertiesResponse) FileCreationTime ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (DirectorySetPropertiesResponse) FileID ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (DirectorySetPropertiesResponse) FileLastWriteTime ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (DirectorySetPropertiesResponse) FileParentID ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (DirectorySetPropertiesResponse) FilePermissionKey ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (DirectorySetPropertiesResponse) IsServerEncrypted ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (DirectorySetPropertiesResponse) LastModified ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (DirectorySetPropertiesResponse) RequestID ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DirectorySetPropertiesResponse) Response ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DirectorySetPropertiesResponse) Status ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DirectorySetPropertiesResponse) StatusCode ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DirectorySetPropertiesResponse) Version ¶ added in v0.6.0
func (dspr DirectorySetPropertiesResponse) Version() string
Version returns the value for header x-ms-version.
type DirectoryURL ¶
type DirectoryURL struct {
// contains filtered or unexported fields
}
A DirectoryURL represents a URL to the Azure Storage directory allowing you to manipulate its directories and files.
func NewDirectoryURL ¶
func NewDirectoryURL(url url.URL, p pipeline.Pipeline) DirectoryURL
NewDirectoryURL creates a DirectoryURL object using the specified URL and request policy pipeline. Note: p can't be nil.
func (DirectoryURL) Create ¶
func (d DirectoryURL) Create(ctx context.Context, metadata Metadata, properties SMBProperties) (*DirectoryCreateResponse, error)
Create creates a new directory within a storage account. For more information, see https://docs.microsoft.com/rest/api/storageservices/create-directory. Pass default values for SMB properties (ex: "None" for file attributes). If permissions is empty, the default permission "inherit" is used. For SDDL strings over 9KB, upload using ShareURL.CreatePermission, and supply the permissionKey.
func (DirectoryURL) Delete ¶
func (d DirectoryURL) Delete(ctx context.Context) (*DirectoryDeleteResponse, error)
Delete removes the specified empty directory. Note that the directory must be empty before it can be deleted.. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-directory.
func (DirectoryURL) GetProperties ¶
func (d DirectoryURL) GetProperties(ctx context.Context) (*DirectoryGetPropertiesResponse, error)
GetProperties returns the directory's metadata and system properties. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/get-directory-properties.
func (DirectoryURL) ListFilesAndDirectoriesSegment ¶
func (d DirectoryURL) ListFilesAndDirectoriesSegment(ctx context.Context, marker Marker, o ListFilesAndDirectoriesOptions) (*ListFilesAndDirectoriesSegmentResponse, error)
ListFilesAndDirectoriesSegment returns a single segment of files and directories starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. File and directory names are returned in lexicographic order. After getting a segment, process it, and then call ListFilesAndDirectoriesSegment again (passing the the previously-returned Marker) to get the next segment. This method lists the contents only for a single level of the directory hierarchy. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/list-directories-and-files.
func (DirectoryURL) NewDirectoryURL ¶
func (d DirectoryURL) NewDirectoryURL(directoryName string) DirectoryURL
NewDirectoryURL creates a new DirectoryURL object by concatenating directoryName to the end of DirectoryURL's URL. The new DirectoryURL uses the same request policy pipeline as the DirectoryURL. To change the pipeline, create the DirectoryURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewDirectoryURL instead of calling this object's NewDirectoryURL method.
func (DirectoryURL) NewFileURL ¶
func (d DirectoryURL) NewFileURL(fileName string) FileURL
NewFileURL creates a new FileURL object by concatenating fileName to the end of DirectoryURL's URL. The new FileURL uses the same request policy pipeline as the DirectoryURL. To change the pipeline, create the FileURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewFileURL instead of calling this object's NewFileURL method.
func (DirectoryURL) SetMetadata ¶
func (d DirectoryURL) SetMetadata(ctx context.Context, metadata Metadata) (*DirectorySetMetadataResponse, error)
SetMetadata sets the directory's metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-directory-metadata.
func (DirectoryURL) SetProperties ¶ added in v0.7.0
func (d DirectoryURL) SetProperties(ctx context.Context, properties SMBProperties) (*DirectorySetPropertiesResponse, error)
SetProperties sets the directory's metadata and system properties. Preserves values for SMB properties. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/set-directory-properties.
func (DirectoryURL) String ¶
func (d DirectoryURL) String() string
String returns the URL as a string.
func (DirectoryURL) URL ¶
func (d DirectoryURL) URL() url.URL
URL returns the URL endpoint used by the DirectoryURL object.
func (DirectoryURL) WithPipeline ¶
func (d DirectoryURL) WithPipeline(p pipeline.Pipeline) DirectoryURL
WithPipeline creates a new DirectoryURL object identical to the source but with the specified request policy pipeline.
type DownloadFromAzureFileOptions ¶
type DownloadFromAzureFileOptions struct { // RangeSize specifies the range size to use in each parallel download; the default is FileMaxUploadRangeBytes. RangeSize int64 // Progress is a function that is invoked periodically as bytes are recieved. Progress pipeline.ProgressReceiver // Parallelism indicates the maximum number of ranges to download in parallel. If 0(default) is provided, 5 parallelism will be used by default. Parallelism uint16 // Max retry requests used during reading data for each range. MaxRetryRequestsPerRange int }
DownloadFromAzureFileOptions identifies options used by the DownloadAzureFileToBuffer and DownloadAzureFileToFile functions.
type DownloadResponse ¶
type DownloadResponse struct {
// contains filtered or unexported fields
}
DownloadResponse - Wraps the response from the fileClient.Download method.
func (DownloadResponse) AcceptRanges ¶
func (dr DownloadResponse) AcceptRanges() string
AcceptRanges returns the value for header Accept-Ranges.
func (DownloadResponse) Body ¶
func (dr DownloadResponse) Body() io.ReadCloser
Body returns the raw HTTP response object's Body.
func (DownloadResponse) CacheControl ¶
func (dr DownloadResponse) CacheControl() string
CacheControl returns the value for header Cache-Control.
func (DownloadResponse) ContentDisposition ¶
func (dr DownloadResponse) ContentDisposition() string
ContentDisposition returns the value for header Content-Disposition.
func (DownloadResponse) ContentEncoding ¶
func (dr DownloadResponse) ContentEncoding() string
ContentEncoding returns the value for header Content-Encoding.
func (DownloadResponse) ContentLanguage ¶
func (dr DownloadResponse) ContentLanguage() string
ContentLanguage returns the value for header Content-Language.
func (DownloadResponse) ContentLength ¶
func (dr DownloadResponse) ContentLength() int64
ContentLength returns the value for header Content-Length.
func (DownloadResponse) ContentMD5 ¶
func (dr DownloadResponse) ContentMD5() []byte
ContentMD5 returns the value for header Content-MD5.
func (DownloadResponse) ContentRange ¶
func (dr DownloadResponse) ContentRange() string
ContentRange returns the value for header Content-Range.
func (DownloadResponse) ContentType ¶
func (dr DownloadResponse) ContentType() string
ContentType returns the value for header Content-Type.
func (DownloadResponse) CopyCompletionTime ¶
func (dr DownloadResponse) CopyCompletionTime() time.Time
CopyCompletionTime returns the value for header x-ms-copy-completion-time.
func (DownloadResponse) CopyID ¶
func (dr DownloadResponse) CopyID() string
CopyID returns the value for header x-ms-copy-id.
func (DownloadResponse) CopyProgress ¶
func (dr DownloadResponse) CopyProgress() string
CopyProgress returns the value for header x-ms-copy-progress.
func (DownloadResponse) CopySource ¶
func (dr DownloadResponse) CopySource() string
CopySource returns the value for header x-ms-copy-source.
func (DownloadResponse) CopyStatus ¶
func (dr DownloadResponse) CopyStatus() CopyStatusType
CopyStatus returns the value for header x-ms-copy-status.
func (DownloadResponse) CopyStatusDescription ¶
func (dr DownloadResponse) CopyStatusDescription() string
CopyStatusDescription returns the value for header x-ms-copy-status-description.
func (DownloadResponse) Date ¶
func (dr DownloadResponse) Date() time.Time
Date returns the value for header Date.
func (DownloadResponse) ETag ¶
func (dr DownloadResponse) ETag() ETag
ETag returns the value for header ETag.
func (DownloadResponse) ErrorCode ¶ added in v0.6.0
func (dr DownloadResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (DownloadResponse) FileAttributes ¶ added in v0.6.0
func (dr DownloadResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (DownloadResponse) FileChangeTime ¶ added in v0.6.0
func (dr DownloadResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (DownloadResponse) FileContentMD5 ¶
func (dr DownloadResponse) FileContentMD5() []byte
FileContentMD5 returns the value for header x-ms-content-md5.
func (DownloadResponse) FileCreationTime ¶ added in v0.6.0
func (dr DownloadResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (DownloadResponse) FileID ¶ added in v0.6.0
func (dr DownloadResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (DownloadResponse) FileLastWriteTime ¶ added in v0.6.0
func (dr DownloadResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (DownloadResponse) FileParentID ¶ added in v0.6.0
func (dr DownloadResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (DownloadResponse) FilePermissionKey ¶ added in v0.6.0
func (dr DownloadResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (DownloadResponse) IsServerEncrypted ¶
func (dr DownloadResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-server-encrypted.
func (DownloadResponse) LastModified ¶
func (dr DownloadResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (DownloadResponse) NewMetadata ¶
func (dr DownloadResponse) NewMetadata() Metadata
NewMetadata returns user-defined key/value pairs.
func (DownloadResponse) RequestID ¶
func (dr DownloadResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (DownloadResponse) Response ¶
func (dr DownloadResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (DownloadResponse) Status ¶
func (dr DownloadResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (DownloadResponse) StatusCode ¶
func (dr DownloadResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (DownloadResponse) Version ¶
func (dr DownloadResponse) Version() string
Version returns the value for header x-ms-version.
type FailedReadNotifier ¶
type FailedReadNotifier func(failureCount int, lastError error, offset int64, count int64, willRetry bool)
FailedReadNotifier is a function type that represents the notification function called when a read fails
type FileAbortCopyResponse ¶
type FileAbortCopyResponse struct {
// contains filtered or unexported fields
}
FileAbortCopyResponse ...
func (FileAbortCopyResponse) Date ¶
func (facr FileAbortCopyResponse) Date() time.Time
Date returns the value for header Date.
func (FileAbortCopyResponse) ErrorCode ¶
func (facr FileAbortCopyResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileAbortCopyResponse) RequestID ¶
func (facr FileAbortCopyResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileAbortCopyResponse) Response ¶
func (facr FileAbortCopyResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileAbortCopyResponse) Status ¶
func (facr FileAbortCopyResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileAbortCopyResponse) StatusCode ¶
func (facr FileAbortCopyResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileAbortCopyResponse) Version ¶
func (facr FileAbortCopyResponse) Version() string
Version returns the value for header x-ms-version.
type FileAttributeFlags ¶ added in v0.7.0
type FileAttributeFlags uint32
FileAttributeFlags are a subset of the WinNT.h file attribute bitflags. The uint32 returned from golang.org/x/sys/windows' GetFileAttributes func can be converted directly without worry, since both types are uint32, and the numeric values line up. However, crafting these manually is acceptable via the .Add function. Removing properties is done via .Remove. Checking if one contains another can be done with .Has The subset is listed at: https://docs.microsoft.com/en-us/rest/api/storageservices/set-file-properties#file-system-attributes and the values are listed at: https://www.magnumdb.com/search?q=filename%3Awinnt.h+AND+FILE_ATTRIBUTE_* This is intended for easy conversion from the following function: https://pkg.go.dev/golang.org/x/sys/windows?tab=doc#GetFileAttributes
const ( FileAttributeNone FileAttributeFlags = 0 FileAttributeReadonly FileAttributeFlags = 1 FileAttributeHidden FileAttributeFlags = 2 FileAttributeSystem FileAttributeFlags = 4 FileAttributeArchive FileAttributeFlags = 32 FileAttributeTemporary FileAttributeFlags = 256 FileAttributeOffline FileAttributeFlags = 4096 FileAttributeNotContentIndexed FileAttributeFlags = 8192 FileAttributeNoScrubData FileAttributeFlags = 131072 )
func ParseFileAttributeFlagsString ¶ added in v0.7.0
func ParseFileAttributeFlagsString(input string) (out FileAttributeFlags)
ParseFileAttributeFlagsString parses the service-side file attribute strings that the above enum strongly types.
func (FileAttributeFlags) Add ¶ added in v0.7.0
func (f FileAttributeFlags) Add(new FileAttributeFlags) FileAttributeFlags
func (FileAttributeFlags) Has ¶ added in v0.7.0
func (f FileAttributeFlags) Has(item FileAttributeFlags) bool
func (FileAttributeFlags) Remove ¶ added in v0.7.0
func (f FileAttributeFlags) Remove(old FileAttributeFlags) FileAttributeFlags
func (FileAttributeFlags) String ¶ added in v0.7.0
func (f FileAttributeFlags) String() (out string)
type FileCreateResponse ¶
type FileCreateResponse struct {
// contains filtered or unexported fields
}
FileCreateResponse ...
func (FileCreateResponse) Date ¶
func (fcr FileCreateResponse) Date() time.Time
Date returns the value for header Date.
func (FileCreateResponse) ETag ¶
func (fcr FileCreateResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileCreateResponse) ErrorCode ¶
func (fcr FileCreateResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileCreateResponse) FileAttributes ¶ added in v0.6.0
func (fcr FileCreateResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (FileCreateResponse) FileChangeTime ¶ added in v0.6.0
func (fcr FileCreateResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (FileCreateResponse) FileCreationTime ¶ added in v0.6.0
func (fcr FileCreateResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (FileCreateResponse) FileID ¶ added in v0.6.0
func (fcr FileCreateResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (FileCreateResponse) FileLastWriteTime ¶ added in v0.6.0
func (fcr FileCreateResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (FileCreateResponse) FileParentID ¶ added in v0.6.0
func (fcr FileCreateResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (FileCreateResponse) FilePermissionKey ¶ added in v0.6.0
func (fcr FileCreateResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (FileCreateResponse) IsServerEncrypted ¶
func (fcr FileCreateResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (FileCreateResponse) LastModified ¶
func (fcr FileCreateResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileCreateResponse) RequestID ¶
func (fcr FileCreateResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileCreateResponse) Response ¶
func (fcr FileCreateResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileCreateResponse) Status ¶
func (fcr FileCreateResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileCreateResponse) StatusCode ¶
func (fcr FileCreateResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileCreateResponse) Version ¶
func (fcr FileCreateResponse) Version() string
Version returns the value for header x-ms-version.
type FileDeleteResponse ¶
type FileDeleteResponse struct {
// contains filtered or unexported fields
}
FileDeleteResponse ...
func (FileDeleteResponse) Date ¶
func (fdr FileDeleteResponse) Date() time.Time
Date returns the value for header Date.
func (FileDeleteResponse) ErrorCode ¶
func (fdr FileDeleteResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileDeleteResponse) RequestID ¶
func (fdr FileDeleteResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileDeleteResponse) Response ¶
func (fdr FileDeleteResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileDeleteResponse) Status ¶
func (fdr FileDeleteResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileDeleteResponse) StatusCode ¶
func (fdr FileDeleteResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileDeleteResponse) Version ¶
func (fdr FileDeleteResponse) Version() string
Version returns the value for header x-ms-version.
type FileForceCloseHandlesResponse ¶ added in v0.6.0
type FileForceCloseHandlesResponse struct {
// contains filtered or unexported fields
}
FileForceCloseHandlesResponse ...
func (FileForceCloseHandlesResponse) Date ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) Date() time.Time
Date returns the value for header Date.
func (FileForceCloseHandlesResponse) ErrorCode ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileForceCloseHandlesResponse) Marker ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) Marker() string
Marker returns the value for header x-ms-marker.
func (FileForceCloseHandlesResponse) NumberOfHandlesClosed ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) NumberOfHandlesClosed() int32
NumberOfHandlesClosed returns the value for header x-ms-number-of-handles-closed.
func (FileForceCloseHandlesResponse) RequestID ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileForceCloseHandlesResponse) Response ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileForceCloseHandlesResponse) Status ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileForceCloseHandlesResponse) StatusCode ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileForceCloseHandlesResponse) Version ¶ added in v0.6.0
func (ffchr FileForceCloseHandlesResponse) Version() string
Version returns the value for header x-ms-version.
type FileGetPropertiesResponse ¶
type FileGetPropertiesResponse struct {
// contains filtered or unexported fields
}
FileGetPropertiesResponse ...
func DownloadAzureFileToBuffer ¶
func DownloadAzureFileToBuffer(ctx context.Context, fileURL FileURL, b []byte, o DownloadFromAzureFileOptions) (*FileGetPropertiesResponse, error)
DownloadAzureFileToBuffer downloads an Azure file to a buffer with parallel.
func DownloadAzureFileToFile ¶
func DownloadAzureFileToFile(ctx context.Context, fileURL FileURL, file *os.File, o DownloadFromAzureFileOptions) (*FileGetPropertiesResponse, error)
DownloadAzureFileToFile downloads an Azure file to a local file. The file would be created if it doesn't exist, and would be truncated if the size doesn't match. Note: file can't be nil.
Example ¶
This example shows how to download a large Azure file to local with parallel support.
package main import ( "context" "fmt" "log" "net/url" "os" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a FileURL object to a file in the share (we assume the share & file already exist). u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/BigFile.bin", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) file, err := os.Create("BigFile.bin") // Create the file to hold the downloaded file contents. if err != nil { log.Fatal(err) } defer file.Close() // Trigger parallel download with Parallelism set to 3, MaxRetryRequestsPerRange means the count of retry requests // could be sent if there is error during reading stream. downloadResponse, err := azfile.DownloadAzureFileToFile(context.Background(), fileURL, file, azfile.DownloadFromAzureFileOptions{ Parallelism: 3, MaxRetryRequestsPerRange: 2, Progress: func(bytesTransferred int64) { fmt.Printf("Downloaded %d bytes.\n", bytesTransferred) }, }) if err != nil { log.Fatal(err) } lastModified := downloadResponse.LastModified() // You can check the property of download file as well. _ = lastModified // Avoid compiler's "declared and not used" error }
Output:
func (FileGetPropertiesResponse) CacheControl ¶
func (fgpr FileGetPropertiesResponse) CacheControl() string
CacheControl returns the value for header Cache-Control.
func (FileGetPropertiesResponse) ContentDisposition ¶
func (fgpr FileGetPropertiesResponse) ContentDisposition() string
ContentDisposition returns the value for header Content-Disposition.
func (FileGetPropertiesResponse) ContentEncoding ¶
func (fgpr FileGetPropertiesResponse) ContentEncoding() string
ContentEncoding returns the value for header Content-Encoding.
func (FileGetPropertiesResponse) ContentLanguage ¶
func (fgpr FileGetPropertiesResponse) ContentLanguage() string
ContentLanguage returns the value for header Content-Language.
func (FileGetPropertiesResponse) ContentLength ¶
func (fgpr FileGetPropertiesResponse) ContentLength() int64
ContentLength returns the value for header Content-Length.
func (FileGetPropertiesResponse) ContentMD5 ¶
func (fgpr FileGetPropertiesResponse) ContentMD5() []byte
ContentMD5 returns the value for header Content-MD5.
func (FileGetPropertiesResponse) ContentType ¶
func (fgpr FileGetPropertiesResponse) ContentType() string
ContentType returns the value for header Content-Type.
func (FileGetPropertiesResponse) CopyCompletionTime ¶
func (fgpr FileGetPropertiesResponse) CopyCompletionTime() time.Time
CopyCompletionTime returns the value for header x-ms-copy-completion-time.
func (FileGetPropertiesResponse) CopyID ¶
func (fgpr FileGetPropertiesResponse) CopyID() string
CopyID returns the value for header x-ms-copy-id.
func (FileGetPropertiesResponse) CopyProgress ¶
func (fgpr FileGetPropertiesResponse) CopyProgress() string
CopyProgress returns the value for header x-ms-copy-progress.
func (FileGetPropertiesResponse) CopySource ¶
func (fgpr FileGetPropertiesResponse) CopySource() string
CopySource returns the value for header x-ms-copy-source.
func (FileGetPropertiesResponse) CopyStatus ¶
func (fgpr FileGetPropertiesResponse) CopyStatus() CopyStatusType
CopyStatus returns the value for header x-ms-copy-status.
func (FileGetPropertiesResponse) CopyStatusDescription ¶
func (fgpr FileGetPropertiesResponse) CopyStatusDescription() string
CopyStatusDescription returns the value for header x-ms-copy-status-description.
func (FileGetPropertiesResponse) Date ¶
func (fgpr FileGetPropertiesResponse) Date() time.Time
Date returns the value for header Date.
func (FileGetPropertiesResponse) ETag ¶
func (fgpr FileGetPropertiesResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileGetPropertiesResponse) ErrorCode ¶
func (fgpr FileGetPropertiesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileGetPropertiesResponse) FileAttributes ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (FileGetPropertiesResponse) FileChangeTime ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (FileGetPropertiesResponse) FileCreationTime ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (FileGetPropertiesResponse) FileID ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (FileGetPropertiesResponse) FileLastWriteTime ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (FileGetPropertiesResponse) FileParentID ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (FileGetPropertiesResponse) FilePermissionKey ¶ added in v0.6.0
func (fgpr FileGetPropertiesResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (FileGetPropertiesResponse) FileType ¶
func (fgpr FileGetPropertiesResponse) FileType() string
FileType returns the value for header x-ms-type.
func (FileGetPropertiesResponse) IsServerEncrypted ¶
func (fgpr FileGetPropertiesResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-server-encrypted.
func (FileGetPropertiesResponse) LastModified ¶
func (fgpr FileGetPropertiesResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileGetPropertiesResponse) NewHTTPHeaders ¶
func (fgpr FileGetPropertiesResponse) NewHTTPHeaders() FileHTTPHeaders
NewHTTPHeaders returns the user-modifiable properties for this file.
func (FileGetPropertiesResponse) NewMetadata ¶
func (fgpr FileGetPropertiesResponse) NewMetadata() Metadata
NewMetadata returns user-defined key/value pairs.
func (FileGetPropertiesResponse) RequestID ¶
func (fgpr FileGetPropertiesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileGetPropertiesResponse) Response ¶
func (fgpr FileGetPropertiesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileGetPropertiesResponse) Status ¶
func (fgpr FileGetPropertiesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileGetPropertiesResponse) StatusCode ¶
func (fgpr FileGetPropertiesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileGetPropertiesResponse) Version ¶
func (fgpr FileGetPropertiesResponse) Version() string
Version returns the value for header x-ms-version.
type FileHTTPHeaders ¶
type FileHTTPHeaders struct { ContentType string ContentMD5 []byte ContentEncoding string ContentLanguage string ContentDisposition string CacheControl string SMBProperties }
FileHTTPHeaders contains read/writeable file properties.
type FileItem ¶
type FileItem struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"File"` // Name - Name of the entry. Name string `xml:"Name"` Properties *FileProperty `xml:"Properties"` }
FileItem - Listed file item.
type FileProperty ¶
type FileProperty struct { // ContentLength - Content length of the file. This value may not be up-to-date since an SMB client may have modified the file locally. The value of Content-Length may not reflect that fact until the handle is closed or the op-lock is broken. To retrieve current property values, call Get File Properties. ContentLength int64 `xml:"Content-Length"` }
FileProperty - File properties.
type FileRangeWriteType ¶
type FileRangeWriteType string
FileRangeWriteType enumerates the values for file range write type.
const ( // FileRangeWriteClear ... FileRangeWriteClear FileRangeWriteType = "clear" // FileRangeWriteNone represents an empty FileRangeWriteType. FileRangeWriteNone FileRangeWriteType = "" // FileRangeWriteUpdate ... FileRangeWriteUpdate FileRangeWriteType = "update" )
func PossibleFileRangeWriteTypeValues ¶
func PossibleFileRangeWriteTypeValues() []FileRangeWriteType
PossibleFileRangeWriteTypeValues returns an array of possible values for the FileRangeWriteType const type.
type FileSASPermissions ¶
type FileSASPermissions struct{ Read, Create, Write, Delete bool }
The FileSASPermissions type simplifies creating the permissions string for an Azure Storage file SAS. Initialize an instance of this type and then call its String method to set FileSASSignatureValues's Permissions field.
func (*FileSASPermissions) Parse ¶
func (p *FileSASPermissions) Parse(s string) error
Parse initializes the FileSASPermissions's fields from a string.
func (FileSASPermissions) String ¶
func (p FileSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage file. Call this method to set FileSASSignatureValues's Permissions field.
type FileSASSignatureValues ¶
type FileSASSignatureValues struct { Version string `param:"sv"` // If not specified, this defaults to SASVersion Protocol SASProtocol `param:"spr"` // See the SASProtocol* constants StartTime time.Time `param:"st"` // Not specified if IsZero ExpiryTime time.Time `param:"se"` // Not specified if IsZero Permissions string `param:"sp"` // Create by initializing a ShareSASPermissions or FileSASPermissions and then call String() IPRange IPRange `param:"sip"` Identifier string `param:"si"` FilePath string // Ex: "directory/FileName" or "FileName". Use "" to create a Share SAS. CacheControl string // rscc ContentDisposition string // rscd ContentEncoding string // rsce ContentLanguage string // rscl ContentType string // rsct }
FileSASSignatureValues is used to generate a Shared Access Signature (SAS) for an Azure Storage share or file.
Example ¶
This example shows how to create and use a File Service Shared Access Signature (SAS).
package main import ( "fmt" "log" "net/url" "os" "time" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account's name and account key. accountName, accountKey := accountInfo() // Use your Storage account's name and key to create a credential object; this is required to sign a SAS. credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // This is the name of the share and path of the file that we're creating a SAS to. shareName := "myshare" // Share names require lowercase filePath := "mydirectory/HelloWorld.txt" // Directory and file path can be mixed case and is case insensitive // Set the desired SAS signature values and sign them with the shared key credentials to get the SAS query parameters. sasQueryParams, err := azfile.FileSASSignatureValues{ Protocol: azfile.SASProtocolHTTPS, // Users MUST use HTTPS (not HTTP) ExpiryTime: time.Now().UTC().Add(48 * time.Hour), // 48-hours before expiration ShareName: shareName, FilePath: filePath, // To produce a share SAS (as opposed to a file SAS in this example), assign to Permissions using // ShareSASPermissions and make sure the FilePath field is "" (the default). Permissions: azfile.FileSASPermissions{Read: true, Write: true}.String(), }.NewSASQueryParameters(credential) if err != nil { log.Fatal(err) } // Create the URL of the resource you wish to access and append the SAS query parameters. // Since this is a file SAS, the URL is to the Azure storage file. qp := sasQueryParams.Encode() urlToSendToSomeone := fmt.Sprintf("https://%s.file.core.windows.net/%s/%s?%s", accountName, shareName, filePath, qp) // At this point, you can send the urlToSendToSomeone to someone via email or any other mechanism you choose. // ************************************************************************************************ // When someone receives the URL, they access the SAS-protected resource with code like this: u, _ := url.Parse(urlToSendToSomeone) // Create an FileURL object that wraps the file URL (and its SAS) and a pipeline. // When using a SAS URLs, anonymous credentials are required. fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(azfile.NewAnonymousCredential(), azfile.PipelineOptions{})) // Now, you can use this fileURL just like any other to make requests of the resource. // If you have a SAS query parameter string, you can parse it into its parts: fileURLParts := azfile.NewFileURLParts(fileURL.URL()) fmt.Printf("SAS expiry time=%v", fileURLParts.SAS.ExpiryTime()) fmt.Printf(urlToSendToSomeone) _ = fileURL // Avoid compiler's "declared and not used" error }
Output:
func (FileSASSignatureValues) NewSASQueryParameters ¶
func (v FileSASSignatureValues) NewSASQueryParameters(sharedKeyCredential *SharedKeyCredential) (SASQueryParameters, error)
NewSASQueryParameters uses an account's shared key credential to sign this signature values to produce the proper SAS query parameters.
type FileServiceProperties ¶
type FileServiceProperties struct { // HourMetrics - A summary of request statistics grouped by API in hourly aggregates for files. HourMetrics MetricProperties // MinuteMetrics - A summary of request statistics grouped by API in minute aggregates for files. MinuteMetrics MetricProperties // Cors - The set of CORS rules. Cors []CorsRule // contains filtered or unexported fields }
FileServiceProperties defines convenience struct for StorageServiceProperties
func (FileServiceProperties) RequestID ¶
func (fsp FileServiceProperties) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileServiceProperties) Response ¶
func (fsp FileServiceProperties) Response() *http.Response
Response returns the raw HTTP response object.
func (FileServiceProperties) Status ¶
func (fsp FileServiceProperties) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileServiceProperties) StatusCode ¶
func (fsp FileServiceProperties) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileServiceProperties) Version ¶
func (fsp FileServiceProperties) Version() string
Version returns the value for header x-ms-version.
type FileSetHTTPHeadersResponse ¶
type FileSetHTTPHeadersResponse struct {
// contains filtered or unexported fields
}
FileSetHTTPHeadersResponse ...
func (FileSetHTTPHeadersResponse) Date ¶
func (fshhr FileSetHTTPHeadersResponse) Date() time.Time
Date returns the value for header Date.
func (FileSetHTTPHeadersResponse) ETag ¶
func (fshhr FileSetHTTPHeadersResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileSetHTTPHeadersResponse) ErrorCode ¶
func (fshhr FileSetHTTPHeadersResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileSetHTTPHeadersResponse) FileAttributes ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileAttributes() string
FileAttributes returns the value for header x-ms-file-attributes.
func (FileSetHTTPHeadersResponse) FileChangeTime ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileChangeTime() string
FileChangeTime returns the value for header x-ms-file-change-time.
func (FileSetHTTPHeadersResponse) FileCreationTime ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileCreationTime() string
FileCreationTime returns the value for header x-ms-file-creation-time.
func (FileSetHTTPHeadersResponse) FileID ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileID() string
FileID returns the value for header x-ms-file-id.
func (FileSetHTTPHeadersResponse) FileLastWriteTime ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileLastWriteTime() string
FileLastWriteTime returns the value for header x-ms-file-last-write-time.
func (FileSetHTTPHeadersResponse) FileParentID ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FileParentID() string
FileParentID returns the value for header x-ms-file-parent-id.
func (FileSetHTTPHeadersResponse) FilePermissionKey ¶ added in v0.6.0
func (fshhr FileSetHTTPHeadersResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (FileSetHTTPHeadersResponse) IsServerEncrypted ¶
func (fshhr FileSetHTTPHeadersResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (FileSetHTTPHeadersResponse) LastModified ¶
func (fshhr FileSetHTTPHeadersResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileSetHTTPHeadersResponse) RequestID ¶
func (fshhr FileSetHTTPHeadersResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileSetHTTPHeadersResponse) Response ¶
func (fshhr FileSetHTTPHeadersResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileSetHTTPHeadersResponse) Status ¶
func (fshhr FileSetHTTPHeadersResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileSetHTTPHeadersResponse) StatusCode ¶
func (fshhr FileSetHTTPHeadersResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileSetHTTPHeadersResponse) Version ¶
func (fshhr FileSetHTTPHeadersResponse) Version() string
Version returns the value for header x-ms-version.
type FileSetMetadataResponse ¶
type FileSetMetadataResponse struct {
// contains filtered or unexported fields
}
FileSetMetadataResponse ...
func (FileSetMetadataResponse) Date ¶
func (fsmr FileSetMetadataResponse) Date() time.Time
Date returns the value for header Date.
func (FileSetMetadataResponse) ETag ¶
func (fsmr FileSetMetadataResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileSetMetadataResponse) ErrorCode ¶
func (fsmr FileSetMetadataResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileSetMetadataResponse) IsServerEncrypted ¶
func (fsmr FileSetMetadataResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (FileSetMetadataResponse) RequestID ¶
func (fsmr FileSetMetadataResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileSetMetadataResponse) Response ¶
func (fsmr FileSetMetadataResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileSetMetadataResponse) Status ¶
func (fsmr FileSetMetadataResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileSetMetadataResponse) StatusCode ¶
func (fsmr FileSetMetadataResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileSetMetadataResponse) Version ¶
func (fsmr FileSetMetadataResponse) Version() string
Version returns the value for header x-ms-version.
type FileStartCopyResponse ¶
type FileStartCopyResponse struct {
// contains filtered or unexported fields
}
FileStartCopyResponse ...
func (FileStartCopyResponse) CopyID ¶
func (fscr FileStartCopyResponse) CopyID() string
CopyID returns the value for header x-ms-copy-id.
func (FileStartCopyResponse) CopyStatus ¶
func (fscr FileStartCopyResponse) CopyStatus() CopyStatusType
CopyStatus returns the value for header x-ms-copy-status.
func (FileStartCopyResponse) Date ¶
func (fscr FileStartCopyResponse) Date() time.Time
Date returns the value for header Date.
func (FileStartCopyResponse) ETag ¶
func (fscr FileStartCopyResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileStartCopyResponse) ErrorCode ¶
func (fscr FileStartCopyResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileStartCopyResponse) LastModified ¶
func (fscr FileStartCopyResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileStartCopyResponse) RequestID ¶
func (fscr FileStartCopyResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileStartCopyResponse) Response ¶
func (fscr FileStartCopyResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileStartCopyResponse) Status ¶
func (fscr FileStartCopyResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileStartCopyResponse) StatusCode ¶
func (fscr FileStartCopyResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileStartCopyResponse) Version ¶
func (fscr FileStartCopyResponse) Version() string
Version returns the value for header x-ms-version.
type FileURL ¶
type FileURL struct {
// contains filtered or unexported fields
}
A FileURL represents a URL to an Azure Storage file.
Example ¶
ExampleFileURL shows how to create & resize a file, and then update & get data in the file.
package main import ( "bytes" "context" "fmt" "log" "net/url" "os" "strings" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() ctx := context.Background() // This example uses a never-expiring context credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Prepare a share for the file example. u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare", accountName)) shareURL := azfile.NewShareURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) _, err = shareURL.Create(ctx, azfile.Metadata{}, 0) if err != nil && err.(azfile.StorageError) != nil && err.(azfile.StorageError).ServiceCode() != azfile.ServiceCodeShareAlreadyExists { log.Fatal(err) } // Create a FileURL object with a default pipeline. u, _ = url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/MyFile.txt", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) // Create the file with string (plain text) content. d1 := "Hello " d1Length := int64(len(d1)) _, err = fileURL.Create(ctx, d1Length, azfile.FileHTTPHeaders{ContentType: "text/plain"}, azfile.Metadata{}) if err != nil { log.Fatal(err) } // UploadRange updates data in the file with the range for d1. // In this stage, file created has one range: [0, d1Length-1] _, err = fileURL.UploadRange(ctx, 0, strings.NewReader(d1), nil) if err != nil { log.Fatal(err) } // We have more data to save in the file. d2 := "World!" d2Offset := d1Length d2Length := int64(len(d2)) totalLength := d1Length + d2Length // Resize the file, as we want to save more data in this file. _, err = fileURL.Resize(ctx, totalLength) if err != nil { log.Fatal(err) } // UploadRange updates data in the file with the range for d2. // In this stage, file created has two ranges: [0, length-1] for data and [d2Offset, totalLength-1] for d2. _, err = fileURL.UploadRange(ctx, d2Offset, strings.NewReader(d2), nil) if err != nil { log.Fatal(err) } // Let's get all the data saved in the file, and verify if data is correct. // User can specify 0 as offset and azfile.CountToEnd(-1) as count to indiciate downloading the entire file. get, err := fileURL.Download(ctx, 0, azfile.CountToEnd, false) if err != nil { log.Fatal(err) } fileData := &bytes.Buffer{} // The resilient reader can help to read stream in a resilient way, by default it returns a raw stream, // which will not provide additional retry mechanism. retryReader := get.Body(azfile.RetryReaderOptions{}) defer retryReader.Close() // The client must close the response body when finished with it _, err = fileData.ReadFrom(retryReader) if err != nil { log.Fatal(err) } fmt.Println(fileData) // The output would be: // Hello World! }
Output:
Example (ProgressUploadDownload) ¶
This example shows how to upload and download with progress updates.
package main import ( "bytes" "context" "fmt" "log" "net/url" "os" "strings" "github.com/Azure/azure-pipeline-go/pipeline" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // Create a request pipeline using your Storage account's name and account key. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } p := azfile.NewPipeline(credential, azfile.PipelineOptions{}) // From the Azure portal, get your Storage account file service URL endpoint. sURL, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare", accountName)) // Create a ShareURL object that wraps the share URL and a request pipeline to making requests. shareURL := azfile.NewShareURL(*sURL, p) ctx := context.Background() // This example uses a never-expiring context fileURL := shareURL.NewRootDirectoryURL().NewFileURL("Data.bin") // requestBody is the stream of data to write requestBody := strings.NewReader("Some text to write") size := requestBody.Len() // Wrap the request body in a RequestBodyProgress and pass a callback function for progress reporting. _, err = fileURL.Create(ctx, int64(size), azfile.FileHTTPHeaders{ ContentType: "text/html; charset=utf-8", ContentDisposition: "attachment", }, azfile.Metadata{}) if err != nil { log.Fatal(err) } _, err = fileURL.UploadRange(ctx, 0, pipeline.NewRequestBodyProgress(requestBody, func(bytesTransferred int64) { fmt.Printf("Wrote %d of %d bytes.\n", bytesTransferred, size) }), nil) if err != nil { log.Fatal(err) } // Here's how to read the file's data with progress reporting: get, err := fileURL.Download(ctx, 0, azfile.CountToEnd, false) if err != nil { log.Fatal(err) } // Wrap the response body in a ResponseBodyProgress and pass a callback function for progress reporting. responseBody := pipeline.NewResponseBodyProgress(get.Body(azfile.RetryReaderOptions{}), func(bytesTransferred int64) { fmt.Printf("Read %d of %d bytes.\n", bytesTransferred, get.ContentLength()) }) downloadedData := &bytes.Buffer{} downloadedData.ReadFrom(responseBody) responseBody.Close() // The client must close the response body when finished with it // The downloaded file data is in downloadData's buffer }
Output:
func NewFileURL ¶
NewFileURL creates a FileURL object using the specified URL and request policy pipeline. Note: p can't be nil.
func (FileURL) AbortCopy ¶
AbortCopy stops a pending copy that was previously started and leaves a destination file with 0 length and metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/abort-copy-file.
func (FileURL) ClearRange ¶
func (f FileURL) ClearRange(ctx context.Context, offset int64, count int64) (*FileUploadRangeResponse, error)
ClearRange clears the specified range and releases the space used in storage for that range. offset means the start offset of the range to clear. count means count of bytes to clean, it cannot be CountToEnd (0), and must be explictly specified. If the range specified is not 512-byte aligned, the operation will write zeros to the start or end of the range that is not 512-byte aligned and free the rest of the range inside that is 512-byte aligned. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-range.
func (FileURL) Create ¶
func (f FileURL) Create(ctx context.Context, size int64, h FileHTTPHeaders, metadata Metadata) (*FileCreateResponse, error)
Create creates a new file or replaces a file. Note that this method only initializes the file. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/create-file. Pass default values for SMB properties (ex: "None" for file attributes).
func (FileURL) Delete ¶
func (f FileURL) Delete(ctx context.Context) (*FileDeleteResponse, error)
Delete immediately removes the file from the storage account. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-file2.
func (FileURL) Download ¶
func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeGetContentMD5 bool) (*RetryableDownloadResponse, error)
Download downloads count bytes of data from the start offset. The response includes all of the file’s properties. However, passing true for rangeGetContentMD5 returns the range’s MD5 in the ContentMD5 response header/property if the range is <= 4MB; the HTTP request fails with 400 (Bad Request) if the requested range is greater than 4MB. Note: offset must be >=0, count must be >= 0. If count is CountToEnd (0), then data is read from specified offset to the end. rangeGetContentMD5 only works with partial data downloading. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-file.
Example ¶
This example shows how to download a large file using a RetryReader. Specifically, if the connection fails while reading, continuing to read from this RetryReader initiates a new Download call passing a range that starts from the last byte successfully read before the failure.
package main import ( "context" "fmt" "io" "log" "net/url" "os" "github.com/Azure/azure-pipeline-go/pipeline" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a FileURL object to a file in the share (we assume the share & file already exist). // Note: You can call GetProperties first to ensure the Azure file exists before downloading. u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/BigFile.bin", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) // Trigger download. downloadResponse, err := fileURL.Download(context.Background(), 0, azfile.CountToEnd, false) // 0 offset and azfile.CountToEnd(-1) count means download entire file. if err != nil { log.Fatal(err) } contentLength := downloadResponse.ContentLength() // Used for progress reporting to report the total number of bytes being downloaded. // Setup RetryReader options for stream reading retry. retryReader := downloadResponse.Body(azfile.RetryReaderOptions{MaxRetryRequests: 3}) // NewResponseBodyStream wraps the RetryReader with progress reporting; it returns an io.ReadCloser. progressReader := pipeline.NewResponseBodyProgress(retryReader, func(bytesTransferred int64) { fmt.Printf("Downloaded %d of %d bytes.\n", bytesTransferred, contentLength) }) defer progressReader.Close() // The client must close the response body when finished with it file, err := os.Create("BigFile.bin") // Create the file to hold the downloaded file contents. if err != nil { log.Fatal(err) } defer file.Close() written, err := io.Copy(file, progressReader) // Write to the file by reading from the file (with intelligent retries). if err != nil { log.Fatal(err) } _ = written // Avoid compiler's "declared and not used" error }
Output:
func (FileURL) GetProperties ¶
func (f FileURL) GetProperties(ctx context.Context) (*FileGetPropertiesResponse, error)
GetProperties returns the file's metadata and properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-file-properties.
Example ¶
This examples shows how to create a file with metadata and then how to get properties & update the file's metadata.
package main import ( "context" "fmt" "log" "net/url" "os" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a FileURL with default pipeline based on an existing share with name myshare. u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/ReadMe.txt", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) ctx := context.Background() // This example uses a never-expiring context // Create a file with metadata (string key/value pairs) // NOTE: Metadata key names are always converted to lowercase before being sent to the Storage Service. // Therefore, you should always use lowercase letters; especially when querying a map for a metadata key. _, err = fileURL.Create(ctx, 0, azfile.FileHTTPHeaders{}, azfile.Metadata{"createdby": "Jeffrey&Jiachen"}) // With size 0 if err != nil { log.Fatal(err) } // Query the file's properties and metadata get, err := fileURL.GetProperties(ctx) if err != nil { log.Fatal(err) } // Show some of the file's read-only properties fmt.Println(get.FileType(), get.ETag(), get.LastModified()) // Show the file's metadata metadata := get.NewMetadata() for k, v := range metadata { fmt.Print(k + "=" + v + "\n") } // Update the file's metadata and write it back to the file metadata["updatedby"] = "Jiachen" // Add a new key/value; NOTE: The keyname is in all lowercase letters _, err = fileURL.SetMetadata(ctx, metadata) if err != nil { log.Fatal(err) } // NOTE: The SetMetadata method updates the file's ETag & LastModified properties _, err = fileURL.Delete(ctx) if err != nil { log.Fatal(err) } }
Output:
func (FileURL) GetRangeList ¶
GetRangeList returns the list of valid ranges for a file. Use a count with value CountToEnd (0) to indicate the left part of file start from offset. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/list-ranges.
func (FileURL) Resize ¶
Resize resizes the file to the specified size. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-file-properties.
func (FileURL) SetHTTPHeaders ¶
func (f FileURL) SetHTTPHeaders(ctx context.Context, h FileHTTPHeaders) (*FileSetHTTPHeadersResponse, error)
SetHTTPHeaders sets file's system properties. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-file-properties.
Example ¶
This examples shows how to create a file with HTTP Headers and then how to read & update the file's HTTP headers.
package main import ( "context" "fmt" "log" "net/url" "os" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a FileURL with default pipeline based on an existing share with name myshare. u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/HelpForHTTPHeader.txt", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) ctx := context.Background() // This example uses a never-expiring context // Create a file with HTTP headers _, err = fileURL.Create(ctx, 0, azfile.FileHTTPHeaders{ ContentType: "text/html; charset=utf-8", ContentDisposition: "attachment", }, azfile.Metadata{}) // With size 0 if err != nil { log.Fatal(err) } // GetProperties returns the file's properties, HTTP headers, and metadata get, err := fileURL.GetProperties(ctx) if err != nil { log.Fatal(err) } // Read the file's HTTP Headers httpHeaders := get.NewHTTPHeaders() fmt.Println(httpHeaders.ContentType, httpHeaders.ContentDisposition) // Update the file's HTTP Headers and write them back to the file httpHeaders.ContentType = "text/plain" _, err = fileURL.SetHTTPHeaders(ctx, httpHeaders) if err != nil { log.Fatal(err) } // NOTE: The SetHTTPHeaders method updates the file's ETag & LastModified properties _, err = fileURL.Delete(ctx) if err != nil { log.Fatal(err) } }
Output:
func (FileURL) SetMetadata ¶
func (f FileURL) SetMetadata(ctx context.Context, metadata Metadata) (*FileSetMetadataResponse, error)
SetMetadata sets a file's metadata. https://docs.microsoft.com/rest/api/storageservices/set-file-metadata.
func (FileURL) StartCopy ¶
func (f FileURL) StartCopy(ctx context.Context, source url.URL, metadata Metadata) (*FileStartCopyResponse, error)
StartCopy copies the data at the source URL to a file. For more information, see https://docs.microsoft.com/rest/api/storageservices/copy-file.
Example ¶
This example shows how to copy a source document on the Internet to a file.
package main import ( "context" "fmt" "log" "net/url" "os" "time" "github.com/Azure/azure-storage-file-go/azfile" ) // Please set environment variable ACCOUNT_NAME and ACCOUNT_KEY to your storage accout name and account key, // before run the examples. func accountInfo() (string, string) { return os.Getenv("ACCOUNT_NAME"), os.Getenv("ACCOUNT_KEY") } func main() { // From the Azure portal, get your Storage account file service URL endpoint. accountName, accountKey := accountInfo() credential, err := azfile.NewSharedKeyCredential(accountName, accountKey) if err != nil { log.Fatal(err) } // Create a ShareURL object to a share where we'll create a file and its snapshot. // Create a BlockFileURL object to a file in the share. u, _ := url.Parse(fmt.Sprintf("https://%s.file.core.windows.net/myshare/CopiedFile.bin", accountName)) fileURL := azfile.NewFileURL(*u, azfile.NewPipeline(credential, azfile.PipelineOptions{})) ctx := context.Background() // This example uses a never-expiring context src, _ := url.Parse("https://cdn2.auth0.com/docs/media/addons/azure_file.svg") // Suppose this is an accessible source resource startCopy, err := fileURL.StartCopy(ctx, *src, nil) if err != nil { log.Fatal(err) } copyID := startCopy.CopyID() copyStatus := startCopy.CopyStatus() for copyStatus == azfile.CopyStatusPending { time.Sleep(time.Second * 2) properties, err := fileURL.GetProperties(ctx) if err != nil { log.Fatal(err) } copyStatus = properties.CopyStatus() } fmt.Printf("StartCopy from %s to %s: ID=%s, Status=%s\n", src.String(), fileURL, copyID, copyStatus) }
Output:
func (FileURL) UploadRange ¶
func (f FileURL) UploadRange(ctx context.Context, offset int64, body io.ReadSeeker, transactionalMD5 []byte) (*FileUploadRangeResponse, error)
UploadRange writes bytes to a file. offset indicates the offset at which to begin writing, in bytes. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/put-range.
func (FileURL) UploadRangeFromURL ¶ added in v0.6.0
func (f FileURL) UploadRangeFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64, count int64) (*FileUploadRangeFromURLResponse, error)
Update range with bytes from a specific URL. offset indicates the offset at which to begin writing, in bytes.
func (FileURL) WithPipeline ¶
WithPipeline creates a new FileURL object identical to the source but with the specified request policy pipeline.
func (FileURL) WithSnapshot ¶
WithSnapshot creates a new FileURL object identical to the source but with the specified share snapshot timestamp. Pass time.Time{} to remove the share snapshot returning a URL to the base file.
type FileURLParts ¶
type FileURLParts struct { Scheme string // Ex: "https://" Host string // Ex: "account.share.core.windows.net", "10.132.141.33", "10.132.141.33:80" DirectoryOrFilePath string // Path of directory or file, Ex: "mydirectory/myfile" SAS SASQueryParameters UnparsedParams string IPEndpointStyleInfo IPEndpointStyleInfo // Useful Parts for IP endpoint style URL. }
A FileURLParts object represents the components that make up an Azure Storage Share/Directory/File URL. You parse an existing URL into its parts by calling NewFileURLParts(). You construct a URL from parts by calling URL(). NOTE: Changing any SAS-related field requires computing a new SAS signature.
Example ¶
This example shows how to break a URL into its parts so you can examine and/or change some of its values and then construct a new URL.
package main import ( "fmt" "net/url" "github.com/Azure/azure-storage-file-go/azfile" ) func main() { // Let's start with a URL that identifies a snapshot of a file in a share. // The URL also contains a Shared Access Signature (SAS): u, _ := url.Parse("https://myaccount.file.core.windows.net/myshare/mydirectory/ReadMe.txt?" + "sharesnapshot=2018-03-08T02:29:11.0000000Z&" + "sv=2015-02-21&sr=b&st=2111-01-09T01:42:34.936Z&se=2222-03-09T01:42:34.936Z&sp=rw&sip=168.1.5.60-168.1.5.70&" + "spr=https,http&si=myIdentifier&ss=bf&srt=s&sig=92836758923659283652983562==") // You can parse this URL into its constituent parts: parts := azfile.NewFileURLParts(*u) // Now, we access the parts (this example prints them). fmt.Println(parts.Host, parts.ShareName, parts.DirectoryOrFilePath, parts.ShareSnapshot) sas := parts.SAS fmt.Println(sas.Version(), sas.Resource(), sas.StartTime(), sas.ExpiryTime(), sas.Permissions(), sas.IPRange(), sas.Protocol(), sas.Identifier(), sas.Services(), sas.ResourceTypes(), sas.Signature()) // You can then change some of the fields and construct a new URL: parts.SAS = azfile.SASQueryParameters{} // Remove the SAS query parameters parts.ShareSnapshot = "" // Remove the share snapshot timestamp parts.ShareName = "othershare" // Change the share name // In this example, we'll keep the path of file or directory as is. // Construct a new URL from the parts: newURL := parts.URL() fmt.Print(newURL.String()) // NOTE: You can pass the new URL to azfile.NewFileURLParts (or similar methods) to manipulate the file. }
Output: myaccount.file.core.windows.net myshare mydirectory/ReadMe.txt 2018-03-08T02:29:11.0000000Z 2015-02-21 b 2111-01-09 01:42:34.936 +0000 UTC 2222-03-09 01:42:34.936 +0000 UTC rw {168.1.5.60 168.1.5.70} https,http myIdentifier bf s 92836758923659283652983562== https://myaccount.file.core.windows.net/othershare/mydirectory/ReadMe.txt
func NewFileURLParts ¶
func NewFileURLParts(u url.URL) FileURLParts
NewFileURLParts parses a URL initializing FileURLParts' fields including any SAS-related & sharesnapshot query parameters. Any other query parameters remain in the UnparsedParams field. This method overwrites all fields in the FileURLParts object.
func (FileURLParts) URL ¶
func (up FileURLParts) URL() url.URL
URL returns a URL object whose fields are initialized from the FileURLParts fields. The URL's RawQuery field contains the SAS, snapshot, and unparsed query parameters.
type FileUploadRangeFromURLResponse ¶ added in v0.6.0
type FileUploadRangeFromURLResponse struct {
// contains filtered or unexported fields
}
FileUploadRangeFromURLResponse ...
func (FileUploadRangeFromURLResponse) Date ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) Date() time.Time
Date returns the value for header Date.
func (FileUploadRangeFromURLResponse) ETag ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileUploadRangeFromURLResponse) ErrorCode ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileUploadRangeFromURLResponse) IsServerEncrypted ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (FileUploadRangeFromURLResponse) LastModified ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileUploadRangeFromURLResponse) RequestID ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileUploadRangeFromURLResponse) Response ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileUploadRangeFromURLResponse) Status ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileUploadRangeFromURLResponse) StatusCode ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileUploadRangeFromURLResponse) Version ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) Version() string
Version returns the value for header x-ms-version.
func (FileUploadRangeFromURLResponse) XMsContentCrc64 ¶ added in v0.6.0
func (furfur FileUploadRangeFromURLResponse) XMsContentCrc64() []byte
XMsContentCrc64 returns the value for header x-ms-content-crc64.
type FileUploadRangeResponse ¶
type FileUploadRangeResponse struct {
// contains filtered or unexported fields
}
FileUploadRangeResponse ...
func (FileUploadRangeResponse) ContentMD5 ¶
func (furr FileUploadRangeResponse) ContentMD5() []byte
ContentMD5 returns the value for header Content-MD5.
func (FileUploadRangeResponse) Date ¶
func (furr FileUploadRangeResponse) Date() time.Time
Date returns the value for header Date.
func (FileUploadRangeResponse) ETag ¶
func (furr FileUploadRangeResponse) ETag() ETag
ETag returns the value for header ETag.
func (FileUploadRangeResponse) ErrorCode ¶
func (furr FileUploadRangeResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (FileUploadRangeResponse) IsServerEncrypted ¶
func (furr FileUploadRangeResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (FileUploadRangeResponse) LastModified ¶
func (furr FileUploadRangeResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (FileUploadRangeResponse) RequestID ¶
func (furr FileUploadRangeResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (FileUploadRangeResponse) Response ¶
func (furr FileUploadRangeResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (FileUploadRangeResponse) Status ¶
func (furr FileUploadRangeResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (FileUploadRangeResponse) StatusCode ¶
func (furr FileUploadRangeResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (FileUploadRangeResponse) Version ¶
func (furr FileUploadRangeResponse) Version() string
Version returns the value for header x-ms-version.
type FilesAndDirectoriesListSegment ¶ added in v0.6.0
type FilesAndDirectoriesListSegment struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"Entries"` DirectoryItems []DirectoryItem `xml:"Directory"` FileItems []FileItem `xml:"File"` }
FilesAndDirectoriesListSegment - Abstract for entries that can be listed from Directory.
type HTTPGetter ¶
HTTPGetter is a function type that refers to a method that performs an HTTP GET operation.
type HTTPGetterInfo ¶
type HTTPGetterInfo struct { // Offset specifies the start offset that should be used when // creating the HTTP GET request's Range header Offset int64 // Count specifies the count of bytes that should be used to calculate // the end offset when creating the HTTP GET request's Range header Count int64 // ETag specifies the resource's etag that should be used when creating // the HTTP GET request's If-Match header ETag ETag }
HTTPGetterInfo is passed to an HTTPGetter function passing it parameters that should be used to make an HTTP GET request.
type HandleItem ¶ added in v0.6.0
type HandleItem struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"Handle"` // HandleID - XSMB service handle ID HandleID string `xml:"HandleId"` // Path - File or directory name including full path starting from share root Path string `xml:"Path"` // FileID - FileId uniquely identifies the file or directory. FileID string `xml:"FileId"` // ParentID - ParentId uniquely identifies the parent directory of the object. ParentID *string `xml:"ParentId"` // SessionID - SMB session ID in context of which the file handle was opened SessionID string `xml:"SessionId"` // ClientIP - Client IP that opened the handle ClientIP string `xml:"ClientIp"` // OpenTime - Time when the session that previously opened the handle has last been reconnected. (UTC) OpenTime time.Time `xml:"OpenTime"` // LastReconnectTime - Time handle was last connected to (UTC) LastReconnectTime *time.Time `xml:"LastReconnectTime"` }
HandleItem - A listed Azure Storage handle item.
func (HandleItem) MarshalXML ¶ added in v0.6.0
func (hi HandleItem) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for HandleItem.
func (*HandleItem) UnmarshalXML ¶ added in v0.6.0
func (hi *HandleItem) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for HandleItem.
type IPEndpointStyleInfo ¶
type IPEndpointStyleInfo struct {
AccountName string // "" if not using IP endpoint style
}
IPEndpointStyleInfo is used for IP endpoint style URL. It's commonly used when working with Azure storage emulator or testing environments. Ex: "https://10.132.141.33/accountname/sharename"
type IPRange ¶
type IPRange struct { Start net.IP // Not specified if length = 0 End net.IP // Not specified if length = 0 }
IPRange represents a SAS IP range's start IP and (optionally) end IP.
type ListFilesAndDirectoriesOptions ¶
type ListFilesAndDirectoriesOptions struct { Prefix string // No Prefix header is produced if "" MaxResults int32 // 0 means unspecified }
ListFilesAndDirectoriesOptions defines options available when calling ListFilesAndDirectoriesSegment.
type ListFilesAndDirectoriesSegmentResponse ¶
type ListFilesAndDirectoriesSegmentResponse struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"EnumerationResults"` ServiceEndpoint string `xml:"ServiceEndpoint,attr"` DirectoryPath string `xml:"DirectoryPath,attr"` Prefix string `xml:"Prefix"` Marker *string `xml:"Marker"` MaxResults *int32 `xml:"MaxResults"` FileItems []FileItem `xml:"Entries>File"` DirectoryItems []DirectoryItem `xml:"Entries>Directory"` NextMarker Marker `xml:"NextMarker"` // contains filtered or unexported fields }
ListFilesAndDirectoriesSegmentResponse - An enumeration of directories and files.
func (ListFilesAndDirectoriesSegmentResponse) ContentType ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) ContentType() string
ContentType returns the value for header Content-Type.
func (ListFilesAndDirectoriesSegmentResponse) Date ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) Date() time.Time
Date returns the value for header Date.
func (ListFilesAndDirectoriesSegmentResponse) ErrorCode ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ListFilesAndDirectoriesSegmentResponse) RequestID ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ListFilesAndDirectoriesSegmentResponse) Response ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ListFilesAndDirectoriesSegmentResponse) Status ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ListFilesAndDirectoriesSegmentResponse) StatusCode ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ListFilesAndDirectoriesSegmentResponse) Version ¶
func (ldafr ListFilesAndDirectoriesSegmentResponse) Version() string
Version returns the value for header x-ms-version.
type ListHandlesResponse ¶ added in v0.6.0
type ListHandlesResponse struct { // XMLName is used for marshalling and is subject to removal in a future release. XMLName xml.Name `xml:"EnumerationResults"` HandleList []HandleItem `xml:"Entries>Handle"` NextMarker string `xml:"NextMarker"` // contains filtered or unexported fields }
ListHandlesResponse - An enumeration of handles.
func (ListHandlesResponse) ContentType ¶ added in v0.6.0
func (lhr ListHandlesResponse) ContentType() string
ContentType returns the value for header Content-Type.
func (ListHandlesResponse) Date ¶ added in v0.6.0
func (lhr ListHandlesResponse) Date() time.Time
Date returns the value for header Date.
func (ListHandlesResponse) ErrorCode ¶ added in v0.6.0
func (lhr ListHandlesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ListHandlesResponse) RequestID ¶ added in v0.6.0
func (lhr ListHandlesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ListHandlesResponse) Response ¶ added in v0.6.0
func (lhr ListHandlesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ListHandlesResponse) Status ¶ added in v0.6.0
func (lhr ListHandlesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ListHandlesResponse) StatusCode ¶ added in v0.6.0
func (lhr ListHandlesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ListHandlesResponse) Version ¶ added in v0.6.0
func (lhr ListHandlesResponse) Version() string
Version returns the value for header x-ms-version.
type ListSharesDetail ¶
type ListSharesDetail struct {
ListSharesDetail indicates what additional information the service should return with each share.
type ListSharesIncludeType ¶
type ListSharesIncludeType string
ListSharesIncludeType enumerates the values for list shares include type.
const ( ListSharesIncludeType = "metadata" ListSharesIncludeNone ListSharesIncludeType = "" ListSharesIncludeSnapshots ListSharesIncludeType = "snapshots" )ListSharesIncludeMetadata
func PossibleListSharesIncludeTypeValues ¶
func PossibleListSharesIncludeTypeValues() []ListSharesIncludeType
PossibleListSharesIncludeTypeValues returns an array of possible values for the ListSharesIncludeType const type.
type ListSharesOptions ¶
type ListSharesOptions struct {}
ListSharesOptions defines options available when calling ListSharesSegment.
type ListSharesResponse ¶
type ListSharesResponse struct { // XMLName is used for marshalling and is subject to removal in a future release. // contains filtered or unexported fields }
ListSharesResponse - An enumeration of shares.
func (ListSharesResponse) ErrorCode ¶
func (lsr ListSharesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ListSharesResponse) RequestID ¶
func (lsr ListSharesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ListSharesResponse) Response ¶
func (lsr ListSharesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ListSharesResponse) Status ¶
func (lsr ListSharesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ListSharesResponse) StatusCode ¶
func (lsr ListSharesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ListSharesResponse) Version ¶
func (lsr ListSharesResponse) Version() string
Version returns the value for header x-ms-version.
type Marker ¶
type Marker struct {
Val *string
}
Marker represents an opaque value used in paged responses.
func (Marker) NotDone ¶
NotDone returns true if the list enumeration should be started or is not yet complete. Specifically, NotDone returns true for a just-initialized (zero value) Marker indicating that you should make an initial request to get a result portion from the service. NotDone also returns true whenever the service returns an interim result portion. NotDone returns false only after the service has returned the final result portion.
func (*Marker) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for Marker.
type Metadata ¶
Metadata contains metadata key/value pairs.
func (*Metadata) UnmarshalXML ¶
UnmarshalXML implements the xml.Unmarshaler interface for Metadata.
type MetricProperties ¶
type MetricProperties struct { // MetricEnabled - Indicates whether metrics are enabled for the File service. MetricEnabled bool // Version - The version of Storage Analytics to configure. // Version string, comment out version, as it's mandatory and should be 1.0 // IncludeAPIs - Indicates whether metrics should generate summary statistics for called API operations. IncludeAPIs bool // RetentionPolicyEnabled - Indicates whether a rentention policy is enabled for the File service. RetentionPolicyEnabled bool // RetentionDays - Indicates the number of days that metrics data should be retained. RetentionDays int32 }
MetricProperties definies convenience struct for Metrics,
type Metrics ¶
type Metrics struct { // Version - The version of Storage Analytics to configure. Version string `xml:"Version"` // Enabled - Indicates whether metrics are enabled for the File service. Enabled bool `xml:"Enabled"` // IncludeAPIs - Indicates whether metrics should generate summary statistics for called API operations. IncludeAPIs *bool `xml:"IncludeAPIs"` RetentionPolicy *RetentionPolicy `xml:"RetentionPolicy"` }
Metrics - Storage Analytics metrics for file service.
type PipelineOptions ¶
type PipelineOptions struct { // Log configures the pipeline's logging infrastructure indicating what information is logged and where. Log pipeline.LogOptions // Retry configures the built-in retry policy behavior. Retry RetryOptions // RequestLog configures the built-in request logging policy. RequestLog RequestLogOptions // Telemetry configures the built-in telemetry policy behavior. Telemetry TelemetryOptions }
PipelineOptions is used to configure a request policy pipeline's retry policy and logging.
type Range ¶
type Range struct { // Start - Start of the range. Start int64 `xml:"Start"` // End - End of the range. End int64 `xml:"End"` }
Range - An Azure Storage file range.
type Ranges ¶
type Ranges struct { Items []Range `xml:"Range"` // contains filtered or unexported fields }
Ranges - Wraps the response from the fileClient.GetRangeList method.
func (Ranges) FileContentLength ¶
FileContentLength returns the value for header x-ms-content-length.
func (Ranges) LastModified ¶
LastModified returns the value for header Last-Modified.
func (Ranges) StatusCode ¶
StatusCode returns the HTTP status code of the response, e.g. 200.
type RequestLogOptions ¶
type RequestLogOptions struct { // LogWarningIfTryOverThreshold logs a warning if a tried operation takes longer than the specified // duration (-1=no logging; 0=default threshold). LogWarningIfTryOverThreshold time.Duration }
RequestLogOptions configures the retry policy's behavior.
type ResponseError ¶
type ResponseError interface { // Error exposes the Error(), Temporary() and Timeout() methods. net.Error // Includes the Go error interface // Response returns the HTTP response. You may examine this but you should not modify it. Response() *http.Response }
ResponseError identifies a responder-generated network or response parsing error.
type RetentionPolicy ¶
type RetentionPolicy struct { // Enabled - Indicates whether a retention policy is enabled for the File service. If false, metrics data is retained, and the user is responsible for deleting it. Enabled bool `xml:"Enabled"` // Days - Indicates the number of days that metrics data should be retained. All data older than this value will be deleted. Metrics data is deleted on a best-effort basis after the retention period expires. Days *int32 `xml:"Days"` }
RetentionPolicy - The retention policy.
type RetryOptions ¶
type RetryOptions struct { // Policy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants.\ // A value of zero means that you accept our default policy. Policy RetryPolicy // MaxTries specifies the maximum number of attempts an operation will be tried before producing an error (0=default). // A value of zero means that you accept our default policy. A value of 1 means 1 try and no retries. MaxTries int32 // TryTimeout indicates the maximum time allowed for any single try of an HTTP request. // A value of zero means that you accept our default timeout. NOTE: When transferring large amounts // of data, the default TryTimeout will probably not be sufficient. You should override this value // based on the bandwidth available to the host machine and proximity to the Storage service. A good // starting point may be something like (60 seconds per MB of anticipated-payload-size). TryTimeout time.Duration // RetryDelay specifies the amount of delay to use before retrying an operation (0=default). // When RetryPolicy is specified as RetryPolicyExponential, the delay increases exponentially // with each retry up to a maximum specified by MaxRetryDelay. // If you specify 0, then you must also specify 0 for MaxRetryDelay. // If you specify RetryDelay, then you must also specify MaxRetryDelay, and MaxRetryDelay should be // equal to or greater than RetryDelay. RetryDelay time.Duration // MaxRetryDelay specifies the maximum delay allowed before retrying an operation (0=default). // If you specify 0, then you must also specify 0 for RetryDelay. MaxRetryDelay time.Duration }
RetryOptions configures the retry policy's behavior.
type RetryPolicy ¶
type RetryPolicy int32
RetryPolicy tells the pipeline what kind of retry policy to use. See the RetryPolicy* constants.
const ( // RetryPolicyExponential tells the pipeline to use an exponential back-off retry policy RetryPolicyExponential RetryPolicy = 0 // RetryPolicyFixed tells the pipeline to use a fixed back-off retry policy RetryPolicyFixed RetryPolicy = 1 )
type RetryReaderOptions ¶
type RetryReaderOptions struct { // MaxRetryRequests specifies the maximum number of HTTP GET requests that will be made // while reading from a RetryReader. A value of zero means that no additional HTTP // GET requests will be made. MaxRetryRequests int // NotifyFailedRead is called, if non-nil, after any failure to read. Expected usage is diagnostic logging. NotifyFailedRead FailedReadNotifier // TreatEarlyCloseAsError can be set to true to prevent retries after "read on closed response body". By default, // retryReader has the following special behaviour: closing the response body before it is all read is treated as a // retryable error. This is to allow callers to force a retry by closing the body from another goroutine (e.g. if the = // read is too slow, caller may want to force a retry in the hope that the retry will be quicker). If // TreatEarlyCloseAsError is true, then retryReader's special behaviour is suppressed, and "read on closed body" is instead // treated as a fatal (non-retryable) error. // Note that setting TreatEarlyCloseAsError only guarantees that Closing will produce a fatal error if the Close happens // from the same "thread" (goroutine) as Read. Concurrent Close calls from other goroutines may instead produce network errors // which will be retried. TreatEarlyCloseAsError bool // contains filtered or unexported fields }
RetryReaderOptions contains properties which can help to decide when to do retry.
type RetryableDownloadResponse ¶ added in v0.6.0
type RetryableDownloadResponse struct {
// contains filtered or unexported fields
}
RetryableDownloadResponse wraps AutoRest generated DownloadResponse and helps to provide info for retry.
func (RetryableDownloadResponse) AcceptRanges ¶ added in v0.6.0
func (dr RetryableDownloadResponse) AcceptRanges() string
AcceptRanges returns the value for header Accept-Ranges.
func (*RetryableDownloadResponse) Body ¶ added in v0.6.0
func (dr *RetryableDownloadResponse) Body(o RetryReaderOptions) io.ReadCloser
Body constructs a stream to read data from with a resilient reader option. A zero-value option means to get a raw stream.
func (RetryableDownloadResponse) CacheControl ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CacheControl() string
CacheControl returns the value for header Cache-Control.
func (RetryableDownloadResponse) ContentDisposition ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentDisposition() string
ContentDisposition returns the value for header Content-Disposition.
func (RetryableDownloadResponse) ContentEncoding ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentEncoding() string
ContentEncoding returns the value for header Content-Encoding.
func (RetryableDownloadResponse) ContentLanguage ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentLanguage() string
ContentLanguage returns the value for header Content-Language.
func (RetryableDownloadResponse) ContentLength ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentLength() int64
ContentLength returns the value for header Content-Length.
func (RetryableDownloadResponse) ContentMD5 ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentMD5() []byte
ContentMD5 returns the value for header Content-MD5.
func (RetryableDownloadResponse) ContentRange ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentRange() string
ContentRange returns the value for header Content-Range.
func (RetryableDownloadResponse) ContentType ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ContentType() string
ContentType returns the value for header Content-Type.
func (RetryableDownloadResponse) CopyCompletionTime ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopyCompletionTime() time.Time
CopyCompletionTime returns the value for header x-ms-copy-completion-time.
func (RetryableDownloadResponse) CopyID ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopyID() string
CopyID returns the value for header x-ms-copy-id.
func (RetryableDownloadResponse) CopyProgress ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopyProgress() string
CopyProgress returns the value for header x-ms-copy-progress.
func (RetryableDownloadResponse) CopySource ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopySource() string
CopySource returns the value for header x-ms-copy-source.
func (RetryableDownloadResponse) CopyStatus ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopyStatus() CopyStatusType
CopyStatus returns the value for header x-ms-copy-status.
func (RetryableDownloadResponse) CopyStatusDescription ¶ added in v0.6.0
func (dr RetryableDownloadResponse) CopyStatusDescription() string
CopyStatusDescription returns the value for header x-ms-copy-status-description.
func (RetryableDownloadResponse) Date ¶ added in v0.6.0
func (dr RetryableDownloadResponse) Date() time.Time
Date returns the value for header Date.
func (RetryableDownloadResponse) ETag ¶ added in v0.6.0
func (dr RetryableDownloadResponse) ETag() ETag
ETag returns the value for header ETag.
func (RetryableDownloadResponse) FileContentMD5 ¶ added in v0.6.0
func (dr RetryableDownloadResponse) FileContentMD5() []byte
FileContentMD5 returns the value for header x-ms-content-md5.
func (RetryableDownloadResponse) IsServerEncrypted ¶ added in v0.6.0
func (dr RetryableDownloadResponse) IsServerEncrypted() string
IsServerEncrypted returns the value for header x-ms-server-encrypted.
func (RetryableDownloadResponse) LastModified ¶ added in v0.6.0
func (dr RetryableDownloadResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (RetryableDownloadResponse) NewHTTPHeaders ¶ added in v0.6.0
func (dr RetryableDownloadResponse) NewHTTPHeaders() FileHTTPHeaders
NewHTTPHeaders returns the user-modifiable properties for this file.
func (RetryableDownloadResponse) NewMetadata ¶ added in v0.6.0
func (dr RetryableDownloadResponse) NewMetadata() Metadata
NewMetadata returns user-defined key/value pairs.
func (RetryableDownloadResponse) RequestID ¶ added in v0.6.0
func (dr RetryableDownloadResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (RetryableDownloadResponse) Response ¶ added in v0.6.0
func (dr RetryableDownloadResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (RetryableDownloadResponse) Status ¶ added in v0.6.0
func (dr RetryableDownloadResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (RetryableDownloadResponse) StatusCode ¶ added in v0.6.0
func (dr RetryableDownloadResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (RetryableDownloadResponse) Version ¶ added in v0.6.0
func (dr RetryableDownloadResponse) Version() string
Version returns the value for header x-ms-version.
type SASProtocol ¶
type SASProtocol string
const ( // SASProtocolHTTPS can be specified for a SAS protocol SASProtocolHTTPS SASProtocol = "https" // SASProtocolHTTPSandHTTP can be specified for a SAS protocol SASProtocolHTTPSandHTTP SASProtocol = "https,http" )
type SASQueryParameters ¶
type SASQueryParameters struct {
// contains filtered or unexported fields
}
A SASQueryParameters object represents the components that make up an Azure Storage SAS' query parameters. You parse a map of query parameters into its fields by calling NewSASQueryParameters(). You add the components to a query parameter map by calling AddToValues(). NOTE: Changing any field requires computing a new SAS signature using a XxxSASSignatureValues type.
This type defines the components used by all Azure Storage resources (Containers, Blobs, Files, & Queues).
func (*SASQueryParameters) CacheControl ¶
func (p *SASQueryParameters) CacheControl() string
func (*SASQueryParameters) ContentDisposition ¶
func (p *SASQueryParameters) ContentDisposition() string
func (*SASQueryParameters) ContentEncoding ¶
func (p *SASQueryParameters) ContentEncoding() string
func (*SASQueryParameters) ContentLanguage ¶
func (p *SASQueryParameters) ContentLanguage() string
func (*SASQueryParameters) ContentType ¶
func (p *SASQueryParameters) ContentType() string
func (*SASQueryParameters) Encode ¶
func (p *SASQueryParameters) Encode() string
Encode encodes the SAS query parameters into URL encoded form sorted by key.
func (*SASQueryParameters) ExpiryTime ¶
func (p *SASQueryParameters) ExpiryTime() time.Time
func (*SASQueryParameters) IPRange ¶
func (p *SASQueryParameters) IPRange() IPRange
func (*SASQueryParameters) Identifier ¶
func (p *SASQueryParameters) Identifier() string
func (*SASQueryParameters) Permissions ¶
func (p *SASQueryParameters) Permissions() string
func (*SASQueryParameters) Protocol ¶
func (p *SASQueryParameters) Protocol() SASProtocol
func (*SASQueryParameters) Resource ¶
func (p *SASQueryParameters) Resource() string
func (*SASQueryParameters) ResourceTypes ¶
func (p *SASQueryParameters) ResourceTypes() string
func (*SASQueryParameters) Services ¶
func (p *SASQueryParameters) Services() string
func (*SASQueryParameters) Signature ¶
func (p *SASQueryParameters) Signature() string
func (*SASQueryParameters) StartTime ¶
func (p *SASQueryParameters) StartTime() time.Time
func (*SASQueryParameters) Version ¶
func (p *SASQueryParameters) Version() string
type SMBProperties ¶ added in v0.7.0
type SMBProperties struct { // NOTE: If pointers are nil, we infer that you wish to preserve these properties. To clear them, point to an empty string. // NOTE: Permission strings are required to be sub-9KB. Please upload the permission to the share, and submit a key instead if yours exceeds this limit. PermissionString *string PermissionKey *string // In Windows, a 32 bit file attributes integer exists. This is that. FileAttributes *FileAttributeFlags // A UTC time-date string is specified below. A value of 'now' defaults to now. 'preserve' defaults to preserving the old case. FileCreationTime *time.Time FileLastWriteTime *time.Time }
SMBProperties defines a struct that takes in optional parameters regarding SMB/NTFS properties. When you pass this into another function (Either literally or via FileHTTPHeaders), the response will probably fit inside SMBPropertyAdapter. Nil values of the properties are inferred to be preserved (or when creating, use defaults). Clearing a value can be done by supplying an empty item instead of nil.
func (*SMBProperties) SetISO8601CreationTime ¶ added in v0.7.0
func (sp *SMBProperties) SetISO8601CreationTime(input string) error
SetISO8601CreationTime sets the file creation time with a string formatted as ISO8601
func (*SMBProperties) SetISO8601WriteTime ¶ added in v0.7.0
func (sp *SMBProperties) SetISO8601WriteTime(input string) error
SetISO8601WriteTime sets the file last write time with a string formatted as ISO8601
type SMBPropertyAdapter ¶ added in v0.7.0
type SMBPropertyAdapter struct {
PropertySource SMBPropertyHolder
}
SMBPropertyAdapter is a wrapper struct that automatically converts the string outputs of FileAttributes, FileCreationTime and FileLastWrite time to time.Time. It is _not_ error resistant. It is expected that the response you're inserting into this is a valid response. File and directory calls that return such properties are: GetProperties, SetProperties, Create File Downloads also return such properties. Insert other response types at your peril.
func (*SMBPropertyAdapter) FileAttributes ¶ added in v0.7.0
func (s *SMBPropertyAdapter) FileAttributes() FileAttributeFlags
func (*SMBPropertyAdapter) FileCreationTime ¶ added in v0.7.0
func (s *SMBPropertyAdapter) FileCreationTime() time.Time
func (*SMBPropertyAdapter) FileLastWriteTime ¶ added in v0.7.0
func (s *SMBPropertyAdapter) FileLastWriteTime() time.Time
type SMBPropertyHolder ¶ added in v0.7.0
type SMBPropertyHolder interface { FileCreationTime() string FileLastWriteTime() string FileAttributes() string }
SMBPropertyHolder is an interface designed for SMBPropertyAdapter, to identify valid response types for adapting.
type ServiceCodeType ¶
type ServiceCodeType string
ServiceCodeType is a string identifying a storage service error. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/status-and-error-codes2
const ( // The file or directory could not be deleted because it is in use by an SMB client (409). ServiceCodeCannotDeleteFileOrDirectory ServiceCodeType = "CannotDeleteFileOrDirectory" // The specified resource state could not be flushed from an SMB client in the specified time (500). ServiceCodeClientCacheFlushDelay ServiceCodeType = "ClientCacheFlushDelay" // The specified resource is marked for deletion by an SMB client (409). ServiceCodeDeletePending ServiceCodeType = "DeletePending" // The specified directory is not empty (409). ServiceCodeDirectoryNotEmpty ServiceCodeType = "DirectoryNotEmpty" // A portion of the specified file is locked by an SMB client (409). ServiceCodeFileLockConflict ServiceCodeType = "FileLockConflict" // File or directory path is too long (400). // Or File or directory path has too many subdirectories (400). ServiceCodeInvalidFileOrDirectoryPathName ServiceCodeType = "InvalidFileOrDirectoryPathName" // The specified parent path does not exist (404). ServiceCodeParentNotFound ServiceCodeType = "ParentNotFound" // The specified resource is read-only and cannot be modified at this time (409). ServiceCodeReadOnlyAttribute ServiceCodeType = "ReadOnlyAttribute" ServiceCodeShareAlreadyExists ServiceCodeType = "ShareAlreadyExists" ServiceCodeShareBeingDeleted ServiceCodeType = "ShareBeingDeleted" ServiceCodeShareDisabled ServiceCodeType = "ShareDisabled" ServiceCodeShareNotFound ServiceCodeType = "ShareNotFound" // The specified resource may be in use by an SMB client (409). ServiceCodeSharingViolation ServiceCodeType = "SharingViolation" ServiceCodeShareSnapshotInProgress ServiceCodeType = "ShareSnapshotInProgress" ServiceCodeShareSnapshotCountExceeded ServiceCodeType = "ShareSnapshotCountExceeded" ServiceCodeShareSnapshotOperationNotSupported ServiceCodeType = "ShareSnapshotOperationNotSupported" ServiceCodeShareHasSnapshots ServiceCodeType = "ShareHasSnapshots" )
ServiceCode values indicate a service failure.
const ( // ServiceCodeNone is the default value. It indicates that the error was related to the service or that the service didn't return a code. ServiceCodeNone ServiceCodeType = "" // ServiceCodeAccountAlreadyExists means the specified account already exists. ServiceCodeAccountAlreadyExists ServiceCodeType = "AccountAlreadyExists" // ServiceCodeAccountBeingCreated means the specified account is in the process of being created (403). ServiceCodeAccountBeingCreated ServiceCodeType = "AccountBeingCreated" // ServiceCodeAccountIsDisabled means the specified account is disabled (403). ServiceCodeAccountIsDisabled ServiceCodeType = "AccountIsDisabled" // ServiceCodeAuthenticationFailed means the server failed to authenticate the request. Make sure the value of the Authorization header is formed correctly including the signature (403). ServiceCodeAuthenticationFailed ServiceCodeType = "AuthenticationFailed" // ServiceCodeConditionHeadersNotSupported means the condition headers are not supported (400). ServiceCodeConditionHeadersNotSupported ServiceCodeType = "ConditionHeadersNotSupported" // ServiceCodeConditionNotMet means the condition specified in the conditional header(s) was not met for a read/write operation (304/412). ServiceCodeConditionNotMet ServiceCodeType = "ConditionNotMet" // ServiceCodeEmptyMetadataKey means the key for one of the metadata key-value pairs is empty (400). ServiceCodeEmptyMetadataKey ServiceCodeType = "EmptyMetadataKey" // ServiceCodeInsufficientAccountPermissions means read operations are currently disabled or Write operations are not allowed or The account being accessed does not have sufficient permissions to execute this operation (403). ServiceCodeInsufficientAccountPermissions ServiceCodeType = "InsufficientAccountPermissions" // ServiceCodeInternalError means the server encountered an internal error. Please retry the request (500). ServiceCodeInternalError ServiceCodeType = "InternalError" // ServiceCodeInvalidAuthenticationInfo means the authentication information was not provided in the correct format. Verify the value of Authorization header (400). ServiceCodeInvalidAuthenticationInfo ServiceCodeType = "InvalidAuthenticationInfo" // ServiceCodeInvalidHeaderValue means the value provided for one of the HTTP headers was not in the correct format (400). ServiceCodeInvalidHeaderValue ServiceCodeType = "InvalidHeaderValue" // ServiceCodeInvalidHTTPVerb means the HTTP verb specified was not recognized by the server (400). ServiceCodeInvalidHTTPVerb ServiceCodeType = "InvalidHttpVerb" // ServiceCodeInvalidInput means one of the request inputs is not valid (400). ServiceCodeInvalidInput ServiceCodeType = "InvalidInput" // ServiceCodeInvalidMd5 means the MD5 value specified in the request is invalid. The MD5 value must be 128 bits and Base64-encoded (400). ServiceCodeInvalidMd5 ServiceCodeType = "InvalidMd5" // ServiceCodeInvalidMetadata means the specified metadata is invalid. It includes characters that are not permitted (400). ServiceCodeInvalidMetadata ServiceCodeType = "InvalidMetadata" // ServiceCodeInvalidQueryParameterValue means an invalid value was specified for one of the query parameters in the request URI (400). ServiceCodeInvalidQueryParameterValue ServiceCodeType = "InvalidQueryParameterValue" // ServiceCodeInvalidRange means the range specified is invalid for the current size of the resource (416). ServiceCodeInvalidRange ServiceCodeType = "InvalidRange" // ServiceCodeInvalidResourceName means the specified resource name contains invalid characters (400). ServiceCodeInvalidResourceName ServiceCodeType = "InvalidResourceName" // ServiceCodeInvalidURI means the requested URI does not represent any resource on the server (400). ServiceCodeInvalidURI ServiceCodeType = "InvalidUri" // ServiceCodeInvalidXMLDocument means the specified XML is not syntactically valid (400). ServiceCodeInvalidXMLDocument ServiceCodeType = "InvalidXmlDocument" // ServiceCodeInvalidXMLNodeValue means the value provided for one of the XML nodes in the request body was not in the correct format (400). ServiceCodeInvalidXMLNodeValue ServiceCodeType = "InvalidXmlNodeValue" // ServiceCodeMd5Mismatch means the MD5 value specified in the request did not match the MD5 value calculated by the server (400). ServiceCodeMd5Mismatch ServiceCodeType = "Md5Mismatch" // ServiceCodeMetadataTooLarge means the size of the specified metadata exceeds the maximum size permitted (400). ServiceCodeMetadataTooLarge ServiceCodeType = "MetadataTooLarge" // ServiceCodeMissingContentLengthHeader means the Content-Length header was not specified (411). ServiceCodeMissingContentLengthHeader ServiceCodeType = "MissingContentLengthHeader" // ServiceCodeMissingRequiredQueryParameter means a required query parameter was not specified for this request (400). ServiceCodeMissingRequiredQueryParameter ServiceCodeType = "MissingRequiredQueryParameter" // ServiceCodeMissingRequiredHeader means a required HTTP header was not specified (400). ServiceCodeMissingRequiredHeader ServiceCodeType = "MissingRequiredHeader" // ServiceCodeMissingRequiredXMLNode means a required XML node was not specified in the request body (400). ServiceCodeMissingRequiredXMLNode ServiceCodeType = "MissingRequiredXmlNode" // ServiceCodeMultipleConditionHeadersNotSupported means multiple condition headers are not supported (400). ServiceCodeMultipleConditionHeadersNotSupported ServiceCodeType = "MultipleConditionHeadersNotSupported" // ServiceCodeOperationTimedOut means the operation could not be completed within the permitted time (500). ServiceCodeOperationTimedOut ServiceCodeType = "OperationTimedOut" // ServiceCodeOutOfRangeInput means one of the request inputs is out of range (400). ServiceCodeOutOfRangeInput ServiceCodeType = "OutOfRangeInput" // ServiceCodeOutOfRangeQueryParameterValue means a query parameter specified in the request URI is outside the permissible range (400). ServiceCodeOutOfRangeQueryParameterValue ServiceCodeType = "OutOfRangeQueryParameterValue" // ServiceCodeRequestBodyTooLarge means the size of the request body exceeds the maximum size permitted (413). ServiceCodeRequestBodyTooLarge ServiceCodeType = "RequestBodyTooLarge" // ServiceCodeResourceTypeMismatch means the specified resource type does not match the type of the existing resource (409). ServiceCodeResourceTypeMismatch ServiceCodeType = "ResourceTypeMismatch" // ServiceCodeRequestURLFailedToParse means the url in the request could not be parsed (400). ServiceCodeRequestURLFailedToParse ServiceCodeType = "RequestUrlFailedToParse" // ServiceCodeResourceAlreadyExists means the specified resource already exists (409). ServiceCodeResourceAlreadyExists ServiceCodeType = "ResourceAlreadyExists" // ServiceCodeResourceNotFound means the specified resource does not exist (404). ServiceCodeResourceNotFound ServiceCodeType = "ResourceNotFound" // ServiceCodeServerBusy means the server is currently unable to receive requests. Please retry your request or Ingress/egress is over the account limit or operations per second is over the account limit (503). ServiceCodeServerBusy ServiceCodeType = "ServerBusy" // ServiceCodeUnsupportedHeader means one of the HTTP headers specified in the request is not supported (400). ServiceCodeUnsupportedHeader ServiceCodeType = "UnsupportedHeader" // ServiceCodeUnsupportedXMLNode means one of the XML nodes specified in the request body is not supported (400). ServiceCodeUnsupportedXMLNode ServiceCodeType = "UnsupportedXmlNode" // ServiceCodeUnsupportedQueryParameter means one of the query parameters specified in the request URI is not supported (400). ServiceCodeUnsupportedQueryParameter ServiceCodeType = "UnsupportedQueryParameter" // ServiceCodeUnsupportedHTTPVerb means the resource doesn't support the specified HTTP verb (405). ServiceCodeUnsupportedHTTPVerb ServiceCodeType = "UnsupportedHttpVerb" )
type ServiceSetPropertiesResponse ¶
type ServiceSetPropertiesResponse struct {
// contains filtered or unexported fields
}
ServiceSetPropertiesResponse ...
func (ServiceSetPropertiesResponse) ErrorCode ¶
func (sspr ServiceSetPropertiesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ServiceSetPropertiesResponse) RequestID ¶
func (sspr ServiceSetPropertiesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ServiceSetPropertiesResponse) Response ¶
func (sspr ServiceSetPropertiesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ServiceSetPropertiesResponse) Status ¶
func (sspr ServiceSetPropertiesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ServiceSetPropertiesResponse) StatusCode ¶
func (sspr ServiceSetPropertiesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ServiceSetPropertiesResponse) Version ¶
func (sspr ServiceSetPropertiesResponse) Version() string
Version returns the value for header x-ms-version.
type ServiceURL ¶
type ServiceURL struct {
// contains filtered or unexported fields
}
A ServiceURL represents a URL to the Azure Storage File service allowing you to manipulate file shares.
func NewServiceURL ¶
func NewServiceURL(url url.URL, p pipeline.Pipeline) ServiceURL
NewServiceURL creates a ServiceURL object using the specified URL and request policy pipeline. Note: p can't be nil.
func (ServiceURL) GetProperties ¶
func (s ServiceURL) GetProperties(ctx context.Context) (*FileServiceProperties, error)
GetProperties returns the properties of the File service. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/get-file-service-properties.
func (ServiceURL) ListSharesSegment ¶
func (s ServiceURL) ListSharesSegment(ctx context.Context, marker Marker, o ListSharesOptions) (*ListSharesResponse, error)
ListSharesSegment returns a single segment of shares starting from the specified Marker. Use an empty Marker to start enumeration from the beginning. Share names are returned in lexicographic order. After getting a segment, process it, and then call ListSharesSegment again (passing the the previously-returned Marker) to get the next segment. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/list-shares.
func (ServiceURL) NewShareURL ¶
func (s ServiceURL) NewShareURL(shareName string) ShareURL
NewShareURL creates a new ShareURL object by concatenating shareName to the end of ServiceURL's URL. The new ShareURL uses the same request policy pipeline as the ServiceURL. To change the pipeline, create the ShareURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewShareURL instead of calling this object's NewShareURL method.
func (ServiceURL) SetProperties ¶
func (s ServiceURL) SetProperties(ctx context.Context, properties FileServiceProperties) (*ServiceSetPropertiesResponse, error)
SetProperties sets the properties of the File service. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/set-file-service-properties.
func (ServiceURL) URL ¶
func (s ServiceURL) URL() url.URL
URL returns the URL endpoint used by the ServiceURL object.
func (ServiceURL) WithPipeline ¶
func (s ServiceURL) WithPipeline(p pipeline.Pipeline) ServiceURL
WithPipeline creates a new ServiceURL object identical to the source but with the specified request policy pipeline.
type ShareCreatePermissionResponse ¶ added in v0.6.0
type ShareCreatePermissionResponse struct {
// contains filtered or unexported fields
}
ShareCreatePermissionResponse ...
func (ShareCreatePermissionResponse) Date ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) Date() time.Time
Date returns the value for header Date.
func (ShareCreatePermissionResponse) ErrorCode ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareCreatePermissionResponse) FilePermissionKey ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) FilePermissionKey() string
FilePermissionKey returns the value for header x-ms-file-permission-key.
func (ShareCreatePermissionResponse) RequestID ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareCreatePermissionResponse) Response ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareCreatePermissionResponse) Status ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareCreatePermissionResponse) StatusCode ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareCreatePermissionResponse) Version ¶ added in v0.6.0
func (scpr ShareCreatePermissionResponse) Version() string
Version returns the value for header x-ms-version.
type ShareCreateResponse ¶
type ShareCreateResponse struct {
// contains filtered or unexported fields
}
ShareCreateResponse ...
func (ShareCreateResponse) Date ¶
func (scr ShareCreateResponse) Date() time.Time
Date returns the value for header Date.
func (ShareCreateResponse) ETag ¶
func (scr ShareCreateResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareCreateResponse) ErrorCode ¶
func (scr ShareCreateResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareCreateResponse) LastModified ¶
func (scr ShareCreateResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareCreateResponse) RequestID ¶
func (scr ShareCreateResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareCreateResponse) Response ¶
func (scr ShareCreateResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareCreateResponse) Status ¶
func (scr ShareCreateResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareCreateResponse) StatusCode ¶
func (scr ShareCreateResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareCreateResponse) Version ¶
func (scr ShareCreateResponse) Version() string
Version returns the value for header x-ms-version.
type ShareCreateSnapshotResponse ¶
type ShareCreateSnapshotResponse struct {
// contains filtered or unexported fields
}
ShareCreateSnapshotResponse ...
func (ShareCreateSnapshotResponse) Date ¶
func (scsr ShareCreateSnapshotResponse) Date() time.Time
Date returns the value for header Date.
func (ShareCreateSnapshotResponse) ETag ¶
func (scsr ShareCreateSnapshotResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareCreateSnapshotResponse) ErrorCode ¶
func (scsr ShareCreateSnapshotResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareCreateSnapshotResponse) LastModified ¶
func (scsr ShareCreateSnapshotResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareCreateSnapshotResponse) RequestID ¶
func (scsr ShareCreateSnapshotResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareCreateSnapshotResponse) Response ¶
func (scsr ShareCreateSnapshotResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareCreateSnapshotResponse) Snapshot ¶
func (scsr ShareCreateSnapshotResponse) Snapshot() string
Snapshot returns the value for header x-ms-snapshot.
func (ShareCreateSnapshotResponse) Status ¶
func (scsr ShareCreateSnapshotResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareCreateSnapshotResponse) StatusCode ¶
func (scsr ShareCreateSnapshotResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareCreateSnapshotResponse) Version ¶
func (scsr ShareCreateSnapshotResponse) Version() string
Version returns the value for header x-ms-version.
type ShareDeleteResponse ¶
type ShareDeleteResponse struct {
// contains filtered or unexported fields
}
ShareDeleteResponse ...
func (ShareDeleteResponse) Date ¶
func (sdr ShareDeleteResponse) Date() time.Time
Date returns the value for header Date.
func (ShareDeleteResponse) ErrorCode ¶
func (sdr ShareDeleteResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareDeleteResponse) RequestID ¶
func (sdr ShareDeleteResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareDeleteResponse) Response ¶
func (sdr ShareDeleteResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareDeleteResponse) Status ¶
func (sdr ShareDeleteResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareDeleteResponse) StatusCode ¶
func (sdr ShareDeleteResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareDeleteResponse) Version ¶
func (sdr ShareDeleteResponse) Version() string
Version returns the value for header x-ms-version.
type ShareGetPropertiesResponse ¶
type ShareGetPropertiesResponse struct {
// contains filtered or unexported fields
}
ShareGetPropertiesResponse ...
func (ShareGetPropertiesResponse) Date ¶
func (sgpr ShareGetPropertiesResponse) Date() time.Time
Date returns the value for header Date.
func (ShareGetPropertiesResponse) ETag ¶
func (sgpr ShareGetPropertiesResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareGetPropertiesResponse) ErrorCode ¶
func (sgpr ShareGetPropertiesResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareGetPropertiesResponse) LastModified ¶
func (sgpr ShareGetPropertiesResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareGetPropertiesResponse) NewMetadata ¶
func (sgpr ShareGetPropertiesResponse) NewMetadata() Metadata
NewMetadata returns user-defined key/value pairs.
func (ShareGetPropertiesResponse) Quota ¶
func (sgpr ShareGetPropertiesResponse) Quota() int32
Quota returns the value for header x-ms-share-quota.
func (ShareGetPropertiesResponse) RequestID ¶
func (sgpr ShareGetPropertiesResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareGetPropertiesResponse) Response ¶
func (sgpr ShareGetPropertiesResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareGetPropertiesResponse) Status ¶
func (sgpr ShareGetPropertiesResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareGetPropertiesResponse) StatusCode ¶
func (sgpr ShareGetPropertiesResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareGetPropertiesResponse) Version ¶
func (sgpr ShareGetPropertiesResponse) Version() string
Version returns the value for header x-ms-version.
type ShareItem ¶
type ShareItem struct { // XMLName is used for marshalling and is subject to removal in a future release. }
ShareItem - A listed Azure Storage share item.
type SharePermission ¶ added in v0.6.0
type SharePermission struct { string // contains filtered or unexported fields }Permission
SharePermission - A permission (a security descriptor) at the share level.
func (SharePermission) Date ¶ added in v0.6.0
func (sp SharePermission) Date() time.Time
Date returns the value for header Date.
func (SharePermission) ErrorCode ¶ added in v0.6.0
func (sp SharePermission) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (SharePermission) RequestID ¶ added in v0.6.0
func (sp SharePermission) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (SharePermission) Response ¶ added in v0.6.0
func (sp SharePermission) Response() *http.Response
Response returns the raw HTTP response object.
func (SharePermission) Status ¶ added in v0.6.0
func (sp SharePermission) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (SharePermission) StatusCode ¶ added in v0.6.0
func (sp SharePermission) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (SharePermission) Version ¶ added in v0.6.0
func (sp SharePermission) Version() string
Version returns the value for header x-ms-version.
type ShareProperties ¶
type ShareProperties struct {}
ShareProperties - Properties of a share.
func (ShareProperties) MarshalXML ¶
func (sp ShareProperties) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML implements the xml.Marshaler interface for ShareProperties.
func (*ShareProperties) UnmarshalXML ¶
func (sp *ShareProperties) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements the xml.Unmarshaler interface for ShareProperties.
type ShareSASPermissions ¶
type ShareSASPermissions struct {
The ShareSASPermissions type simplifies creating the permissions string for an Azure Storage share SAS. Initialize an instance of this type and then call its String method to set FileSASSignatureValues's Permissions field.
func (*ShareSASPermissions) Parse ¶
func (p *ShareSASPermissions) Parse(s string) error
Parse initializes the ShareSASPermissions's fields from a string.
func (ShareSASPermissions) String ¶
func (p ShareSASPermissions) String() string
String produces the SAS permissions string for an Azure Storage share. Call this method to set FileSASSignatureValues's Permissions field.
type ShareSetAccessPolicyResponse ¶
type ShareSetAccessPolicyResponse struct {
// contains filtered or unexported fields
}
ShareSetAccessPolicyResponse ...
func (ShareSetAccessPolicyResponse) Date ¶
func (ssapr ShareSetAccessPolicyResponse) Date() time.Time
Date returns the value for header Date.
func (ShareSetAccessPolicyResponse) ETag ¶
func (ssapr ShareSetAccessPolicyResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareSetAccessPolicyResponse) ErrorCode ¶
func (ssapr ShareSetAccessPolicyResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareSetAccessPolicyResponse) LastModified ¶
func (ssapr ShareSetAccessPolicyResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareSetAccessPolicyResponse) RequestID ¶
func (ssapr ShareSetAccessPolicyResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareSetAccessPolicyResponse) Response ¶
func (ssapr ShareSetAccessPolicyResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareSetAccessPolicyResponse) Status ¶
func (ssapr ShareSetAccessPolicyResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareSetAccessPolicyResponse) StatusCode ¶
func (ssapr ShareSetAccessPolicyResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareSetAccessPolicyResponse) Version ¶
func (ssapr ShareSetAccessPolicyResponse) Version() string
Version returns the value for header x-ms-version.
type ShareSetMetadataResponse ¶
type ShareSetMetadataResponse struct {
// contains filtered or unexported fields
}
ShareSetMetadataResponse ...
func (ShareSetMetadataResponse) Date ¶
func (ssmr ShareSetMetadataResponse) Date() time.Time
Date returns the value for header Date.
func (ShareSetMetadataResponse) ETag ¶
func (ssmr ShareSetMetadataResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareSetMetadataResponse) ErrorCode ¶
func (ssmr ShareSetMetadataResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareSetMetadataResponse) LastModified ¶
func (ssmr ShareSetMetadataResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareSetMetadataResponse) RequestID ¶
func (ssmr ShareSetMetadataResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareSetMetadataResponse) Response ¶
func (ssmr ShareSetMetadataResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareSetMetadataResponse) Status ¶
func (ssmr ShareSetMetadataResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareSetMetadataResponse) StatusCode ¶
func (ssmr ShareSetMetadataResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareSetMetadataResponse) Version ¶
func (ssmr ShareSetMetadataResponse) Version() string
Version returns the value for header x-ms-version.
type ShareSetQuotaResponse ¶
type ShareSetQuotaResponse struct {
// contains filtered or unexported fields
}
ShareSetQuotaResponse ...
func (ShareSetQuotaResponse) Date ¶
func (ssqr ShareSetQuotaResponse) Date() time.Time
Date returns the value for header Date.
func (ShareSetQuotaResponse) ETag ¶
func (ssqr ShareSetQuotaResponse) ETag() ETag
ETag returns the value for header ETag.
func (ShareSetQuotaResponse) ErrorCode ¶
func (ssqr ShareSetQuotaResponse) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareSetQuotaResponse) LastModified ¶
func (ssqr ShareSetQuotaResponse) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareSetQuotaResponse) RequestID ¶
func (ssqr ShareSetQuotaResponse) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareSetQuotaResponse) Response ¶
func (ssqr ShareSetQuotaResponse) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareSetQuotaResponse) Status ¶
func (ssqr ShareSetQuotaResponse) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareSetQuotaResponse) StatusCode ¶
func (ssqr ShareSetQuotaResponse) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareSetQuotaResponse) Version ¶
func (ssqr ShareSetQuotaResponse) Version() string
Version returns the value for header x-ms-version.
type ShareStats ¶
type ShareStats struct { int32 `xml:"ShareUsageBytes"` // contains filtered or unexported fields }ShareUsageBytes
ShareStats - Stats for the share.
func (ShareStats) Date ¶
func (ss ShareStats) Date() time.Time
Date returns the value for header Date.
func (ShareStats) ErrorCode ¶
func (ss ShareStats) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (ShareStats) LastModified ¶
func (ss ShareStats) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (ShareStats) RequestID ¶
func (ss ShareStats) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (ShareStats) Response ¶
func (ss ShareStats) Response() *http.Response
Response returns the raw HTTP response object.
func (ShareStats) Status ¶
func (ss ShareStats) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (ShareStats) StatusCode ¶
func (ss ShareStats) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (ShareStats) Version ¶
func (ss ShareStats) Version() string
Version returns the value for header x-ms-version.
type ShareURL ¶
type ShareURL struct {
// contains filtered or unexported fields
}
A ShareURL represents a URL to the Azure Storage share allowing you to manipulate its directories and files.
func NewShareURL ¶
NewShareURL creates a ShareURL object using the specified URL and request policy pipeline. Note: p can't be nil.
func (ShareURL) Create ¶
func (s ShareURL) Create(ctx context.Context, metadata Metadata, quotaInGB int32) (*ShareCreateResponse, error)
Create creates a new share within a storage account. If a share with the same name already exists, the operation fails. quotaInGB specifies the maximum size of the share in gigabytes, 0 means you accept service's default quota. For more information, see https://docs.microsoft.com/rest/api/storageservices/create-share.
func (ShareURL) CreatePermission ¶ added in v0.7.0
func (s ShareURL) CreatePermission(ctx context.Context, permission string) (*ShareCreatePermissionResponse, error)
CreatePermission uploads a SDDL permission string, and returns a permission key to use in conjunction with a file or folder. Note that this is only required for 9KB or larger permission strings. Furthermore, note that SDDL strings should be converted to a portable format before being uploaded. In order to make a SDDL portable, please replace well-known SIDs with their domain specific counterpart. Well-known SIDs are listed here: https://docs.microsoft.com/en-us/windows/win32/secauthz/sid-strings More info about SDDL strings can be located at: https://docs.microsoft.com/en-us/windows/win32/secauthz/security-descriptor-string-format
func (ShareURL) CreateSnapshot ¶
func (s ShareURL) CreateSnapshot(ctx context.Context, metadata Metadata) (*ShareCreateSnapshotResponse, error)
CreateSnapshot creates a read-only snapshot of a share. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/snapshot-share.
func (ShareURL) Delete ¶
func (s ShareURL) Delete(ctx context.Context, deleteSnapshotsOption DeleteSnapshotsOptionType) (*ShareDeleteResponse, error)
Delete marks the specified share or share snapshot for deletion. The share or share snapshot and any files contained within it are later deleted during garbage collection. For more information, see https://docs.microsoft.com/rest/api/storageservices/delete-share.
func (ShareURL) GetPermission ¶ added in v0.7.0
func (s ShareURL) GetPermission(ctx context.Context, permissionKey string) (*SharePermission, error)
GetPermission obtains a SDDL permission string from the service using a known permission key.
func (ShareURL) GetPermissions ¶
func (s ShareURL) GetPermissions(ctx context.Context) (*SignedIdentifiers, error)
GetPermissions returns information about stored access policies specified on the share. For more information, see https://docs.microsoft.com/rest/api/storageservices/get-share-acl.
func (ShareURL) GetProperties ¶
func (s ShareURL) GetProperties(ctx context.Context) (*ShareGetPropertiesResponse, error)
GetProperties returns all user-defined metadata and system properties for the specified share or share snapshot. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/get-share-properties.
func (ShareURL) GetStatistics ¶
func (s ShareURL) GetStatistics(ctx context.Context) (*ShareStats, error)
GetStatistics retrieves statistics related to the share. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/get-share-stats.
func (ShareURL) NewDirectoryURL ¶
func (s ShareURL) NewDirectoryURL(directoryName string) DirectoryURL
NewDirectoryURL creates a new DirectoryURL object by concatenating directoryName to the end of ShareURL's URL. The new DirectoryURL uses the same request policy pipeline as the ShareURL. To change the pipeline, create the DirectoryURL and then call its WithPipeline method passing in the desired pipeline object. Or, call this package's NewDirectoryURL instead of calling this object's NewDirectoryURL method.
func (ShareURL) NewRootDirectoryURL ¶
func (s ShareURL) NewRootDirectoryURL() DirectoryURL
NewRootDirectoryURL creates a new DirectoryURL object using ShareURL's URL. The new DirectoryURL uses the same request policy pipeline as the ShareURL. To change the pipeline, create the DirectoryURL and then call its WithPipeline method passing in the desired pipeline object. Or, call NewDirectoryURL instead of calling the NewDirectoryURL method.
func (ShareURL) SetMetadata ¶
func (s ShareURL) SetMetadata(ctx context.Context, metadata Metadata) (*ShareSetMetadataResponse, error)
SetMetadata sets the share's metadata. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-share-metadata.
func (ShareURL) SetPermissions ¶
func (s ShareURL) SetPermissions(ctx context.Context, permissions []SignedIdentifier) (*ShareSetAccessPolicyResponse, error)
SetPermissions sets a stored access policy for use with shared access signatures. For more information, see https://docs.microsoft.com/rest/api/storageservices/set-share-acl.
func (ShareURL) SetQuota ¶
SetQuota sets service-defined properties for the specified share. quotaInGB specifies the maximum size of the share in gigabytes, 0 means no quote and uses service's default value. For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/set-share-properties.
func (ShareURL) WithPipeline ¶
WithPipeline creates a new ShareURL object identical to the source but with the specified request policy pipeline.
func (ShareURL) WithSnapshot ¶
WithSnapshot creates a new ShareURL object identical to the source but with the specified snapshot timestamp. Pass time.Time{} to remove the snapshot returning a URL to the base share.
type SharedKeyCredential ¶
type SharedKeyCredential struct {
// contains filtered or unexported fields
}
SharedKeyCredential contains an account's name and its primary or secondary key. It is immutable making it shareable and goroutine-safe.
func NewSharedKeyCredential ¶
func NewSharedKeyCredential(accountName, accountKey string) (*SharedKeyCredential, error)
NewSharedKeyCredential creates an immutable SharedKeyCredential containing the storage account's name and either its primary or secondary key.
func (SharedKeyCredential) AccountName ¶
func (f SharedKeyCredential) AccountName() string
AccountName returns the Storage account's name.
func (*SharedKeyCredential) ComputeHMACSHA256 ¶
func (f *SharedKeyCredential) ComputeHMACSHA256(message string) (base64String string)
ComputeHMACSHA256 generates a hash signature for an HTTP request or for a SAS.
func (*SharedKeyCredential) New ¶
func (f *SharedKeyCredential) New(next pipeline.Policy, po *pipeline.PolicyOptions) pipeline.Policy
New creates a credential policy object.
type SignedIdentifier ¶
type SignedIdentifier struct { // ID - A unique id. ID string `xml:"Id"` // AccessPolicy - The access policy. AccessPolicy *AccessPolicy `xml:"AccessPolicy"` }
SignedIdentifier - Signed identifier.
type SignedIdentifiers ¶
type SignedIdentifiers struct { Items []SignedIdentifier `xml:"SignedIdentifier"` // contains filtered or unexported fields }
SignedIdentifiers - Wraps the response from the shareClient.GetAccessPolicy method.
func (SignedIdentifiers) Date ¶
func (si SignedIdentifiers) Date() time.Time
Date returns the value for header Date.
func (SignedIdentifiers) ETag ¶
func (si SignedIdentifiers) ETag() ETag
ETag returns the value for header ETag.
func (SignedIdentifiers) ErrorCode ¶
func (si SignedIdentifiers) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (SignedIdentifiers) LastModified ¶
func (si SignedIdentifiers) LastModified() time.Time
LastModified returns the value for header Last-Modified.
func (SignedIdentifiers) RequestID ¶
func (si SignedIdentifiers) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (SignedIdentifiers) Response ¶
func (si SignedIdentifiers) Response() *http.Response
Response returns the raw HTTP response object.
func (SignedIdentifiers) Status ¶
func (si SignedIdentifiers) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (SignedIdentifiers) StatusCode ¶
func (si SignedIdentifiers) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (SignedIdentifiers) Version ¶
func (si SignedIdentifiers) Version() string
Version returns the value for header x-ms-version.
type StorageError ¶
type StorageError interface { // ResponseError implements error's Error(), net.Error's Temporary() and Timeout() methods & Response(). ResponseError // ServiceCode returns a service error code. Your code can use this to make error recovery decisions. ServiceCode() ServiceCodeType }
StorageError identifies a responder-generated network or response parsing error.
Example ¶
package main import ( "context" "log" "net/http" "net/url" "github.com/Azure/azure-storage-file-go/azfile" ) func main() { // This example shows how to handle errors returned from various XxxURL methods. All these methods return an // object implementing the pipeline.Response interface and an object implementing Go's error interface. // The error result is nil if the request was successful; your code can safely use the Response interface object. // If error is non-nil, the error could be due to: // 1. An invalid argument passed to the method. You should not write code to handle these errors; // instead, fix these errors as they appear during development/testing. // 2. A network request didn't reach an Azure Storage Service. This usually happens due to a bad URL or // faulty networking infrastructure (like a router issue). In this case, an object implementing the // net.Error interface will be returned. The net.Error interface offers Timeout and Temporary methods // which return true if the network error is determined to be a timeout or temporary condition. If // your pipeline uses the retry policy factory, then this policy looks for Timeout/Temporary and // automatically retries based on the retry options you've configured. Because of the retry policy, // your code will usually not call the Timeout/Temporary methods explicitly other than possibly logging // the network failure. // 3. A network request did reach the Azure Storage Service but the service failed to perform the // requested operation. In this case, an object implementing the azfile.StorageError interface is returned. // The azfile.StorageError interface also implements the net.Error interface and, if you use the retry policy, // you would most likely ignore the Timeout/Temporary methods. However, the azfile.StorageError interface exposes // richer information such as a service error code, an error description, details data, and the // service-returned http.Response. And, from the http.Response, you can get the initiating http.Request. u, _ := url.Parse("http://myaccount.file.core.windows.net/myshare") // Suppose there is an existing storage account with name myaccount shareURL := azfile.NewShareURL(*u, azfile.NewPipeline(azfile.NewAnonymousCredential(), azfile.PipelineOptions{})) create, err := shareURL.Create(context.Background(), azfile.Metadata{}, 0) if err != nil { // Suppose there is an error occurred if serr, ok := err.(azfile.StorageError); ok { // This error is a Service-specific error // azfile.StorageError also implements net.Error so you could call its Timeout/Temporary methods if you want. switch serr.ServiceCode() { // Compare serviceCode to various ServiceCodeXxx constants case azfile.ServiceCodeShareAlreadyExists: // You can also look at the http.Response object that failed. if failedResponse := serr.Response(); failedResponse != nil { // From the response object, you can get the initiating http.Request object failedRequest := failedResponse.Request _ = failedRequest // Avoid compiler's "declared and not used" error } case azfile.ServiceCodeShareBeingDeleted: // Handle this error ... default: // Handle other errors ... } // You can also directly handle error through looking at HTTP's status code. if serr.Response().StatusCode == http.StatusForbidden { // Handle this error ... } } log.Fatal(err) // Error is not due to Azure Storage service; networking infrastructure failure } // If err is nil, then the method was successful; use the response to access the result _ = create // Avoid compiler's "declared and not used" error }
Output:
type StorageErrorCodeType ¶ added in v0.6.0
type StorageErrorCodeType string
StorageErrorCodeType enumerates the values for storage error code type.
const ( // StorageErrorCodeAccountAlreadyExists ... StorageErrorCodeAccountAlreadyExists StorageErrorCodeType = "AccountAlreadyExists" // StorageErrorCodeAccountBeingCreated ... StorageErrorCodeAccountBeingCreated StorageErrorCodeType = "AccountBeingCreated" // StorageErrorCodeAccountIsDisabled ... StorageErrorCodeAccountIsDisabled StorageErrorCodeType = "AccountIsDisabled" // StorageErrorCodeAuthenticationFailed ... StorageErrorCodeAuthenticationFailed StorageErrorCodeType = "AuthenticationFailed" // StorageErrorCodeAuthorizationFailure ... StorageErrorCodeAuthorizationFailure StorageErrorCodeType = "AuthorizationFailure" // StorageErrorCodeAuthorizationPermissionMismatch ... StorageErrorCodeAuthorizationPermissionMismatch StorageErrorCodeType = "AuthorizationPermissionMismatch" // StorageErrorCodeAuthorizationProtocolMismatch ... StorageErrorCodeAuthorizationProtocolMismatch StorageErrorCodeType = "AuthorizationProtocolMismatch" // StorageErrorCodeAuthorizationResourceTypeMismatch ... StorageErrorCodeAuthorizationResourceTypeMismatch StorageErrorCodeType = "AuthorizationResourceTypeMismatch" // StorageErrorCodeAuthorizationServiceMismatch ... StorageErrorCodeAuthorizationServiceMismatch StorageErrorCodeType = "AuthorizationServiceMismatch" // StorageErrorCodeAuthorizationSourceIPMismatch ... StorageErrorCodeAuthorizationSourceIPMismatch StorageErrorCodeType = "AuthorizationSourceIPMismatch" // StorageErrorCodeCannotDeleteFileOrDirectory ... StorageErrorCodeCannotDeleteFileOrDirectory StorageErrorCodeType = "CannotDeleteFileOrDirectory" // StorageErrorCodeClientCacheFlushDelay ... StorageErrorCodeClientCacheFlushDelay StorageErrorCodeType = "ClientCacheFlushDelay" // StorageErrorCodeConditionHeadersNotSupported ... StorageErrorCodeConditionHeadersNotSupported StorageErrorCodeType = "ConditionHeadersNotSupported" // StorageErrorCodeConditionNotMet ... StorageErrorCodeConditionNotMet StorageErrorCodeType = "ConditionNotMet" // StorageErrorCodeContainerQuotaDowngradeNotAllowed ... StorageErrorCodeContainerQuotaDowngradeNotAllowed StorageErrorCodeType = "ContainerQuotaDowngradeNotAllowed" // StorageErrorCodeDeletePending ... StorageErrorCodeDeletePending StorageErrorCodeType = "DeletePending" // StorageErrorCodeDirectoryNotEmpty ... StorageErrorCodeDirectoryNotEmpty StorageErrorCodeType = "DirectoryNotEmpty" // StorageErrorCodeEmptyMetadataKey ... StorageErrorCodeEmptyMetadataKey StorageErrorCodeType = "EmptyMetadataKey" // StorageErrorCodeFeatureVersionMismatch ... StorageErrorCodeFeatureVersionMismatch StorageErrorCodeType = "FeatureVersionMismatch" // StorageErrorCodeFileLockConflict ... StorageErrorCodeFileLockConflict StorageErrorCodeType = "FileLockConflict" // StorageErrorCodeInsufficientAccountPermissions ... StorageErrorCodeInsufficientAccountPermissions StorageErrorCodeType = "InsufficientAccountPermissions" // StorageErrorCodeInternalError ... StorageErrorCodeInternalError StorageErrorCodeType = "InternalError" // StorageErrorCodeInvalidAuthenticationInfo ... StorageErrorCodeInvalidAuthenticationInfo StorageErrorCodeType = "InvalidAuthenticationInfo" // StorageErrorCodeInvalidFileOrDirectoryPathName ... StorageErrorCodeInvalidFileOrDirectoryPathName StorageErrorCodeType = "InvalidFileOrDirectoryPathName" // StorageErrorCodeInvalidHeaderValue ... StorageErrorCodeInvalidHeaderValue StorageErrorCodeType = "InvalidHeaderValue" // StorageErrorCodeInvalidHTTPVerb ... StorageErrorCodeInvalidHTTPVerb StorageErrorCodeType = "InvalidHttpVerb" // StorageErrorCodeInvalidInput ... StorageErrorCodeInvalidInput StorageErrorCodeType = "InvalidInput" // StorageErrorCodeInvalidMd5 ... StorageErrorCodeInvalidMd5 StorageErrorCodeType = "InvalidMd5" // StorageErrorCodeInvalidMetadata ... StorageErrorCodeInvalidMetadata StorageErrorCodeType = "InvalidMetadata" // StorageErrorCodeInvalidQueryParameterValue ... StorageErrorCodeInvalidQueryParameterValue StorageErrorCodeType = "InvalidQueryParameterValue" // StorageErrorCodeInvalidRange ... StorageErrorCodeInvalidRange StorageErrorCodeType = "InvalidRange" // StorageErrorCodeInvalidResourceName ... StorageErrorCodeInvalidResourceName StorageErrorCodeType = "InvalidResourceName" // StorageErrorCodeInvalidURI ... StorageErrorCodeInvalidURI StorageErrorCodeType = "InvalidUri" // StorageErrorCodeInvalidXMLDocument ... StorageErrorCodeInvalidXMLDocument StorageErrorCodeType = "InvalidXmlDocument" // StorageErrorCodeInvalidXMLNodeValue ... StorageErrorCodeInvalidXMLNodeValue StorageErrorCodeType = "InvalidXmlNodeValue" // StorageErrorCodeMd5Mismatch ... StorageErrorCodeMd5Mismatch StorageErrorCodeType = "Md5Mismatch" // StorageErrorCodeMetadataTooLarge ... StorageErrorCodeMetadataTooLarge StorageErrorCodeType = "MetadataTooLarge" // StorageErrorCodeMissingContentLengthHeader ... StorageErrorCodeMissingContentLengthHeader StorageErrorCodeType = "MissingContentLengthHeader" // StorageErrorCodeMissingRequiredHeader ... StorageErrorCodeMissingRequiredHeader StorageErrorCodeType = "MissingRequiredHeader" // StorageErrorCodeMissingRequiredQueryParameter ... StorageErrorCodeMissingRequiredQueryParameter StorageErrorCodeType = "MissingRequiredQueryParameter" // StorageErrorCodeMissingRequiredXMLNode ... StorageErrorCodeMissingRequiredXMLNode StorageErrorCodeType = "MissingRequiredXmlNode" // StorageErrorCodeMultipleConditionHeadersNotSupported ... StorageErrorCodeMultipleConditionHeadersNotSupported StorageErrorCodeType = "MultipleConditionHeadersNotSupported" // StorageErrorCodeNone represents an empty StorageErrorCodeType. StorageErrorCodeNone StorageErrorCodeType = "" // StorageErrorCodeOperationTimedOut ... StorageErrorCodeOperationTimedOut StorageErrorCodeType = "OperationTimedOut" // StorageErrorCodeOutOfRangeInput ... StorageErrorCodeOutOfRangeInput StorageErrorCodeType = "OutOfRangeInput" // StorageErrorCodeOutOfRangeQueryParameterValue ... StorageErrorCodeOutOfRangeQueryParameterValue StorageErrorCodeType = "OutOfRangeQueryParameterValue" // StorageErrorCodeParentNotFound ... StorageErrorCodeParentNotFound StorageErrorCodeType = "ParentNotFound" // StorageErrorCodeReadOnlyAttribute ... StorageErrorCodeReadOnlyAttribute StorageErrorCodeType = "ReadOnlyAttribute" // StorageErrorCodeRequestBodyTooLarge ... StorageErrorCodeRequestBodyTooLarge StorageErrorCodeType = "RequestBodyTooLarge" // StorageErrorCodeRequestURLFailedToParse ... StorageErrorCodeRequestURLFailedToParse StorageErrorCodeType = "RequestUrlFailedToParse" // StorageErrorCodeResourceAlreadyExists ... StorageErrorCodeResourceAlreadyExists StorageErrorCodeType = "ResourceAlreadyExists" // StorageErrorCodeResourceNotFound ... StorageErrorCodeResourceNotFound StorageErrorCodeType = "ResourceNotFound" // StorageErrorCodeResourceTypeMismatch ... StorageErrorCodeResourceTypeMismatch StorageErrorCodeType = "ResourceTypeMismatch" // StorageErrorCodeServerBusy ... StorageErrorCodeServerBusy StorageErrorCodeType = "ServerBusy" StorageErrorCodeShareAlreadyExists StorageErrorCodeType = "ShareAlreadyExists" StorageErrorCodeShareBeingDeleted StorageErrorCodeType = "ShareBeingDeleted" StorageErrorCodeShareDisabled StorageErrorCodeType = "ShareDisabled" StorageErrorCodeShareHasSnapshots StorageErrorCodeType = "ShareHasSnapshots" StorageErrorCodeShareNotFound StorageErrorCodeType = "ShareNotFound" StorageErrorCodeShareSnapshotCountExceeded StorageErrorCodeType = "ShareSnapshotCountExceeded" StorageErrorCodeShareSnapshotInProgress StorageErrorCodeType = "ShareSnapshotInProgress" StorageErrorCodeShareSnapshotOperationNotSupported StorageErrorCodeType = "ShareSnapshotOperationNotSupported" // StorageErrorCodeSharingViolation ... StorageErrorCodeSharingViolation StorageErrorCodeType = "SharingViolation" // StorageErrorCodeUnsupportedHeader ... StorageErrorCodeUnsupportedHeader StorageErrorCodeType = "UnsupportedHeader" // StorageErrorCodeUnsupportedHTTPVerb ... StorageErrorCodeUnsupportedHTTPVerb StorageErrorCodeType = "UnsupportedHttpVerb" // StorageErrorCodeUnsupportedQueryParameter ... StorageErrorCodeUnsupportedQueryParameter StorageErrorCodeType = "UnsupportedQueryParameter" // StorageErrorCodeUnsupportedXMLNode ... StorageErrorCodeUnsupportedXMLNode StorageErrorCodeType = "UnsupportedXmlNode" )
func PossibleStorageErrorCodeTypeValues ¶ added in v0.6.0
func PossibleStorageErrorCodeTypeValues() []StorageErrorCodeType
PossibleStorageErrorCodeTypeValues returns an array of possible values for the StorageErrorCodeType const type.
type StorageServiceProperties ¶
type StorageServiceProperties struct { // HourMetrics - A summary of request statistics grouped by API in hourly aggregates for files. HourMetrics *Metrics `xml:"HourMetrics"` // MinuteMetrics - A summary of request statistics grouped by API in minute aggregates for files. MinuteMetrics *Metrics `xml:"MinuteMetrics"` // Cors - The set of CORS rules. Cors []CorsRule `xml:"Cors>CorsRule"` // contains filtered or unexported fields }
StorageServiceProperties - Storage service properties.
func (StorageServiceProperties) ErrorCode ¶
func (ssp StorageServiceProperties) ErrorCode() string
ErrorCode returns the value for header x-ms-error-code.
func (StorageServiceProperties) RequestID ¶
func (ssp StorageServiceProperties) RequestID() string
RequestID returns the value for header x-ms-request-id.
func (StorageServiceProperties) Response ¶
func (ssp StorageServiceProperties) Response() *http.Response
Response returns the raw HTTP response object.
func (StorageServiceProperties) Status ¶
func (ssp StorageServiceProperties) Status() string
Status returns the HTTP status message of the response, e.g. "200 OK".
func (StorageServiceProperties) StatusCode ¶
func (ssp StorageServiceProperties) StatusCode() int
StatusCode returns the HTTP status code of the response, e.g. 200.
func (StorageServiceProperties) Version ¶
func (ssp StorageServiceProperties) Version() string
Version returns the value for header x-ms-version.
type TelemetryOptions ¶
type TelemetryOptions struct { // Value is a string prepended to each request's User-Agent and sent to the service. // The service records the user-agent in logs for diagnostics and tracking of client requests. Value string }
TelemetryOptions configures the telemetry policy's behavior.
type UploadToAzureFileOptions ¶
type UploadToAzureFileOptions struct { // RangeSize specifies the range size to use in each parallel upload; the default (and maximum size) is FileMaxUploadRangeBytes. RangeSize int64 // Progress is a function that is invoked periodically as bytes are send in a UploadRange call to the FileURL. Progress pipeline.ProgressReceiver // Parallelism indicates the maximum number of ranges to upload in parallel. If 0(default) is provided, 5 parallelism will be used by default. Parallelism uint16 // FileHTTPHeaders contains read/writeable file properties. FileHTTPHeaders FileHTTPHeaders // Metadata contains metadata key/value pairs. Metadata Metadata }
UploadToAzureFileOptions identifies options used by the UploadBufferToAzureFile and UploadFileToAzureFile functions.
Source Files ¶
- highlevel.go
- parsing_urls.go
- sas_service.go
- service_codes_file.go
- smb_property_bitflags.go
- url_directory.go
- url_file.go
- url_service.go
- url_share.go
- version.go
- zc_credential_anonymous.go
- zc_credential_shared_key.go
- zc_mmf_unix.go
- zc_pipeline.go
- zc_policy_request_log.go
- zc_policy_retry.go
- zc_policy_telemetry.go
- zc_policy_unique_request_id.go
- zc_retry_reader.go
- zc_sas_account.go
- zc_sas_query_params.go
- zc_service_codes_common.go
- zc_storage_error.go
- zc_util_validate.go
- zc_uuid.go
- zt_doc.go
- zz_generated_client.go
- zz_generated_directory.go
- zz_generated_file.go
- zz_generated_models.go
- zz_generated_responder_policy.go
- zz_generated_response_error.go
- zz_generated_service.go
- zz_generated_share.go
- zz_generated_validation.go
- zz_generated_version.go
- zz_response_helpers.go