diff --git a/.gitignore b/.gitignore
index 8b438c9..31a7ac7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
+# mac specific
+.DS_Store
+
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
diff --git a/azfile/url_directory.go b/azfile/url_directory.go
index 7113c41..b08d410 100644
--- a/azfile/url_directory.go
+++ b/azfile/url_directory.go
@@ -57,8 +57,11 @@ func (d DirectoryURL) NewDirectoryURL(directoryName string) DirectoryURL {
// 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).
func (d DirectoryURL) Create(ctx context.Context, metadata Metadata) (*DirectoryCreateResponse, error) {
- return d.directoryClient.Create(ctx, nil, metadata)
+ defaultPermissions := "inherit"
+ return d.directoryClient.Create(ctx, "None", "now", "now", nil, metadata,
+ &defaultPermissions, nil)
}
// Delete removes the specified empty directory. Note that the directory must be empty before it can be deleted..
@@ -140,5 +143,5 @@ func (o *ListFilesAndDirectoriesOptions) pointers() (prefix *string, maxResults
// For more information, see https://docs.microsoft.com/en-us/rest/api/storageservices/list-directories-and-files.
func (d DirectoryURL) ListFilesAndDirectoriesSegment(ctx context.Context, marker Marker, o ListFilesAndDirectoriesOptions) (*ListFilesAndDirectoriesSegmentResponse, error) {
prefix, maxResults := o.pointers()
- return d.directoryClient.ListFilesAndDirectoriesSegment(ctx, prefix, nil, marker.val, maxResults, nil)
+ return d.directoryClient.ListFilesAndDirectoriesSegment(ctx, prefix, nil, marker.Val, maxResults, nil)
}
diff --git a/azfile/url_file.go b/azfile/url_file.go
index a119edb..78a32d2 100644
--- a/azfile/url_file.go
+++ b/azfile/url_file.go
@@ -58,10 +58,12 @@ func (f FileURL) WithSnapshot(shareSnapshot string) FileURL {
// 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 (f FileURL) Create(ctx context.Context, size int64, h FileHTTPHeaders, metadata Metadata) (*FileCreateResponse, error) {
- return f.fileClient.Create(ctx, size, nil,
+ defaultPermissions := "inherit"
+ return f.fileClient.Create(ctx, size, "None", "now", "now", nil,
&h.ContentType, &h.ContentEncoding, &h.ContentLanguage, &h.CacheControl,
- h.ContentMD5, &h.ContentDisposition, metadata)
+ h.ContentMD5, &h.ContentDisposition, metadata, &defaultPermissions, nil)
}
// StartCopy copies the data at the source URL to a file.
@@ -83,7 +85,7 @@ func (f FileURL) AbortCopy(ctx context.Context, copyID string) (*FileAbortCopyRe
// 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.
-func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeGetContentMD5 bool) (*DownloadResponse, error) {
+func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeGetContentMD5 bool) (*RetryableDownloadResponse, error) {
var xRangeGetContentMD5 *bool
if rangeGetContentMD5 {
if offset == 0 && count == CountToEnd {
@@ -96,7 +98,7 @@ func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeG
return nil, err
}
- return &DownloadResponse{
+ return &RetryableDownloadResponse{
f: f,
dr: dr,
ctx: ctx,
@@ -106,7 +108,7 @@ func (f FileURL) Download(ctx context.Context, offset int64, count int64, rangeG
// Body constructs a stream to read data from with a resilient reader option.
// A zero-value option means to get a raw stream.
-func (dr *DownloadResponse) Body(o RetryReaderOptions) io.ReadCloser {
+func (dr *RetryableDownloadResponse) Body(o RetryReaderOptions) io.ReadCloser {
if o.MaxRetryRequests == 0 {
return dr.Response().Body
}
@@ -140,8 +142,10 @@ func (f FileURL) GetProperties(ctx context.Context) (*FileGetPropertiesResponse,
// SetHTTPHeaders sets file's system properties.
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-file-properties.
func (f FileURL) SetHTTPHeaders(ctx context.Context, h FileHTTPHeaders) (*FileSetHTTPHeadersResponse, error) {
- return f.fileClient.SetHTTPHeaders(ctx, nil,
- nil, &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, &h.CacheControl, h.ContentMD5, &h.ContentDisposition)
+ defaultPermissions := "preserve"
+ return f.fileClient.SetHTTPHeaders(ctx, "preserve", "preserve", "preserve", nil,
+ nil, &h.ContentType, &h.ContentEncoding, &h.ContentLanguage, &h.CacheControl, h.ContentMD5,
+ &h.ContentDisposition, &defaultPermissions, nil)
}
// SetMetadata sets a file's metadata.
@@ -153,12 +157,14 @@ func (f FileURL) SetMetadata(ctx context.Context, metadata Metadata) (*FileSetMe
// Resize resizes the file to the specified size.
// For more information, see https://docs.microsoft.com/rest/api/storageservices/set-file-properties.
func (f FileURL) Resize(ctx context.Context, length int64) (*FileSetHTTPHeadersResponse, error) {
- return f.fileClient.SetHTTPHeaders(ctx, nil,
- &length, nil, nil, nil, nil, nil, nil)
+ defaultPermissions := "preserve"
+ return f.fileClient.SetHTTPHeaders(ctx, "preserve", "preserve", "preserve", nil,
+ &length, nil, nil, nil, nil,
+ nil, nil, &defaultPermissions, nil)
}
// UploadRange writes bytes to a file.
-// offset indiciates the offset at which to begin writing, in bytes.
+// 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 (f FileURL) UploadRange(ctx context.Context, offset int64, body io.ReadSeeker, transactionalMD5 []byte) (*FileUploadRangeResponse, error) {
if body == nil {
@@ -174,6 +180,15 @@ func (f FileURL) UploadRange(ctx context.Context, offset int64, body io.ReadSeek
return f.fileClient.UploadRange(ctx, *toRange(offset, count), FileRangeWriteUpdate, count, body, nil, transactionalMD5)
}
+// Update range with bytes from a specific URL.
+// offset indicates the offset at which to begin writing, in bytes.
+func (f FileURL) UploadRangeFromURL(ctx context.Context, sourceURL url.URL, sourceOffset int64, destOffset int64,
+ count int64) (*FileUploadRangeFromURLResponse, error) {
+
+ return f.fileClient.UploadRangeFromURL(ctx, *toRange(destOffset, count), sourceURL.String(), 0, nil,
+ toRange(sourceOffset, count), nil, nil, nil)
+}
+
// 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.
diff --git a/azfile/url_service.go b/azfile/url_service.go
index aaeb845..b633f7d 100644
--- a/azfile/url_service.go
+++ b/azfile/url_service.go
@@ -78,7 +78,7 @@ func appendToURLPath(u url.URL, name string) url.URL {
// https://docs.microsoft.com/en-us/rest/api/storageservices/list-shares.
func (s ServiceURL) ListSharesSegment(ctx context.Context, marker Marker, o ListSharesOptions) (*ListSharesResponse, error) {
prefix, include, maxResults := o.pointers()
- return s.client.ListSharesSegment(ctx, prefix, marker.val, maxResults, include, nil)
+ return s.client.ListSharesSegment(ctx, prefix, marker.Val, maxResults, include, nil)
}
// ListSharesOptions defines options available when calling ListSharesSegment.
diff --git a/azfile/version.go b/azfile/version.go
index 83bf4ee..d5215c9 100644
--- a/azfile/version.go
+++ b/azfile/version.go
@@ -1,3 +1,3 @@
package azfile
-const serviceLibVersion = "0.5.0"
+const serviceLibVersion = "0.6.0"
diff --git a/azfile/zt_examples_test.go b/azfile/zt_examples_test.go
index 0ef0d13..fb44603 100644
--- a/azfile/zt_examples_test.go
+++ b/azfile/zt_examples_test.go
@@ -496,9 +496,10 @@ func ExampleShareURL_SetQuota() {
// Check current usage stats for the share.
// Note that the ShareStats object is part of the protocol layer for the File service.
if statistics, err := shareURL.GetStatistics(ctx); err == nil {
- fmt.Printf("Current share usage: %d GB\n", statistics.ShareUsage)
+ shareUsageGB := statistics.ShareUsageBytes/1024/1024/1024
+ fmt.Printf("Current share usage: %d GB\n", shareUsageGB)
- shareURL.SetQuota(ctx, 10+statistics.ShareUsage)
+ shareURL.SetQuota(ctx, 10+shareUsageGB)
properties, err := shareURL.GetProperties(ctx)
if err != nil {
diff --git a/azfile/zt_url_file_test.go b/azfile/zt_url_file_test.go
index e8dd113..b298c76 100644
--- a/azfile/zt_url_file_test.go
+++ b/azfile/zt_url_file_test.go
@@ -1098,7 +1098,7 @@ func (s *FileURLSuite) TestFileUploadRangeTransactionalMD5(c *chk.C) {
c.Assert(pResp.ContentMD5(), chk.DeepEquals, md5[:])
// Upload range with empty MD5, nil MD5 is covered by other cases.
- pResp, err = fileURL.UploadRange(context.Background(), 1024, bytes.NewReader(contentD[1024:]), []byte{})
+ pResp, err = fileURL.UploadRange(context.Background(), 1024, bytes.NewReader(contentD[1024:]), nil)
c.Assert(err, chk.IsNil)
c.Assert(pResp.ContentMD5(), chk.NotNil)
c.Assert(pResp.StatusCode(), chk.Equals, http.StatusCreated)
@@ -1129,6 +1129,51 @@ func (s *FileURLSuite) TestFileUploadRangeIncorrectTransactionalMD5(c *chk.C) {
validateStorageError(c, err, azfile.ServiceCodeMd5Mismatch)
}
+func (f *FileURLSuite) TestUploadRangeFromURL(c *chk.C) {
+ fsu := getFSU()
+ shareURL, shareName := createNewShare(c, fsu)
+ defer delShare(c, shareURL, azfile.DeleteSnapshotsOptionNone)
+
+ // create the source file and populate it with random data at a specific offset
+ expectedDataSize := 2048
+ totalFileSize := 4096
+ srcOffset := 999
+ expectedDataReader, expectedData := getRandomDataAndReader(expectedDataSize)
+ srcFileURL, _ := createNewFileFromShare(c, shareURL, int64(totalFileSize))
+ _, err := srcFileURL.UploadRange(context.Background(), int64(srcOffset), expectedDataReader, nil)
+ c.Assert(err, chk.IsNil)
+
+ // generate a URL with SAS pointing to the source file
+ credential, _ := getCredential()
+ sasQueryParams, err := azfile.FileSASSignatureValues{
+ Protocol: azfile.SASProtocolHTTPS,
+ ExpiryTime: time.Now().UTC().Add(48 * time.Hour),
+ ShareName: shareName,
+ Permissions: azfile.FileSASPermissions{Create: true, Read: true, Write: true, Delete: true}.String(),
+ }.NewSASQueryParameters(credential)
+ c.Assert(err, chk.IsNil)
+ rawSrcURL := srcFileURL.URL()
+ rawSrcURL.RawQuery = sasQueryParams.Encode()
+
+ // create the destination file
+ dstFileURL, _ := createNewFileFromShare(c, shareURL, int64(totalFileSize))
+
+ // invoke UploadRange on dstFileURL and put the data at a random range
+ // source and destination have different offsets so we can test both values at the same time
+ dstOffset := 100
+ uploadFromURLResp, err := dstFileURL.UploadRangeFromURL(ctx, rawSrcURL, int64(srcOffset),
+ int64(dstOffset), int64(expectedDataSize))
+ c.Assert(err, chk.IsNil)
+ c.Assert(uploadFromURLResp.StatusCode(), chk.Equals, 201)
+
+ // verify the destination
+ resp, err := dstFileURL.Download(context.Background(), int64(dstOffset), int64(expectedDataSize), false)
+ c.Assert(err, chk.IsNil)
+ download, err := ioutil.ReadAll(resp.Response().Body)
+ c.Assert(err, chk.IsNil)
+ c.Assert(download, chk.DeepEquals, expectedData)
+}
+
// Testings for GetRangeList and ClearRange
func (s *FileURLSuite) TestGetRangeListNonDefaultExact(c *chk.C) {
fsu := getFSU()
diff --git a/azfile/zt_url_share_test.go b/azfile/zt_url_share_test.go
index fc11886..86b29ca 100644
--- a/azfile/zt_url_share_test.go
+++ b/azfile/zt_url_share_test.go
@@ -567,7 +567,7 @@ func (s *ShareURLSuite) TestShareGetStats(c *chk.C) {
// c.Assert(gResp.LastModified().IsZero(), chk.Equals, false) // TODO: Even share is once updated, no LastModified would be returned.
c.Assert(gResp.RequestID(), chk.Not(chk.Equals), "")
c.Assert(gResp.Version(), chk.Not(chk.Equals), "")
- c.Assert(gResp.ShareUsage, chk.Equals, int32(0))
+ c.Assert(gResp.ShareUsageBytes, chk.Equals, int32(0))
}
func (s *ShareURLSuite) TestShareGetStatsNegative(c *chk.C) {
@@ -741,7 +741,6 @@ func (s *ShareURLSuite) TestShareDeleteSnapshot(c *chk.C) {
func (s *ShareURLSuite) TestShareDeleteSnapshotsInclude(c *chk.C) {
fsu := getFSU()
share, shareName := createNewShare(c, fsu)
- defer delShare(c, share, azfile.DeleteSnapshotsOptionNone)
_, err := share.CreateSnapshot(ctx, nil)
c.Assert(err, chk.IsNil)
diff --git a/azfile/zz_generated_client.go b/azfile/zz_generated_client.go
index c40f8df..c2a7014 100644
--- a/azfile/zz_generated_client.go
+++ b/azfile/zz_generated_client.go
@@ -10,7 +10,7 @@ import (
const (
// ServiceVersion specifies the version of the operations used in this package.
- ServiceVersion = "2018-03-28"
+ ServiceVersion = "2019-02-02"
)
// managementClient is the base client for Azfile.
diff --git a/azfile/zz_generated_directory.go b/azfile/zz_generated_directory.go
index ddd8139..618485b 100644
--- a/azfile/zz_generated_directory.go
+++ b/azfile/zz_generated_directory.go
@@ -26,17 +26,26 @@ func newDirectoryClient(url url.URL, p pipeline.Pipeline) directoryClient {
// Create creates a new directory under the specified share or parent directory.
//
+// fileAttributes is if specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and
+// ‘Directory’ for directory. ‘None’ can also be specified as default. fileCreationTime is creation time for the
+// file/directory. Default value: Now. fileLastWriteTime is last write time for the file/directory. Default value: Now.
// timeout is the timeout parameter is expressed in seconds. For more information, see Setting
// Timeouts for File Service Operations. metadata is a name-value pair to associate with a file storage object.
-func (client directoryClient) Create(ctx context.Context, timeout *int32, metadata map[string]string) (*DirectoryCreateResponse, error) {
+// filePermission is if specified the permission (security descriptor) shall be set for the directory/file. This header
+// can be used if Permission size is <= 8KB, else x-ms-file-permission-key header shall be used. Default value:
+// Inherit. If SDDL is specified as input, it must have owner, group and dacl. Note: Only one of the
+// x-ms-file-permission or x-ms-file-permission-key should be specified. filePermissionKey is key of the permission to
+// be set for the directory/file. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be
+// specified.
+func (client directoryClient) Create(ctx context.Context, fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, metadata map[string]string, filePermission *string, filePermissionKey *string) (*DirectoryCreateResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
- req, err := client.createPreparer(timeout, metadata)
+ req, err := client.createPreparer(fileAttributes, fileCreationTime, fileLastWriteTime, timeout, metadata, filePermission, filePermissionKey)
if err != nil {
return nil, err
}
@@ -48,7 +57,7 @@ func (client directoryClient) Create(ctx context.Context, timeout *int32, metada
}
// createPreparer prepares the Create request.
-func (client directoryClient) createPreparer(timeout *int32, metadata map[string]string) (pipeline.Request, error) {
+func (client directoryClient) createPreparer(fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, metadata map[string]string, filePermission *string, filePermissionKey *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@@ -65,6 +74,15 @@ func (client directoryClient) createPreparer(timeout *int32, metadata map[string
}
}
req.Header.Set("x-ms-version", ServiceVersion)
+ if filePermission != nil {
+ req.Header.Set("x-ms-file-permission", *filePermission)
+ }
+ if filePermissionKey != nil {
+ req.Header.Set("x-ms-file-permission-key", *filePermissionKey)
+ }
+ req.Header.Set("x-ms-file-attributes", fileAttributes)
+ req.Header.Set("x-ms-file-creation-time", fileCreationTime)
+ req.Header.Set("x-ms-file-last-write-time", fileLastWriteTime)
return req, nil
}
@@ -129,6 +147,72 @@ func (client directoryClient) deleteResponder(resp pipeline.Response) (pipeline.
return &DirectoryDeleteResponse{rawResponse: resp.Response()}, err
}
+// ForceCloseHandles closes all handles open for given directory.
+//
+// handleID is specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that
+// specifies all handles. timeout is the timeout parameter is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations. marker is a string value that identifies the portion of the list to be
+// returned with the next list operation. The operation returns a marker value within the response body if the list
+// returned was not complete. The marker value may then be used in a subsequent call to request the next set of list
+// items. The marker value is opaque to the client. sharesnapshot is the snapshot parameter is an opaque DateTime value
+// that, when present, specifies the share snapshot to query. recursive is specifies operation should apply to the
+// directory specified in the URI, its files, its subdirectories and their files.
+func (client directoryClient) ForceCloseHandles(ctx context.Context, handleID string, timeout *int32, marker *string, sharesnapshot *string, recursive *bool) (*DirectoryForceCloseHandlesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.forceCloseHandlesPreparer(handleID, timeout, marker, sharesnapshot, recursive)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.forceCloseHandlesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*DirectoryForceCloseHandlesResponse), err
+}
+
+// forceCloseHandlesPreparer prepares the ForceCloseHandles request.
+func (client directoryClient) forceCloseHandlesPreparer(handleID string, timeout *int32, marker *string, sharesnapshot *string, recursive *bool) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if sharesnapshot != nil && len(*sharesnapshot) > 0 {
+ params.Set("sharesnapshot", *sharesnapshot)
+ }
+ params.Set("comp", "forceclosehandles")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-handle-id", handleID)
+ if recursive != nil {
+ req.Header.Set("x-ms-recursive", strconv.FormatBool(*recursive))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// forceCloseHandlesResponder handles the response to the ForceCloseHandles request.
+func (client directoryClient) forceCloseHandlesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &DirectoryForceCloseHandlesResponse{rawResponse: resp.Response()}, err
+}
+
// GetProperties returns all system properties for the specified directory, and can also be used to check the existence
// of a directory. The data returned does not include the files in the directory or any subdirectories.
//
@@ -218,40 +302,6 @@ func (client directoryClient) ListFilesAndDirectoriesSegment(ctx context.Context
return resp.(*ListFilesAndDirectoriesSegmentResponse), err
}
-// ListFilesAndDirectoriesSegmentAutoRest returns a list of files or directories under the specified share or directory. It
-// lists the contents only for a single level of the directory hierarchy.
-//
-// prefix is filters the results to return only entries whose name begins with the specified prefix. sharesnapshot is
-// the snapshot parameter is an opaque DateTime value that, when present, specifies the share snapshot to query. marker
-// is a string value that identifies the portion of the list to be returned with the next list operation. The operation
-// returns a marker value within the response body if the list returned was not complete. The marker value may then be
-// used in a subsequent call to request the next set of list items. The marker value is opaque to the client.
-// maxresults is specifies the maximum number of entries to return. If the request does not specify maxresults, or
-// specifies a value greater than 5,000, the server will return up to 5,000 items. timeout is the timeout parameter is
-// expressed in seconds. For more information, see Setting
-// Timeouts for File Service Operations.
-// func (client directoryClient) ListFilesAndDirectoriesSegmentAutoRest(ctx context.Context, prefix *string, sharesnapshot *string, marker *string, maxresults *int32, timeout *int32) (*listFilesAndDirectoriesSegmentResponse, error) {
-// if err := validate([]validation{
-// {targetValue: maxresults,
-// constraints: []constraint{{target: "maxresults", name: null, rule: false,
-// chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}},
-// {targetValue: timeout,
-// constraints: []constraint{{target: "timeout", name: null, rule: false,
-// chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
-// return nil, err
-// }
-// req, err := client.listFilesAndDirectoriesSegmentPreparer(prefix, sharesnapshot, marker, maxresults, timeout)
-// if err != nil {
-// return nil, err
-// }
-// resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listFilesAndDirectoriesSegmentResponderAutoRest}, req)
-// if err != nil {
-// return nil, err
-// }
-// return resp.(*listFilesAndDirectoriesSegmentResponse), err
-// }
-
// listFilesAndDirectoriesSegmentPreparer prepares the ListFilesAndDirectoriesSegment request.
func (client directoryClient) listFilesAndDirectoriesSegmentPreparer(prefix *string, sharesnapshot *string, marker *string, maxresults *int32, timeout *int32) (pipeline.Request, error) {
req, err := pipeline.NewRequest("GET", client.url, nil)
@@ -306,29 +356,91 @@ func (client directoryClient) listFilesAndDirectoriesSegmentResponder(resp pipel
return result, nil
}
-// listFilesAndDirectoriesSegmentResponderAutoRest handles the response to the ListFilesAndDirectoriesSegment request.
-// func (client directoryClient) listFilesAndDirectoriesSegmentResponderAutoRest(resp pipeline.Response) (pipeline.Response, error) {
-// err := validateResponse(resp, http.StatusOK)
-// if resp == nil {
-// return nil, err
-// }
-// result := &listFilesAndDirectoriesSegmentResponse{rawResponse: resp.Response()}
-// if err != nil {
-// return result, err
-// }
-// defer resp.Response().Body.Close()
-// b, err := ioutil.ReadAll(resp.Response().Body)
-// if err != nil {
-// return result, NewResponseError(err, resp.Response(), "failed to read response body")
-// }
-// if len(b) > 0 {
-// err = xml.Unmarshal(b, result)
-// if err != nil {
-// return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
-// }
-// }
-// return result, nil
-// }
+// ListHandles lists handles for directory.
+//
+// marker is a string value that identifies the portion of the list to be returned with the next list operation. The
+// operation returns a marker value within the response body if the list returned was not complete. The marker value
+// may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the
+// client. maxresults is specifies the maximum number of entries to return. If the request does not specify maxresults,
+// or specifies a value greater than 5,000, the server will return up to 5,000 items. timeout is the timeout parameter
+// is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations. sharesnapshot is the snapshot parameter is an opaque DateTime value that,
+// when present, specifies the share snapshot to query. recursive is specifies operation should apply to the directory
+// specified in the URI, its files, its subdirectories and their files.
+func (client directoryClient) ListHandles(ctx context.Context, marker *string, maxresults *int32, timeout *int32, sharesnapshot *string, recursive *bool) (*ListHandlesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: maxresults,
+ constraints: []constraint{{target: "maxresults", name: null, rule: false,
+ chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}},
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.listHandlesPreparer(marker, maxresults, timeout, sharesnapshot, recursive)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listHandlesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ListHandlesResponse), err
+}
+
+// listHandlesPreparer prepares the ListHandles request.
+func (client directoryClient) listHandlesPreparer(marker *string, maxresults *int32, timeout *int32, sharesnapshot *string, recursive *bool) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if maxresults != nil {
+ params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10))
+ }
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ if sharesnapshot != nil && len(*sharesnapshot) > 0 {
+ params.Set("sharesnapshot", *sharesnapshot)
+ }
+ params.Set("comp", "listhandles")
+ req.URL.RawQuery = params.Encode()
+ if recursive != nil {
+ req.Header.Set("x-ms-recursive", strconv.FormatBool(*recursive))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// listHandlesResponder handles the response to the ListHandles request.
+func (client directoryClient) listHandlesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &ListHandlesResponse{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, err
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
// SetMetadata updates user defined metadata for the specified directory.
//
@@ -377,7 +489,7 @@ func (client directoryClient) setMetadataPreparer(timeout *int32, metadata map[s
// setMetadataResponder handles the response to the SetMetadata request.
func (client directoryClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) {
- err := validateResponse(resp, http.StatusOK, http.StatusAccepted)
+ err := validateResponse(resp, http.StatusOK)
if resp == nil {
return nil, err
}
@@ -385,3 +497,71 @@ func (client directoryClient) setMetadataResponder(resp pipeline.Response) (pipe
resp.Response().Body.Close()
return &DirectorySetMetadataResponse{rawResponse: resp.Response()}, err
}
+
+// SetProperties sets properties on the directory.
+//
+// fileAttributes is if specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and
+// ‘Directory’ for directory. ‘None’ can also be specified as default. fileCreationTime is creation time for the
+// file/directory. Default value: Now. fileLastWriteTime is last write time for the file/directory. Default value: Now.
+// timeout is the timeout parameter is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations. filePermission is if specified the permission (security descriptor) shall
+// be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key
+// header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl.
+// Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. filePermissionKey is key
+// of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or
+// x-ms-file-permission-key should be specified.
+func (client directoryClient) SetProperties(ctx context.Context, fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, filePermission *string, filePermissionKey *string) (*DirectorySetPropertiesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.setPropertiesPreparer(fileAttributes, fileCreationTime, fileLastWriteTime, timeout, filePermission, filePermissionKey)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.setPropertiesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*DirectorySetPropertiesResponse), err
+}
+
+// setPropertiesPreparer prepares the SetProperties request.
+func (client directoryClient) setPropertiesPreparer(fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, filePermission *string, filePermissionKey *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "directory")
+ params.Set("comp", "properties")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-version", ServiceVersion)
+ if filePermission != nil {
+ req.Header.Set("x-ms-file-permission", *filePermission)
+ }
+ if filePermissionKey != nil {
+ req.Header.Set("x-ms-file-permission-key", *filePermissionKey)
+ }
+ req.Header.Set("x-ms-file-attributes", fileAttributes)
+ req.Header.Set("x-ms-file-creation-time", fileCreationTime)
+ req.Header.Set("x-ms-file-last-write-time", fileLastWriteTime)
+ return req, nil
+}
+
+// setPropertiesResponder handles the response to the SetProperties request.
+func (client directoryClient) setPropertiesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &DirectorySetPropertiesResponse{rawResponse: resp.Response()}, err
+}
diff --git a/azfile/zz_generated_file.go b/azfile/zz_generated_file.go
index 7be6a9b..e3fa1b1 100644
--- a/azfile/zz_generated_file.go
+++ b/azfile/zz_generated_file.go
@@ -80,7 +80,10 @@ func (client fileClient) abortCopyResponder(resp pipeline.Response) (pipeline.Re
// Create creates a new file or replaces a file. Note it only initializes the file with no content.
//
-// fileContentLength is specifies the maximum size for the file, up to 1 TB. timeout is the timeout parameter is
+// fileContentLength is specifies the maximum size for the file, up to 1 TB. fileAttributes is if specified, the
+// provided file attributes shall be set. Default value: ‘Archive’ for file and ‘Directory’ for directory. ‘None’ can
+// also be specified as default. fileCreationTime is creation time for the file/directory. Default value: Now.
+// fileLastWriteTime is last write time for the file/directory. Default value: Now. timeout is the timeout parameter is
// expressed in seconds. For more information, see Setting
// Timeouts for File Service Operations. fileContentType is sets the MIME content type of the file. The default
@@ -88,15 +91,20 @@ func (client fileClient) abortCopyResponder(resp pipeline.Response) (pipeline.Re
// the file. fileContentLanguage is specifies the natural languages used by this resource. fileCacheControl is sets the
// file's cache control. The File service stores this value but does not use or modify it. fileContentMD5 is sets the
// file's MD5 hash. fileContentDisposition is sets the file's Content-Disposition header. metadata is a name-value pair
-// to associate with a file storage object.
-func (client fileClient) Create(ctx context.Context, fileContentLength int64, timeout *int32, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, metadata map[string]string) (*FileCreateResponse, error) {
+// to associate with a file storage object. filePermission is if specified the permission (security descriptor) shall
+// be set for the directory/file. This header can be used if Permission size is <= 8KB, else x-ms-file-permission-key
+// header shall be used. Default value: Inherit. If SDDL is specified as input, it must have owner, group and dacl.
+// Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be specified. filePermissionKey is key
+// of the permission to be set for the directory/file. Note: Only one of the x-ms-file-permission or
+// x-ms-file-permission-key should be specified.
+func (client fileClient) Create(ctx context.Context, fileContentLength int64, fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, metadata map[string]string, filePermission *string, filePermissionKey *string) (*FileCreateResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
- req, err := client.createPreparer(fileContentLength, timeout, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5, fileContentDisposition, metadata)
+ req, err := client.createPreparer(fileContentLength, fileAttributes, fileCreationTime, fileLastWriteTime, timeout, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5, fileContentDisposition, metadata, filePermission, filePermissionKey)
if err != nil {
return nil, err
}
@@ -108,7 +116,7 @@ func (client fileClient) Create(ctx context.Context, fileContentLength int64, ti
}
// createPreparer prepares the Create request.
-func (client fileClient) createPreparer(fileContentLength int64, timeout *int32, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, metadata map[string]string) (pipeline.Request, error) {
+func (client fileClient) createPreparer(fileContentLength int64, fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, metadata map[string]string, filePermission *string, filePermissionKey *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@@ -144,6 +152,15 @@ func (client fileClient) createPreparer(fileContentLength int64, timeout *int32,
req.Header.Set("x-ms-meta-"+k, v)
}
}
+ if filePermission != nil {
+ req.Header.Set("x-ms-file-permission", *filePermission)
+ }
+ if filePermissionKey != nil {
+ req.Header.Set("x-ms-file-permission-key", *filePermissionKey)
+ }
+ req.Header.Set("x-ms-file-attributes", fileAttributes)
+ req.Header.Set("x-ms-file-creation-time", fileCreationTime)
+ req.Header.Set("x-ms-file-last-write-time", fileLastWriteTime)
return req, nil
}
@@ -214,7 +231,7 @@ func (client fileClient) deleteResponder(resp pipeline.Response) (pipeline.Respo
// Timeouts for File Service Operations. rangeParameter is return file data only from the specified byte range.
// rangeGetContentMD5 is when this header is set to true and specified together with the Range header, the service
// returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size.
-func (client fileClient) Download(ctx context.Context, timeout *int32, rangeParameter *string, rangeGetContentMD5 *bool) (*downloadResponse, error) {
+func (client fileClient) Download(ctx context.Context, timeout *int32, rangeParameter *string, rangeGetContentMD5 *bool) (*DownloadResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
@@ -229,7 +246,7 @@ func (client fileClient) Download(ctx context.Context, timeout *int32, rangePara
if err != nil {
return nil, err
}
- return resp.(*downloadResponse), err
+ return resp.(*DownloadResponse), err
}
// downloadPreparer prepares the Download request.
@@ -259,7 +276,69 @@ func (client fileClient) downloadResponder(resp pipeline.Response) (pipeline.Res
if resp == nil {
return nil, err
}
- return &downloadResponse{rawResponse: resp.Response()}, err
+ return &DownloadResponse{rawResponse: resp.Response()}, err
+}
+
+// ForceCloseHandles closes all handles open for given file
+//
+// handleID is specifies handle ID opened on the file or directory to be closed. Asterix (‘*’) is a wildcard that
+// specifies all handles. timeout is the timeout parameter is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations. marker is a string value that identifies the portion of the list to be
+// returned with the next list operation. The operation returns a marker value within the response body if the list
+// returned was not complete. The marker value may then be used in a subsequent call to request the next set of list
+// items. The marker value is opaque to the client. sharesnapshot is the snapshot parameter is an opaque DateTime value
+// that, when present, specifies the share snapshot to query.
+func (client fileClient) ForceCloseHandles(ctx context.Context, handleID string, timeout *int32, marker *string, sharesnapshot *string) (*FileForceCloseHandlesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.forceCloseHandlesPreparer(handleID, timeout, marker, sharesnapshot)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.forceCloseHandlesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*FileForceCloseHandlesResponse), err
+}
+
+// forceCloseHandlesPreparer prepares the ForceCloseHandles request.
+func (client fileClient) forceCloseHandlesPreparer(handleID string, timeout *int32, marker *string, sharesnapshot *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if sharesnapshot != nil && len(*sharesnapshot) > 0 {
+ params.Set("sharesnapshot", *sharesnapshot)
+ }
+ params.Set("comp", "forceclosehandles")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-handle-id", handleID)
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// forceCloseHandlesResponder handles the response to the ForceCloseHandles request.
+func (client fileClient) forceCloseHandlesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &FileForceCloseHandlesResponse{rawResponse: resp.Response()}, err
}
// GetProperties returns all user-defined metadata, standard HTTP properties, and system properties for the file. It
@@ -388,8 +467,93 @@ func (client fileClient) getRangeListResponder(resp pipeline.Response) (pipeline
return result, nil
}
+// ListHandles lists handles for file
+//
+// marker is a string value that identifies the portion of the list to be returned with the next list operation. The
+// operation returns a marker value within the response body if the list returned was not complete. The marker value
+// may then be used in a subsequent call to request the next set of list items. The marker value is opaque to the
+// client. maxresults is specifies the maximum number of entries to return. If the request does not specify maxresults,
+// or specifies a value greater than 5,000, the server will return up to 5,000 items. timeout is the timeout parameter
+// is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations. sharesnapshot is the snapshot parameter is an opaque DateTime value that,
+// when present, specifies the share snapshot to query.
+func (client fileClient) ListHandles(ctx context.Context, marker *string, maxresults *int32, timeout *int32, sharesnapshot *string) (*ListHandlesResponse, error) {
+ if err := validate([]validation{
+ {targetValue: maxresults,
+ constraints: []constraint{{target: "maxresults", name: null, rule: false,
+ chain: []constraint{{target: "maxresults", name: inclusiveMinimum, rule: 1, chain: nil}}}}},
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.listHandlesPreparer(marker, maxresults, timeout, sharesnapshot)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.listHandlesResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ListHandlesResponse), err
+}
+
+// listHandlesPreparer prepares the ListHandles request.
+func (client fileClient) listHandlesPreparer(marker *string, maxresults *int32, timeout *int32, sharesnapshot *string) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if marker != nil && len(*marker) > 0 {
+ params.Set("marker", *marker)
+ }
+ if maxresults != nil {
+ params.Set("maxresults", strconv.FormatInt(int64(*maxresults), 10))
+ }
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ if sharesnapshot != nil && len(*sharesnapshot) > 0 {
+ params.Set("sharesnapshot", *sharesnapshot)
+ }
+ params.Set("comp", "listhandles")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// listHandlesResponder handles the response to the ListHandles request.
+func (client fileClient) listHandlesResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &ListHandlesResponse{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, err
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
+
// SetHTTPHeaders sets HTTP headers on the file.
//
+// fileAttributes is if specified, the provided file attributes shall be set. Default value: ‘Archive’ for file and
+// ‘Directory’ for directory. ‘None’ can also be specified as default. fileCreationTime is creation time for the
+// file/directory. Default value: Now. fileLastWriteTime is last write time for the file/directory. Default value: Now.
// timeout is the timeout parameter is expressed in seconds. For more information, see Setting
// Timeouts for File Service Operations. fileContentLength is resizes a file to the specified size. If the
@@ -398,15 +562,20 @@ func (client fileClient) getRangeListResponder(resp pipeline.Response) (pipeline
// fileContentEncoding is specifies which content encodings have been applied to the file. fileContentLanguage is
// specifies the natural languages used by this resource. fileCacheControl is sets the file's cache control. The File
// service stores this value but does not use or modify it. fileContentMD5 is sets the file's MD5 hash.
-// fileContentDisposition is sets the file's Content-Disposition header.
-func (client fileClient) SetHTTPHeaders(ctx context.Context, timeout *int32, fileContentLength *int64, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string) (*FileSetHTTPHeadersResponse, error) {
+// fileContentDisposition is sets the file's Content-Disposition header. filePermission is if specified the permission
+// (security descriptor) shall be set for the directory/file. This header can be used if Permission size is <= 8KB,
+// else x-ms-file-permission-key header shall be used. Default value: Inherit. If SDDL is specified as input, it must
+// have owner, group and dacl. Note: Only one of the x-ms-file-permission or x-ms-file-permission-key should be
+// specified. filePermissionKey is key of the permission to be set for the directory/file. Note: Only one of the
+// x-ms-file-permission or x-ms-file-permission-key should be specified.
+func (client fileClient) SetHTTPHeaders(ctx context.Context, fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, fileContentLength *int64, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, filePermission *string, filePermissionKey *string) (*FileSetHTTPHeadersResponse, error) {
if err := validate([]validation{
{targetValue: timeout,
constraints: []constraint{{target: "timeout", name: null, rule: false,
chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
return nil, err
}
- req, err := client.setHTTPHeadersPreparer(timeout, fileContentLength, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5, fileContentDisposition)
+ req, err := client.setHTTPHeadersPreparer(fileAttributes, fileCreationTime, fileLastWriteTime, timeout, fileContentLength, fileContentType, fileContentEncoding, fileContentLanguage, fileCacheControl, fileContentMD5, fileContentDisposition, filePermission, filePermissionKey)
if err != nil {
return nil, err
}
@@ -418,7 +587,7 @@ func (client fileClient) SetHTTPHeaders(ctx context.Context, timeout *int32, fil
}
// setHTTPHeadersPreparer prepares the SetHTTPHeaders request.
-func (client fileClient) setHTTPHeadersPreparer(timeout *int32, fileContentLength *int64, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string) (pipeline.Request, error) {
+func (client fileClient) setHTTPHeadersPreparer(fileAttributes string, fileCreationTime string, fileLastWriteTime string, timeout *int32, fileContentLength *int64, fileContentType *string, fileContentEncoding *string, fileContentLanguage *string, fileCacheControl *string, fileContentMD5 []byte, fileContentDisposition *string, filePermission *string, filePermissionKey *string) (pipeline.Request, error) {
req, err := pipeline.NewRequest("PUT", client.url, nil)
if err != nil {
return req, pipeline.NewError(err, "failed to create request")
@@ -451,6 +620,15 @@ func (client fileClient) setHTTPHeadersPreparer(timeout *int32, fileContentLengt
if fileContentDisposition != nil {
req.Header.Set("x-ms-content-disposition", *fileContentDisposition)
}
+ if filePermission != nil {
+ req.Header.Set("x-ms-file-permission", *filePermission)
+ }
+ if filePermissionKey != nil {
+ req.Header.Set("x-ms-file-permission-key", *filePermissionKey)
+ }
+ req.Header.Set("x-ms-file-attributes", fileAttributes)
+ req.Header.Set("x-ms-file-creation-time", fileCreationTime)
+ req.Header.Set("x-ms-file-last-write-time", fileLastWriteTime)
return req, nil
}
@@ -511,7 +689,7 @@ func (client fileClient) setMetadataPreparer(timeout *int32, metadata map[string
// setMetadataResponder handles the response to the SetMetadata request.
func (client fileClient) setMetadataResponder(resp pipeline.Response) (pipeline.Response, error) {
- err := validateResponse(resp, http.StatusOK, http.StatusAccepted)
+ err := validateResponse(resp, http.StatusOK)
if resp == nil {
return nil, err
}
@@ -649,3 +827,80 @@ func (client fileClient) uploadRangeResponder(resp pipeline.Response) (pipeline.
resp.Response().Body.Close()
return &FileUploadRangeResponse{rawResponse: resp.Response()}, err
}
+
+// UploadRangeFromURL upload a range of bytes to a file where the contents are read from a URL.
+//
+// rangeParameter is writes data to the specified byte range in the file. copySource is specifies the URL of the source
+// file or blob, up to 2 KB in length. To copy a file to another file within the same storage account, you may use
+// Shared Key to authenticate the source file. If you are copying a file from another storage account, or if you are
+// copying a blob from the same storage account or another storage account, then you must authenticate the source file
+// or blob using a shared access signature. If the source is a public blob, no authentication is required to perform
+// the copy operation. A file in a share snapshot can also be specified as a copy source. contentLength is specifies
+// the number of bytes being transmitted in the request body. When the x-ms-write header is set to clear, the value of
+// this header must be set to zero. timeout is the timeout parameter is expressed in seconds. For more information, see
+// Setting
+// Timeouts for File Service Operations. sourceRange is bytes of source data in the specified range.
+// sourceContentCrc64 is specify the crc64 calculated for the range of bytes that must be read from the copy source.
+// sourceIfMatchCrc64 is specify the crc64 value to operate only on range with a matching crc64 checksum.
+// sourceIfNoneMatchCrc64 is specify the crc64 value to operate only on range without a matching crc64 checksum.
+func (client fileClient) UploadRangeFromURL(ctx context.Context, rangeParameter string, copySource string, contentLength int64, timeout *int32, sourceRange *string, sourceContentCrc64 []byte, sourceIfMatchCrc64 []byte, sourceIfNoneMatchCrc64 []byte) (*FileUploadRangeFromURLResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.uploadRangeFromURLPreparer(rangeParameter, copySource, contentLength, timeout, sourceRange, sourceContentCrc64, sourceIfMatchCrc64, sourceIfNoneMatchCrc64)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.uploadRangeFromURLResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*FileUploadRangeFromURLResponse), err
+}
+
+// uploadRangeFromURLPreparer prepares the UploadRangeFromURL request.
+func (client fileClient) uploadRangeFromURLPreparer(rangeParameter string, copySource string, contentLength int64, timeout *int32, sourceRange *string, sourceContentCrc64 []byte, sourceIfMatchCrc64 []byte, sourceIfNoneMatchCrc64 []byte) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("comp", "range")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-range", rangeParameter)
+ req.Header.Set("x-ms-copy-source", copySource)
+ if sourceRange != nil {
+ req.Header.Set("x-ms-source-range", *sourceRange)
+ }
+ req.Header.Set("x-ms-write", "update")
+ req.Header.Set("Content-Length", strconv.FormatInt(contentLength, 10))
+ if sourceContentCrc64 != nil {
+ req.Header.Set("x-ms-source-content-crc64", base64.StdEncoding.EncodeToString(sourceContentCrc64))
+ }
+ if sourceIfMatchCrc64 != nil {
+ req.Header.Set("x-ms-source-if-match-crc64", base64.StdEncoding.EncodeToString(sourceIfMatchCrc64))
+ }
+ if sourceIfNoneMatchCrc64 != nil {
+ req.Header.Set("x-ms-source-if-none-match-crc64", base64.StdEncoding.EncodeToString(sourceIfNoneMatchCrc64))
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// uploadRangeFromURLResponder handles the response to the UploadRangeFromURL request.
+func (client fileClient) uploadRangeFromURLResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusCreated)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &FileUploadRangeFromURLResponse{rawResponse: resp.Response()}, err
+}
diff --git a/azfile/zz_generated_models.go b/azfile/zz_generated_models.go
index 9f06f4f..9f2ee9f 100644
--- a/azfile/zz_generated_models.go
+++ b/azfile/zz_generated_models.go
@@ -55,7 +55,7 @@ func (md *Metadata) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
// Marker represents an opaque value used in paged responses.
type Marker struct {
- val *string
+ Val *string
}
// NotDone returns true if the list enumeration should be started or is not yet complete. Specifically, NotDone returns true
@@ -63,14 +63,14 @@ type Marker struct {
// 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 (m Marker) NotDone() bool {
- return m.val == nil || *m.val != ""
+ return m.Val == nil || *m.Val != ""
}
// UnmarshalXML implements the xml.Unmarshaler interface for Marker.
func (m *Marker) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
var out string
err := d.DecodeElement(&out, &start)
- m.val = &out
+ m.Val = &out
return err
}
@@ -163,6 +163,139 @@ func PossibleListSharesIncludeTypeValues() []ListSharesIncludeType {
return []ListSharesIncludeType{ListSharesIncludeMetadata, ListSharesIncludeNone, ListSharesIncludeSnapshots}
}
+// StorageErrorCodeType enumerates the values for storage error code type.
+type StorageErrorCodeType string
+
+const (
+ // StorageErrorCodeAccountAlreadyExists ...
+ StorageErrorCodeAccountAlreadyExists StorageErrorCodeType = "AccountAlreadyExists"
+ // StorageErrorCodeAccountBeingCreated ...
+ StorageErrorCodeAccountBeingCreated StorageErrorCodeType = "AccountBeingCreated"
+ // StorageErrorCodeAccountIsDisabled ...
+ StorageErrorCodeAccountIsDisabled StorageErrorCodeType = "AccountIsDisabled"
+ // StorageErrorCodeAuthenticationFailed ...
+ StorageErrorCodeAuthenticationFailed StorageErrorCodeType = "AuthenticationFailed"
+ // StorageErrorCodeAuthorizationFailure ...
+ StorageErrorCodeAuthorizationFailure StorageErrorCodeType = "AuthorizationFailure"
+ // 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"
+ // 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 ...
+ StorageErrorCodeShareAlreadyExists StorageErrorCodeType = "ShareAlreadyExists"
+ // StorageErrorCodeShareBeingDeleted ...
+ StorageErrorCodeShareBeingDeleted StorageErrorCodeType = "ShareBeingDeleted"
+ // StorageErrorCodeShareDisabled ...
+ StorageErrorCodeShareDisabled StorageErrorCodeType = "ShareDisabled"
+ // StorageErrorCodeShareHasSnapshots ...
+ StorageErrorCodeShareHasSnapshots StorageErrorCodeType = "ShareHasSnapshots"
+ // StorageErrorCodeShareNotFound ...
+ StorageErrorCodeShareNotFound StorageErrorCodeType = "ShareNotFound"
+ // StorageErrorCodeShareSnapshotCountExceeded ...
+ StorageErrorCodeShareSnapshotCountExceeded StorageErrorCodeType = "ShareSnapshotCountExceeded"
+ // StorageErrorCodeShareSnapshotInProgress ...
+ StorageErrorCodeShareSnapshotInProgress StorageErrorCodeType = "ShareSnapshotInProgress"
+ // StorageErrorCodeShareSnapshotOperationNotSupported ...
+ StorageErrorCodeShareSnapshotOperationNotSupported StorageErrorCodeType = "ShareSnapshotOperationNotSupported"
+ // StorageErrorCodeSharingViolation ...
+ StorageErrorCodeSharingViolation StorageErrorCodeType = "SharingViolation"
+ // StorageErrorCodeUnsupportedHeader ...
+ StorageErrorCodeUnsupportedHeader StorageErrorCodeType = "UnsupportedHeader"
+ // StorageErrorCodeUnsupportedHTTPVerb ...
+ StorageErrorCodeUnsupportedHTTPVerb StorageErrorCodeType = "UnsupportedHttpVerb"
+ // StorageErrorCodeUnsupportedQueryParameter ...
+ StorageErrorCodeUnsupportedQueryParameter StorageErrorCodeType = "UnsupportedQueryParameter"
+ // StorageErrorCodeUnsupportedXMLNode ...
+ StorageErrorCodeUnsupportedXMLNode StorageErrorCodeType = "UnsupportedXmlNode"
+)
+
+// PossibleStorageErrorCodeTypeValues returns an array of possible values for the StorageErrorCodeType const type.
+func PossibleStorageErrorCodeTypeValues() []StorageErrorCodeType {
+ return []StorageErrorCodeType{StorageErrorCodeAccountAlreadyExists, StorageErrorCodeAccountBeingCreated, StorageErrorCodeAccountIsDisabled, StorageErrorCodeAuthenticationFailed, StorageErrorCodeAuthorizationFailure, StorageErrorCodeCannotDeleteFileOrDirectory, StorageErrorCodeClientCacheFlushDelay, StorageErrorCodeConditionHeadersNotSupported, StorageErrorCodeConditionNotMet, StorageErrorCodeContainerQuotaDowngradeNotAllowed, StorageErrorCodeDeletePending, StorageErrorCodeDirectoryNotEmpty, StorageErrorCodeEmptyMetadataKey, StorageErrorCodeFileLockConflict, StorageErrorCodeInsufficientAccountPermissions, StorageErrorCodeInternalError, StorageErrorCodeInvalidAuthenticationInfo, StorageErrorCodeInvalidFileOrDirectoryPathName, StorageErrorCodeInvalidHeaderValue, StorageErrorCodeInvalidHTTPVerb, StorageErrorCodeInvalidInput, StorageErrorCodeInvalidMd5, StorageErrorCodeInvalidMetadata, StorageErrorCodeInvalidQueryParameterValue, StorageErrorCodeInvalidRange, StorageErrorCodeInvalidResourceName, StorageErrorCodeInvalidURI, StorageErrorCodeInvalidXMLDocument, StorageErrorCodeInvalidXMLNodeValue, StorageErrorCodeMd5Mismatch, StorageErrorCodeMetadataTooLarge, StorageErrorCodeMissingContentLengthHeader, StorageErrorCodeMissingRequiredHeader, StorageErrorCodeMissingRequiredQueryParameter, StorageErrorCodeMissingRequiredXMLNode, StorageErrorCodeMultipleConditionHeadersNotSupported, StorageErrorCodeNone, StorageErrorCodeOperationTimedOut, StorageErrorCodeOutOfRangeInput, StorageErrorCodeOutOfRangeQueryParameterValue, StorageErrorCodeParentNotFound, StorageErrorCodeReadOnlyAttribute, StorageErrorCodeRequestBodyTooLarge, StorageErrorCodeRequestURLFailedToParse, StorageErrorCodeResourceAlreadyExists, StorageErrorCodeResourceNotFound, StorageErrorCodeResourceTypeMismatch, StorageErrorCodeServerBusy, StorageErrorCodeShareAlreadyExists, StorageErrorCodeShareBeingDeleted, StorageErrorCodeShareDisabled, StorageErrorCodeShareHasSnapshots, StorageErrorCodeShareNotFound, StorageErrorCodeShareSnapshotCountExceeded, StorageErrorCodeShareSnapshotInProgress, StorageErrorCodeShareSnapshotOperationNotSupported, StorageErrorCodeSharingViolation, StorageErrorCodeUnsupportedHeader, StorageErrorCodeUnsupportedHTTPVerb, StorageErrorCodeUnsupportedQueryParameter, StorageErrorCodeUnsupportedXMLNode}
+}
+
// AccessPolicy - An Access policy.
type AccessPolicy struct {
// Start - The date-time the policy is active.
@@ -245,6 +378,41 @@ func (dcr DirectoryCreateResponse) ETag() ETag {
return ETag(dcr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (dcr DirectoryCreateResponse) FileAttributes() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (dcr DirectoryCreateResponse) FileChangeTime() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (dcr DirectoryCreateResponse) FileCreationTime() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (dcr DirectoryCreateResponse) FileID() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (dcr DirectoryCreateResponse) FileLastWriteTime() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (dcr DirectoryCreateResponse) FileParentID() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (dcr DirectoryCreateResponse) FilePermissionKey() string {
+ return dcr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (dcr DirectoryCreateResponse) IsServerEncrypted() string {
return dcr.rawResponse.Header.Get("x-ms-request-server-encrypted")
@@ -321,6 +489,72 @@ func (ddr DirectoryDeleteResponse) Version() string {
return ddr.rawResponse.Header.Get("x-ms-version")
}
+// DirectoryForceCloseHandlesResponse ...
+type DirectoryForceCloseHandlesResponse struct {
+ rawResponse *http.Response
+}
+
+// Response returns the raw HTTP response object.
+func (dfchr DirectoryForceCloseHandlesResponse) Response() *http.Response {
+ return dfchr.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (dfchr DirectoryForceCloseHandlesResponse) StatusCode() int {
+ return dfchr.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (dfchr DirectoryForceCloseHandlesResponse) Status() string {
+ return dfchr.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (dfchr DirectoryForceCloseHandlesResponse) Date() time.Time {
+ s := dfchr.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (dfchr DirectoryForceCloseHandlesResponse) ErrorCode() string {
+ return dfchr.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// Marker returns the value for header x-ms-marker.
+func (dfchr DirectoryForceCloseHandlesResponse) Marker() string {
+ return dfchr.rawResponse.Header.Get("x-ms-marker")
+}
+
+// NumberOfHandlesClosed returns the value for header x-ms-number-of-handles-closed.
+func (dfchr DirectoryForceCloseHandlesResponse) NumberOfHandlesClosed() int32 {
+ s := dfchr.rawResponse.Header.Get("x-ms-number-of-handles-closed")
+ if s == "" {
+ return -1
+ }
+ i, err := strconv.ParseInt(s, 10, 32)
+ if err != nil {
+ i = 0
+ }
+ return int32(i)
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (dfchr DirectoryForceCloseHandlesResponse) RequestID() string {
+ return dfchr.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (dfchr DirectoryForceCloseHandlesResponse) Version() string {
+ return dfchr.rawResponse.Header.Get("x-ms-version")
+}
+
// DirectoryGetPropertiesResponse ...
type DirectoryGetPropertiesResponse struct {
rawResponse *http.Response
@@ -377,6 +611,41 @@ func (dgpr DirectoryGetPropertiesResponse) ETag() ETag {
return ETag(dgpr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (dgpr DirectoryGetPropertiesResponse) FileAttributes() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (dgpr DirectoryGetPropertiesResponse) FileChangeTime() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (dgpr DirectoryGetPropertiesResponse) FileCreationTime() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (dgpr DirectoryGetPropertiesResponse) FileID() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (dgpr DirectoryGetPropertiesResponse) FileLastWriteTime() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (dgpr DirectoryGetPropertiesResponse) FileParentID() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (dgpr DirectoryGetPropertiesResponse) FilePermissionKey() string {
+ return dgpr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// IsServerEncrypted returns the value for header x-ms-server-encrypted.
func (dgpr DirectoryGetPropertiesResponse) IsServerEncrypted() string {
return dgpr.rawResponse.Header.Get("x-ms-server-encrypted")
@@ -405,6 +674,13 @@ func (dgpr DirectoryGetPropertiesResponse) Version() string {
return dgpr.rawResponse.Header.Get("x-ms-version")
}
+// DirectoryItem - A listed directory item.
+//type DirectoryItem struct {
+// // XMLName is used for marshalling and is subject to removal in a future release.
+// XMLName xml.Name `xml:"Directory"`
+// Name string `xml:"Name"`
+//}
+
// DirectorySetMetadataResponse ...
type DirectorySetMetadataResponse struct {
rawResponse *http.Response
@@ -463,13 +739,119 @@ func (dsmr DirectorySetMetadataResponse) Version() string {
return dsmr.rawResponse.Header.Get("x-ms-version")
}
-// downloadResponse - Wraps the response from the fileClient.Download method.
-type downloadResponse struct {
+// DirectorySetPropertiesResponse ...
+type DirectorySetPropertiesResponse struct {
+ rawResponse *http.Response
+}
+
+// Response returns the raw HTTP response object.
+func (dspr DirectorySetPropertiesResponse) Response() *http.Response {
+ return dspr.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (dspr DirectorySetPropertiesResponse) StatusCode() int {
+ return dspr.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (dspr DirectorySetPropertiesResponse) Status() string {
+ return dspr.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (dspr DirectorySetPropertiesResponse) Date() time.Time {
+ s := dspr.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (dspr DirectorySetPropertiesResponse) ErrorCode() string {
+ return dspr.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// ETag returns the value for header ETag.
+func (dspr DirectorySetPropertiesResponse) ETag() ETag {
+ return ETag(dspr.rawResponse.Header.Get("ETag"))
+}
+
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (dspr DirectorySetPropertiesResponse) FileAttributes() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (dspr DirectorySetPropertiesResponse) FileChangeTime() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (dspr DirectorySetPropertiesResponse) FileCreationTime() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (dspr DirectorySetPropertiesResponse) FileID() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (dspr DirectorySetPropertiesResponse) FileLastWriteTime() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (dspr DirectorySetPropertiesResponse) FileParentID() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (dspr DirectorySetPropertiesResponse) FilePermissionKey() string {
+ return dspr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
+// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
+func (dspr DirectorySetPropertiesResponse) IsServerEncrypted() string {
+ return dspr.rawResponse.Header.Get("x-ms-request-server-encrypted")
+}
+
+// LastModified returns the value for header Last-Modified.
+func (dspr DirectorySetPropertiesResponse) LastModified() time.Time {
+ s := dspr.rawResponse.Header.Get("Last-Modified")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (dspr DirectorySetPropertiesResponse) RequestID() string {
+ return dspr.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (dspr DirectorySetPropertiesResponse) Version() string {
+ return dspr.rawResponse.Header.Get("x-ms-version")
+}
+
+// DownloadResponse - Wraps the response from the fileClient.Download method.
+type DownloadResponse struct {
rawResponse *http.Response
}
// NewMetadata returns user-defined key/value pairs.
-func (dr downloadResponse) NewMetadata() Metadata {
+func (dr DownloadResponse) NewMetadata() Metadata {
md := Metadata{}
for k, v := range dr.rawResponse.Header {
if len(k) > mdPrefixLen {
@@ -482,52 +864,52 @@ func (dr downloadResponse) NewMetadata() Metadata {
}
// Response returns the raw HTTP response object.
-func (dr downloadResponse) Response() *http.Response {
+func (dr DownloadResponse) Response() *http.Response {
return dr.rawResponse
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
-func (dr downloadResponse) StatusCode() int {
+func (dr DownloadResponse) StatusCode() int {
return dr.rawResponse.StatusCode
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
-func (dr downloadResponse) Status() string {
+func (dr DownloadResponse) Status() string {
return dr.rawResponse.Status
}
// Body returns the raw HTTP response object's Body.
-func (dr downloadResponse) Body() io.ReadCloser {
+func (dr DownloadResponse) Body() io.ReadCloser {
return dr.rawResponse.Body
}
// AcceptRanges returns the value for header Accept-Ranges.
-func (dr downloadResponse) AcceptRanges() string {
+func (dr DownloadResponse) AcceptRanges() string {
return dr.rawResponse.Header.Get("Accept-Ranges")
}
// CacheControl returns the value for header Cache-Control.
-func (dr downloadResponse) CacheControl() string {
+func (dr DownloadResponse) CacheControl() string {
return dr.rawResponse.Header.Get("Cache-Control")
}
// ContentDisposition returns the value for header Content-Disposition.
-func (dr downloadResponse) ContentDisposition() string {
+func (dr DownloadResponse) ContentDisposition() string {
return dr.rawResponse.Header.Get("Content-Disposition")
}
// ContentEncoding returns the value for header Content-Encoding.
-func (dr downloadResponse) ContentEncoding() string {
+func (dr DownloadResponse) ContentEncoding() string {
return dr.rawResponse.Header.Get("Content-Encoding")
}
// ContentLanguage returns the value for header Content-Language.
-func (dr downloadResponse) ContentLanguage() string {
+func (dr DownloadResponse) ContentLanguage() string {
return dr.rawResponse.Header.Get("Content-Language")
}
// ContentLength returns the value for header Content-Length.
-func (dr downloadResponse) ContentLength() int64 {
+func (dr DownloadResponse) ContentLength() int64 {
s := dr.rawResponse.Header.Get("Content-Length")
if s == "" {
return -1
@@ -540,7 +922,7 @@ func (dr downloadResponse) ContentLength() int64 {
}
// ContentMD5 returns the value for header Content-MD5.
-func (dr downloadResponse) ContentMD5() []byte {
+func (dr DownloadResponse) ContentMD5() []byte {
s := dr.rawResponse.Header.Get("Content-MD5")
if s == "" {
return nil
@@ -553,17 +935,17 @@ func (dr downloadResponse) ContentMD5() []byte {
}
// ContentRange returns the value for header Content-Range.
-func (dr downloadResponse) ContentRange() string {
+func (dr DownloadResponse) ContentRange() string {
return dr.rawResponse.Header.Get("Content-Range")
}
// ContentType returns the value for header Content-Type.
-func (dr downloadResponse) ContentType() string {
+func (dr DownloadResponse) ContentType() string {
return dr.rawResponse.Header.Get("Content-Type")
}
// CopyCompletionTime returns the value for header x-ms-copy-completion-time.
-func (dr downloadResponse) CopyCompletionTime() time.Time {
+func (dr DownloadResponse) CopyCompletionTime() time.Time {
s := dr.rawResponse.Header.Get("x-ms-copy-completion-time")
if s == "" {
return time.Time{}
@@ -576,32 +958,32 @@ func (dr downloadResponse) CopyCompletionTime() time.Time {
}
// CopyID returns the value for header x-ms-copy-id.
-func (dr downloadResponse) CopyID() string {
+func (dr DownloadResponse) CopyID() string {
return dr.rawResponse.Header.Get("x-ms-copy-id")
}
// CopyProgress returns the value for header x-ms-copy-progress.
-func (dr downloadResponse) CopyProgress() string {
+func (dr DownloadResponse) CopyProgress() string {
return dr.rawResponse.Header.Get("x-ms-copy-progress")
}
// CopySource returns the value for header x-ms-copy-source.
-func (dr downloadResponse) CopySource() string {
+func (dr DownloadResponse) CopySource() string {
return dr.rawResponse.Header.Get("x-ms-copy-source")
}
// CopyStatus returns the value for header x-ms-copy-status.
-func (dr downloadResponse) CopyStatus() CopyStatusType {
+func (dr DownloadResponse) CopyStatus() CopyStatusType {
return CopyStatusType(dr.rawResponse.Header.Get("x-ms-copy-status"))
}
// CopyStatusDescription returns the value for header x-ms-copy-status-description.
-func (dr downloadResponse) CopyStatusDescription() string {
+func (dr DownloadResponse) CopyStatusDescription() string {
return dr.rawResponse.Header.Get("x-ms-copy-status-description")
}
// Date returns the value for header Date.
-func (dr downloadResponse) Date() time.Time {
+func (dr DownloadResponse) Date() time.Time {
s := dr.rawResponse.Header.Get("Date")
if s == "" {
return time.Time{}
@@ -614,17 +996,27 @@ func (dr downloadResponse) Date() time.Time {
}
// ErrorCode returns the value for header x-ms-error-code.
-func (dr downloadResponse) ErrorCode() string {
+func (dr DownloadResponse) ErrorCode() string {
return dr.rawResponse.Header.Get("x-ms-error-code")
}
// ETag returns the value for header ETag.
-func (dr downloadResponse) ETag() ETag {
+func (dr DownloadResponse) ETag() ETag {
return ETag(dr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (dr DownloadResponse) FileAttributes() string {
+ return dr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (dr DownloadResponse) FileChangeTime() string {
+ return dr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
// FileContentMD5 returns the value for header x-ms-content-md5.
-func (dr downloadResponse) FileContentMD5() []byte {
+func (dr DownloadResponse) FileContentMD5() []byte {
s := dr.rawResponse.Header.Get("x-ms-content-md5")
if s == "" {
return nil
@@ -636,13 +1028,38 @@ func (dr downloadResponse) FileContentMD5() []byte {
return b
}
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (dr DownloadResponse) FileCreationTime() string {
+ return dr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (dr DownloadResponse) FileID() string {
+ return dr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (dr DownloadResponse) FileLastWriteTime() string {
+ return dr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (dr DownloadResponse) FileParentID() string {
+ return dr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (dr DownloadResponse) FilePermissionKey() string {
+ return dr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// IsServerEncrypted returns the value for header x-ms-server-encrypted.
-func (dr downloadResponse) IsServerEncrypted() string {
+func (dr DownloadResponse) IsServerEncrypted() string {
return dr.rawResponse.Header.Get("x-ms-server-encrypted")
}
// LastModified returns the value for header Last-Modified.
-func (dr downloadResponse) LastModified() time.Time {
+func (dr DownloadResponse) LastModified() time.Time {
s := dr.rawResponse.Header.Get("Last-Modified")
if s == "" {
return time.Time{}
@@ -655,12 +1072,12 @@ func (dr downloadResponse) LastModified() time.Time {
}
// RequestID returns the value for header x-ms-request-id.
-func (dr downloadResponse) RequestID() string {
+func (dr DownloadResponse) RequestID() string {
return dr.rawResponse.Header.Get("x-ms-request-id")
}
// Version returns the value for header x-ms-version.
-func (dr downloadResponse) Version() string {
+func (dr DownloadResponse) Version() string {
return dr.rawResponse.Header.Get("x-ms-version")
}
@@ -755,6 +1172,41 @@ func (fcr FileCreateResponse) ETag() ETag {
return ETag(fcr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (fcr FileCreateResponse) FileAttributes() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (fcr FileCreateResponse) FileChangeTime() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (fcr FileCreateResponse) FileCreationTime() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (fcr FileCreateResponse) FileID() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (fcr FileCreateResponse) FileLastWriteTime() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (fcr FileCreateResponse) FileParentID() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (fcr FileCreateResponse) FilePermissionKey() string {
+ return fcr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (fcr FileCreateResponse) IsServerEncrypted() string {
return fcr.rawResponse.Header.Get("x-ms-request-server-encrypted")
@@ -831,6 +1283,72 @@ func (fdr FileDeleteResponse) Version() string {
return fdr.rawResponse.Header.Get("x-ms-version")
}
+// FileForceCloseHandlesResponse ...
+type FileForceCloseHandlesResponse struct {
+ rawResponse *http.Response
+}
+
+// Response returns the raw HTTP response object.
+func (ffchr FileForceCloseHandlesResponse) Response() *http.Response {
+ return ffchr.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (ffchr FileForceCloseHandlesResponse) StatusCode() int {
+ return ffchr.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (ffchr FileForceCloseHandlesResponse) Status() string {
+ return ffchr.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (ffchr FileForceCloseHandlesResponse) Date() time.Time {
+ s := ffchr.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (ffchr FileForceCloseHandlesResponse) ErrorCode() string {
+ return ffchr.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// Marker returns the value for header x-ms-marker.
+func (ffchr FileForceCloseHandlesResponse) Marker() string {
+ return ffchr.rawResponse.Header.Get("x-ms-marker")
+}
+
+// NumberOfHandlesClosed returns the value for header x-ms-number-of-handles-closed.
+func (ffchr FileForceCloseHandlesResponse) NumberOfHandlesClosed() int32 {
+ s := ffchr.rawResponse.Header.Get("x-ms-number-of-handles-closed")
+ if s == "" {
+ return -1
+ }
+ i, err := strconv.ParseInt(s, 10, 32)
+ if err != nil {
+ i = 0
+ }
+ return int32(i)
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (ffchr FileForceCloseHandlesResponse) RequestID() string {
+ return ffchr.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (ffchr FileForceCloseHandlesResponse) Version() string {
+ return ffchr.rawResponse.Header.Get("x-ms-version")
+}
+
// FileGetPropertiesResponse ...
type FileGetPropertiesResponse struct {
rawResponse *http.Response
@@ -976,6 +1494,41 @@ func (fgpr FileGetPropertiesResponse) ETag() ETag {
return ETag(fgpr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (fgpr FileGetPropertiesResponse) FileAttributes() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (fgpr FileGetPropertiesResponse) FileChangeTime() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (fgpr FileGetPropertiesResponse) FileCreationTime() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (fgpr FileGetPropertiesResponse) FileID() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (fgpr FileGetPropertiesResponse) FileLastWriteTime() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (fgpr FileGetPropertiesResponse) FileParentID() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (fgpr FileGetPropertiesResponse) FilePermissionKey() string {
+ return fgpr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// FileType returns the value for header x-ms-type.
func (fgpr FileGetPropertiesResponse) FileType() string {
return string(fgpr.rawResponse.Header.Get("x-ms-type"))
@@ -1009,12 +1562,28 @@ func (fgpr FileGetPropertiesResponse) Version() string {
return fgpr.rawResponse.Header.Get("x-ms-version")
}
+// FileItem - A listed file item.
+//type FileItem struct {
+// // XMLName is used for marshalling and is subject to removal in a future release.
+// XMLName xml.Name `xml:"File"`
+// Name string `xml:"Name"`
+// Properties FileProperty `xml:"Properties"`
+//}
+
// FileProperty - File properties.
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"`
}
+// FilesAndDirectoriesListSegment - Abstract for entries that can be listed from Directory.
+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"`
+}
+
// FileSetHTTPHeadersResponse ...
type FileSetHTTPHeadersResponse struct {
rawResponse *http.Response
@@ -1058,6 +1627,41 @@ func (fshhr FileSetHTTPHeadersResponse) ETag() ETag {
return ETag(fshhr.rawResponse.Header.Get("ETag"))
}
+// FileAttributes returns the value for header x-ms-file-attributes.
+func (fshhr FileSetHTTPHeadersResponse) FileAttributes() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-attributes")
+}
+
+// FileChangeTime returns the value for header x-ms-file-change-time.
+func (fshhr FileSetHTTPHeadersResponse) FileChangeTime() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-change-time")
+}
+
+// FileCreationTime returns the value for header x-ms-file-creation-time.
+func (fshhr FileSetHTTPHeadersResponse) FileCreationTime() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-creation-time")
+}
+
+// FileID returns the value for header x-ms-file-id.
+func (fshhr FileSetHTTPHeadersResponse) FileID() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-id")
+}
+
+// FileLastWriteTime returns the value for header x-ms-file-last-write-time.
+func (fshhr FileSetHTTPHeadersResponse) FileLastWriteTime() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-last-write-time")
+}
+
+// FileParentID returns the value for header x-ms-file-parent-id.
+func (fshhr FileSetHTTPHeadersResponse) FileParentID() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-parent-id")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (fshhr FileSetHTTPHeadersResponse) FilePermissionKey() string {
+ return fshhr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
func (fshhr FileSetHTTPHeadersResponse) IsServerEncrypted() string {
return fshhr.rawResponse.Header.Get("x-ms-request-server-encrypted")
@@ -1220,6 +1824,90 @@ func (fscr FileStartCopyResponse) Version() string {
return fscr.rawResponse.Header.Get("x-ms-version")
}
+// FileUploadRangeFromURLResponse ...
+type FileUploadRangeFromURLResponse struct {
+ rawResponse *http.Response
+}
+
+// Response returns the raw HTTP response object.
+func (furfur FileUploadRangeFromURLResponse) Response() *http.Response {
+ return furfur.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (furfur FileUploadRangeFromURLResponse) StatusCode() int {
+ return furfur.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (furfur FileUploadRangeFromURLResponse) Status() string {
+ return furfur.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (furfur FileUploadRangeFromURLResponse) Date() time.Time {
+ s := furfur.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (furfur FileUploadRangeFromURLResponse) ErrorCode() string {
+ return furfur.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// ETag returns the value for header ETag.
+func (furfur FileUploadRangeFromURLResponse) ETag() ETag {
+ return ETag(furfur.rawResponse.Header.Get("ETag"))
+}
+
+// IsServerEncrypted returns the value for header x-ms-request-server-encrypted.
+func (furfur FileUploadRangeFromURLResponse) IsServerEncrypted() string {
+ return furfur.rawResponse.Header.Get("x-ms-request-server-encrypted")
+}
+
+// LastModified returns the value for header Last-Modified.
+func (furfur FileUploadRangeFromURLResponse) LastModified() time.Time {
+ s := furfur.rawResponse.Header.Get("Last-Modified")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (furfur FileUploadRangeFromURLResponse) RequestID() string {
+ return furfur.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (furfur FileUploadRangeFromURLResponse) Version() string {
+ return furfur.rawResponse.Header.Get("x-ms-version")
+}
+
+// XMsContentCrc64 returns the value for header x-ms-content-crc64.
+func (furfur FileUploadRangeFromURLResponse) XMsContentCrc64() []byte {
+ s := furfur.rawResponse.Header.Get("x-ms-content-crc64")
+ if s == "" {
+ return nil
+ }
+ b, err := base64.StdEncoding.DecodeString(s)
+ if err != nil {
+ b = nil
+ }
+ return b
+}
+
// FileUploadRangeResponse ...
type FileUploadRangeResponse struct {
rawResponse *http.Response
@@ -1304,6 +1992,161 @@ func (furr FileUploadRangeResponse) Version() string {
return furr.rawResponse.Header.Get("x-ms-version")
}
+// HandleItem - A listed Azure Storage handle item.
+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"`
+}
+
+// MarshalXML implements the xml.Marshaler interface for HandleItem.
+func (hi HandleItem) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
+ hi2 := (*handleItem)(unsafe.Pointer(&hi))
+ return e.EncodeElement(*hi2, start)
+}
+
+// UnmarshalXML implements the xml.Unmarshaler interface for HandleItem.
+func (hi *HandleItem) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
+ hi2 := (*handleItem)(unsafe.Pointer(hi))
+ return d.DecodeElement(hi2, &start)
+}
+
+//// ListFilesAndDirectoriesSegmentResponse - An enumeration of directories and files.
+//type ListFilesAndDirectoriesSegmentResponse struct {
+// rawResponse *http.Response
+// // XMLName is used for marshalling and is subject to removal in a future release.
+// XMLName xml.Name `xml:"EnumerationResults"`
+// ServiceEndpoint string `xml:"ServiceEndpoint,attr"`
+// ShareName string `xml:"ShareName,attr"`
+// ShareSnapshot *string `xml:"ShareSnapshot,attr"`
+// DirectoryPath string `xml:"DirectoryPath,attr"`
+// Prefix string `xml:"Prefix"`
+// Marker *string `xml:"Marker"`
+// MaxResults *int32 `xml:"MaxResults"`
+// Segment FilesAndDirectoriesListSegment `xml:"Entries"`
+// NextMarker Marker `xml:"NextMarker"`
+//}
+//
+//// Response returns the raw HTTP response object.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) Response() *http.Response {
+// return lfadsr.rawResponse
+//}
+//
+//// StatusCode returns the HTTP status code of the response, e.g. 200.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) StatusCode() int {
+// return lfadsr.rawResponse.StatusCode
+//}
+//
+//// Status returns the HTTP status message of the response, e.g. "200 OK".
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) Status() string {
+// return lfadsr.rawResponse.Status
+//}
+//
+//// ContentType returns the value for header Content-Type.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) ContentType() string {
+// return lfadsr.rawResponse.Header.Get("Content-Type")
+//}
+//
+//// Date returns the value for header Date.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) Date() time.Time {
+// s := lfadsr.rawResponse.Header.Get("Date")
+// if s == "" {
+// return time.Time{}
+// }
+// t, err := time.Parse(time.RFC1123, s)
+// if err != nil {
+// t = time.Time{}
+// }
+// return t
+//}
+//
+//// ErrorCode returns the value for header x-ms-error-code.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) ErrorCode() string {
+// return lfadsr.rawResponse.Header.Get("x-ms-error-code")
+//}
+//
+//// RequestID returns the value for header x-ms-request-id.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) RequestID() string {
+// return lfadsr.rawResponse.Header.Get("x-ms-request-id")
+//}
+//
+//// Version returns the value for header x-ms-version.
+//func (lfadsr ListFilesAndDirectoriesSegmentResponse) Version() string {
+// return lfadsr.rawResponse.Header.Get("x-ms-version")
+//}
+
+// ListHandlesResponse - An enumeration of handles.
+type ListHandlesResponse struct {
+ rawResponse *http.Response
+ // 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"`
+}
+
+// Response returns the raw HTTP response object.
+func (lhr ListHandlesResponse) Response() *http.Response {
+ return lhr.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (lhr ListHandlesResponse) StatusCode() int {
+ return lhr.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (lhr ListHandlesResponse) Status() string {
+ return lhr.rawResponse.Status
+}
+
+// ContentType returns the value for header Content-Type.
+func (lhr ListHandlesResponse) ContentType() string {
+ return lhr.rawResponse.Header.Get("Content-Type")
+}
+
+// Date returns the value for header Date.
+func (lhr ListHandlesResponse) Date() time.Time {
+ s := lhr.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (lhr ListHandlesResponse) ErrorCode() string {
+ return lhr.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (lhr ListHandlesResponse) RequestID() string {
+ return lhr.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (lhr ListHandlesResponse) Version() string {
+ return lhr.rawResponse.Header.Get("x-ms-version")
+}
+
// ListSharesResponse - An enumeration of shares.
type ListSharesResponse struct {
rawResponse *http.Response
@@ -1489,6 +2332,59 @@ func (sspr ServiceSetPropertiesResponse) Version() string {
return sspr.rawResponse.Header.Get("x-ms-version")
}
+// ShareCreatePermissionResponse ...
+type ShareCreatePermissionResponse struct {
+ rawResponse *http.Response
+}
+
+// Response returns the raw HTTP response object.
+func (scpr ShareCreatePermissionResponse) Response() *http.Response {
+ return scpr.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (scpr ShareCreatePermissionResponse) StatusCode() int {
+ return scpr.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (scpr ShareCreatePermissionResponse) Status() string {
+ return scpr.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (scpr ShareCreatePermissionResponse) Date() time.Time {
+ s := scpr.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (scpr ShareCreatePermissionResponse) ErrorCode() string {
+ return scpr.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// FilePermissionKey returns the value for header x-ms-file-permission-key.
+func (scpr ShareCreatePermissionResponse) FilePermissionKey() string {
+ return scpr.rawResponse.Header.Get("x-ms-file-permission-key")
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (scpr ShareCreatePermissionResponse) RequestID() string {
+ return scpr.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (scpr ShareCreatePermissionResponse) Version() string {
+ return scpr.rawResponse.Header.Get("x-ms-version")
+}
+
// ShareCreateResponse ...
type ShareCreateResponse struct {
rawResponse *http.Response
@@ -1776,6 +2672,56 @@ type ShareItem struct {
Metadata Metadata `xml:"Metadata"`
}
+// SharePermission - A permission (a security descriptor) at the share level.
+type SharePermission struct {
+ rawResponse *http.Response
+ // Permission - The permission in the Security Descriptor Definition Language (SDDL).
+ Permission string `xml:"permission"`
+}
+
+// Response returns the raw HTTP response object.
+func (sp SharePermission) Response() *http.Response {
+ return sp.rawResponse
+}
+
+// StatusCode returns the HTTP status code of the response, e.g. 200.
+func (sp SharePermission) StatusCode() int {
+ return sp.rawResponse.StatusCode
+}
+
+// Status returns the HTTP status message of the response, e.g. "200 OK".
+func (sp SharePermission) Status() string {
+ return sp.rawResponse.Status
+}
+
+// Date returns the value for header Date.
+func (sp SharePermission) Date() time.Time {
+ s := sp.rawResponse.Header.Get("Date")
+ if s == "" {
+ return time.Time{}
+ }
+ t, err := time.Parse(time.RFC1123, s)
+ if err != nil {
+ t = time.Time{}
+ }
+ return t
+}
+
+// ErrorCode returns the value for header x-ms-error-code.
+func (sp SharePermission) ErrorCode() string {
+ return sp.rawResponse.Header.Get("x-ms-error-code")
+}
+
+// RequestID returns the value for header x-ms-request-id.
+func (sp SharePermission) RequestID() string {
+ return sp.rawResponse.Header.Get("x-ms-request-id")
+}
+
+// Version returns the value for header x-ms-version.
+func (sp SharePermission) Version() string {
+ return sp.rawResponse.Header.Get("x-ms-version")
+}
+
// ShareProperties - Properties of a share.
type ShareProperties struct {
LastModified time.Time `xml:"Last-Modified"`
@@ -1996,8 +2942,8 @@ func (ssqr ShareSetQuotaResponse) Version() string {
// ShareStats - Stats for the share.
type ShareStats struct {
rawResponse *http.Response
- // ShareUsage - The approximate size of the data stored on the share, rounded up to the nearest gigabyte. Note that this value may not include all recently created or recently resized files.
- ShareUsage int32 `xml:"ShareUsage"`
+ // ShareUsageBytes - The approximate size of the data stored in bytes. Note that this value may not include all recently created or recently resized files.
+ ShareUsageBytes int32 `xml:"ShareUsageBytes"`
}
// Response returns the raw HTTP response object.
@@ -2186,6 +3132,9 @@ func init() {
if reflect.TypeOf((*AccessPolicy)(nil)).Elem().Size() != reflect.TypeOf((*accessPolicy)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between AccessPolicy and accessPolicy"))
}
+ if reflect.TypeOf((*HandleItem)(nil)).Elem().Size() != reflect.TypeOf((*handleItem)(nil)).Elem().Size() {
+ validateError(errors.New("size mismatch between HandleItem and handleItem"))
+ }
if reflect.TypeOf((*ShareProperties)(nil)).Elem().Size() != reflect.TypeOf((*shareProperties)(nil)).Elem().Size() {
validateError(errors.New("size mismatch between ShareProperties and shareProperties"))
}
@@ -2237,6 +3186,20 @@ type accessPolicy struct {
Permission *string `xml:"Permission"`
}
+// internal type used for marshalling
+type handleItem struct {
+ // XMLName is used for marshalling and is subject to removal in a future release.
+ XMLName xml.Name `xml:"Handle"`
+ HandleID string `xml:"HandleId"`
+ Path string `xml:"Path"`
+ FileID string `xml:"FileId"`
+ ParentID *string `xml:"ParentId"`
+ SessionID string `xml:"SessionId"`
+ ClientIP string `xml:"ClientIp"`
+ OpenTime timeRFC1123 `xml:"OpenTime"`
+ LastReconnectTime *timeRFC1123 `xml:"LastReconnectTime"`
+}
+
// internal type used for marshalling
type shareProperties struct {
LastModified timeRFC1123 `xml:"Last-Modified"`
diff --git a/azfile/zz_generated_share.go b/azfile/zz_generated_share.go
index e94d336..e6bf865 100644
--- a/azfile/zz_generated_share.go
+++ b/azfile/zz_generated_share.go
@@ -88,6 +88,67 @@ func (client shareClient) createResponder(resp pipeline.Response) (pipeline.Resp
return &ShareCreateResponse{rawResponse: resp.Response()}, err
}
+// CreatePermission create a permission (a security descriptor).
+//
+// sharePermission is a permission (a security descriptor) at the share level. timeout is the timeout parameter is
+// expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations.
+func (client shareClient) CreatePermission(ctx context.Context, sharePermission SharePermission, timeout *int32) (*ShareCreatePermissionResponse, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.createPermissionPreparer(sharePermission, timeout)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.createPermissionResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*ShareCreatePermissionResponse), err
+}
+
+// createPermissionPreparer prepares the CreatePermission request.
+func (client shareClient) createPermissionPreparer(sharePermission SharePermission, timeout *int32) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("PUT", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "share")
+ params.Set("comp", "filepermission")
+ req.URL.RawQuery = params.Encode()
+ req.Header.Set("x-ms-version", ServiceVersion)
+ b, err := xml.Marshal(sharePermission)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to marshal request body")
+ }
+ req.Header.Set("Content-Type", "application/xml")
+ err = req.SetBody(bytes.NewReader(b))
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to set request body")
+ }
+ return req, nil
+}
+
+// createPermissionResponder handles the response to the CreatePermission request.
+func (client shareClient) createPermissionResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK, http.StatusCreated)
+ if resp == nil {
+ return nil, err
+ }
+ io.Copy(ioutil.Discard, resp.Response().Body)
+ resp.Response().Body.Close()
+ return &ShareCreatePermissionResponse{rawResponse: resp.Response()}, err
+}
+
// CreateSnapshot creates a read-only snapshot of a share.
//
// timeout is the timeout parameter is expressed in seconds. For more information, see Setting
+// Timeouts for File Service Operations.
+func (client shareClient) GetPermission(ctx context.Context, filePermissionKey *string, timeout *int32) (*SharePermission, error) {
+ if err := validate([]validation{
+ {targetValue: timeout,
+ constraints: []constraint{{target: "timeout", name: null, rule: false,
+ chain: []constraint{{target: "timeout", name: inclusiveMinimum, rule: 0, chain: nil}}}}}}); err != nil {
+ return nil, err
+ }
+ req, err := client.getPermissionPreparer(filePermissionKey, timeout)
+ if err != nil {
+ return nil, err
+ }
+ resp, err := client.Pipeline().Do(ctx, responderPolicyFactory{responder: client.getPermissionResponder}, req)
+ if err != nil {
+ return nil, err
+ }
+ return resp.(*SharePermission), err
+}
+
+// getPermissionPreparer prepares the GetPermission request.
+func (client shareClient) getPermissionPreparer(filePermissionKey *string, timeout *int32) (pipeline.Request, error) {
+ req, err := pipeline.NewRequest("GET", client.url, nil)
+ if err != nil {
+ return req, pipeline.NewError(err, "failed to create request")
+ }
+ params := req.URL.Query()
+ if timeout != nil {
+ params.Set("timeout", strconv.FormatInt(int64(*timeout), 10))
+ }
+ params.Set("restype", "share")
+ params.Set("comp", "filepermission")
+ req.URL.RawQuery = params.Encode()
+ if filePermissionKey != nil {
+ req.Header.Set("x-ms-file-permission-key", *filePermissionKey)
+ }
+ req.Header.Set("x-ms-version", ServiceVersion)
+ return req, nil
+}
+
+// getPermissionResponder handles the response to the GetPermission request.
+func (client shareClient) getPermissionResponder(resp pipeline.Response) (pipeline.Response, error) {
+ err := validateResponse(resp, http.StatusOK)
+ if resp == nil {
+ return nil, err
+ }
+ result := &SharePermission{rawResponse: resp.Response()}
+ if err != nil {
+ return result, err
+ }
+ defer resp.Response().Body.Close()
+ b, err := ioutil.ReadAll(resp.Response().Body)
+ if err != nil {
+ return result, err
+ }
+ if len(b) > 0 {
+ b = removeBOM(b)
+ err = xml.Unmarshal(b, result)
+ if err != nil {
+ return result, NewResponseError(err, resp.Response(), "failed to unmarshal response body")
+ }
+ }
+ return result, nil
+}
+
// GetProperties returns all user-defined metadata and system properties for the specified share or share snapshot. The
// data returned does not include the share's list of files.
//
diff --git a/azfile/zz_generated_version.go b/azfile/zz_generated_version.go
index 481c391..b1d3649 100644
--- a/azfile/zz_generated_version.go
+++ b/azfile/zz_generated_version.go
@@ -5,10 +5,10 @@ package azfile
// UserAgent returns the UserAgent string to use when sending http.Requests.
func UserAgent() string {
- return "Azure-SDK-For-Go/10.0.0 azfile/2018-03-28"
+ return "Azure-SDK-For-Go/0.0.0 azfile/2019-02-02"
}
// Version returns the semantic version (see http://semver.org) of the client.
func Version() string {
- return "10.0.0"
+ return "0.0.0"
}
diff --git a/azfile/zz_response_helpers.go b/azfile/zz_response_helpers.go
index 6b779ef..21fd25e 100644
--- a/azfile/zz_response_helpers.go
+++ b/azfile/zz_response_helpers.go
@@ -18,7 +18,7 @@ type FileHTTPHeaders struct {
}
// NewHTTPHeaders returns the user-modifiable properties for this file.
-func (dr DownloadResponse) NewHTTPHeaders() FileHTTPHeaders {
+func (dr RetryableDownloadResponse) NewHTTPHeaders() FileHTTPHeaders {
return FileHTTPHeaders{
ContentType: dr.ContentType(),
ContentEncoding: dr.ContentEncoding(),
@@ -41,9 +41,9 @@ func (fgpr FileGetPropertiesResponse) NewHTTPHeaders() FileHTTPHeaders {
}
}
-// DownloadResponse wraps AutoRest generated downloadResponse and helps to provide info for retry.
-type DownloadResponse struct {
- dr *downloadResponse
+// RetryableDownloadResponse wraps AutoRest generated DownloadResponse and helps to provide info for retry.
+type RetryableDownloadResponse struct {
+ dr *DownloadResponse
// Fields need for retry.
ctx context.Context
@@ -52,132 +52,132 @@ type DownloadResponse struct {
}
// Response returns the raw HTTP response object.
-func (dr DownloadResponse) Response() *http.Response {
+func (dr RetryableDownloadResponse) Response() *http.Response {
return dr.dr.Response()
}
// StatusCode returns the HTTP status code of the response, e.g. 200.
-func (dr DownloadResponse) StatusCode() int {
+func (dr RetryableDownloadResponse) StatusCode() int {
return dr.dr.StatusCode()
}
// Status returns the HTTP status message of the response, e.g. "200 OK".
-func (dr DownloadResponse) Status() string {
+func (dr RetryableDownloadResponse) Status() string {
return dr.dr.Status()
}
// AcceptRanges returns the value for header Accept-Ranges.
-func (dr DownloadResponse) AcceptRanges() string {
+func (dr RetryableDownloadResponse) AcceptRanges() string {
return dr.dr.AcceptRanges()
}
// CacheControl returns the value for header Cache-Control.
-func (dr DownloadResponse) CacheControl() string {
+func (dr RetryableDownloadResponse) CacheControl() string {
return dr.dr.CacheControl()
}
// ContentDisposition returns the value for header Content-Disposition.
-func (dr DownloadResponse) ContentDisposition() string {
+func (dr RetryableDownloadResponse) ContentDisposition() string {
return dr.dr.ContentDisposition()
}
// ContentEncoding returns the value for header Content-Encoding.
-func (dr DownloadResponse) ContentEncoding() string {
+func (dr RetryableDownloadResponse) ContentEncoding() string {
return dr.dr.ContentEncoding()
}
// ContentLanguage returns the value for header Content-Language.
-func (dr DownloadResponse) ContentLanguage() string {
+func (dr RetryableDownloadResponse) ContentLanguage() string {
return dr.dr.ContentLanguage()
}
// ContentLength returns the value for header Content-Length.
-func (dr DownloadResponse) ContentLength() int64 {
+func (dr RetryableDownloadResponse) ContentLength() int64 {
return dr.dr.ContentLength()
}
// ContentRange returns the value for header Content-Range.
-func (dr DownloadResponse) ContentRange() string {
+func (dr RetryableDownloadResponse) ContentRange() string {
return dr.dr.ContentRange()
}
// ContentType returns the value for header Content-Type.
-func (dr DownloadResponse) ContentType() string {
+func (dr RetryableDownloadResponse) ContentType() string {
return dr.dr.ContentType()
}
// CopyCompletionTime returns the value for header x-ms-copy-completion-time.
-func (dr DownloadResponse) CopyCompletionTime() time.Time {
+func (dr RetryableDownloadResponse) CopyCompletionTime() time.Time {
return dr.dr.CopyCompletionTime()
}
// CopyID returns the value for header x-ms-copy-id.
-func (dr DownloadResponse) CopyID() string {
+func (dr RetryableDownloadResponse) CopyID() string {
return dr.dr.CopyID()
}
// CopyProgress returns the value for header x-ms-copy-progress.
-func (dr DownloadResponse) CopyProgress() string {
+func (dr RetryableDownloadResponse) CopyProgress() string {
return dr.dr.CopyProgress()
}
// CopySource returns the value for header x-ms-copy-source.
-func (dr DownloadResponse) CopySource() string {
+func (dr RetryableDownloadResponse) CopySource() string {
return dr.dr.CopySource()
}
// CopyStatus returns the value for header x-ms-copy-status.
-func (dr DownloadResponse) CopyStatus() CopyStatusType {
+func (dr RetryableDownloadResponse) CopyStatus() CopyStatusType {
return dr.dr.CopyStatus()
}
// CopyStatusDescription returns the value for header x-ms-copy-status-description.
-func (dr DownloadResponse) CopyStatusDescription() string {
+func (dr RetryableDownloadResponse) CopyStatusDescription() string {
return dr.dr.CopyStatusDescription()
}
// Date returns the value for header Date.
-func (dr DownloadResponse) Date() time.Time {
+func (dr RetryableDownloadResponse) Date() time.Time {
return dr.dr.Date()
}
// ETag returns the value for header ETag.
-func (dr DownloadResponse) ETag() ETag {
+func (dr RetryableDownloadResponse) ETag() ETag {
return dr.dr.ETag()
}
// IsServerEncrypted returns the value for header x-ms-server-encrypted.
-func (dr DownloadResponse) IsServerEncrypted() string {
+func (dr RetryableDownloadResponse) IsServerEncrypted() string {
return dr.dr.IsServerEncrypted()
}
// LastModified returns the value for header Last-Modified.
-func (dr DownloadResponse) LastModified() time.Time {
+func (dr RetryableDownloadResponse) LastModified() time.Time {
return dr.dr.LastModified()
}
// RequestID returns the value for header x-ms-request-id.
-func (dr DownloadResponse) RequestID() string {
+func (dr RetryableDownloadResponse) RequestID() string {
return dr.dr.RequestID()
}
// Version returns the value for header x-ms-version.
-func (dr DownloadResponse) Version() string {
+func (dr RetryableDownloadResponse) Version() string {
return dr.dr.Version()
}
// NewMetadata returns user-defined key/value pairs.
-func (dr DownloadResponse) NewMetadata() Metadata {
+func (dr RetryableDownloadResponse) NewMetadata() Metadata {
return dr.dr.NewMetadata()
}
// FileContentMD5 returns the value for header x-ms-content-md5.
-func (dr DownloadResponse) FileContentMD5() []byte {
+func (dr RetryableDownloadResponse) FileContentMD5() []byte {
return dr.dr.FileContentMD5()
}
// ContentMD5 returns the value for header Content-MD5.
-func (dr DownloadResponse) ContentMD5() []byte {
+func (dr RetryableDownloadResponse) ContentMD5() []byte {
return dr.dr.ContentMD5()
}
diff --git a/go.mod b/go.mod
index c4b9491..db47095 100644
--- a/go.mod
+++ b/go.mod
@@ -7,3 +7,5 @@ require (
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
)
+
+go 1.13
diff --git a/go.sum b/go.sum
index 25a6552..4af99db 100644
--- a/go.sum
+++ b/go.sum
@@ -1,12 +1,15 @@
github.com/Azure/azure-pipeline-go v0.2.0/go.mod h1:SIBjTji/wnj2Mk2Z7+YsWrDLe4hQ5natSjDyna2yVX0=
github.com/Azure/azure-pipeline-go v0.2.1 h1:OLBdZJ3yvOn2MezlWvbrBMTEUQC72zAftRZOMdj5HYo=
github.com/Azure/azure-pipeline-go v0.2.1/go.mod h1:UGSo8XybXnIGZ3epmeBw7Jdz+HiUVpqIlpz/HKHylF4=
+github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
+github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149 h1:HfxbT6/JcvIljmERptWhwa8XzP7H3T+Z2N26gTsaDaA=
github.com/mattn/go-ieproxy v0.0.0-20190610004146-91bb50d98149/go.mod h1:31jz6HNzdxOmlERGGEc4v/dMssOfmp2p5bT/okiKFFc=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb h1:fgwFCsaw9buMuxNd6+DQfAuSFqbNiQZpcgJQAgJsK6k=
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
diff --git a/swagger/README.md b/swagger/README.md
new file mode 100644
index 0000000..f98ecf1
--- /dev/null
+++ b/swagger/README.md
@@ -0,0 +1,80 @@
+# Azure File Storage for Golang
+
+> see https://aka.ms/autorest
+
+### Generation
+```bash
+cd swagger
+autorest README.md --use=@microsoft.azure/autorest.go@v3.0.63
+gofmt -w Go_FileStorage/*
+```
+
+### Settings
+``` yaml
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-02-02/file.json
+go: true
+output-folder: Go_FileStorage
+namespace: azfile
+go-export-clients: false
+enable-xml: true
+file-prefix: zz_generated_
+```
+
+### Note: the following directives were copied over from Python
+### The dates should be string instead
+``` yaml
+directive:
+- from: swagger-document
+ where: $["x-ms-paths"]..responses..headers["x-ms-file-last-write-time"]
+ transform: >
+ $.format = "str";
+- from: swagger-document
+ where: $["x-ms-paths"]..responses..headers["x-ms-file-change-time"]
+ transform: >
+ $.format = "str";
+- from: swagger-document
+ where: $["x-ms-paths"]..responses..headers["x-ms-file-creation-time"]
+ transform: >
+ $.format = "str";
+```
+
+### Change new SMB file parameters to use default values
+``` yaml
+directive:
+- from: swagger-document
+ where: $.parameters.FileCreationTime
+ transform: >
+ $.format = "str";
+ $.default = "now";
+- from: swagger-document
+ where: $.parameters.FileLastWriteTime
+ transform: >
+ $.format = "str";
+ $.default = "now";
+- from: swagger-document
+ where: $.parameters.FileAttributes
+ transform: >
+ $.default = "none";
+- from: swagger-document
+ where: $.parameters.FilePermission
+ transform: >
+ $.default = "inherit";
+```
+
+### FileRangeWriteFromUrl Constant
+This value is supposed to be the constant value update and these changes turn it from a parameter into a constant.
+``` yaml
+directive:
+- from: swagger-document
+ where: $.parameters.FileRangeWriteFromUrl
+ transform: >
+ delete $.default;
+ delete $["x-ms-enum"];
+ $["x-ms-parameter-location"] = "method";
+```
+
+### TODO: Get rid of StorageError since we define it
+### attempt didn't work
+
+### TODO: Sort out the duplicated definitions related to listing
+### clarify the purpose first
\ No newline at end of file